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_field.htm 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. {volist name="$users_para" id="vo"}
  2. {switch name="vo.dtype"}
  3. {case value="hidden"}
  4. <!-- 隐藏域 start -->
  5. <dl class="row" style="display: none;">
  6. <dt class="tit">
  7. <label>{$vo.title}</label>
  8. </dt>
  9. <dd class="opt">
  10. <input type="hidden" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
  11. <span class="err"></span>
  12. <p class="notic">{$vo.remark|default=''}</p>
  13. </dd>
  14. </dl>
  15. <!-- 隐藏域 start -->
  16. {/case}
  17. {case value="text"}
  18. <!-- 单行文本框 start -->
  19. <div class="users-form-item users-col-span-7">
  20. <label class="users-form-item-label">{$vo.title}:</label>
  21. <div class="users-form-item-content">
  22. <input type="text" class="input-txt" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
  23. </div>
  24. </div>
  25. <!-- 单行文本框 end -->
  26. {/case}
  27. {case value="multitext"}
  28. <!-- 多行文本框 start -->
  29. <div class="users-form-item users-col-span-100" style="height: unset;line-height: unset;">
  30. <label class="users-form-item-label">{$vo.title}:</label>
  31. <div class="users-form-item-content" style="height: unset;line-height: unset;">
  32. <textarea rows="5" cols="60" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" style="height:60px;">{$vo.dfvalue|default=''}</textarea>
  33. </div>
  34. </div>
  35. <!-- 多行文本框 end -->
  36. {/case}
  37. {case value="checkbox"}
  38. <!-- 复选框 start -->
  39. <div class="users-form-item users-col-span-100">
  40. <label class="users-form-item-label">{$vo.title}:</label>
  41. <div class="users-form-item-content">
  42. <div class="source">
  43. {volist name="$vo.dfvalue" id="v2"}
  44. <div class="users-tooltip">
  45. <div class="users-tooltip-rel">
  46. <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}>{$v2}
  47. </div>
  48. </div>
  49. {/volist}
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 复选框 end -->
  54. {/case}
  55. {case value="radio"}
  56. <!-- 单选项 start -->
  57. <div class="users-form-item users-col-span-100">
  58. <label class="users-form-item-label">{$vo.title}:</label>
  59. <div class="users-form-item-content">
  60. <div class="source">
  61. {volist name="$vo.dfvalue" id="v2"}
  62. <div class="users-tooltip">
  63. <div class="users-tooltip-rel">
  64. <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}
  65. </div>
  66. </div>
  67. {/volist}
  68. </div>
  69. </div>
  70. </div>
  71. <!-- 单选项 end -->
  72. {/case}
  73. {case value="switch"}
  74. <!-- 开关 start -->
  75. <div class="users-form-item users-col-span-7">
  76. <label class="users-form-item-label">{$vo.title}:</label>
  77. <div class="users-form-item-content">
  78. <div class="onoff">
  79. <label for="{$vo.fieldArr}_{$vo.name|default=''}1" class="cb-enable {if condition="0 != $vo['dfvalue']"}selected{/if}">是</label>
  80. <label for="{$vo.fieldArr}_{$vo.name|default=''}0" class="cb-disable {if condition="0 == $vo['dfvalue']"}selected{/if}">否</label>
  81. <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}>
  82. <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}>
  83. </div>
  84. </div>
  85. </div>
  86. <!-- 开关 end -->
  87. {/case}
  88. {case value="select"}
  89. <!-- 下拉框 start -->
  90. <div class="users-form-item users-col-span-7">
  91. <label class="users-form-item-label">{$vo.title}:</label>
  92. <div class="users-form-item-content">
  93. <select name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}">
  94. <option value="">请选择</option>
  95. {volist name="$vo.dfvalue" id="v2"}
  96. <option value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}selected{/if}>{$v2}</option>
  97. {/volist}
  98. </select>
  99. </div>
  100. </div>
  101. <!-- 下拉框 end -->
  102. {/case}
  103. {case value="img"}
  104. <!-- 单张图 start -->
  105. <div class="users-form-item users-col-span-7">
  106. <label class="users-form-item-label">{$vo.title}:</label>
  107. <div class="users-form-item-content">
  108. <div class="input-file-show div_{$vo.fieldArr}_{$vo.name|default=''}">
  109. <span class="show">
  110. <a id="img_a_{$vo.fieldArr}_{$vo.name|default=''}" target="_blank" class="nyroModal" rel="gal" href="{$vo['dfvalue']|default='javascript:void(0);'}">
  111. <i id="img_i_{$vo.fieldArr}_{$vo.name|default=''}" class="fa fa-picture-o" {notempty name="$vo['dfvalue']"}onmouseover="layer_tips=layer.tips('<img src={$vo['dfvalue']} class=\'layer_tips_img\'>',this,{tips: [1, '#fff']});"{/notempty} onmouseout="layer.close(layer_tips);"></i>
  112. </a>
  113. </span>
  114. <span class="type-file-box">
  115. <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo['dfvalue']|default=''}" class="type-file-text" autocomplete="off" style="width: 70%;">
  116. <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button" style="width: 30%;">
  117. <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=''}"
  118. title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
  119. </span>
  120. </div>
  121. </div>
  122. </div>
  123. <script type="text/javascript">
  124. function {$vo.fieldArr}_{$vo.name|default=''}_call_back(fileurl_tmp)
  125. {
  126. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(fileurl_tmp);
  127. $("#img_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', fileurl_tmp);
  128. $("#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']});");
  129. }
  130. </script>
  131. <!-- 单张图 end -->
  132. {/case}
  133. {case value="imgs"}
  134. <!-- 多张图 start -->
  135. <div class="users-form-item users-col-span-100" style="height: unset;line-height: unset;">
  136. <label class="users-form-item-label">{$vo.title}:</label>
  137. <div class="users-form-item-content" style="height: unset;line-height: unset;">
  138. <div class="tab-pane pics" >
  139. <div id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
  140. <table class="table table-bordered">
  141. <tbody>
  142. <tr>
  143. <td>
  144. <div class="sort-list-img sort-list-{$vo.fieldArr}_{$vo.name|default=''}">
  145. {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
  146. <div class="images_upload images_upload_html">
  147. <div class="images_upload_box">
  148. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2}">
  149. <a href="{$v2}" onclick="" class="upimg" target="_blank">
  150. <img src="{$v2}">
  151. </a>
  152. <a href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2}')" class="delect" title="删除"></a>
  153. </div>
  154. </div>
  155. {/volist}
  156. <div class="images_upload"></div>
  157. </div>
  158. <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="img-upload mb15">
  159. <div class="y-line"></div>
  160. <div class="x-line"></div>
  161. </a>
  162. </td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. </div>
  167. <!-- 上传图片显示的样板 start -->
  168. <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl none">
  169. <div class="images_upload sort-list-img images_upload_html">
  170. <div class="images_upload_box">
  171. <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
  172. <a href="javascript:void(0);" onClick="" class="upimg">
  173. <img src="__STATIC__/admin/images/add-button.jpg" />
  174. </a>
  175. <a href="javascript:void(0)" class="delect" title="删除"></a>
  176. </div>
  177. </div>
  178. </div>
  179. <!-- 上传图片显示的样板 end -->
  180. </div>
  181. </div>
  182. </div>
  183. <script type="text/javascript">
  184. // 上传多图回调函数
  185. function {$vo.fieldArr}_{$vo.name|default=''}_call_back(paths){
  186. var last_div = $(".{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl").html();
  187. for (var i=0;i<paths.length ;i++ )
  188. {
  189. if ($(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html").length > 0) {
  190. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").after(last_div); // 插入一个 新图片
  191. } else {
  192. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload:last").before(last_div); // 插入一个 新图片
  193. }
  194. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
  195. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
  196. $(".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('');
  197. $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .images_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
  198. }
  199. }
  200. /*
  201. * 上传之后删除组图input
  202. * @access public
  203. * @val string 删除的图片input
  204. */
  205. function {$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(obj,path)
  206. {
  207. $.ajax({
  208. type:'GET',
  209. url:"{:url('Uploadimgnew/delupload', ['_ajax'=>1])}",
  210. data:{action:"del", filename:path},
  211. success:function(){
  212. $(obj).parent().parent().remove(); // 删除完服务器的, 再删除 html上的图片
  213. }
  214. });
  215. // 删除数据库记录
  216. $.ajax({
  217. type:'GET',
  218. url:"{:url('Field/del_channelimgs', ['_ajax'=>1])}",
  219. data:{filename:path,channel:"{$channeltype|default='0'}",fieldid:"{$vo.id}",aid:"{$aid|default='0'}"},
  220. success:function(){
  221. //
  222. }
  223. });
  224. }
  225. /** 以下 产品相册的拖动排序相关 js*/
  226. $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).sortable({
  227. start: function( event, ui) {
  228. }
  229. ,stop: function( event, ui ) {
  230. }
  231. });
  232. $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).disableSelection();
  233. </script>
  234. <!-- 多张图 end -->
  235. {/case}
  236. {case value="int"}
  237. <!-- 整数类型 start -->
  238. <dl class="row">
  239. <dt class="tit">
  240. <label>{if condition="1 == $vo.is_required"}<!-- <em>*</em> -->{/if}{$vo.title}</label>
  241. </dt>
  242. <dd class="opt">
  243. <input type="text" value="{$vo.dfvalue|default='0'}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="只允许纯数字" class="input-txt" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9]/g,''));">{$vo.dfvalue_unit|default=''}
  244. <span class="err"></span>
  245. <p class="notic">{$vo.remark|default=''}</p>
  246. </dd>
  247. </dl>
  248. <!-- 整数类型 end -->
  249. {/case}
  250. {case value="float"}
  251. <!-- 小数类型 start -->
  252. <dl class="row">
  253. <dt class="tit">
  254. <label>{if condition="1 == $vo.is_required"}<!-- <em>*</em> -->{/if}{$vo.title}</label>
  255. </dt>
  256. <dd class="opt">
  257. <input type="text" value="{$vo.dfvalue|default='0'}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="允许带有小数点的数值" class="input-txt" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));">{$vo.dfvalue_unit|default=''}
  258. <span class="err"></span>
  259. <p class="notic">{$vo.remark|default=''}</p>
  260. </dd>
  261. </dl>
  262. <!-- 小数类型 end -->
  263. {/case}
  264. {case value="decimal"}
  265. <!-- 金额类型 start -->
  266. <dl class="row">
  267. <dt class="tit">
  268. <label>{if condition="1 == $vo.is_required"}<!-- <em>*</em> -->{/if}{$vo.title}</label>
  269. </dt>
  270. <dd class="opt">
  271. <input type="text" value="{$vo.dfvalue|default='0.00'}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="允许带有小数点的数值" class="input-txt" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));">{$vo.dfvalue_unit|default=''}
  272. <span class="err"></span>
  273. <p class="notic">{$vo.remark|default=''}</p>
  274. </dd>
  275. </dl>
  276. <!-- 金额类型 end -->
  277. {/case}
  278. {case value="datetime"}
  279. <!-- 日期和时间 start -->
  280. <div class="users-form-item users-col-span-7">
  281. <label class="users-form-item-label">{$vo.title}:</label>
  282. <div class="users-form-item-content">
  283. <input type="text" class="input-txt" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" value="{php}if(empty($vo['dfvalue'])){echo date('Y-m-d H:i:s');}else{echo $vo['dfvalue'];}{/php}">
  284. <span class="add-on input-group-addon">
  285. <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
  286. </span>
  287. </div>
  288. </div>
  289. <script type="text/javascript">
  290. layui.use('laydate', function() {
  291. var laydate = layui.laydate;
  292. laydate.render({
  293. elem: "#{$vo.fieldArr}_{$vo.name|default=''}"
  294. ,type: 'datetime'
  295. });
  296. })
  297. </script>
  298. <!-- 日期和时间 end -->
  299. {/case}
  300. {case value="htmltext"}
  301. <!-- HTML文本 start -->
  302. <dl class="row">
  303. <dt class="tit">
  304. <label>{if condition="1 == $vo.is_required"}<!-- <em>*</em> -->{/if}{$vo.title}</label>
  305. </dt>
  306. <dd class="opt">
  307. <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>
  308. <span class="err"></span>
  309. <p class="notic">{$vo.remark|default=''}</p>
  310. </dd>
  311. </dl>
  312. <script type="text/javascript">
  313. UE.getEditor('{$vo.fieldArr}_{$vo.name|default=''}',{
  314. serverUrl :"{:url('Ueditor/index',array('savepath'=>'allimg'))}",
  315. zIndex: 999,
  316. initialFrameWidth: "100%", //初化宽度
  317. initialFrameHeight: 450, //初化高度
  318. focus: false, //初始化时,是否让编辑器获得焦点true或false
  319. maximumWords: 99999,
  320. removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
  321. pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
  322. autoHeightEnabled: false,
  323. toolbars: ueditor_toolbars
  324. });
  325. //必须在提交前渲染编辑器;
  326. function {$vo.fieldArr}_{$vo.name|default=''}() {
  327. //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
  328. if(UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").queryCommandState('source') != 0) {
  329. UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('source'); //切换到【设计】视图
  330. }
  331. }
  332. </script>
  333. <!-- HTML文本 end -->
  334. {/case}
  335. {/eyou:case}
  336. {case value="file"}
  337. <!-- 单个文件 start -->
  338. <div class="users-form-item users-col-span-7">
  339. <label class="users-form-item-label">{$vo.title}:</label>
  340. <div class="users-form-item-content">
  341. <a id="download_file_{$vo.fieldArr}_{$vo.name|default=''}" style="margin-right: 30px;text-decoration: underline;{eyou:notempty name='$vo.info' /}display: '';{eyou:else /}display: none;{/eyou:notempty}"
  342. {eyou:notempty name='$vo.info' /} href="{$vo.info|default=''}" download="{$vo.info|get_filename=###}" {/eyou:notempty}>
  343. <img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">下载附件</a>
  344. <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.info|default=''}" style="display: none;">
  345. <button type="button" class="users-btn users-btn-text" id="upload_{$vo.fieldArr}_{$vo.name|default=''}">
  346. <span>上传文件</span>
  347. </button>
  348. </div>
  349. </div>
  350. <script type="text/javascript">
  351. layui.use('upload', function(){
  352. var upload = layui.upload;
  353. //执行实例
  354. upload.render({
  355. elem: '#upload_{$vo.fieldArr}_{$vo.name|default=""}' //绑定元素
  356. ,url: "{:url('Ueditor/DownloadUploadFileAjax')}"
  357. ,accept: 'file' //普通文件
  358. ,exts: '{$vo.ext}'
  359. ,size: {$vo.filesize} //限制文件大小,单位 KB
  360. ,done: function(res){
  361. if (res.code==1){
  362. layer.msg(res.msg);
  363. var arr = res.file_url.split("/");
  364. var download = arr[arr.length-1];
  365. $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.file_url);
  366. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}")
  367. .show()
  368. .attr('href',res.file_url)
  369. .attr('download',download)
  370. .css('color','#000')
  371. .html('<img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">下载附件');
  372. }else {
  373. $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}")
  374. .show()
  375. .css('color','red')
  376. .text(res.msg)
  377. .attr('href', 'javascript:void(0);');
  378. }
  379. }
  380. ,error: function(){
  381. //请求异常回调
  382. }
  383. });
  384. });
  385. </script>
  386. <!-- 单个文件 end -->
  387. {/case}
  388. {/switch}
  389. {/volist}