Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  1. <!-- 用户自定义扩展模板文件 -->
  2. {include file="diy_extend/archives_extend" /}
  3. <!-- end -->
  4. <script>
  5. // 获取联动地址
  6. function GetFieldRegionData_1670295376(t,type){
  7. var name = $(t).attr('data-name');
  8. var parent_id = parseInt($(t).val());
  9. if(!parent_id || 0 >= parent_id){
  10. if ('province' == type) {
  11. $('#city_'+name).hide();
  12. $('#area_'+name).hide();
  13. }else if ('city' == type){
  14. $('#area_'+name).hide();
  15. }
  16. return false;
  17. }
  18. var url = "{:url('Field/ajax_get_region_data')}";
  19. $.ajax({
  20. url: url,
  21. data: {parent_id:parent_id,_ajax:1},
  22. type:'post',
  23. dataType:'json',
  24. success:function(res){
  25. if (res.region_html) {
  26. // 输出下一级栏目选项
  27. if ('province' == type) {
  28. res = '<option value="-1">请选择</option>'+ res.region_html;
  29. $('#city_'+name).empty().html(res);
  30. $('#city_'+name).show();
  31. $('#area_'+name).hide();
  32. $('#area_'+name).empty();
  33. }else if ('city' == type){
  34. res = '<option value="-1">请选择</option>'+ res.region_html;
  35. $('#area_'+name).empty().html(res);
  36. $('#area_'+name).show();
  37. }
  38. }
  39. },
  40. error : function(e) {
  41. layer.closeAll();
  42. layer.alert(e.responseText, {icon: 5});
  43. }
  44. });
  45. }
  46. </script>
  47. {volist name="$addonFieldExtList" id="vo"}
  48. <?php
  49. //var_dump($vo);
  50. ?>
  51. <?php
  52. //var_dump($typeid);
  53. ?>
  54. {if condition="(('Custom' == $controller_name && isset($vo.ifeditable) && $vo.ifeditable == 1) || ('Custom' != $controller_name && (!isset($vo.ifeditable) || $vo.ifeditable)))"}
  55. {switch name="vo.dtype"}
  56. {case value="hidden"}
  57. <!-- 隐藏域 start -->
  58. <dl class="row" style="display: none;">
  59. <dt class="tit">
  60. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  61. </dt>
  62. <dd class="opt">
  63. <input type="hidden" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
  64. </dd>
  65. </dl>
  66. <!-- 隐藏域 start -->
  67. {/case}
  68. {case value="region"}
  69. {empty name="$vo.set_type"}
  70. <!-- 区域选项 start -->
  71. <dl class="row">
  72. <dt class="tit">
  73. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  74. </dt>
  75. <dd class="opt">
  76. {volist name="$vo.dfvalue" id="v2"}
  77. <label>
  78. <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']}
  79. </label>&nbsp;
  80. {/volist}
  81. <span class="err"></span>
  82. <p class="notic">{$vo.remark|default=''}</p>
  83. </dd>
  84. </dl>
  85. <!-- 区域选项 end -->
  86. {else /}
  87. <dl class="row">
  88. <dt class="tit">
  89. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  90. </dt>
  91. <dd class="opt">
  92. <!--一级-->
  93. <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}>
  94. <option value="-1">请选择</option>
  95. <option {if condition="$vo['trueValue'][0] === 0 || $vo['trueValue'][0] ==='0'"} selected {/if} value="0">全国</option>
  96. {volist name="$vo.dfvalue" id="v_p"}
  97. <option {if condition="$vo['trueValue'][0] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
  98. {/volist}
  99. </select>
  100. <!--二级-->
  101. <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}>
  102. {volist name="$vo.city_list" id="v_p"}
  103. <option {if condition="$vo['trueValue'][1] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
  104. {/volist}
  105. </select>
  106. <!--三级-->
  107. <select name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="area_{$vo.fieldArr}_{$vo.name|default=''}" {empty name="$vo['trueValue'][2]"}style="display: none;"{/empty}>
  108. {volist name="$vo.area_list" id="v_p"}
  109. <option {if condition="$vo['trueValue'][2] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
  110. {/volist}
  111. </select>
  112. <span class="err"></span>
  113. <p class="notic">{$vo.remark|default=''}</p>
  114. </dd>
  115. </dl>
  116. {/empty}
  117. {/case}
  118. {case value="text"}
  119. <!-- 单行文本框 start -->
  120. <dl class="row">
  121. <dt class="tit">
  122. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  123. </dt>
  124. <dd class="opt">
  125. <input type="text" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">&nbsp;{$vo.dfvalue_unit|default=''}
  126. <span class="err"></span>
  127. <p class="notic">{$vo.remark|default=''}</p>
  128. </dd>
  129. </dl>
  130. <!-- 单行文本框 end -->
  131. {/case}
  132. {case value="multitext"}
  133. <!-- 多行文本框 start -->
  134. <dl class="row">
  135. <dt class="tit">
  136. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  137. </dt>
  138. <dd class="opt">
  139. <textarea rows="5" cols="60" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" style="height:60px;">{$vo.dfvalue|default=''}</textarea>
  140. <span class="err"></span>
  141. <p class="notic">{$vo.remark|default=''}</p>
  142. </dd>
  143. </dl>
  144. <!-- 多行文本框 end -->
  145. {/case}
  146. {case value="checkbox"}
  147. <!-- 复选框 start -->
  148. <dl class="row">
  149. <dt class="tit">
  150. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  151. </dt>
  152. <dd class="opt">
  153. {volist name="$vo.dfvalue" id="v2"}
  154. <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>&nbsp;
  155. {/volist}
  156. <input type="hidden" name="{$vo.fieldArr}[{$vo.name}_eyempty]" value="{if condition="!empty($vo['trueValue'])"}1{else /}0{/if}">
  157. <span class="err"></span>
  158. <p class="notic">{$vo.remark|default=''}</p>
  159. </dd>
  160. </dl>
  161. <script type="text/javascript">
  162. function func_{$vo.name}_eyempty()
  163. {
  164. var len = $("input[name='{$vo.fieldArr}[{$vo.name}][]']:checked").length;
  165. $("input[name='{$vo.fieldArr}[{$vo.name}_eyempty]']").val(len);
  166. }
  167. </script>
  168. <!-- 复选框 end -->
  169. {/case}
  170. {case value="radio"}
  171. <!-- 单选项 start -->
  172. <dl class="row">
  173. <dt class="tit">
  174. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  175. </dt>
  176. <dd class="opt">
  177. {volist name="$vo.dfvalue" id="v2"}
  178. <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>&nbsp;
  179. {/volist}
  180. <span class="err"></span>
  181. <p class="notic">{$vo.remark|default=''}</p>
  182. </dd>
  183. </dl>
  184. <!-- 单选项 end -->
  185. {/case}
  186. {case value="switch"}
  187. <!-- 开关 start -->
  188. <dl class="row">
  189. <dt class="tit">
  190. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  191. </dt>
  192. <dd class="opt">
  193. <div class="onoff">
  194. <label for="{$vo.fieldArr}_{$vo.name|default=''}1" class="cb-enable {if condition="0 != $vo['dfvalue']"}selected{/if}">是</label>
  195. <label for="{$vo.fieldArr}_{$vo.name|default=''}0" class="cb-disable {if condition="0 == $vo['dfvalue']"}selected{/if}">否</label>
  196. <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}>
  197. <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}>
  198. </div>
  199. <span class="err"></span>
  200. <p class="notic">{$vo.remark|default=''}</p>
  201. </dd>
  202. </dl>
  203. <script type="text/javascript">
  204. $(function(){
  205. //自定义radio样式
  206. $(".cb-enable").on('click', function(){
  207. var parent = $(this).parents('.onoff');
  208. $('.cb-disable',parent).removeClass('selected');
  209. $(this).addClass('selected');
  210. $('.checkbox',parent).attr('checked', true);
  211. });
  212. $(".cb-disable").on('click', function(){
  213. var parent = $(this).parents('.onoff');
  214. $('.cb-enable',parent).removeClass('selected');
  215. $(this).addClass('selected');
  216. $('.checkbox',parent).attr('checked', false);
  217. });
  218. });
  219. </script>
  220. <!-- 开关 end -->
  221. {/case}
  222. {case value="select"}
  223. <!-- 下拉框 start -->
  224. <dl class="row">
  225. <dt class="tit">
  226. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  227. </dt>
  228. <dd class="opt">
  229. <select name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}">
  230. {volist name="$vo.dfvalue" id="v2"}
  231. <option value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}selected{/if}>{$v2}</option>
  232. {/volist}
  233. </select>
  234. <span class="err"></span>
  235. <p class="notic">{$vo.remark|default=''}</p>
  236. </dd>
  237. </dl>
  238. <!-- 下拉框 end -->
  239. {/case}
  240. {case value="img"}
  241. <!-- 单张图 start -->
  242. <dl class="row">
  243. <dt class="tit">
  244. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  245. </dt>
  246. <dd class="opt">
  247. <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}>
  248. <span class="show">
  249. <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);'}">
  250. <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>
  251. </a>
  252. </span>
  253. <span class="type-file-box">
  254. <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">
  255. <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
  256. <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=''}"
  257. title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
  258. </span>
  259. </div>
  260. <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}>
  261. &nbsp;
  262. <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>
  263. <span class="err"></span>
  264. <p class="notic">{$vo.remark|default=''}</p>
  265. </dd>
  266. </dl>
  267. <script type="text/javascript">
  268. function {$vo.fieldArr}_{$vo.name|default=''}_call_back(fileurl_tmp)
  269. {
  270. $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(fileurl_tmp);
  271. $("#img_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', fileurl_tmp);
  272. $("#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']});");
  273. }
  274. </script>
  275. <!-- 单张图 end -->
  276. {/case}
  277. {case value="file"}
  278. <!-- 单个文件 start -->
  279. <dl class="row">
  280. <dt class="tit">
  281. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  282. </dt>
  283. <dd class="opt">
  284. <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}>
  285. <span class="show">
  286. <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=###}">
  287. <i id="file_i_{$vo.fieldArr}_{$vo.name|default=''}" class="layui-icon layui-icon-file-b" ></i>
  288. </a>
  289. </span>
  290. <span class="type-file-box">
  291. <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">
  292. <input type="button" name="button" id="{$vo.fieldArr}_{$vo.name|default=''}_button" value="选择上传..." class="type-file-button">
  293. <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=''}">
  294. </span>
  295. </div>
  296. <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}>
  297. &nbsp;
  298. <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>
  299. <span class="err"></span>
  300. <p class="notic">{$vo.remark|default=''}</p>
  301. </dd>
  302. </dl>
  303. <script type="text/javascript">
  304. function upload_file_{$vo.fieldArr}_{$vo.name|default=''}_1585641737(e){
  305. var data_type = $(e).attr('data-type');
  306. if ('qny' == data_type) {
  307. // 七牛云上传
  308. {$vo.fieldArr}_{$vo.name|default=''}_qny_file(e);
  309. } else if ('oss' == data_type) {
  310. // OSS上传
  311. {$vo.fieldArr}_{$vo.name|default=''}_oss_file(e);
  312. } else if ('cos' == data_type) {
  313. // COS上传
  314. {$vo.fieldArr}_{$vo.name|default=''}_cos_file(e);
  315. } else {
  316. // 本地上传
  317. {$vo.fieldArr}_{$vo.name|default=''}_local_file(e);
  318. }
  319. }
  320. function judgeExtFile(ext) {
  321. var type = '{$vo.ext}';
  322. var extArr = [];
  323. extArr = type.split("|");
  324. var exts = ext.replace(".","");
  325. return extArr.indexOf(exts);
  326. }
  327. // 七牛云
  328. function {$vo.fieldArr}_{$vo.name|default=''}_qny_file(e) {
  329. // 获取文件路径名
  330. var file = $(e)[0].files[0];
  331. // 验证上传格式
  332. var fileName = file.name;
  333. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  334. var ext = judgeExtFile(fileExt);
  335. if (ext == -1) {
  336. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  337. return false;
  338. }
  339. // 验证上传大小
  340. size = parseInt("{$vo.filesize}");
  341. if (file.size > size) {
  342. showErrorMsg('附件大小超过限制,可在附件设置中修改');
  343. return false;
  344. }
  345. // 执行上传
  346. layer_loading('上传七牛云');
  347. $.ajax({
  348. type: 'POST',
  349. url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
  350. data: {_ajax: 1},
  351. dataType: "JSON",
  352. success: function(res1) {
  353. if (1 == res1.code) {
  354. var token = res1.data.token;
  355. var formData = new FormData();
  356. formData.append('file', file);
  357. formData.append('token', token);
  358. fileName = res1.data.filePath + fileExt;
  359. formData.append('key', fileName);
  360. $.ajax({
  361. url: res1.data.uphost,
  362. type: 'POST',
  363. dataType: 'JSON',
  364. data: formData,
  365. timeout: 1200000,
  366. cache: false,
  367. processData: false,
  368. contentType: false,
  369. xhr: function () {
  370. myXhr = $.ajaxSettings.xhr();
  371. if (myXhr.upload) {
  372. myXhr.upload.addEventListener('progress', function(e){
  373. var curr = e.loaded;
  374. var total = e.total;
  375. process = parseInt(curr / total * 100);
  376. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传中...'+process+"%");
  377. });
  378. }
  379. return myXhr;
  380. },
  381. success: function(res2) {
  382. layer.closeAll();
  383. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传成功');
  384. setTimeout(function() {
  385. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').text('选择上传...');
  386. }, 2000);
  387. var video_url = res1.data.domain + "/" + res2.key;
  388. $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(video_url);
  389. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
  390. var arr = video_url.split("/");
  391. var download = arr[arr.length-1];
  392. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
  393. },
  394. error: function(e) {
  395. layer.closeAll();
  396. showErrorMsg(e.responseText);
  397. return false;
  398. }
  399. });
  400. } else {
  401. layer.closeAll();
  402. showErrorMsg(res1.msg);
  403. }
  404. },
  405. error: function(e) {
  406. layer.closeAll();
  407. showErrorMsg(e.responseText);
  408. }
  409. });
  410. }
  411. //OSS
  412. function {$vo.fieldArr}_{$vo.name|default=''}_oss_file(e) {
  413. // 获取文件路径名
  414. var file = $(e)[0].files[0];
  415. // 验证上传格式
  416. var fileName = file.name;
  417. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  418. var ext = judgeExtFile(fileExt);
  419. if (ext == -1) {
  420. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  421. return false;
  422. }
  423. // 验证上传大小
  424. size = parseInt("{$vo.filesize}");
  425. if (file.size > size) {
  426. showErrorMsg('附件大小超过限制,可在附件设置中修改');
  427. return false;
  428. }
  429. // 执行上传
  430. layer_loading('上传阿里云OSS');
  431. $.ajax({
  432. type: 'POST',
  433. url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
  434. data: {_ajax: 1},
  435. dataType: "JSON",
  436. success: function(res1){
  437. if (1 == res1.code){
  438. fileName = res1.data.filePath + fileExt;
  439. //组装发送数据
  440. var request = new FormData();
  441. request.append("OSSAccessKeyId",res1.data.accessid);
  442. request.append("policy",res1.data.policy);
  443. request.append("Signature",res1.data.signature);
  444. request.append("key",fileName);
  445. request.append("success_action_status",201);
  446. request.append('file', file);
  447. $.ajax({
  448. url : res1.data.host,
  449. data : request,
  450. processData: false,
  451. cache: false,
  452. contentType: false,
  453. dataType: 'xml',
  454. type : 'post',
  455. xhr: function () {
  456. myXhr = $.ajaxSettings.xhr();
  457. if (myXhr.upload) {
  458. myXhr.upload.addEventListener('progress', function(e){
  459. var curr = e.loaded;
  460. var total = e.total;
  461. var process = parseInt(curr / total * 100);
  462. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传中...'+process+"%");
  463. });
  464. }
  465. return myXhr;
  466. },
  467. success : function(data) {
  468. layer.closeAll();
  469. var res = $(data).find('PostResponse');
  470. if (res) {
  471. var key = res.find('Key').text();
  472. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传成功');
  473. setTimeout(function() {
  474. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('选择上传...');
  475. }, 2000);
  476. var video_url = res1.data.domain + "/" + key;
  477. $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(video_url);
  478. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
  479. var arr = video_url.split("/");
  480. var download = arr[arr.length-1];
  481. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
  482. } else {
  483. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传失败');
  484. setTimeout(function() {
  485. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('选择上传...');
  486. }, 2000);
  487. }
  488. },
  489. error : function(e) {
  490. layer.closeAll();
  491. console.log(e.responseText);
  492. }
  493. });
  494. } else {
  495. layer.closeAll();
  496. showErrorMsg(res1.msg);
  497. }
  498. },
  499. error: function(e) {
  500. layer.closeAll();
  501. showErrorMsg(e.responseText);
  502. }
  503. });
  504. }
  505. //COS
  506. function {$vo.fieldArr}_{$vo.name|default=''}_cos_file(e) {
  507. // 获取文件路径名
  508. var file = $(e)[0].files[0];
  509. // 验证上传格式
  510. var fileName = file.name;
  511. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  512. var ext = judgeExtFile(fileExt);
  513. if (ext == -1) {
  514. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  515. return false;
  516. }
  517. // 验证上传大小
  518. size = parseInt("{$vo.filesize}");
  519. if (file.size > size) {
  520. showErrorMsg('附件大小超过限制,可在附件设置中修改');
  521. return false;
  522. }
  523. // 上传参数
  524. var formData = new FormData();
  525. formData.append('file', file);
  526. formData.append('file_ext', fileExt);
  527. // 执行上传
  528. $.ajax({
  529. type: 'post',
  530. url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
  531. data: formData,
  532. contentType: false,
  533. processData: false,
  534. dataType: 'json',
  535. xhr: function () {
  536. myXhr = $.ajaxSettings.xhr();
  537. if (myXhr.upload) {
  538. myXhr.upload.addEventListener('progress', function(e){
  539. var curr = e.loaded;
  540. var total = e.total;
  541. process = parseInt(curr / total * 100);
  542. if (100 == process) {
  543. process = 99;
  544. layer_loading('上传腾讯云');
  545. }
  546. $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传中...'+process+"%");
  547. });
  548. }
  549. return myXhr;
  550. },
  551. success: function(res) {
  552. layer.closeAll();
  553. if (1 == res.code) {
  554. video_url = res.data.url;
  555. $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(video_url);
  556. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
  557. var arr = video_url.split("/");
  558. var download = arr[arr.length-1];
  559. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
  560. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传成功');
  561. } else {
  562. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").text('上传失败');
  563. }
  564. setTimeout(function() {
  565. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').text('选择上传...');
  566. }, 2000);
  567. },
  568. error: function(e) {
  569. layer.closeAll();
  570. showErrorMsg(e.responseText);
  571. }
  572. });
  573. }
  574. // 本地上传
  575. function {$vo.fieldArr}_{$vo.name|default=''}_local_file(e){
  576. // 获取文件路径名
  577. var file = $(e)[0].files[0];
  578. // 验证上传格式
  579. var fileName = file.name;
  580. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  581. var ext = judgeExtFile(fileExt);
  582. if (ext == -1) {
  583. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  584. return false;
  585. }
  586. // 验证上传大小
  587. size = parseInt("{$vo.filesize}");
  588. if (file.size > size) {
  589. showErrorMsg('附件大小超过限制,可在附件设置中修改');
  590. return false;
  591. }
  592. // 定义上传数据
  593. var formData = new FormData();
  594. formData.append('file', file);
  595. // 执行上传
  596. layer_loading('上传本地');
  597. $.ajax({
  598. type: 'post',
  599. url : "{:url('Ueditor/DownloadUploadFileAjax')}",
  600. data: formData,
  601. contentType: false,
  602. processData: false,
  603. dataType: 'json',
  604. xhr: function () {
  605. myXhr = $.ajaxSettings.xhr();
  606. if (myXhr.upload) {
  607. myXhr.upload.addEventListener('progress', function(e){
  608. var curr = e.loaded;
  609. var total = e.total;
  610. process = parseInt(curr / total * 100);
  611. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").html('上传中...'+process+"%");
  612. });
  613. }
  614. return myXhr;
  615. },
  616. success: function (res) {
  617. layer.closeAll();
  618. if (res.code==0){
  619. layer.msg(res.msg)
  620. setTimeout(function() {
  621. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').html('选择上传...');
  622. }, 2000);
  623. }else {
  624. $("#{$vo.fieldArr}_{$vo.name|default=''}_button").html('上传成功');
  625. setTimeout(function() {
  626. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_button').html('选择上传...');
  627. }, 2000);
  628. $("#{$vo.fieldArr}_{$vo.name|default=''}_eyou_local").val(res.file_url);
  629. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',res.file_url);
  630. var arr = res.file_url.split("/");
  631. var download = arr[arr.length-1];
  632. $("#file_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
  633. }
  634. }
  635. });
  636. }
  637. </script>
  638. <!-- 单个文件 end -->
  639. {/case}
  640. {case value="imgs"}
  641. <!-- 多张图 start -->
  642. <dl class="row" id="dl_{$vo.fieldArr}_{$vo.name|default=''}">
  643. <dt class="tit">
  644. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  645. </dt>
  646. <dd class="opt">
  647. <div class="tab-pane pics" id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
  648. <!-- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="imgupload">
  649. <i class="fa fa-photo"></i>上传图片
  650. </a> -->
  651. <table class="table table-bordered">
  652. <tbody>
  653. <tr>
  654. <td >
  655. <div class="sort-list-{$vo.fieldArr}_{$vo.name|default=''}">
  656. {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
  657. <div class="images_upload images_upload_html" style="display:inline-block;">
  658. <div class="images_upload_box">
  659. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2['image_url']}">
  660. <a href="{$v2['image_url']}" onclick="" class="upimg" target="_blank" title="拖动修改排序">
  661. <img data-original="{$v2['image_url']}">
  662. </a>
  663. <a href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2['image_url']}')" class="delect" title="删除"></a>
  664. </div>
  665. <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" placeholder="图片注释">{$v2.intro}</textarea>
  666. </div>
  667. {/volist}
  668. <div class="images_upload"></div>
  669. </div>
  670. <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="img-upload mb15" title="点击上传">
  671. <div class="y-line"></div>
  672. <div class="x-line"></div>
  673. </a>
  674. </td>
  675. </tr>
  676. </tbody>
  677. </table>
  678. </div>
  679. <!-- 上传图片显示的样板 start -->
  680. <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl none">
  681. <div class="images_upload images_upload_html" style="display:inline-block;">
  682. <div class="images_upload_box">
  683. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
  684. <a href="javascript:void(0);" onClick="" class="upimg" title="拖动修改排序">
  685. <img src="__STATIC__/admin/images/add-button.jpg"/>
  686. </a>
  687. <a href="javascript:void(0)" class="delect" title="删除">&nbsp;&nbsp;</a>
  688. </div>
  689. <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" placeholder="图片注释"></textarea>
  690. </div>
  691. </div>
  692. <!-- 上传图片显示的样板 end -->
  693. </dd>
  694. </dl>
  695. <script type="text/javascript">
  696. // 上传多图回调函数
  697. function {$vo.fieldArr}_{$vo.name|default=''}_call_back(paths){
  698. var last_div = $(".{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl").html();
  699. for (var i=0;i<paths.length ;i++ )
  700. {
  701. if ($(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html").length > 0) {
  702. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").after(last_div); // 插入一个 新图片
  703. } else {
  704. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload:last").before(last_div); // 插入一个 新图片
  705. }
  706. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
  707. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
  708. $(".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('');
  709. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
  710. }
  711. }
  712. /*
  713. * 上传之后删除组图input
  714. * @access public
  715. * @val string 删除的图片input
  716. */
  717. function {$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(obj,path)
  718. {
  719. // 删除数据库记录
  720. $.ajax({
  721. type:'GET',
  722. url:"{:url('Field/del_channelimgs', ['_ajax'=>1])}",
  723. data:{filename:path,channel:"{$channeltype|default='0'}",fieldid:"{$vo.id}",aid:"{$aid|default='0'}"},
  724. success:function(){
  725. $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
  726. $.ajax({
  727. type:'GET',
  728. url:"{:url('Uploadimgnew/delupload', ['_ajax'=>1])}",
  729. data:{action:"del", filename:path},
  730. success:function(){}
  731. });
  732. }
  733. });
  734. }
  735. /** 以下 产品相册的拖动排序相关 js*/
  736. $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).sortable({
  737. start: function( event, ui) {
  738. }
  739. ,stop: function( event, ui ) {
  740. }
  741. });
  742. //因为他们要拖动,所以尽量设置他们的文字不能选择。
  743. // $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).disableSelection();
  744. </script>
  745. <!-- 多张图 end -->
  746. {/case}
  747. {case value="int"}
  748. <!-- 整数类型 start -->
  749. <dl class="row">
  750. <dt class="tit">
  751. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  752. </dt>
  753. <dd class="opt">
  754. <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,''));">&nbsp;{$vo.dfvalue_unit|default=''}
  755. <span class="err"></span>
  756. <p class="notic">{$vo.remark|default=''}</p>
  757. </dd>
  758. </dl>
  759. <!-- 整数类型 end -->
  760. {/case}
  761. {case value="float"}
  762. <!-- 小数类型 start -->
  763. <dl class="row">
  764. <dt class="tit">
  765. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  766. </dt>
  767. <dd class="opt">
  768. <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,''));">&nbsp;{$vo.dfvalue_unit|default=''}
  769. <span class="err"></span>
  770. <p class="notic">{$vo.remark|default=''}</p>
  771. </dd>
  772. </dl>
  773. <!-- 小数类型 end -->
  774. {/case}
  775. {case value="decimal"}
  776. <!-- 金额类型 start -->
  777. <dl class="row">
  778. <dt class="tit">
  779. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  780. </dt>
  781. <dd class="opt">
  782. <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,''));">&nbsp;{$vo.dfvalue_unit|default=''}
  783. <span class="err"></span>
  784. <p class="notic">{$vo.remark|default=''}</p>
  785. </dd>
  786. </dl>
  787. <!-- 金额类型 end -->
  788. {/case}
  789. {case value="datetime"}
  790. <!-- 日期和时间 start -->
  791. <dl class="row">
  792. <dt class="tit">
  793. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  794. </dt>
  795. <dd class="opt">
  796. <input type="text" class="input-txt" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" value="{$vo['dfvalue']}" autocomplete="off">
  797. <span class="add-on input-group-addon">
  798. <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
  799. </span>
  800. <span class="err"></span>
  801. <p class="notic">{$vo.remark|default=''}</p>
  802. </dd>
  803. </dl>
  804. <script type="text/javascript">
  805. layui.use('laydate', function() {
  806. var laydate = layui.laydate;
  807. //常规用法
  808. laydate.render({
  809. elem: "#{$vo.fieldArr}_{$vo.name|default=''}"
  810. ,type: 'datetime'
  811. });
  812. })
  813. </script>
  814. <!-- 日期和时间 end -->
  815. {/case}
  816. {case value="htmltext"}
  817. <!-- HTML文本 start -->
  818. {eq name="$editor.editor_select" value="1"}
  819. <dl class="row">
  820. <dt class="tit">
  821. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  822. </dt>
  823. <dd class="opt">
  824. {if condition="$vo.name=='content'"}
  825. {notempty name="$have_content_ey_m"}
  826. <div class="pcwap-onoff">
  827. <label onclick="contentSwitch(1);" class="cb-enable selected">PC端详情</label>
  828. <label onclick="contentSwitch(2);" class="cb-disable">手机端详情</label>
  829. </div>
  830. {/notempty}
  831. {if condition="isset($vo['first']) AND 1 == $vo['first']"}
  832. <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>&nbsp;<!-- <a href="javascript:void(0);" onclick="editor_handle_210607(1);">[手动]</a>&nbsp; -->
  833. <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>&nbsp;<!-- <a href="javascript:void(0);" onclick="editor_handle_210607(2);">[手动]</a>&nbsp; -->
  834. {if condition="'Arctype' == $controller_name && 'single_edit' == $action_name"}
  835. <label class="curpoin"><input class="check" type="checkbox" name="empty_logic" value="1" {notempty name="$info['empty_logic']"} checked="checked" {/notempty}>提取下级栏目内容</label>&nbsp;<p class="notic">当内容详情没有填写时,前台内容部分将自动调用下级栏目的内容</p>
  836. {/if}
  837. {/if}
  838. <div id="div_hint" style="float: right;display: none;">
  839. <a style="color: #f00;">左侧编辑器如不填写,就自动引用pc端的内容</a>
  840. <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>
  841. </div>
  842. {else /}
  843. {if condition="isset($vo['first']) AND 1 == $vo['first']"}
  844. <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>&nbsp;<!-- <a href="javascript:void(0);" onclick="editor_handle_210607(1);">[手动]</a>&nbsp; -->
  845. <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>&nbsp;<!-- <a href="javascript:void(0);" onclick="editor_handle_210607(2);">[手动]</a>&nbsp; -->
  846. {/if}
  847. {/if}
  848. <div style="clear: both;"></div>
  849. {if condition="$vo.name=='content' || $vo.name=='content_ey_m'"}
  850. <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>
  851. <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>
  852. {notempty name="$have_content_ey_m"}
  853. <div id="content_ey_m_div" {if condition="$vo.name=='content'"}style="display: none"{/if}>
  854. <p id="content_ey_m_all_tit">
  855. <i class="iconfont e-left" style="float: left;font-size: 18px;"></i>正文预览 <i class="iconfont e-xiaochengxu1" style="float: right;font-size: 24px;"></i>
  856. </p>
  857. <div id="content_ey_m_all_div">
  858. <div id="phone_title_div" {if condition="!empty($nid) and $nid == 'single'"}style="display:none"{/if}>这里是标题</div>
  859. <div id="phone_time_div" {if condition="!empty($nid) and $nid == 'single'"}style="display:none"{/if}>2022-03-31</div>
  860. <div id="phone_preview_div"></div>
  861. </div>
  862. </div>
  863. {/notempty}
  864. {else /}
  865. <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>
  866. <span class="err"></span>
  867. <p class="notic">{$vo.remark|default=''}</p>
  868. {/if}
  869. </dd>
  870. </dl>
  871. <style>
  872. #addonFieldExt_content_ey_m{
  873. max-width: 58%;
  874. width: 100%;
  875. float: left;
  876. margin-right: 2%;
  877. display: block;
  878. }
  879. #content_ey_m_div{
  880. float: right;
  881. width: 39%;
  882. max-width: 470px;
  883. display: block;
  884. border: solid 1px #eee;
  885. zoom: 1;
  886. -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
  887. -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
  888. box-shadow: 0 1px 4px rgb(0 0 0 / 10%);
  889. }
  890. #content_ey_m_all_tit{
  891. padding: 10px 10px;
  892. text-align: center;
  893. font-size: 17px;
  894. color: #444;
  895. font-weight: 500;
  896. border-bottom: solid 1px #eee;
  897. }
  898. #content_ey_m_all_div{
  899. width: 100%;
  900. height: 491px;
  901. overflow: auto;
  902. box-sizing: border-box;
  903. }
  904. #phone_title_div{
  905. font-size: 20px;
  906. font-weight: bold;
  907. padding: 5px 10px;
  908. margin-top: 10px;
  909. color: #444;
  910. }
  911. #phone_time_div{
  912. padding: 0 10px;
  913. margin-bottom: 5px;
  914. }
  915. #phone_preview_div{
  916. padding: 10px;
  917. width: 100%;
  918. /*height: 491px;*/
  919. /*overflow: auto;*/
  920. /*border: solid 1px #eee;*/
  921. box-sizing: border-box;
  922. }
  923. #phone_preview_div img {
  924. -ms-interpolation-mode: bicubic;
  925. }
  926. #phone_preview_div img {
  927. max-width: 100%;
  928. }
  929. #phone_preview_div video{
  930. max-width: 100%;
  931. }
  932. </style>
  933. <script type="text/javascript">
  934. function contentSwitch(id) {
  935. if (id == 1){
  936. $("#addonFieldExt_content").show();
  937. $("#addonFieldExt_content_ey_m").hide();
  938. $("#content_ey_m_div").hide();
  939. $("#div_hint").hide();
  940. }else{
  941. $("#addonFieldExt_content_ey_m").show();
  942. $("#content_ey_m_div").show();
  943. $("#addonFieldExt_content").hide();
  944. $("#div_hint").show();
  945. }
  946. }
  947. $(function(){
  948. //自定义radio样式
  949. $(".cb-enable").on('click', function(){
  950. var parent = $(this).parents('.pcwap-onoff');
  951. $('.cb-disable',parent).removeClass('selected');
  952. $(this).addClass('selected');
  953. $('.checkbox',parent).attr('checked', true);
  954. });
  955. $(".cb-disable").on('click', function(){
  956. var parent = $(this).parents('.pcwap-onoff');
  957. $('.cb-enable',parent).removeClass('selected');
  958. $(this).addClass('selected');
  959. $('.checkbox',parent).attr('checked', false);
  960. });
  961. });
  962. </script>
  963. <?php
  964. //var_dump($vo);
  965. //存在多个编辑器的时候 只能加载 收个 不然js会报错
  966. ?>
  967. {if condition="isset($vo['first']) AND 1 == $vo['first']"}
  968. <script type="text/javascript">
  969. // 打开多图选择及上传界面
  970. function OpenImagesList(e, obj) {
  971. var func = '';
  972. if (e.path && e.path[10] && e.path[10].id && undefined != e.path[10].id) {
  973. func = e.path[10].id;
  974. } else {
  975. func = $(obj).parent().parent().parent().parent().parent().parent().parent().parent().parent().attr('id');
  976. }
  977. if (func.indexOf('addonFieldExt_') == -1) {
  978. func = 'addonFieldExt_content';
  979. }
  980. var OpenUrl = "{:url('Uploadimgnew/upload', ['num'=>30, 'path'=>'allimg', 'is_water'=>1])}";
  981. OpenUrl += "&func=images_call_" + func;
  982. top.layer.open({
  983. type: 2,
  984. title: '图片上传',
  985. shade: layer_shade,
  986. maxmin: false,
  987. shadeClose: false,
  988. area: ['1000px', '625px'],
  989. content: OpenUrl
  990. });
  991. }
  992. </script>
  993. {/if}
  994. <script type="text/javascript">
  995. var ue_{$vo.fieldArr}_{$vo.name|default=''} = UE.getEditor('{$vo.fieldArr}_{$vo.name|default=''}',{
  996. serverUrl :"{:url('Ueditor/index',array('savepath'=>'allimg'))}",
  997. zIndex: 999,
  998. initialFrameWidth: "100%", //初化宽度
  999. initialFrameHeight: 450, //初化高度
  1000. focus: false, //初始化时,是否让编辑器获得焦点true或false
  1001. maximumWords: 99999,
  1002. removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
  1003. pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  1004. autoHeightEnabled: false,
  1005. toolbars: ueditor_toolbars
  1006. });
  1007. //必须在提交前渲染编辑器;
  1008. function {$vo.fieldArr}_{$vo.name|default=''}() {
  1009. //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
  1010. if(UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").queryCommandState('source') != 0) {
  1011. UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('source'); //切换到【设计】视图
  1012. }
  1013. }
  1014. // 加载图片到编辑器指定位置
  1015. function images_call_{$vo.fieldArr}_{$vo.name|default=''}(fileurl_tmp,filename_tmp) {
  1016. var addBody = '';
  1017. $.each(fileurl_tmp, function(index, items) {
  1018. addBody += '<p><img src="'+items+'" alt="'+filename_tmp[index]+'"></p>';
  1019. });
  1020. UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('inserthtml', addBody);
  1021. }
  1022. // 自动远程图片本地化/自动清除非本站链接
  1023. function ajax_auto_editor_{$vo.fieldArr}_{$vo.name|default=''}(local,link) {
  1024. var body = UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").getContent();
  1025. $.ajax({
  1026. type: 'POST',
  1027. url: "{:url('Archives/ajax_auto_editor')}",
  1028. data: {local:local,link:link,body:body,_ajax:1},
  1029. dataType: "JSON",
  1030. async:false,
  1031. success: function(res){
  1032. if (res.code == 1) {
  1033. UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").setContent(res.data.body);
  1034. }
  1035. }
  1036. });
  1037. }
  1038. </script>
  1039. {if condition="$vo.name=='content' || $vo.name=='content_ey_m'"}
  1040. <script type="text/javascript">
  1041. //编辑器发生变动执行方法
  1042. function get_ue_content_ey_m_1645596891(){
  1043. try{
  1044. var content_ey_m_text = UE.getEditor("addonFieldExt_content_ey_m").getContent();
  1045. }catch (e){
  1046. var content_ey_m_text = '';
  1047. }
  1048. if (content_ey_m_text === '' || content_ey_m_text === undefined){ //手机端为空时候,pc端编辑器信息给正文预览
  1049. content_ey_m_text = UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").getContent();
  1050. }
  1051. $('#phone_preview_div').html(content_ey_m_text);
  1052. }
  1053. var ue_addonFieldExt_content_ey_m = UE.getEditor('addonFieldExt_content_ey_m',{
  1054. serverUrl :"{:url('Ueditor/index',array('savepath'=>'allimg'))}",
  1055. zIndex: 999,
  1056. initialFrameWidth: "100%", //初化宽度
  1057. initialFrameHeight: 478, //初化高度
  1058. focus: false, //初始化时,是否让编辑器获得焦点true或false
  1059. maximumWords: 99999,
  1060. removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
  1061. pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  1062. autoHeightEnabled: false,
  1063. toolbars: ueditor_toolbars_ey_m
  1064. });
  1065. //必须在提交前渲染编辑器;
  1066. function addonFieldExt_content_ey_m() {
  1067. //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
  1068. if(UE.getEditor("addonFieldExt_content_ey_m").queryCommandState('source') != 0) {
  1069. UE.getEditor("addonFieldExt_content_ey_m").execCommand('source'); //切换到【设计】视图
  1070. }
  1071. }
  1072. // 加载图片到编辑器指定位置
  1073. function images_call_addonFieldExt_content_ey_m(fileurl_tmp,filename_tmp) {
  1074. var addBody = '';
  1075. $.each(fileurl_tmp, function(index, items) {
  1076. addBody += '<p><img src="'+items+'" alt="'+filename_tmp[index]+'"></p>';
  1077. });
  1078. UE.getEditor("addonFieldExt_content_ey_m").execCommand('inserthtml', addBody);
  1079. }
  1080. // 自动远程图片本地化/自动清除非本站链接
  1081. function ajax_auto_editor_addonFieldExt_content_ey_m(local,link) {
  1082. var body = UE.getEditor("addonFieldExt_content_ey_m").getContent();
  1083. $.ajax({
  1084. type: 'POST',
  1085. url: "{:url('Archives/ajax_auto_editor')}",
  1086. data: {local:local,link:link,body:body,_ajax:1},
  1087. dataType: "JSON",
  1088. async:false,
  1089. success: function(res){
  1090. if (res.code == 1) {
  1091. UE.getEditor("addonFieldExt_content_ey_m").setContent(res.data.body);
  1092. }
  1093. }
  1094. });
  1095. }
  1096. var myDate = new Date();
  1097. var myYear = myDate.getFullYear(); //获取完整的年份
  1098. var myMonth = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  1099. var myToday = myDate.getDate(); //
  1100. $('#phone_time_div').html(myYear+'-'+ myMonth+'-'+ myToday);
  1101. function get_ue_phone_title_1645596891(){
  1102. if ($("input[name='title']").length > 0){
  1103. var phone_title = $("input[name='title']")[0].value;
  1104. $('#phone_title_div').text(phone_title);
  1105. }
  1106. }
  1107. phone_title_1645596891 = window.setInterval(function(){ get_ue_phone_title_1645596891(); }, 500);
  1108. </script>
  1109. {/if}
  1110. {else/}
  1111. <dl class="row">
  1112. <dt class="tit">
  1113. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  1114. </dt>
  1115. <dd class="opt">
  1116. {if condition="isset($vo['first']) AND 1 == $vo['first']"}
  1117. <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>&nbsp;<!-- <a href="javascript:void(0);" onclick="editor_handle_210607(1);">[手动]</a>&nbsp; -->
  1118. <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>&nbsp;<!-- <a href="javascript:void(0);" onclick="editor_handle_210607(2);">[手动]</a>&nbsp; -->
  1119. {/if}
  1120. <textarea id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]">{$vo.dfvalue|default=''}</textarea>
  1121. <span class="err"></span>
  1122. <p class="notic">{$vo.remark|default=''}</p>
  1123. </dd>
  1124. </dl>
  1125. <script type="text/javascript">
  1126. // 加载编辑器,若存在编辑器则先进行销毁
  1127. try {
  1128. var elemtid = "{$vo.fieldArr}_{$vo.name|default=''}";
  1129. var editor = CKEDITOR.instances[elemtid];
  1130. if (editor) editor.destroy(true);
  1131. } catch(e) {}
  1132. CKEDITOR.replace(elemtid, {
  1133. filebrowserBrowseUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
  1134. filebrowserImageBrowseUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
  1135. filebrowserUploadUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
  1136. filebrowserImageUploadUrl: "{:url('Ueditor/index', ['savepath'=>'allimg', 'action'=>'uploadimage'])}",
  1137. });
  1138. // 自动远程图片本地化/自动清除非本站链接
  1139. function ajax_auto_editor_{$vo.fieldArr}_{$vo.name|default=''}(local,link) {
  1140. var body = CKEDITOR.instances.{$vo.fieldArr}_{$vo.name|default=''}.getData();
  1141. $.ajax({
  1142. type: 'POST',
  1143. url: "{:url('Archives/ajax_auto_editor')}",
  1144. data: {local:local,link:link,body:body,_ajax:1},
  1145. dataType: "JSON",
  1146. async:false,
  1147. success: function(res){
  1148. if (res.code == 1) {
  1149. CKEDITOR.instances.{$vo.fieldArr}_{$vo.name|default=''}.setData(res.data.body);
  1150. }
  1151. }
  1152. });
  1153. }
  1154. </script>
  1155. {if condition="$vo.name=='content' || $vo.name=='content_ey_m'"}
  1156. <script type="text/javascript">
  1157. // 自动远程图片本地化/自动清除非本站链接
  1158. function ajax_auto_editor_addonFieldExt_content_ey_m(local,link) {
  1159. }
  1160. </script>
  1161. {/if}
  1162. {/eq}
  1163. <!-- HTML文本 end -->
  1164. {/case}
  1165. <!-- 多媒体类型 start -->
  1166. {case value="media"}
  1167. <dl class="row">
  1168. <dt class="tit">
  1169. <label>{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}</label>
  1170. </dt>
  1171. <dd class="opt">
  1172. <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;" >
  1173. <input type="file" id="{$vo.fieldArr}_{$vo.name|default=''}_upload_media" onchange="{$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210408(this)" style="display: none;">
  1174. {if condition="'qny' == $vo.upload_flag"}
  1175. <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>
  1176. {elseif condition="'oss' == $vo.upload_flag"}
  1177. <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>
  1178. {elseif condition="'cos' == $vo.upload_flag"}
  1179. <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>
  1180. {else}
  1181. <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>
  1182. {/if}
  1183. <span class="err"></span>
  1184. <p class="notic">{$vo.remark|default=''}</p>
  1185. </dd>
  1186. </dl>
  1187. <script>
  1188. // 上传媒体文件
  1189. function {$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210408(e){
  1190. var data_type = $(e).attr('data-type');
  1191. if ('qny' == data_type) {
  1192. // 七牛云上传
  1193. {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e);
  1194. } else if ('oss' == data_type) {
  1195. // OSS上传
  1196. {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e);
  1197. } else if ('cos' == data_type) {
  1198. // COS上传
  1199. {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e);
  1200. } else {
  1201. // 本地上传
  1202. {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e);
  1203. }
  1204. }
  1205. function judgeExtMedia(ext) {
  1206. var type = '{$vo.ext}';
  1207. var extArr = [];
  1208. extArr = type.split("|");
  1209. var exts = ext.replace(".","");
  1210. return extArr.indexOf(exts);
  1211. }
  1212. // 七牛云
  1213. function {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e) {
  1214. // 获取文件路径名
  1215. var file = $(e)[0].files[0];
  1216. // 验证上传格式
  1217. var fileName = file.name;
  1218. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1219. var ext = judgeExtMedia(fileExt);
  1220. if (ext == -1) {
  1221. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  1222. return false;
  1223. }
  1224. // 验证上传大小
  1225. size = parseInt("{$vo.filesize}");
  1226. if (file.size > size) {
  1227. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1228. return false;
  1229. }
  1230. // 执行上传
  1231. layer_loading('上传七牛云');
  1232. $.ajax({
  1233. type: 'POST',
  1234. url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
  1235. data: {_ajax: 1},
  1236. dataType: "JSON",
  1237. success: function(res1) {
  1238. if (1 == res1.code) {
  1239. var token = res1.data.token;
  1240. var formData = new FormData();
  1241. formData.append('file', file);
  1242. formData.append('token', token);
  1243. fileName = res1.data.filePath + fileExt;
  1244. formData.append('key', fileName);
  1245. $.ajax({
  1246. url: res1.data.uphost,
  1247. type: 'POST',
  1248. dataType: 'JSON',
  1249. data: formData,
  1250. timeout: 1200000,
  1251. cache: false,
  1252. processData: false,
  1253. contentType: false,
  1254. xhr: function () {
  1255. myXhr = $.ajaxSettings.xhr();
  1256. if (myXhr.upload) {
  1257. myXhr.upload.addEventListener('progress', function(e){
  1258. var curr = e.loaded;
  1259. var total = e.total;
  1260. process = parseInt(curr / total * 100);
  1261. $("#{$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media").text('上传中...'+process+"%");
  1262. });
  1263. }
  1264. return myXhr;
  1265. },
  1266. success: function(res2) {
  1267. layer.closeAll();
  1268. $("#{$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media").text('上传成功');
  1269. setTimeout(function() {
  1270. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_qny_upload_media').text('七牛云上传');
  1271. }, 2000);
  1272. var video_url = res1.data.domain + "/" + res2.key;
  1273. $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(video_url);
  1274. },
  1275. error: function(e) {
  1276. layer.closeAll();
  1277. showErrorMsg(e.responseText);
  1278. return false;
  1279. }
  1280. });
  1281. } else {
  1282. layer.closeAll();
  1283. showErrorMsg(res1.msg);
  1284. }
  1285. },
  1286. error: function(e) {
  1287. layer.closeAll();
  1288. showErrorMsg(e.responseText);
  1289. }
  1290. });
  1291. }
  1292. //OSS
  1293. function {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e) {
  1294. // 获取文件路径名
  1295. var file = $(e)[0].files[0];
  1296. // 验证上传格式
  1297. var fileName = file.name;
  1298. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1299. var ext = judgeExtMedia(fileExt);
  1300. if (ext == -1) {
  1301. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  1302. return false;
  1303. }
  1304. // 验证上传大小
  1305. size = parseInt("{$vo.filesize}");
  1306. if (file.size > size) {
  1307. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1308. return false;
  1309. }
  1310. // 执行上传
  1311. layer_loading('上传阿里云OSS');
  1312. $.ajax({
  1313. type: 'POST',
  1314. url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
  1315. data: {_ajax: 1},
  1316. dataType: "JSON",
  1317. success: function(res1){
  1318. if (1 == res1.code){
  1319. fileName = res1.data.filePath + fileExt;
  1320. //组装发送数据
  1321. var request = new FormData();
  1322. request.append("OSSAccessKeyId",res1.data.accessid);
  1323. request.append("policy",res1.data.policy);
  1324. request.append("Signature",res1.data.signature);
  1325. request.append("key",fileName);
  1326. request.append("success_action_status",201);
  1327. request.append('file', file);
  1328. $.ajax({
  1329. url : res1.data.host,
  1330. data : request,
  1331. processData: false,
  1332. cache: false,
  1333. contentType: false,
  1334. dataType: 'xml',
  1335. type : 'post',
  1336. xhr: function () {
  1337. myXhr = $.ajaxSettings.xhr();
  1338. if (myXhr.upload) {
  1339. myXhr.upload.addEventListener('progress', function(e){
  1340. var curr = e.loaded;
  1341. var total = e.total;
  1342. var process = parseInt(curr / total * 100);
  1343. $("#{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media").text('上传中...'+process+"%");
  1344. });
  1345. }
  1346. return myXhr;
  1347. },
  1348. success : function(data) {
  1349. layer.closeAll();
  1350. var res = $(data).find('PostResponse');
  1351. if (res) {
  1352. var key = res.find('Key').text();
  1353. $("#{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media").text('上传成功');
  1354. setTimeout(function() {
  1355. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_oss_upload_media').text('oss上传');
  1356. }, 2000);
  1357. var video_url = res1.data.domain + "/" + key;
  1358. $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(video_url);
  1359. } else {
  1360. $("#{$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media").text('上传失败');
  1361. setTimeout(function() {
  1362. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_oss_upload_media').text('oss上传');
  1363. }, 2000);
  1364. }
  1365. },
  1366. error : function(e) {
  1367. layer.closeAll();
  1368. console.log(e.responseText);
  1369. }
  1370. });
  1371. } else {
  1372. layer.closeAll();
  1373. showErrorMsg(res1.msg);
  1374. }
  1375. },
  1376. error: function(e) {
  1377. layer.closeAll();
  1378. showErrorMsg(e.responseText);
  1379. }
  1380. });
  1381. }
  1382. //COS
  1383. function {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e) {
  1384. // 获取文件路径名
  1385. var file = $(e)[0].files[0];
  1386. // 验证上传格式
  1387. var fileName = file.name;
  1388. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1389. var ext = judgeExtMedia(fileExt);
  1390. if (ext == -1) {
  1391. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  1392. return false;
  1393. }
  1394. // 验证上传大小
  1395. size = parseInt("{$vo.filesize}");
  1396. if (file.size > size) {
  1397. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1398. return false;
  1399. }
  1400. // 上传参数
  1401. var formData = new FormData();
  1402. formData.append('file', file);
  1403. formData.append('file_ext', fileExt);
  1404. // 执行上传
  1405. $.ajax({
  1406. type: 'post',
  1407. url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
  1408. data: formData,
  1409. contentType: false,
  1410. processData: false,
  1411. dataType: 'json',
  1412. xhr: function () {
  1413. myXhr = $.ajaxSettings.xhr();
  1414. if (myXhr.upload) {
  1415. myXhr.upload.addEventListener('progress', function(e){
  1416. var curr = e.loaded;
  1417. var total = e.total;
  1418. process = parseInt(curr / total * 100);
  1419. if (100 == process) {
  1420. process = 99;
  1421. layer_loading('上传腾讯云');
  1422. }
  1423. $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传中...'+process+"%");
  1424. });
  1425. }
  1426. return myXhr;
  1427. },
  1428. success: function(res) {
  1429. layer.closeAll();
  1430. if (1 == res.code) {
  1431. $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传成功');
  1432. $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(res.data.url);
  1433. } else {
  1434. $("#{$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media").text('上传失败');
  1435. }
  1436. setTimeout(function() {
  1437. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_cos_upload_media').text('cos上传');
  1438. }, 2000);
  1439. },
  1440. error: function(e) {
  1441. layer.closeAll();
  1442. showErrorMsg(e.responseText);
  1443. }
  1444. });
  1445. }
  1446. // 本地上传
  1447. function {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e){
  1448. // 获取文件路径名
  1449. var file = $(e)[0].files[0];
  1450. // 验证上传格式
  1451. var fileName = file.name;
  1452. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1453. var ext = judgeExtMedia(fileExt);
  1454. if (ext == -1) {
  1455. showErrorMsg('仅支持{$vo.ext}格式,可在附件设置中修改');
  1456. return false;
  1457. }
  1458. // 验证上传大小
  1459. size = parseInt("{$vo.filesize}");
  1460. if (file.size > size) {
  1461. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1462. return false;
  1463. }
  1464. // 定义上传数据
  1465. var formData = new FormData();
  1466. formData.append('file', file);
  1467. // 执行上传
  1468. layer_loading('上传本地');
  1469. $.ajax({
  1470. type: 'post',
  1471. url : "{:url('Ueditor/upVideo', ['savepath'=>'media'])}",
  1472. data: formData,
  1473. contentType: false,
  1474. processData: false,
  1475. dataType: 'json',
  1476. xhr: function () {
  1477. myXhr = $.ajaxSettings.xhr();
  1478. if (myXhr.upload) {
  1479. myXhr.upload.addEventListener('progress', function(e){
  1480. var curr = e.loaded;
  1481. var total = e.total;
  1482. process = parseInt(curr / total * 100);
  1483. $("#upload_video_litpic_local").html('上传中...'+process+"%");
  1484. });
  1485. }
  1486. return myXhr;
  1487. },
  1488. success: function (res) {
  1489. layer.closeAll();
  1490. if ("SUCCESS" == res.state) {
  1491. $("#{$vo.fieldArr}_{$vo.name|default=''}_local_upload_media").html('上传成功');
  1492. setTimeout(function() {
  1493. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_local_upload_media').html('本地上传');
  1494. }, 2000);
  1495. $("#{$vo.fieldArr}_{$vo.name|default=''}_media_url").val(res.url);
  1496. } else {
  1497. showErrorMsg(res.msg);
  1498. }
  1499. }
  1500. });
  1501. }
  1502. </script>
  1503. {/case}
  1504. <!-- 多媒体类型 end -->
  1505. {/switch}
  1506. {/if}
  1507. {/volist}
  1508. <script type="text/javascript">
  1509. var notic_tips_230112 = 0;
  1510. $(function(){
  1511. try {
  1512. $("img").lazyload({
  1513. effect: "fadeIn",
  1514. placeholder : "__PUBLIC__/static/common/images/loading.gif",
  1515. threshold: 200
  1516. });
  1517. }catch(e){}
  1518. auto_notic_tips();
  1519. /**
  1520. * 自动小提示
  1521. */
  1522. function auto_notic_tips()
  1523. {
  1524. 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>';
  1525. $.each($('dd.opt > p.notic'), function(index, item){
  1526. var a_length = $(item).prev("a.ui_tips").length;
  1527. if ($(item).html() != '' && 0 == a_length) {
  1528. $(item).before(html);
  1529. notic_tips_230112 = 1;
  1530. }
  1531. });
  1532. }
  1533. // 第一个自定义字段显示感汉号提示
  1534. if (0 == notic_tips_230112) {
  1535. 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>';
  1536. $($('#FieldAddonextitem').find('dl > dd').find('p.notic').get(0)).parent().append(ganhaohtml);
  1537. }
  1538. });
  1539. </script>