No Description
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.

users_release_field_m.htm 52KB

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