addform.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <style>
  37. .radio-inline, .checkbox-inline {
  38. padding-left: 0px;
  39. }
  40. </style>
  41. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  42. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  43. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  44. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  45. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  46. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  47. <script type="text/javascript" src="/layuiadmin/layui/layui.js?v=2021052500001"></script>
  48. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  49. <link href="/static/css/snailfish.css" rel="stylesheet">
  50. <link href="/static/css/szyV6.css" rel="stylesheet">
  51. <link href="/static/css/allform.css" rel="stylesheet">
  52. </head>
  53. <body layadmin-themealias="default">
  54. <!-- 菜单组件 begin-->
  55. <include file="Public/componts_menu"/>
  56. <!-- 菜单组件end -->
  57. <div class="div-iframe">
  58. <div class="layui-fluid">
  59. <div class="layui-card">
  60. <div class="layui-card layadmin-header" style="display:block;">
  61. <div class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
  62. <a href="{:U('application/index')}">应用</a><span lay-separator="">/</span>
  63. <a href="{:U('allform/index')}"><cite>万能表单</cite></a><span lay-separator="">/</span>
  64. <a href="{:U('allform/index')}"><cite><?php if(empty($item)){?>新增<?php }else{?>修改<?php }?>表单</cite></a>
  65. </div>
  66. </div>
  67. <!--- 内容开始 -->
  68. <div class="layui-card-body" style="padding:5px;">
  69. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  70. <div class="layui-tab-content" style="margin: 0 auto;padding: 5px;">
  71. <div class="layui-tab-item" style="display: block">
  72. <div class="layui-card-body" style="">
  73. <form action="" class="layui-form" lay-filter="example" method="post">
  74. <input type="hidden" name="id" value="<?php echo empty($item) ? '' : $item['id'];?>" />
  75. <div class="layui-form-item" style="display: flex;">
  76. <div class="diyphone">
  77. <div class="page_content">
  78. <div class="page-title">自定义表单预览</div>
  79. <div class="phone-body">
  80. <div class="phone-top">
  81. <div class="phone-img">
  82. <img src="/static/images/poster_1.png" style="width: 375px; height: 20px;">
  83. <img src="/static/images/poster_3.png" style="width: 373px; height: 44px;">
  84. </div>
  85. <div class="phone-title">页面名称</div>
  86. </div>
  87. <div class="phone-main">
  88. <div class="phone-main-content-box">
  89. <div class="phone-main-content">
  90. <?php echo !empty($item['phone_item']) ? $item['phone_item'] : '';?>
  91. </div>
  92. </div>
  93. <div class="bottom-items" style="width: 100%;"></div>
  94. <?php if( empty($item) ){ ?>
  95. <p class="no_element" style="text-align: center; line-height: 400px;
  96. <?php if(!empty($item) && !empty($item->phone_item)){?>
  97. display:none;
  98. <?php } ?>
  99. ">您还没有添加任何元素</p>
  100. <?php } ?>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="form-config">
  106. <div class="layui-form-item">
  107. <label class="layui-form-label "><span style="color:red;">*</span>&nbsp;表单名称:</label>
  108. <div class="layui-input-block">
  109. <input type="text" class="layui-input" name='form_name' value="<?php echo empty($item) ? '' : $item['form_name'];?>" maxlength="100">
  110. </div>
  111. </div>
  112. <div class="layui-form-item">
  113. <label class="layui-form-label">表单类型:</label>
  114. <div class="layui-input-block">
  115. <div class="input-group">
  116. <label class="radio-inline">
  117. <input type="radio" title="下单表单" name="form_type" lay-filter="form_type" value="order" <?php if(empty($item['form_type']) || $item['form_type'] == 'order'){ ?> checked="checked"<?php } ?>>
  118. </label>
  119. </div>
  120. <div class="layui-form-mid layui-word-aux">商品表单位于商品规格下面进行显示,只能商品使用;<br/>下单表单位于订单提交页面进行显示,只能商品下单的时候使用;<br/>申请表单只能在申请分销商以及其他申请信息的时候使用</div>
  121. </div>
  122. </div>
  123. <div class="layui-form-item">
  124. <label class="layui-form-label">选择表单字段:</label>
  125. <div class="layui-input-block">
  126. <div class="form-item-adder">
  127. <div class="btn act_btn" type="image">
  128. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  129. <span>
  130. <img src="/static/images/allform/img.svg" alt="" class="btn-svg"> 图片
  131. <div class="btn-shade"> 添加字段 </div>
  132. </span>
  133. </button>
  134. </div>
  135. <div class="btn act_btn" type="text">
  136. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  137. <span>
  138. <img src="/static/images/allform/moretxt.svg" alt="" class="btn-svg"> 单行文本
  139. <div class="btn-shade"> 添加字段 </div>
  140. </span>
  141. </button>
  142. </div>
  143. <div class="btn act_btn" type="textarea">
  144. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  145. <span>
  146. <img src="/static/images/allform/moretxt.svg" alt="" class="btn-svg"> 多行文本
  147. <div class="btn-shade"> 添加字段 </div>
  148. </span>
  149. </button>
  150. </div>
  151. <div class="btn act_btn" type="select">
  152. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  153. <span>
  154. <img src="/static/images/allform/select.svg" alt="" class="btn-svg"> 下拉框
  155. <div class="btn-shade"> 添加字段 </div>
  156. </span>
  157. </button>
  158. </div>
  159. <div class="btn act_btn" type="radiao">
  160. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  161. <span>
  162. <img src="/static/images/allform/oneradio.svg" alt="" class="btn-svg"> 单选框
  163. <div class="btn-shade"> 添加字段 </div>
  164. </span>
  165. </button>
  166. </div>
  167. <div class="btn act_btn" type="checked">
  168. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  169. <span>
  170. <img src="/static/images/allform/checked.svg" alt="" class="btn-svg"> 多选框
  171. <div class="btn-shade"> 添加字段 </div>
  172. </span>
  173. </button>
  174. </div>
  175. <div class="btn act_btn" type="area">
  176. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  177. <span>
  178. <img src="/static/images/allform/area.svg" alt="" class="btn-svg"> 地区
  179. <div class="btn-shade"> 添加字段 </div>
  180. </span>
  181. </button>
  182. </div>
  183. <div class="btn act_btn" type="date">
  184. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  185. <span>
  186. <img src="/static/images/allform/date.svg" alt="" class="btn-svg"> 日期
  187. <div class="btn-shade"> 添加字段 </div>
  188. </span>
  189. </button>
  190. </div>
  191. <div class="btn act_btn" type="date_range">
  192. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  193. <span>
  194. <img src="/static/images/allform/daterange.svg" alt="" class="btn-svg"> 日期范围
  195. <div class="btn-shade"> 添加字段 </div>
  196. </span>
  197. </button>
  198. </div>
  199. <div class="btn act_btn" type="idcard">
  200. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  201. <span>
  202. <img src="/static/images/allform/idcard.svg" alt="" class="btn-svg"> 身份证号码
  203. <div class="btn-shade"> 添加字段 </div>
  204. </span>
  205. </button>
  206. </div>
  207. <div class="btn act_btn" type="time">
  208. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  209. <span>
  210. <img src="/static/images/allform/time.svg" alt="" class="btn-svg"> 时间
  211. <div class="btn-shade"> 添加字段 </div>
  212. </span>
  213. </button>
  214. </div>
  215. <div class="btn act_btn" type="time_range">
  216. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  217. <span>
  218. <img src="/static/images/allform/timerange.svg" alt="" class="btn-svg"> 时间范围
  219. <div class="btn-shade"> 添加字段 </div>
  220. </span>
  221. </button>
  222. </div>
  223. <div class="btn act_btn" type="telephone">
  224. <button type="button" class="oper-btn ivu-btn ivu-btn-primary">
  225. <span>
  226. <img src="/static/images/allform/telephone.svg" alt="" class="btn-svg"> 手机号码
  227. <div class="btn-shade"> 添加字段 </div>
  228. </span>
  229. </button>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. <div class="layui-form-item" style="margin-bottom: 5px;">
  235. <label class="layui-form-label">表单设置:</label>
  236. </div>
  237. <div class="layui-form-item">
  238. <div class="layui-input-block" style="margin-left: 0px;padding: 0 25px;">
  239. <ul class="form-items" id="form_config_ul">
  240. <?php echo !empty($item['item_li']) ? $item['item_li'] : '';?>
  241. </ul>
  242. </div>
  243. </div>
  244. <div class="layui-form-item" style="border-top: 1px solid #eceaea;padding-top: 10px;">
  245. <label class="layui-form-label"></label>
  246. <div class="layui-input-block">
  247. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  248. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  249. <a class="btn btn-default" style='margin-left:10px;' href="{:U('allform/index')}">返回列表</a>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. </form>
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260. <!--- 内容结束-->
  261. </div>
  262. </div>
  263. </div>
  264. <script>
  265. var add_item_url = "{:U('allform/add_item')}";
  266. </script>
  267. <script type="text/javascript" src="/static/js/allform/allform.js?v=202105240001"></script>
  268. <script type="text/javascript" src="/static/js/dist/area/area_form.js?v=202105240001"></script>
  269. <script>
  270. layui.config({
  271. base: '/layuiadmin/' //静态资源所在路径
  272. }).extend({
  273. index: 'lib/index' //主入口模块
  274. }).use('index');
  275. </script>
  276. <script>
  277. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  278. var layer = layui.layer;
  279. var $;
  280. layui.use(['jquery', 'layer','form'], function(){
  281. $ = layui.$;
  282. var form = layui.form;
  283. $('.sub-nav').css('height', $(window).height() + 'px');
  284. //监听提交
  285. form.on('submit(formDemo)', function(data){
  286. var loadingIndex = layer.load(); // 加载中动画遮罩层(1)
  287. $.ajax({
  288. url: data.form.action,
  289. type: data.form.method,
  290. data: data.field,
  291. dataType:'json',
  292. success: function (info) {
  293. layer.close(loadingIndex); // 提交成功失败都需要关闭
  294. if(info.status == 0)
  295. {
  296. layer.msg(info.result.message,{icon: 1,time: 2000});
  297. can_sub = true;
  298. }else if(info.status == 1){
  299. var go_url = location.href;
  300. if( info.result.hasOwnProperty("url") )
  301. {
  302. go_url = info.result.url;
  303. }
  304. layer.msg('操作成功',{time: 1000,
  305. end:function(){
  306. location.href = go_url;
  307. }
  308. });
  309. can_sub = true;
  310. }
  311. }
  312. });
  313. return false;
  314. });
  315. })
  316. </script>
  317. </body>
  318. </html>