Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

users_release_field.htm 54KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. <script>
  2. // 获取联动地址
  3. function GetFieldRegionData_1671086814(t,type){
  4. var name = $(t).attr('data-name');
  5. var parent_id = parseInt($(t).val());
  6. if(!parent_id || 0 >= parent_id){
  7. if ('province' == type) {
  8. $('#city_'+name).hide();
  9. $('#area_'+name).hide();
  10. }else if ('city' == type){
  11. $('#area_'+name).hide();
  12. }
  13. return false;
  14. }
  15. var url = "{:url('home/Ajax/ajax_get_region_data')}";
  16. $.ajax({
  17. url: url,
  18. data: {parent_id:parent_id,_ajax:1},
  19. type:'post',
  20. dataType:'json',
  21. success:function(res){
  22. if (res.region_html) {
  23. // 输出下一级栏目选项
  24. if ('province' == type) {
  25. res = '<option value="-1">请选择</option>'+ res.region_html;
  26. $('#city_'+name).empty().html(res);
  27. $('#city_'+name).show();
  28. $('#area_'+name).hide();
  29. $('#area_'+name).empty();
  30. }else if ('city' == type){
  31. res = '<option value="-1">请选择</option>'+ res.region_html;
  32. $('#area_'+name).empty().html(res);
  33. $('#area_'+name).show();
  34. }
  35. }
  36. },
  37. error : function(e) {
  38. layer.closeAll();
  39. layer.alert(e.responseText, {icon: 5});
  40. }
  41. });
  42. }
  43. </script>
  44. {volist name="$addonFieldExtList" id="vo"}
  45. {if !isset($vo.ifeditable) || $vo.ifeditable}
  46. {switch name="vo.dtype"}
  47. {case value="hidden"}
  48. <!-- 隐藏域 start -->
  49. <div class="item-from-row" style="display: none;">
  50. <div class="from-row-l">
  51. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}:
  52. </div>
  53. <div class="from-row-r">
  54. <input type="hidden" class="el-input__inner w500" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
  55. <span class="err"></span>
  56. <p class="notic">{$vo.remark|default=''}</p>
  57. </div>
  58. </div>
  59. <!-- 隐藏域 start -->
  60. {/case}
  61. {case value="region"}
  62. {empty name="$vo.set_type"}
  63. <!-- 区域选项 单个区域 start -->
  64. <div class="item-from-row">
  65. <div class="from-row-l">
  66. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  67. </div>
  68. <div class="from-row-r">
  69. {volist name="$vo.dfvalue" id="v2"}
  70. <label class="radio-label">
  71. <span>{$v2['name']}</span>
  72. <input type="radio" class="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}>
  73. <span class="check-mark"></span>
  74. </label>
  75. {/volist}
  76. <span class="err"></span>
  77. <p class="notic">{$vo.remark|default=''}</p>
  78. </div>
  79. </div>
  80. <!-- 区域选项 end -->
  81. {else /}
  82. <!-- 区域选项 三级联动 start -->
  83. <div class="item-from-row">
  84. <div class="from-row-l">
  85. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  86. </div>
  87. <div class="from-row-r">
  88. <!--一级-->
  89. <select class="el-input_select_inner w200" name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="province_{$vo.fieldArr}_{$vo.name|default=''}" data-name="{$vo.fieldArr}_{$vo.name|default=''}" onchange="GetFieldRegionData_1671086814(this,'province');" {if condition="!empty($vo.region_level) && $vo.region_level > 1"}disabled{/if}>
  90. <option value="-1">请选择</option>
  91. <option {if condition="isset($vo['trueValue'][0]) && ($vo['trueValue'][0] === 0 || $vo['trueValue'][0] ==='0')"} selected {/if} value="0">全国</option>
  92. {volist name="$vo.dfvalue" id="v_p"}
  93. <option {if condition="isset($vo['trueValue'][0]) && $vo['trueValue'][0] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
  94. {/volist}
  95. </select>
  96. <!--二级-->
  97. <select class="el-input_select_inner w200" name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="city_{$vo.fieldArr}_{$vo.name|default=''}" data-name="{$vo.fieldArr}_{$vo.name|default=''}" onchange="GetFieldRegionData_1671086814(this,'city');" {empty name="$vo['city_list']"}style="display: none;"{/empty} {if condition="!empty($vo.region_level) && $vo.region_level > 2"}disabled{/if}>
  98. {notempty name="$vo.city_list"}
  99. {volist name="$vo.city_list" id="v_p"}
  100. <option {if condition="$vo['trueValue'][1] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
  101. {/volist}
  102. {/notempty}
  103. </select>
  104. <!--三级-->
  105. <select class="el-input_select_inner w200" name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="area_{$vo.fieldArr}_{$vo.name|default=''}" {empty name="$vo['trueValue'][2]"}style="display: none;"{/empty}>
  106. {notempty name="$vo.area_list"}
  107. {volist name="$vo.area_list" id="v_p"}
  108. <option {if condition="$vo['trueValue'][2] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
  109. {/volist}
  110. {/notempty}
  111. </select>
  112. <span class="err"></span>
  113. <p class="notic">{$vo.remark|default=''}</p>
  114. </div>
  115. </div>
  116. <!-- 区域选项 end -->
  117. {/empty}
  118. {/case}
  119. {case value="text"}
  120. <!-- 单行文本框 start -->
  121. <div class="item-from-row">
  122. <div class="from-row-l">
  123. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  124. </div>
  125. <div class="from-row-r">
  126. <input type="text" class="el-input__inner w500 fs16" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">&nbsp;{$vo.dfvalue_unit|default=''}
  127. <span class="err"></span>
  128. <p class="notic">{$vo.remark|default=''}</p>
  129. </div>
  130. </div>
  131. <!-- 单行文本框 end -->
  132. {/case}
  133. {case value="multitext"}
  134. <!-- 多行1文本框 start -->
  135. <div class="item-from-row">
  136. <div class="from-row-l">
  137. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  138. </div>
  139. <div class="from-row-r">
  140. <textarea rows="5" cols="60" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" class="fs16" style="height:60px;">{$vo.dfvalue|default=''}</textarea>
  141. <span class="err"></span>
  142. <p class="notic">{$vo.remark|default=''}</p>
  143. </div>
  144. </div>
  145. <!-- 多行文本框 end -->
  146. {/case}
  147. {case value="checkbox"}
  148. <!-- 复选框 start -->
  149. <div class="item-from-row">
  150. <div class="from-row-l">
  151. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  152. </div>
  153. <div class="from-row-r">
  154. {volist name="$vo.dfvalue" id="v2"}
  155. <label class="checkbox-label">
  156. <span>{$v2}</span>
  157. <input type="checkbox" class="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();">
  158. <span class="check-mark"></span>
  159. </label>&nbsp;
  160. {/volist}
  161. <input type="hidden" name="{$vo.fieldArr}[{$vo.name}_eyempty]" value="{if condition="!empty($vo['trueValue'])"}1{else /}0{/if}">
  162. <span class="err"></span>
  163. <p class="notic">{$vo.remark|default=''}</p>
  164. </div>
  165. </div>
  166. <script type="text/javascript">
  167. function func_{$vo.name}_eyempty()
  168. {
  169. var len = $("input[name='{$vo.fieldArr}[{$vo.name}][]']:checked").length;
  170. $("input[name='{$vo.fieldArr}[{$vo.name}_eyempty]']").val(len);
  171. }
  172. </script>
  173. <!-- 复选框 end -->
  174. {/case}
  175. {case value="radio"}
  176. <!-- 单选项 start -->
  177. <div class="item-from-row">
  178. <div class="from-row-l">
  179. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  180. </div>
  181. <div class="from-row-r">
  182. {volist name="$vo.dfvalue" id="v2"}
  183. <label class="radio-label">
  184. <span>{$v2}</span>
  185. <input type="radio" class="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}>
  186. <span class="check-mark"></span>
  187. </label>&nbsp;
  188. {/volist}
  189. <span class="err"></span>
  190. <p class="notic">{$vo.remark|default=''}</p>
  191. </div>
  192. </div>
  193. <!-- 单选项 end -->
  194. {/case}
  195. {case value="switch"}
  196. <!-- 开关 start -->
  197. <div class="item-from-row">
  198. <div class="from-row-l">
  199. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  200. </div>
  201. <div class="from-row-r">
  202. <div class="on-off">
  203. <label for="{$vo.fieldArr}_{$vo.name|default=''}1" class="cb-enable {if condition="0 != $vo['dfvalue']"}selected{/if}">是</label>
  204. <label for="{$vo.fieldArr}_{$vo.name|default=''}0" class="cb-disable {if condition="0 == $vo['dfvalue']"}selected{/if}">否</label>
  205. <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}>
  206. <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}>
  207. </div>
  208. <span class="err"></span>
  209. <p class="notic">{$vo.remark|default=''}</p>
  210. </div>
  211. </div>
  212. <script type="text/javascript">
  213. $(function(){
  214. //自定义radio样式
  215. $(".cb-enable").on('click', function(){
  216. var parent = $(this).parents('.on-off');
  217. $('.cb-disable',parent).removeClass('selected');
  218. $(this).addClass('selected');
  219. $('.checkbox',parent).attr('checked', true);
  220. });
  221. $(".cb-disable").on('click', function(){
  222. var parent = $(this).parents('.on-off');
  223. $('.cb-enable',parent).removeClass('selected');
  224. $(this).addClass('selected');
  225. $('.checkbox',parent).attr('checked', false);
  226. });
  227. });
  228. </script>
  229. <!-- 开关 end -->
  230. {/case}
  231. {case value="select"}
  232. <!-- 下拉框 start -->
  233. <div class="item-from-row">
  234. <div class="from-row-l">
  235. {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
  236. </div>
  237. <div class="from-row-r">
  238. <div class="w300 select">
  239. <select name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}">
  240. {volist name="$vo.dfvalue" id="v2"}
  241. <option value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}selected{/if}>{$v2}</option>
  242. {/volist}
  243. </select>
  244. </div>
  245. <span class="err"></span>
  246. <p class="notic">{$vo.remark|default=''}</p>
  247. </div>
  248. </div>
  249. <!-- 下拉框 end -->
  250. {/case}
  251. {case value="img"}
  252. <style type="text/css">
  253. .input-file-show{
  254. position: relative;
  255. width: 120px;
  256. height: 120px;
  257. overflow: hidden;
  258. }
  259. .input-file-show img {
  260. position: absolute;
  261. width: 120px;
  262. height: 120px;
  263. }
  264. .input-file-show span {
  265. position: absolute;
  266. bottom: 0;
  267. width: 120px;
  268. height: 26px;
  269. line-height: 26px;
  270. text-align: center;
  271. background-color: rgba(0,0,0,0.6);
  272. color: #fff;
  273. z-index: 2;
  274. }
  275. </style>
  276. <div class="item-from-row">
  277. <div class="from-row-l">
  278. {$vo.title}:
  279. </div>
  280. <div class="from-row-r">
  281. <a href="javascript:void(0);" onclick="$('#singlePicFile_{$vo.id|default=0}').trigger('click');" class="img-upload">
  282. <div class="y-line" id="singlePicYline_{$vo.id|default=0}" {notempty name='$vo.dfvalue'} style="display: none;" {/notempty}></div>
  283. <div class="x-line" id="singlePicXline_{$vo.id|default=0}" {notempty name='$vo.dfvalue'} style="display: none;" {/notempty}></div>
  284. <img src="{$vo.dfvalue|default=''}" id="singlePicImgSrc_{$vo.id|default=0}" >
  285. </a>
  286. </div>
  287. <input type="file" id="singlePicFile_{$vo.id|default=0}" data-id="{$vo.id|default=0}" onchange="uploadSinglePicFile(this);" style="display: none;">
  288. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="singlePicHidden_{$vo.id|default=0}" value="{$vo.dfvalue|default=''}">
  289. </div>
  290. <script type="text/javascript">
  291. // 单图上传
  292. function uploadSinglePicFile(obj) {
  293. var file = $(obj)[0].files[0];
  294. if (!file) return false;
  295. var formData = new FormData();
  296. formData.append('_ajax', 1);
  297. formData.append('file', file);
  298. formData.append('compress', '1000-1000');
  299. $.ajax({
  300. type: 'post',
  301. url: eyou_basefile + "?m=user&c=Uploadify&a=imageUp",
  302. data: formData,
  303. contentType: false,
  304. processData: false,
  305. dataType: 'json',
  306. success: function (res) {
  307. layer.closeAll();
  308. if (res.state == 'SUCCESS') {
  309. var id = $(obj).data('id');
  310. $("#singlePicHidden_" + id).val(res.url);
  311. $("#singlePicImgSrc_" + id).show().attr('src', res.url);
  312. $('#singlePicYline_'+id+', #singlePicXline_' + id).hide();
  313. } else {
  314. showLayerAlert(res.state);
  315. }
  316. },
  317. error: function(e) {
  318. layer.closeAll();
  319. showLayerAlert(e.responseText);
  320. }
  321. })
  322. }
  323. </script>
  324. <!-- 单张图 end -->
  325. {/case}
  326. {case value="file"}
  327. {eyou:static file="/public/plugins/layui/css/layui.css" /}
  328. <!-- {eyou:static file="/public/plugins/layui/layui.js" /} -->
  329. <!-- 单个文件 start -->
  330. <div class="item-from-row">
  331. <div class="from-row-l">
  332. {$vo.title}:
  333. </div>
  334. <div class="from-row-r" >
  335. <a id="download_file_{$vo.fieldArr}_{$vo.name|default=''}" style="margin-right: 30px;text-decoration: underline;{eyou:notempty name='$vo.dfvalue' /}display: '';{eyou:else /}display: none;{/eyou:notempty}"
  336. {eyou:notempty name='$vo.dfvalue' /} href="{$vo.dfvalue|default=''}" download="{$vo.dfvalue|get_filename=###}" {/eyou:notempty}>
  337. <img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">下载附件</a>
  338. <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}" style="display: none;">
  339. <button type="button" class="el-button el-button--primary is-plain el-button--small" id="upload_{$vo.fieldArr}_{$vo.name|default=''}" ><i class="el-icon-paperclip"></i>上传文件</button>
  340. </div>
  341. </div>
  342. <script>
  343. $(function(){
  344. layui.use('upload', function(){
  345. var upload = layui.upload;
  346. //执行实例
  347. upload.render({
  348. elem: "#upload_{$vo.fieldArr}_{$vo.name|default=''}" //绑定元素
  349. ,url: "{:url('user/Uploadify/DownloadUploadFileAjax')}"
  350. ,accept: 'file' //普通文件
  351. ,exts: '{$vo.ext}'
  352. ,size: {$vo.filesize} //限制文件大小,单位 KB
  353. ,done: function(res){
  354. //上传完毕回调
  355. if (res.state=="SUCCESS"){
  356. layer.msg('上传成功!')
  357. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.url);
  358. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('display','');
  359. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',res.url);
  360. var arr = res.url.split("/");
  361. var download = arr[arr.length-1];
  362. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
  363. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('color','#000');
  364. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").html('<img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">下载附件');
  365. }else {
  366. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('display','');
  367. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('color','red');
  368. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").text(res.state);
  369. }
  370. }
  371. ,error: function(){
  372. //请求异常回调
  373. }
  374. });
  375. });
  376. })
  377. </script>
  378. <!-- 单个文件 end -->
  379. {/case}
  380. {case value="media"}
  381. {eyou:static file="/public/plugins/layui/css/layui.css" /}
  382. <!-- {eyou:static file="/public/plugins/layui/layui.js" /} -->
  383. <!-- 多媒体上传 -->
  384. <div class="item-from-row">
  385. <div class="from-row-l">
  386. {$vo.title}:
  387. </div>
  388. <div class="from-row-r" >
  389. <a id="media_a_{$vo.fieldArr}_{$vo.name|default=''}" style="margin-right: 30px;text-decoration: underline;{eyou:notempty name='$vo.dfvalue' /}display: '';{eyou:else /}display: none;{/eyou:notempty}"
  390. {eyou:notempty name='$vo.dfvalue' /} href="{$vo.dfvalue|default=''}" {/eyou:notempty}>
  391. <img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">点击查看</a>
  392. <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}" style="display: none;">
  393. <input type="file" id="{$vo.fieldArr}_{$vo.name|default=''}_upload_media" onchange="{$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210506(this)" style="display: none;">
  394. <button type="button" class="el-button el-button--primary is-plain el-button--small" id="{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media" onclick="$('#{$vo.fieldArr}_{$vo.name|default=\'\'}_upload_media').attr('data-type', '{$vo.upload_flag}').trigger('click');">上传文件</button>
  395. </div>
  396. </div>
  397. <script>
  398. function {$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210506(e){
  399. var data_type = $(e).attr('data-type');
  400. if ('qny' == data_type) {
  401. {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e);
  402. } else if ('oss' == data_type) {
  403. {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e);
  404. } else if ('cos' == data_type) {
  405. {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e);
  406. } else {
  407. {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e);
  408. }
  409. }
  410. function beforeUploadMedia(ext,file){
  411. var type = '{$vo.ext}';
  412. var extArr = [];
  413. extArr = type.split("|");
  414. var exts = ext.replace(".","");
  415. if (extArr.indexOf(exts) == -1) {
  416. showErrorMsg('仅支持{$vo.ext}格式');
  417. return false;
  418. }
  419. size = parseInt("{$vo.filesize}");
  420. if (file.size > size) {
  421. if (size >= 1048576) {
  422. limit = size/1024/1024;
  423. limit = limit + 'MB';
  424. }else {
  425. limit = size/1024 ;
  426. limit = limit + 'KB';
  427. }
  428. showErrorMsg('仅支持'+limit+'以内的文件');
  429. return false;
  430. }
  431. return true;
  432. }
  433. function {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e) {
  434. var file = $(e)[0].files[0];
  435. var fileName = file.name;
  436. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  437. ret = beforeUploadMedia(fileExt,file);
  438. if (ret){
  439. $.ajax({
  440. type: 'POST',
  441. url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
  442. data: {_ajax: 1},
  443. dataType: "JSON",
  444. success: function(res1) {
  445. if (1 == res1.code) {
  446. var token = res1.data.token;
  447. var formData = new FormData();
  448. formData.append('file', file);
  449. formData.append('token', token);
  450. fileName = res1.data.filePath + fileExt;
  451. formData.append('key', fileName);
  452. $.ajax({
  453. url: res1.data.uphost,
  454. type: 'POST',
  455. dataType: 'JSON',
  456. data: formData,
  457. timeout: 1200000,
  458. cache: false,
  459. processData: false,
  460. contentType: false,
  461. xhr: function () {
  462. myXhr = $.ajaxSettings.xhr();
  463. if (myXhr.upload) {
  464. myXhr.upload.addEventListener('progress', function(e){
  465. var curr = e.loaded;
  466. var total = e.total;
  467. process = parseInt(curr / total * 100);
  468. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传中...'+process+"%");
  469. });
  470. }
  471. return myXhr;
  472. },
  473. success: function(res2) {
  474. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传成功');
  475. setTimeout(function() {
  476. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
  477. }, 2000);
  478. var video_url = res1.data.domain + "/" + res2.key;
  479. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(video_url);
  480. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
  481. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
  482. },
  483. error: function(e) {
  484. layer.closeAll();
  485. showErrorMsg(e.responseText);
  486. return false;
  487. }
  488. });
  489. } else {
  490. layer.closeAll();
  491. showErrorMsg(res1.msg);
  492. }
  493. },
  494. error: function(e) {
  495. layer.closeAll();
  496. showErrorMsg(e.responseText);
  497. }
  498. });
  499. }
  500. }
  501. function {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e) {
  502. var file = $(e)[0].files[0];
  503. var fileName = file.name;
  504. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  505. ret = beforeUploadMedia(fileExt,file);
  506. if (ret) {
  507. $.ajax({
  508. type: 'POST',
  509. url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
  510. data: {_ajax: 1},
  511. dataType: "JSON",
  512. success: function (res1) {
  513. if (1 == res1.code) {
  514. fileName = res1.data.filePath + fileExt;
  515. //组装发送数据
  516. var request = new FormData();
  517. request.append("OSSAccessKeyId", res1.data.accessid);
  518. request.append("policy", res1.data.policy);
  519. request.append("Signature", res1.data.signature);
  520. request.append("key", fileName);
  521. request.append("success_action_status", 201);
  522. request.append('file', file);
  523. $.ajax({
  524. url: res1.data.host,
  525. data: request,
  526. processData: false,
  527. cache: false,
  528. contentType: false,
  529. dataType: 'xml',
  530. type: 'post',
  531. xhr: function () {
  532. myXhr = $.ajaxSettings.xhr();
  533. if (myXhr.upload) {
  534. myXhr.upload.addEventListener('progress', function (e) {
  535. var curr = e.loaded;
  536. var total = e.total;
  537. var process = parseInt(curr / total * 100);
  538. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传中...' + process + "%");
  539. });
  540. }
  541. return myXhr;
  542. },
  543. success: function (data) {
  544. var res = $(data).find('PostResponse');
  545. if (res) {
  546. var key = res.find('Key').text();
  547. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传成功');
  548. setTimeout(function () {
  549. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
  550. }, 2000);
  551. var video_url = res1.data.domain + "/" + key;
  552. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(video_url);
  553. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
  554. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', video_url);
  555. } else {
  556. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传失败');
  557. setTimeout(function () {
  558. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
  559. }, 2000);
  560. }
  561. },
  562. error: function (e) {
  563. layer.closeAll();
  564. console.log(e.responseText);
  565. }
  566. });
  567. } else {
  568. layer.closeAll();
  569. showErrorMsg(res1.msg);
  570. }
  571. },
  572. error: function (e) {
  573. layer.closeAll();
  574. showErrorMsg(e.responseText);
  575. }
  576. });
  577. }
  578. }
  579. function {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e) {
  580. var file = $(e)[0].files[0];
  581. var fileName = file.name;
  582. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  583. ret = beforeUploadMedia(fileExt,file);
  584. if (ret) {
  585. var formData = new FormData();
  586. formData.append('file', file);
  587. formData.append('file_ext', fileExt);
  588. $.ajax({
  589. type: 'post',
  590. url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
  591. data: formData,
  592. contentType: false,
  593. processData: false,
  594. dataType: 'json',
  595. xhr: function () {
  596. myXhr = $.ajaxSettings.xhr();
  597. if (myXhr.upload) {
  598. myXhr.upload.addEventListener('progress', function (e) {
  599. var curr = e.loaded;
  600. var total = e.total;
  601. process = parseInt(curr / total * 100);
  602. if (100 == process) {
  603. process = 99;
  604. }
  605. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传中...' + process + "%");
  606. });
  607. }
  608. return myXhr;
  609. },
  610. success: function (res) {
  611. if (1 == res.code) {
  612. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传成功');
  613. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.data.url);
  614. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
  615. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', res.data.url);
  616. } else {
  617. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传失败');
  618. }
  619. setTimeout(function () {
  620. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
  621. }, 2000);
  622. },
  623. error: function (e) {
  624. layer.closeAll();
  625. showErrorMsg(e.responseText);
  626. }
  627. });
  628. }
  629. }
  630. function {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e){
  631. var file = $(e)[0].files[0];
  632. var fileName = file.name;
  633. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  634. ret = beforeUploadMedia(fileExt,file);
  635. if (ret) {
  636. var formData = new FormData();
  637. formData.append('file', file);
  638. $.ajax({
  639. type: 'post',
  640. url: "{:url('user/Uploadify/AjaxUploadMedia', ['savepath'=>'media'])}",
  641. data: formData,
  642. contentType: false,
  643. processData: false,
  644. dataType: 'json',
  645. xhr: function () {
  646. myXhr = $.ajaxSettings.xhr();
  647. if (myXhr.upload) {
  648. myXhr.upload.addEventListener('progress', function (e) {
  649. var curr = e.loaded;
  650. var total = e.total;
  651. process = parseInt(curr / total * 100);
  652. $("#upload_video_litpic_local").html('上传中...' + process + "%");
  653. });
  654. }
  655. return myXhr;
  656. },
  657. success: function (res) {
  658. if ("SUCCESS" == res.state) {
  659. $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").html('上传成功');
  660. setTimeout(function () {
  661. $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').html('上传文件');
  662. }, 2000);
  663. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.url);
  664. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
  665. $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', res.url);
  666. } else {
  667. showErrorMsg(res.msg);
  668. }
  669. }
  670. });
  671. }
  672. }
  673. </script>
  674. {/case}
  675. {case value="imgs"}
  676. <script type="text/javascript" src="__STATIC__/admin/js/jquery-ui/jquery-ui.min.js"></script>
  677. <!-- 多张图 start -->
  678. <div class="item-from-row" id="dl_{$vo.fieldArr}_{$vo.name|default=''}">
  679. <div class="from-row-l">
  680. <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
  681. </div>
  682. <div class="from-row-r">
  683. <div class="images_upload_main" id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
  684. <!-- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back', '', '{$vo.title}');" class="el-button el-button--primary is-plain el-button--small">
  685. <i class="el-icon-picture"></i>上传图片
  686. </a> -->
  687. <div class="sort-list-{$vo.fieldArr}_{$vo.name|default=''} mt10">
  688. {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
  689. <div class="fieldext_upload mb10 fieldext_upload_html" >
  690. <div class="images_upload_item">
  691. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2.image_url|default=''}">
  692. <a href="{$v2.image_url|default=''}" onclick="" class="pic">
  693. <img src="{$v2.image_url|default=''}" >
  694. </a>
  695. <a class="delete" title="删除" href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2.image_url|default=''}')"></a>
  696. </div>
  697. </div>
  698. {/volist}
  699. <div class="fieldext_upload" style="display:none;"></div>
  700. </div>
  701. <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back', '', '{$vo.title}');" class="img-upload" title="上传图片">
  702. <div class="y-line"></div>
  703. <div class="x-line"></div>
  704. </a>
  705. </div>
  706. <!-- 上传图片显示的样板 start -->
  707. <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl" style="display: none;">
  708. <div class="fieldext_upload mb10 fieldext_upload_html">
  709. <div class="images_upload_item">
  710. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
  711. <a href="javascript:void(0);" onClick="" class="pic">
  712. <img src="__STATIC__/admin/images/add-button.jpg"/>
  713. </a>
  714. <a class="delete" href="javascript:void(0)" title="删除">&nbsp;&nbsp;</a>
  715. </div>
  716. </div>
  717. </div>
  718. <!-- 上传图片显示的样板 end -->
  719. </div>
  720. </div>
  721. <script type="text/javascript">
  722. // 上传多图回调函数
  723. function {$vo.fieldArr}_{$vo.name|default=''}_call_back(paths){
  724. var last_div = $(".{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl").html();
  725. for (var i=0;i<paths.length ;i++ )
  726. {
  727. if ($(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html").length > 0) {
  728. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").after(last_div); // 插入一个 新图片
  729. } else {
  730. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload:last").before(last_div); // 插入一个 新图片
  731. }
  732. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
  733. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
  734. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('a:eq(1)').attr('onclick',"{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'"+paths[i]+"')").text('');
  735. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
  736. }
  737. }
  738. /*
  739. * 上传之后删除组图input
  740. * @access public
  741. * @val string 删除的图片input
  742. */
  743. function {$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(obj,path)
  744. {
  745. // 删除数据库记录
  746. $.ajax({
  747. type:'POST',
  748. url:"{:url('user/UsersRelease/del_channelimgs', ['_ajax'=>1])}",
  749. data:{filename:path,channel:"{$channel_id|default='0'}",fieldid:"{$vo.id}",aid:"{$aid|default='0'}"},
  750. success:function(){
  751. $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片
  752. $.ajax({
  753. type:'POST',
  754. url:"{:url('user/Uploadify/delupload', ['_ajax'=>1])}",
  755. data:{action:"del", filename:path},
  756. success:function(){}
  757. });
  758. }
  759. });
  760. }
  761. /** 以下 图集相册的拖动排序相关 js*/
  762. $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).sortable({
  763. start: function( event, ui) {
  764. }
  765. ,stop: function( event, ui ) {
  766. }
  767. });
  768. //因为他们要拖动,所以尽量设置他们的文字不能选择。
  769. $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).disableSelection();
  770. </script>
  771. <!-- 多张图 end -->
  772. {/case}
  773. {case value="int"}
  774. <!-- 整数类型 start -->
  775. <div class="item-from-row">
  776. <div class="from-row-l">
  777. <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
  778. </div>
  779. <div class="from-row-r">
  780. <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="只允许纯数字" class="el-input__inner w500" 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=''}
  781. <span class="err"></span>
  782. <p class="notic">{$vo.remark|default=''}</p>
  783. </div>
  784. </div>
  785. <!-- 整数类型 end -->
  786. {/case}
  787. {case value="float"}
  788. <!-- 小数类型 start -->
  789. <div class="item-from-row">
  790. <div class="from-row-l">
  791. <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
  792. </div>
  793. <div class="from-row-r">
  794. <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="" class="el-input__inner w500" 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=''}
  795. <span class="err"></span>
  796. <p class="notic">{$vo.remark|default=''}</p>
  797. </div>
  798. </div>
  799. <!-- 小数类型 end -->
  800. {/case}
  801. {case value="decimal"}
  802. <!-- 金额类型 start -->
  803. <div class="item-from-row">
  804. <div class="from-row-l">
  805. <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
  806. </div>
  807. <div class="from-row-r">
  808. <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="" class="el-input__inner w500" 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=''}
  809. <span class="err"></span>
  810. <p class="notic">{$vo.remark|default=''}</p>
  811. </div>
  812. </div>
  813. <!-- 金额类型 end -->
  814. {/case}
  815. {case value="datetime"}
  816. <!-- 日期和时间 start -->
  817. <div class="item-from-row">
  818. <div class="from-row-l">
  819. <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
  820. </div>
  821. <div class="from-row-r">
  822. <input type="text" class="el-input__inner w500" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" value="{$vo['dfvalue']}">
  823. <i class="el-icon-date"></i>
  824. <span class="err"></span>
  825. <p class="notic">{$vo.remark|default=''}</p>
  826. </div>
  827. </div>
  828. <script type="text/javascript">
  829. $(function () {
  830. $('#{$vo.fieldArr}_{$vo.name|default=''}').layDate();
  831. });
  832. </script>
  833. <!-- 日期和时间 end -->
  834. {/case}
  835. {case value="htmltext"}
  836. <!-- HTML文本 start -->
  837. <div class="item-from-row">
  838. <div class="from-row-l">
  839. <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
  840. </div>
  841. <div class="from-row-r">
  842. <textarea class="wb100" id="{$vo.fieldArr}_{$vo.name|default=''}" data-func="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" title="">{$vo.dfvalue|default=''}</textarea>
  843. <span class="err"></span>
  844. <p class="notic">{$vo.remark|default=''}</p>
  845. </div>
  846. </div>
  847. <script type="text/javascript">
  848. var ue_{$vo.fieldArr}_{$vo.name|default=''} = UE.getEditor('{$vo.fieldArr}_{$vo.name|default=''}',{
  849. serverUrl :"{:url('Uploadify/index',array('savepath'=>'allimg'))}",
  850. zIndex: 999,
  851. initialFrameWidth: "100%", //初化宽度
  852. initialFrameHeight: 350, //初化高度
  853. focus: false, //初始化时,是否让编辑器获得焦点true或false
  854. maximumWords: 99999,
  855. removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
  856. pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  857. autoHeightEnabled: false,
  858. toolbars: [['fullscreen', 'forecolor', 'backcolor', 'removeformat', '|', 'simpleupload', 'unlink', '|', 'paragraph', 'fontfamily', 'fontsize']],
  859. // xss 过滤是否开启,inserthtml等操作
  860. xssFilterRules: true,
  861. //input xss过滤
  862. inputXssFilter: true,
  863. //output xss过滤
  864. outputXssFilter: true
  865. });
  866. //必须在提交前渲染编辑器;
  867. function {$vo.fieldArr}_{$vo.name|default=''}() {
  868. //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
  869. if(UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").queryCommandState('source') != 0) {
  870. UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('source'); //切换到【设计】视图
  871. }
  872. }
  873. </script>
  874. <!-- HTML文本 end -->
  875. {/case}
  876. {/switch}
  877. {/if}
  878. {/volist}