12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628 |
-
- <!-- 用户自定义扩展模板文件 -->
- {include file="diy_extend/archives_extend" /}
- <!-- end -->
- <script>
- // 获取联动地址
- function GetFieldRegionData_1670295376(t,type){
- var name = $(t).attr('data-name');
- var parent_id = parseInt($(t).val());
-
- if(!parent_id || 0 >= parent_id){
- if ('province' == type) {
- $('#city_'+name).hide();
- $('#area_'+name).hide();
- }else if ('city' == type){
- $('#area_'+name).hide();
- }
- return false;
- }
-
- var url = "{:url('Field/ajax_get_region_data')}";
- $.ajax({
- url: url,
- data: {parent_id:parent_id,_ajax:1},
- type:'post',
- dataType:'json',
- success:function(res){
- if (res.region_html) {
- // 输出下一级栏目选项
- if ('province' == type) {
- res = '<option value="-1">请选择</option>'+ res.region_html;
- $('#city_'+name).empty().html(res);
- $('#city_'+name).show();
- $('#area_'+name).hide();
- $('#area_'+name).empty();
- }else if ('city' == type){
- res = '<option value="-1">请选择</option>'+ res.region_html;
- $('#area_'+name).empty().html(res);
- $('#area_'+name).show();
- }
- }
- },
- error : function(e) {
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- }
- </script>
- {volist name="$addonFieldExtList" id="vo"}
-
- <?php
- //var_dump($vo);
- ?>
-
- <?php
- //var_dump($typeid);
- ?>
-
- {if condition="(('Custom' == $controller_name && isset($vo.ifeditable) && $vo.ifeditable == 1) || ('Custom' != $controller_name && (!isset($vo.ifeditable) || $vo.ifeditable)))"}
- {switch name="vo.dtype"}
- {case value="hidden"}
- <!-- 隐藏域 start -->
- <dl class="row" style="display: none;">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="hidden" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
- </dd>
- </dl>
- <!-- 隐藏域 start -->
- {/case}
-
- {case value="region"}
- {empty name="$vo.set_type"}
- <!-- 区域选项 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- {volist name="$vo.dfvalue" id="v2"}
- <label>
- <input type="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2['id']}" {if condition="isset($vo['trueValue']) AND in_array($v2['id'], $vo['trueValue'])"}checked="checked"{/if}>{$v2['name']}
- </label>
- {/volist}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 区域选项 end -->
- {else /}
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <!--一级-->
- <select name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="province_{$vo.fieldArr}_{$vo.name|default=''}" data-name="{$vo.fieldArr}_{$vo.name|default=''}" onchange="GetFieldRegionData_1670295376(this,'province');" {if condition="!empty($vo.region_level) && $vo.region_level > 1"}disabled{/if}>
- <option value="-1">请选择</option>
- <option {if condition="$vo['trueValue'][0] === 0 || $vo['trueValue'][0] ==='0'"} selected {/if} value="0">全国</option>
- {volist name="$vo.dfvalue" id="v_p"}
- <option {if condition="$vo['trueValue'][0] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
- {/volist}
- </select>
- <!--二级-->
- <select name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="city_{$vo.fieldArr}_{$vo.name|default=''}" data-name="{$vo.fieldArr}_{$vo.name|default=''}" onchange="GetFieldRegionData_1670295376(this,'city');" {empty name="$vo['city_list']"}style="display: none;"{/empty} {if condition="!empty($vo.region_level) && $vo.region_level > 2"}disabled{/if}>
- {volist name="$vo.city_list" id="v_p"}
- <option {if condition="$vo['trueValue'][1] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
- {/volist}
- </select>
- <!--三级-->
- <select name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="area_{$vo.fieldArr}_{$vo.name|default=''}" {empty name="$vo['trueValue'][2]"}style="display: none;"{/empty}>
- {volist name="$vo.area_list" id="v_p"}
- <option {if condition="$vo['trueValue'][2] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
- {/volist}
- </select>
-
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- {/empty}
- {/case}
-
- {case value="text"}
- <!-- 单行文本框 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="text" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 单行文本框 end -->
- {/case}
-
- {case value="multitext"}
- <!-- 多行文本框 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" style="height:60px;">{$vo.dfvalue|default=''}</textarea>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 多行文本框 end -->
- {/case}
-
- {case value="checkbox"}
- <!-- 复选框 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- {volist name="$vo.dfvalue" id="v2"}
- <label><input type="checkbox" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if} onclick="func_{$vo.name}_eyempty();">{$v2}</label>
- {/volist}
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name}_eyempty]" value="{if condition="!empty($vo['trueValue'])"}1{else /}0{/if}">
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script type="text/javascript">
- function func_{$vo.name}_eyempty()
- {
- var len = $("input[name='{$vo.fieldArr}[{$vo.name}][]']:checked").length;
- $("input[name='{$vo.fieldArr}[{$vo.name}_eyempty]']").val(len);
- }
- </script>
- <!-- 复选框 end -->
- {/case}
-
- {case value="radio"}
- <!-- 单选项 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- {volist name="$vo.dfvalue" id="v2"}
- <label><input type="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if}>{$v2}</label>
- {/volist}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 单选项 end -->
- {/case}
-
- {case value="switch"}
- <!-- 开关 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <div class="onoff">
- <label for="{$vo.fieldArr}_{$vo.name|default=''}1" class="cb-enable {if condition="0 != $vo['dfvalue']"}selected{/if}">是</label>
- <label for="{$vo.fieldArr}_{$vo.name|default=''}0" class="cb-disable {if condition="0 == $vo['dfvalue']"}selected{/if}">否</label>
- <input id="{$vo.fieldArr}_{$vo.name|default=''}1" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="1" type="radio" {if condition="0 != $vo['dfvalue']"}checked="checked"{/if}>
- <input id="{$vo.fieldArr}_{$vo.name|default=''}0" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="0" type="radio" {if condition="0 == $vo['dfvalue']"}checked="checked"{/if}>
- </div>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script type="text/javascript">
- $(function(){
- //自定义radio样式
- $(".cb-enable").on('click', function(){
- var parent = $(this).parents('.onoff');
- $('.cb-disable',parent).removeClass('selected');
- $(this).addClass('selected');
- $('.checkbox',parent).attr('checked', true);
- });
- $(".cb-disable").on('click', function(){
- var parent = $(this).parents('.onoff');
- $('.cb-enable',parent).removeClass('selected');
- $(this).addClass('selected');
- $('.checkbox',parent).attr('checked', false);
- });
- });
- </script>
- <!-- 开关 end -->
- {/case}
-
- {case value="select"}
- <!-- 下拉框 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <select name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}">
- {volist name="$vo.dfvalue" id="v2"}
- <option value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}selected{/if}>{$v2}</option>
- {/volist}
- </select>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 下拉框 end -->
- {/case}
-
- {case value="img"}
- <!-- 单张图 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <div class="input-file-show div_{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" {neq name="$vo[$vo['name'].'_eyou_is_remote']" value="0"}style="display: none;"{/neq}>
- <span class="show">
- <a id="img_a_{$vo.fieldArr}_{$vo.name|default=''}" target="_blank" class="nyroModal" rel="gal" href="{$vo[$vo['name'].'_eyou_local']|default='javascript:void(0);'}">
- <i id="img_i_{$vo.fieldArr}_{$vo.name|default=''}" class="fa fa-picture-o" {notempty name="$vo[$vo['name'].'_eyou_local']"}onmouseover="layer_tips=layer.tips('<img src={$vo[$vo['name'].'_eyou_local']} class=\'layer_tips_img\'>',this,{tips: [1, '#fff']});"{/notempty} onmouseout="layer.close(layer_tips);"></i>
- </a>
- </span>
- <span class="type-file-box">
- <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_local]" value="{$vo[$vo['name'].'_eyou_local']|default=''}" class="type-file-text" autocomplete="off">
- <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
- <input class="type-file-file" onClick="GetUploadify(1,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back')" size="30" hidefocus="true" nc_type="change_site_{$vo.fieldArr}_{$vo.name|default=''}"
- title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
- </span>
- </div>
- <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_remote" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_remote]" value="{$vo[$vo['name'].'_eyou_remote']|default=''}" placeholder="http://" class="input-txt" {neq name="$vo[$vo['name'].'_eyou_is_remote']" value="1"}style="display: none;"{/neq}>
-
- <label><input type="checkbox" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_is_remote]" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_is_remote" value="1" {eq name="$vo[$vo['name'].'_eyou_is_remote']" value="1"}checked="checked"{/eq} onClick="clickRemote(this, '{$vo.fieldArr}_{$vo.name|default=''}_eyou');">远程图片</label>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script type="text/javascript">
- function {$vo.fieldArr}_{$vo.name|default=''}_call_back(fileurl_tmp)
- {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(fileurl_tmp);
- $("#img_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', fileurl_tmp);
- $("#img_i_{$vo.fieldArr}_{$vo.name|default=''}").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
- }
- </script>
- <!-- 单张图 end -->
- {/case}
-
- {case value="file"}
- <!-- 单个文件 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <div class="input-file-show div_{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" {neq name="$vo[$vo['name'].'_eyou_is_remote']" value="0"}style="display: none;"{/neq}>
- <span class="show">
- <a id="file_a_{$vo.fieldArr}_{$vo.name|default=''}" class="nyroModal" rel="gal" href="{$vo[$vo['name'].'_eyou_local']|default='javascript:void(0);'}" download="{$vo[$vo['name'].'_eyou_local']|get_filename=###}">
- <i id="file_i_{$vo.fieldArr}_{$vo.name|default=''}" class="layui-icon layui-icon-file-b" ></i>
- </a>
- </span>
- <span class="type-file-box">
- <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_local" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_local]" value="{$vo[$vo['name'].'_eyou_local']|default=''}" class="type-file-text" autocomplete="off">
- <input type="button" name="button" id="{$vo.fieldArr}_{$vo.name|default=''}_button" value="选择上传..." class="type-file-button">
- <input title="点击前方文件图标可下载文件,点击按钮选择文件并提交表单后上传生效" class="type-file-file" type="file" data-type="{$vo.upload_flag}" onchange="upload_file_{$vo.fieldArr}_{$vo.name|default=''}_1585641737(this)" size="30" hidefocus="true" nc_type="change_site_{$vo.fieldArr}_{$vo.name|default=''}">
- </span>
- </div>
- <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_remote" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_remote]" value="{$vo[$vo['name'].'_eyou_remote']|default=''}" placeholder="http://" class="input-txt" {neq name="$vo[$vo['name'].'_eyou_is_remote']" value="1"}style="display: none;"{/neq}>
-
- <label><input type="checkbox" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_is_remote]" id="{$vo.fieldArr}_{$vo.name|default=''}_eyou_is_remote" value="1" {eq name="$vo[$vo['name'].'_eyou_is_remote']" value="1"}checked="checked"{/eq} onClick="clickRemote(this, '{$vo.fieldArr}_{$vo.name|default=''}_eyou');">远程文件</label>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script type="text/javascript">
- function upload_file_{$vo.fieldArr}_{$vo.name|default=''}_1585641737(e){
- var data_type = $(e).attr('data-type');
- if ('qny' == data_type) {
- // 七牛云上传
- {$vo.fieldArr}_{$vo.name|default=''}_qny_file(e);
- } else if ('oss' == data_type) {
- // OSS上传
- {$vo.fieldArr}_{$vo.name|default=''}_oss_file(e);
- } else if ('cos' == data_type) {
- // COS上传
- {$vo.fieldArr}_{$vo.name|default=''}_cos_file(e);
- } else {
- // 本地上传
- {$vo.fieldArr}_{$vo.name|default=''}_local_file(e);
- }
- }
- function judgeExtFile(ext) {
- var type = '{$vo.ext}';
- var extArr = [];
- extArr = type.split("|");
- var exts = ext.replace(".","");
- return extArr.indexOf(exts);
- }
-
- // 七牛云
- function {$vo.fieldArr}_{$vo.name|default=''}_qny_file(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtFile(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('附件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 执行上传
- layer_loading('上传七牛云');
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1) {
- if (1 == res1.code) {
- var token = res1.data.token;
- var formData = new FormData();
- formData.append('file', file);
- formData.append('token', token);
-
- fileName = res1.data.filePath + fileExt;
- formData.append('key', fileName);
- $.ajax({
- url: res1.data.uphost,
- type: 'POST',
- dataType: 'JSON',
- data: formData,
- timeout: 1200000,
- cache: false,
- processData: false,
- contentType: false,
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res2) {
- layer.closeAll();
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传成功');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').text('选择上传...');
- }, 2000);
- var video_url = res1.data.domain + "/" + res2.key;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(video_url);
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
- var arr = video_url.split("/");
- var download = arr[arr.length-1];
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- return false;
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- //OSS
- function {$vo.fieldArr}_{$vo.name|default=''}_oss_file(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtFile(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('附件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 执行上传
- layer_loading('上传阿里云OSS');
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- fileName = res1.data.filePath + fileExt;
- //组装发送数据
- var request = new FormData();
- request.append("OSSAccessKeyId",res1.data.accessid);
- request.append("policy",res1.data.policy);
- request.append("Signature",res1.data.signature);
- request.append("key",fileName);
- request.append("success_action_status",201);
- request.append('file', file);
-
- $.ajax({
- url : res1.data.host,
- data : request,
- processData: false,
- cache: false,
- contentType: false,
- dataType: 'xml',
- type : 'post',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success : function(data) {
- layer.closeAll();
- var res = $(data).find('PostResponse');
- if (res) {
- var key = res.find('Key').text();
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传成功');
- setTimeout(function() {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('选择上传...');
- }, 2000);
- var video_url = res1.data.domain + "/" + key;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(video_url);
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
- var arr = video_url.split("/");
- var download = arr[arr.length-1];
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
-
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传失败');
- setTimeout(function() {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('选择上传...');
- }, 2000);
- }
- },
- error : function(e) {
- layer.closeAll();
- console.log(e.responseText);
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- //COS
- function {$vo.fieldArr}_{$vo.name|default=''}_cos_file(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtFile(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('附件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 上传参数
- var formData = new FormData();
- formData.append('file', file);
- formData.append('file_ext', fileExt);
-
- // 执行上传
- $.ajax({
- type: 'post',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- if (100 == process) {
- process = 99;
- layer_loading('上传腾讯云');
- }
- $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- video_url = res.data.url;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(video_url);
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
- var arr = video_url.split("/");
- var download = arr[arr.length-1];
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
-
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传成功');
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传失败');
- }
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').text('选择上传...');
- }, 2000);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 本地上传
- function {$vo.fieldArr}_{$vo.name|default=''}_local_file(e){
- // 获取文件路径名
- var file = $(e)[0].files[0];
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtFile(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('附件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 定义上传数据
- var formData = new FormData();
- formData.append('file', file);
-
- // 执行上传
- layer_loading('上传本地');
- $.ajax({
- type: 'post',
- url : "{:url('Ueditor/DownloadUploadFileAjax')}",
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").html('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function (res) {
- layer.closeAll();
- if (res.code==0){
- layer.msg(res.msg)
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').html('选择上传...');
- }, 2000);
- }else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_button").html('上传成功');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').html('选择上传...');
- }, 2000);
-
- $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(res.file_url);
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',res.file_url);
- var arr = res.file_url.split("/");
- var download = arr[arr.length-1];
- $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
- }
- }
- });
- }
- </script>
- <!-- 单个文件 end -->
- {/case}
-
- {case value="imgs"}
- <!-- 多张图 start -->
- <dl class="row" id="dl_{$vo.fieldArr}_{$vo.name|default=''}">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <div class="tab-pane pics" id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
- <!-- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="imgupload">
- <i class="fa fa-photo"></i>上传图片
- </a> -->
- <table class="table table-bordered">
- <tbody>
- <tr>
- <td >
- <div class="sort-list-{$vo.fieldArr}_{$vo.name|default=''}">
- {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
- <div class="images_upload images_upload_html" style="display:inline-block;">
- <div class="images_upload_box">
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2['image_url']}">
- <a href="{$v2['image_url']}" onclick="" class="upimg" target="_blank" title="拖动修改排序">
- <img data-original="{$v2['image_url']}">
- </a>
- <a href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2['image_url']}')" class="delect" title="删除"></a>
- </div>
- <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" placeholder="图片注释">{$v2.intro}</textarea>
- </div>
- {/volist}
- <div class="images_upload"></div>
- </div>
- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="img-upload mb15" title="点击上传">
- <div class="y-line"></div>
- <div class="x-line"></div>
- </a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- 上传图片显示的样板 start -->
- <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl none">
- <div class="images_upload images_upload_html" style="display:inline-block;">
- <div class="images_upload_box">
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
- <a href="javascript:void(0);" onClick="" class="upimg" title="拖动修改排序">
- <img src="__STATIC__/admin/images/add-button.jpg"/>
- </a>
- <a href="javascript:void(0)" class="delect" title="删除"> </a>
- </div>
- <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" placeholder="图片注释"></textarea>
- </div>
- </div>
- <!-- 上传图片显示的样板 end -->
- </dd>
- </dl>
- <script type="text/javascript">
- // 上传多图回调函数
- function {$vo.fieldArr}_{$vo.name|default=''}_call_back(paths){
-
- var last_div = $(".{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl").html();
- for (var i=0;i<paths.length ;i++ )
- {
- if ($(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html").length > 0) {
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").after(last_div); // 插入一个 新图片
- } else {
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload:last").before(last_div); // 插入一个 新图片
- }
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('a:eq(1)').attr('onclick',"{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'"+paths[i]+"')").text('');
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
- }
- }
- /*
- * 上传之后删除组图input
- * @access public
- * @val string 删除的图片input
- */
- function {$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(obj,path)
- {
- // 删除数据库记录
- $.ajax({
- type:'GET',
- url:"{:url('Field/del_channelimgs', ['_ajax'=>1])}",
- data:{filename:path,channel:"{$channeltype|default='0'}",fieldid:"{$vo.id}",aid:"{$aid|default='0'}"},
- success:function(){
- $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
- $.ajax({
- type:'GET',
- url:"{:url('Uploadimgnew/delupload', ['_ajax'=>1])}",
- data:{action:"del", filename:path},
- success:function(){}
- });
- }
- });
- }
-
- /** 以下 产品相册的拖动排序相关 js*/
-
- $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).sortable({
- start: function( event, ui) {
-
- }
- ,stop: function( event, ui ) {
-
- }
- });
- //因为他们要拖动,所以尽量设置他们的文字不能选择。
- // $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).disableSelection();
- </script>
- <!-- 多张图 end -->
- {/case}
-
- {case value="int"}
- <!-- 整数类型 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="只允许纯数字" class="input-txt" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9]/g,''));"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 整数类型 end -->
- {/case}
-
- {case value="float"}
- <!-- 小数类型 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="允许带有小数点的数值" class="input-txt" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 小数类型 end -->
- {/case}
-
- {case value="decimal"}
- <!-- 金额类型 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="允许带有小数点的金额" class="input-txt" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <!-- 金额类型 end -->
- {/case}
-
- {case value="datetime"}
- <!-- 日期和时间 start -->
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="text" class="input-txt" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" value="{$vo['dfvalue']}" autocomplete="off">
- <span class="add-on input-group-addon">
- <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
- </span>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script type="text/javascript">
- layui.use('laydate', function() {
- var laydate = layui.laydate;
-
- //常规用法
- laydate.render({
- elem: "#{$vo.fieldArr}_{$vo.name|default=''}"
- ,type: 'datetime'
- });
- })
- </script>
- <!-- 日期和时间 end -->
- {/case}
-
-
-
-
- {case value="htmltext"}
- <!-- HTML文本 start -->
- {eq name="$editor.editor_select" value="1"}
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- {if condition="$vo.name=='content'"}
- {notempty name="$have_content_ey_m"}
- <div class="pcwap-onoff">
- <label onclick="contentSwitch(1);" class="cb-enable selected">PC端详情</label>
- <label onclick="contentSwitch(2);" class="cb-disable">手机端详情</label>
- </div>
- {/notempty}
- {if condition="isset($vo['first']) AND 1 == $vo['first']"}
- <label class="curpoin"><input type="checkbox" name="editor_remote_img_local" id="editor_remote_img_local" data-val="{$vo.editor.editor_remote_img_local}" value="1" {eq name="$vo.editor.editor_remote_img_local" value="1"} checked {/eq}>远程图片本地化</label> <!-- <a href="javascript:void(0);" onclick="editor_handle_210607(1);">[手动]</a> -->
- <label class="curpoin"><input type="checkbox" name="editor_img_clear_link" id="editor_img_clear_link" data-val="{$vo.editor.editor_img_clear_link}" value="1" {eq name="$vo.editor.editor_img_clear_link" value="1"} checked {/eq}>清除非本站链接</label> <!-- <a href="javascript:void(0);" onclick="editor_handle_210607(2);">[手动]</a> -->
- {if condition="'Arctype' == $controller_name && 'single_edit' == $action_name"}
- <label class="curpoin"><input class="check" type="checkbox" name="empty_logic" value="1" {notempty name="$info['empty_logic']"} checked="checked" {/notempty}>提取下级栏目内容</label> <p class="notic">当内容详情没有填写时,前台内容部分将自动调用下级栏目的内容</p>
- {/if}
- {/if}
- <div id="div_hint" style="float: right;display: none;">
- <a style="color: #f00;">左侧编辑器如不填写,就自动引用pc端的内容</a>
- <a class="ui_tips" style="margin-left: 5px;" href="javascript:void(0);" onmouseover="layer_tips = layer.tips('1、pc和手机端调用标签共用,不用额外调用。<br/>2、pc不填写不会自动引用手机端内容。', this, {time:100000});" onmouseout="layer.close(layer_tips);"></a>
- </div>
- {else /}
- {if condition="isset($vo['first']) AND 1 == $vo['first']"}
- <label class="curpoin"><input type="checkbox" name="editor_remote_img_local" id="editor_remote_img_local" data-val="{$vo.editor.editor_remote_img_local}" value="1" {eq name="$vo.editor.editor_remote_img_local" value="1"} checked {/eq}>远程图片本地化</label> <!-- <a href="javascript:void(0);" onclick="editor_handle_210607(1);">[手动]</a> -->
- <label class="curpoin"><input type="checkbox" name="editor_img_clear_link" id="editor_img_clear_link" data-val="{$vo.editor.editor_img_clear_link}" value="1" {eq name="$vo.editor.editor_img_clear_link" value="1"} checked {/eq}>清除非本站链接</label> <!-- <a href="javascript:void(0);" onclick="editor_handle_210607(2);">[手动]</a> -->
- {/if}
- {/if}
- <div style="clear: both;"></div>
- {if condition="$vo.name=='content' || $vo.name=='content_ey_m'"}
- <textarea class="span12 ckeditor" id="{$vo.fieldArr}_{$vo.name|default=''}" data-func="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" title="">{$vo.dfvalue|default=''}</textarea>
- <textarea style="display: none;" class="span12 ckeditor" id="{$vo.fieldArr}_{$vo.name|default=''}_ey_m" data-func="{$vo.fieldArr}_{$vo.name|default=''}_ey_m" name="{$vo.fieldArr}[{$vo.name|default=''}_ey_m]" title="">{$content_ey_m_dfvalue|default=''}</textarea>
- {notempty name="$have_content_ey_m"}
- <div id="content_ey_m_div" {if condition="$vo.name=='content'"}style="display: none"{/if}>
- <p id="content_ey_m_all_tit">
- <i class="iconfont e-left" style="float: left;font-size: 18px;"></i>正文预览 <i class="iconfont e-xiaochengxu1" style="float: right;font-size: 24px;"></i>
- </p>
- <div id="content_ey_m_all_div">
- <div id="phone_title_div" {if condition="!empty($nid) and $nid == 'single'"}style="display:none"{/if}>这里是标题</div>
- <div id="phone_time_div" {if condition="!empty($nid) and $nid == 'single'"}style="display:none"{/if}>2022-03-31</div>
- <div id="phone_preview_div"></div>
- </div>
- </div>
- {/notempty}
- {else /}
- <textarea class="span12 ckeditor" id="{$vo.fieldArr}_{$vo.name|default=''}" data-func="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" title="">{$vo.dfvalue|default=''}</textarea>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- {/if}
- </dd>
- </dl>
- <style>
- #addonFieldExt_content_ey_m{
- max-width: 58%;
- width: 100%;
- float: left;
- margin-right: 2%;
- display: block;
- }
- #content_ey_m_div{
- float: right;
- width: 39%;
- max-width: 470px;
- display: block;
- border: solid 1px #eee;
- zoom: 1;
- -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
- -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
- box-shadow: 0 1px 4px rgb(0 0 0 / 10%);
- }
- #content_ey_m_all_tit{
- padding: 10px 10px;
- text-align: center;
- font-size: 17px;
- color: #444;
- font-weight: 500;
- border-bottom: solid 1px #eee;
- }
- #content_ey_m_all_div{
- width: 100%;
- height: 491px;
- overflow: auto;
- box-sizing: border-box;
- }
- #phone_title_div{
- font-size: 20px;
- font-weight: bold;
- padding: 5px 10px;
- margin-top: 10px;
- color: #444;
- }
- #phone_time_div{
- padding: 0 10px;
- margin-bottom: 5px;
- }
- #phone_preview_div{
- padding: 10px;
- width: 100%;
- /*height: 491px;*/
- /*overflow: auto;*/
- /*border: solid 1px #eee;*/
- box-sizing: border-box;
- }
- #phone_preview_div img {
- -ms-interpolation-mode: bicubic;
- }
- #phone_preview_div img {
- max-width: 100%;
- }
- #phone_preview_div video{
- max-width: 100%;
- }
- </style>
- <script type="text/javascript">
- function contentSwitch(id) {
- if (id == 1){
- $("#addonFieldExt_content").show();
- $("#addonFieldExt_content_ey_m").hide();
- $("#content_ey_m_div").hide();
- $("#div_hint").hide();
- }else{
- $("#addonFieldExt_content_ey_m").show();
- $("#content_ey_m_div").show();
- $("#addonFieldExt_content").hide();
- $("#div_hint").show();
- }
- }
- $(function(){
- //自定义radio样式
- $(".cb-enable").on('click', function(){
- var parent = $(this).parents('.pcwap-onoff');
- $('.cb-disable',parent).removeClass('selected');
- $(this).addClass('selected');
- $('.checkbox',parent).attr('checked', true);
- });
- $(".cb-disable").on('click', function(){
- var parent = $(this).parents('.pcwap-onoff');
- $('.cb-enable',parent).removeClass('selected');
- $(this).addClass('selected');
- $('.checkbox',parent).attr('checked', false);
- });
- });
- </script>
-
-
-
- <?php
- //var_dump($vo);
- //存在多个编辑器的时候 只能加载 收个 不然js会报错
- ?>
-
- {if condition="isset($vo['first']) AND 1 == $vo['first']"}
- <script type="text/javascript">
- // 打开多图选择及上传界面
- function OpenImagesList(e, obj) {
- var func = '';
- if (e.path && e.path[10] && e.path[10].id && undefined != e.path[10].id) {
- func = e.path[10].id;
- } else {
- func = $(obj).parent().parent().parent().parent().parent().parent().parent().parent().parent().attr('id');
- }
- if (func.indexOf('addonFieldExt_') == -1) {
- func = 'addonFieldExt_content';
- }
- var OpenUrl = "{:url('Uploadimgnew/upload', ['num'=>30, 'path'=>'allimg', 'is_water'=>1])}";
- OpenUrl += "&func=images_call_" + func;
- top.layer.open({
- type: 2,
- title: '图片上传',
- shade: layer_shade,
- maxmin: false,
- shadeClose: false,
- area: ['1000px', '625px'],
- content: OpenUrl
- });
- }
- </script>
- {/if}
-
- <script type="text/javascript">
- var ue_{$vo.fieldArr}_{$vo.name|default=''} = UE.getEditor('{$vo.fieldArr}_{$vo.name|default=''}',{
- serverUrl :"{:url('Ueditor/index',array('savepath'=>'allimg'))}",
- zIndex: 999,
- initialFrameWidth: "100%", //初化宽度
- initialFrameHeight: 450, //初化高度
- focus: false, //初始化时,是否让编辑器获得焦点true或false
- maximumWords: 99999,
- removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
- pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
- autoHeightEnabled: false,
- toolbars: ueditor_toolbars
- });
-
- //必须在提交前渲染编辑器;
- function {$vo.fieldArr}_{$vo.name|default=''}() {
- //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
- if(UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").queryCommandState('source') != 0) {
- UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('source'); //切换到【设计】视图
- }
- }
-
- // 加载图片到编辑器指定位置
- function images_call_{$vo.fieldArr}_{$vo.name|default=''}(fileurl_tmp,filename_tmp) {
- var addBody = '';
- $.each(fileurl_tmp, function(index, items) {
- addBody += '<p><img src="'+items+'" alt="'+filename_tmp[index]+'"></p>';
- });
- UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('inserthtml', addBody);
- }
-
- // 自动远程图片本地化/自动清除非本站链接
- function ajax_auto_editor_{$vo.fieldArr}_{$vo.name|default=''}(local,link) {
- var body = UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").getContent();
- $.ajax({
- type: 'POST',
- url: "{:url('Archives/ajax_auto_editor')}",
- data: {local:local,link:link,body:body,_ajax:1},
- dataType: "JSON",
- async:false,
- success: function(res){
- if (res.code == 1) {
- UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").setContent(res.data.body);
- }
- }
- });
- }
-
- </script>
- {if condition="$vo.name=='content' || $vo.name=='content_ey_m'"}
- <script type="text/javascript">
- //编辑器发生变动执行方法
- function get_ue_content_ey_m_1645596891(){
- try{
- var content_ey_m_text = UE.getEditor("addonFieldExt_content_ey_m").getContent();
- }catch (e){
- var content_ey_m_text = '';
- }
- if (content_ey_m_text === '' || content_ey_m_text === undefined){ //手机端为空时候,pc端编辑器信息给正文预览
- content_ey_m_text = UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").getContent();
- }
- $('#phone_preview_div').html(content_ey_m_text);
- }
- var ue_addonFieldExt_content_ey_m = UE.getEditor('addonFieldExt_content_ey_m',{
- serverUrl :"{:url('Ueditor/index',array('savepath'=>'allimg'))}",
- zIndex: 999,
- initialFrameWidth: "100%", //初化宽度
- initialFrameHeight: 478, //初化高度
- focus: false, //初始化时,是否让编辑器获得焦点true或false
- maximumWords: 99999,
- removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
- pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
- autoHeightEnabled: false,
- toolbars: ueditor_toolbars_ey_m
- });
- //必须在提交前渲染编辑器;
- function addonFieldExt_content_ey_m() {
- //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
- if(UE.getEditor("addonFieldExt_content_ey_m").queryCommandState('source') != 0) {
- UE.getEditor("addonFieldExt_content_ey_m").execCommand('source'); //切换到【设计】视图
- }
- }
- // 加载图片到编辑器指定位置
- function images_call_addonFieldExt_content_ey_m(fileurl_tmp,filename_tmp) {
- var addBody = '';
- $.each(fileurl_tmp, function(index, items) {
- addBody += '<p><img src="'+items+'" alt="'+filename_tmp[index]+'"></p>';
- });
- UE.getEditor("addonFieldExt_content_ey_m").execCommand('inserthtml', addBody);
- }
-
- // 自动远程图片本地化/自动清除非本站链接
- function ajax_auto_editor_addonFieldExt_content_ey_m(local,link) {
- var body = UE.getEditor("addonFieldExt_content_ey_m").getContent();
- $.ajax({
- type: 'POST',
- url: "{:url('Archives/ajax_auto_editor')}",
- data: {local:local,link:link,body:body,_ajax:1},
- dataType: "JSON",
- async:false,
- success: function(res){
- if (res.code == 1) {
- UE.getEditor("addonFieldExt_content_ey_m").setContent(res.data.body);
- }
- }
- });
- }
- var myDate = new Date();
- var myYear = myDate.getFullYear(); //获取完整的年份
- var myMonth = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
- var myToday = myDate.getDate(); //
- $('#phone_time_div').html(myYear+'-'+ myMonth+'-'+ myToday);
- function get_ue_phone_title_1645596891(){
- if ($("input[name='title']").length > 0){
- var phone_title = $("input[name='title']")[0].value;
- $('#phone_title_div').text(phone_title);
- }
- }
- phone_title_1645596891 = window.setInterval(function(){ get_ue_phone_title_1645596891(); }, 500);
- </script>
- {/if}
- {else/}
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- {if condition="isset($vo['first']) AND 1 == $vo['first']"}
- <label class="curpoin"><input type="checkbox" name="editor_remote_img_local" id="editor_remote_img_local" data-val="{$vo.editor.editor_remote_img_local}" value="1" {eq name="$vo.editor.editor_remote_img_local" value="1"} checked {/eq} >远程图片本地化</label> <!-- <a href="javascript:void(0);" onclick="editor_handle_210607(1);">[手动]</a> -->
- <label class="curpoin"><input type="checkbox" name="editor_img_clear_link" id="editor_img_clear_link" data-val="{$vo.editor.editor_img_clear_link}" value="1" {eq name="$vo.editor.editor_img_clear_link" value="1"} checked {/eq} >清除非本站链接</label> <!-- <a href="javascript:void(0);" onclick="editor_handle_210607(2);">[手动]</a> -->
- {/if}
- <textarea id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]">{$vo.dfvalue|default=''}</textarea>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script type="text/javascript">
- // 加载编辑器,若存在编辑器则先进行销毁
- try {
- var elemtid = "{$vo.fieldArr}_{$vo.name|default=''}";
- var editor = CKEDITOR.instances[elemtid];
- if (editor) editor.destroy(true);
- } catch(e) {}
-
- CKEDITOR.replace(elemtid, {
- filebrowserBrowseUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
- filebrowserImageBrowseUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
- filebrowserUploadUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
- filebrowserImageUploadUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
- });
-
- // 自动远程图片本地化/自动清除非本站链接
- function ajax_auto_editor_{$vo.fieldArr}_{$vo.name|default=''}(local,link) {
- var body = CKEDITOR.instances.{$vo.fieldArr}_{$vo.name|default=''}.getData();
- $.ajax({
- type: 'POST',
- url: "{:url('Archives/ajax_auto_editor')}",
- data: {local:local,link:link,body:body,_ajax:1},
- dataType: "JSON",
- async:false,
- success: function(res){
- if (res.code == 1) {
- CKEDITOR.instances.{$vo.fieldArr}_{$vo.name|default=''}.setData(res.data.body);
- }
- }
- });
- }
- </script>
- {if condition="$vo.name=='content' || $vo.name=='content_ey_m'"}
- <script type="text/javascript">
- // 自动远程图片本地化/自动清除非本站链接
- function ajax_auto_editor_addonFieldExt_content_ey_m(local,link) {
- }
- </script>
- {/if}
- {/eq}
- <!-- HTML文本 end -->
- {/case}
-
- <!-- 多媒体类型 start -->
- {case value="media"}
- <dl class="row">
- <dt class="tit">
- <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
- </dt>
- <dd class="opt">
- <input type="text" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}_media_url" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}" style="width: 400px !important;" >
- <input type="file" id="{$vo.fieldArr}_{$vo.name|default=''}_upload_media" onchange="{$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210408(this)" style="display: none;">
- {if condition="'qny' == $vo.upload_flag"}
- <button type="button" class="layui-btn" id="{$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media" onclick="$('#{$vo.fieldArr}_{$vo.name|default=\'\'}_upload_media').attr('data-type', 'qny').trigger('click');">七牛云上传</button>
- {elseif condition="'oss' == $vo.upload_flag"}
- <button type="button" class="layui-btn" id="{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media" onclick="$('#{$vo.fieldArr}_{$vo.name|default=\'\'}_upload_media').attr('data-type', 'oss').trigger('click');">oss上传</button>
- {elseif condition="'cos' == $vo.upload_flag"}
- <button type="button" class="layui-btn" id="{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media" onclick="$('#{$vo.fieldArr}_{$vo.name|default=\'\'}_upload_media').attr('data-type', 'cos').trigger('click');">cos上传</button>
- {else}
- <button type="button" class="layui-btn" id="{$vo.fieldArr}_{$vo.name|default=''}_local_upload_media" onclick="$('#{$vo.fieldArr}_{$vo.name|default=\'\'}_upload_media').attr('data-type', 'local').trigger('click');">本地上传</button>
- {/if}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </dd>
- </dl>
- <script>
- // 上传媒体文件
- function {$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210408(e){
- var data_type = $(e).attr('data-type');
- if ('qny' == data_type) {
- // 七牛云上传
- {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e);
- } else if ('oss' == data_type) {
- // OSS上传
- {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e);
- } else if ('cos' == data_type) {
- // COS上传
- {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e);
- } else {
- // 本地上传
- {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e);
- }
- }
- function judgeExtMedia(ext) {
- var type = '{$vo.ext}';
- var extArr = [];
- extArr = type.split("|");
- var exts = ext.replace(".","");
- return extArr.indexOf(exts);
- }
-
- // 七牛云
- function {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtMedia(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 执行上传
- layer_loading('上传七牛云');
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1) {
- if (1 == res1.code) {
- var token = res1.data.token;
- var formData = new FormData();
- formData.append('file', file);
- formData.append('token', token);
-
- fileName = res1.data.filePath + fileExt;
- formData.append('key', fileName);
- $.ajax({
- url: res1.data.uphost,
- type: 'POST',
- dataType: 'JSON',
- data: formData,
- timeout: 1200000,
- cache: false,
- processData: false,
- contentType: false,
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res2) {
- layer.closeAll();
- $("#{$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media").text('上传成功');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_qny_upload_media').text('七牛云上传');
- }, 2000);
- var video_url = res1.data.domain + "/" + res2.key;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(video_url);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- return false;
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- //OSS
- function {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtMedia(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 执行上传
- layer_loading('上传阿里云OSS');
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- fileName = res1.data.filePath + fileExt;
- //组装发送数据
- var request = new FormData();
- request.append("OSSAccessKeyId",res1.data.accessid);
- request.append("policy",res1.data.policy);
- request.append("Signature",res1.data.signature);
- request.append("key",fileName);
- request.append("success_action_status",201);
- request.append('file', file);
-
- $.ajax({
- url : res1.data.host,
- data : request,
- processData: false,
- cache: false,
- contentType: false,
- dataType: 'xml',
- type : 'post',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success : function(data) {
- layer.closeAll();
- var res = $(data).find('PostResponse');
- if (res) {
- var key = res.find('Key').text();
- $("#{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media").text('上传成功');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_oss_upload_media').text('oss上传');
- }, 2000);
- var video_url = res1.data.domain + "/" + key;
- $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(video_url);
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media").text('上传失败');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_oss_upload_media').text('oss上传');
- }, 2000);
- }
- },
- error : function(e) {
- layer.closeAll();
- console.log(e.responseText);
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- //COS
- function {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e) {
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtMedia(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 上传参数
- var formData = new FormData();
- formData.append('file', file);
- formData.append('file_ext', fileExt);
-
- // 执行上传
- $.ajax({
- type: 'post',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- if (100 == process) {
- process = 99;
- layer_loading('上传腾讯云');
- }
- $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传成功');
- $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(res.data.url);
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传失败');
- }
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_cos_upload_media').text('cos上传');
- }, 2000);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 本地上传
- function {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e){
- // 获取文件路径名
- var file = $(e)[0].files[0];
-
- // 验证上传格式
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExtMedia(fileExt);
- if (ext == -1) {
- showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
- return false;
- }
-
- // 验证上传大小
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- // 定义上传数据
- var formData = new FormData();
- formData.append('file', file);
-
- // 执行上传
- layer_loading('上传本地');
- $.ajax({
- type: 'post',
- url : "{:url('Ueditor/upVideo', ['savepath'=>'media'])}",
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#upload_video_litpic_local").html('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function (res) {
- layer.closeAll();
- if ("SUCCESS" == res.state) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_local_upload_media").html('上传成功');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_local_upload_media').html('本地上传');
- }, 2000);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(res.url);
- } else {
- showErrorMsg(res.msg);
- }
- }
- });
- }
- </script>
- {/case}
- <!-- 多媒体类型 end -->
- {/switch}
- {/if}
- {/volist}
-
- <script type="text/javascript">
- var notic_tips_230112 = 0;
- $(function(){
- try {
- $("img").lazyload({
- effect: "fadeIn",
- placeholder : "__PUBLIC__/static/common/images/loading.gif",
- threshold: 200
- });
- }catch(e){}
-
- auto_notic_tips();
- /**
- * 自动小提示
- */
- function auto_notic_tips()
- {
- var html = '<a class="ui_tips" href="javascript:void(0);" onmouseover="layer_tips = layer.tips($(this).parent().find(\'p.notic\').html(), this, {time:100000});" onmouseout="layer.close(layer_tips);">提示</a>';
- $.each($('dd.opt > p.notic'), function(index, item){
- var a_length = $(item).prev("a.ui_tips").length;
- if ($(item).html() != '' && 0 == a_length) {
- $(item).before(html);
- notic_tips_230112 = 1;
- }
- });
- }
-
- // 第一个自定义字段显示感汉号提示
- if (0 == notic_tips_230112) {
- var ganhaohtml = '<a class="ui_tips" href="javascript:void(0);" onmouseover="layer_tips = layer.tips($(this).parent().find(\'p.notic-ganhan-ico\').html(), this, {time:100000});" onmouseout="layer.close(layer_tips);"></a><p class="notic-ganhan-ico none">属于自定义字段。在“功能地图>频道模型>字段管理”里管理</p>';
- $($('#FieldAddonextitem').find('dl > dd').find('p.notic').get(0)).parent().append(ganhaohtml);
- }
- });
- </script>
|