index.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title><?=$form->getTitle()?></title>
  6. <link href="/system/frame/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
  7. <link href="/system/css/layui-admin.css" rel="stylesheet">
  8. <link href="/system/frame/css/style.min.css?v=3.0.0" rel="stylesheet">
  9. <link href="{__FRAME_PATH}css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
  10. <script src="{__PLUG_PATH}vue/dist/vue.min.js"></script>
  11. <link href="{__PLUG_PATH}iview/dist/styles/iview.css" rel="stylesheet">
  12. <script src="{__PLUG_PATH}iview/dist/iview.min.js"></script>
  13. <script src="{__PLUG_PATH}jquery/jquery.min.js"></script>
  14. <script src="{__PLUG_PATH}form-create/province_city.js"></script>
  15. <script src="{__PLUG_PATH}form-create/form-create.min.js"></script>
  16. <link href="{__PLUG_PATH}layui/css/layui.css" rel="stylesheet">
  17. <script src="{__PLUG_PATH}layui/layui.all.js"></script>
  18. <style>
  19. /*弹框样式修改*/
  20. .ivu-modal{top: 20px;}
  21. .ivu-modal .ivu-modal-body{padding: 10px;}
  22. .ivu-modal .ivu-modal-body .ivu-modal-confirm-head{padding:0 0 10px 0;}
  23. .ivu-modal .ivu-modal-body .ivu-modal-confirm-footer{display: none;padding-bottom: 10px;}
  24. .ivu-date-picker {display: inline-block;line-height: normal;width: 280px;}
  25. .ivu-modal-footer{display: none;}
  26. .ivu-poptip-popper{text-align: left;}
  27. .ivu-icon{padding-left: 5px;}
  28. .ivu-btn-long{width: 10%;min-width:100px;margin-left: 18%;}
  29. </style>
  30. </head>
  31. <body class="gray-bg">
  32. <div class="wrapper wrapper-content">
  33. <div class="row">
  34. <div class="col-sm-12">
  35. <div class="ibox float-e-margins">
  36. {if condition="$config_tab eq null"}
  37. <div class="ibox-title">
  38. <h5>短信配置</h5>
  39. </div>
  40. {else/}
  41. <div class="tabs-container ibox-title">
  42. <ul class="nav nav-tabs">
  43. {volist name="config_tab" id="vo"}
  44. {if condition="$vo['value'] eq $tab_id"}
  45. <li class="active"><a href="{:Url('index',array('tab_id'=>$vo['value'],'type'=>$vo['type']))}"><i class="fa fa-{$vo.icon}"></i>{$vo.label}</a></li>
  46. {else/}
  47. <li><a href="{:Url('index',array('tab_id'=>$vo['value'],'type'=>$vo['type']))}"><i class="fa fa-{$vo.icon}"></i>{$vo.label}</a></li>
  48. {/if}
  49. {/volist}
  50. </ul>
  51. </div>
  52. {/if}
  53. <div class="ibox-content">
  54. <div id="app">
  55. <Alert type="success">如果还没有开通短信账号,可以<a href="{:Url('sms.smsAdmin/index')}" style="color: #0000ff">立即注册</a>
  56. </Alert>
  57. </div>
  58. <div class="p-m m-t-sm" id="configboay">
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </body>
  66. <script>
  67. new Vue({
  68. el : '#app'
  69. });
  70. var $f;
  71. formCreate.formSuccess = function(form,$r){
  72. <?=$form->getSuccessScript()?>
  73. $f.btn.loading(false);
  74. };
  75. (function () {
  76. var create = (function () {
  77. var getRule = function () {
  78. var rule = <?=json_encode($form->getRules())?>;
  79. rule.forEach(function (c) {
  80. if ((c.type == 'cascader' || c.type == 'tree') && Object.prototype.toString.call(c.props.data) == '[object String]') {
  81. if (c.props.data.indexOf('js.') === 0) {
  82. c.props.data = window[c.props.data.replace('js.', '')];
  83. }
  84. }
  85. });
  86. return rule;
  87. }, vm = new Vue,name = 'formBuilderExec<?= !$form->getId() ? '' : '_'.$form->getId() ?>';
  88. var _b = false;
  89. window[name] = function create(el, callback) {
  90. if(_b) return ;
  91. _b = true;
  92. if (!el) el = document.getElementById('configboay');
  93. $f = formCreate.create(getRule(), {
  94. el: el,
  95. form:<?=json_encode($form->getConfig('form'))?>,
  96. row:<?=json_encode($form->getConfig('row'))?>,
  97. submitBtn:<?=$form->isSubmitBtn() ? '{}' : 'false'?>,
  98. resetBtn:<?=$form->isResetBtn() ? 'true' : '{}'?>,
  99. iframeHelper:true,
  100. global:{
  101. upload: {
  102. props:{
  103. onExceededSize: function (file) {
  104. vm.$Message.error(file.name + '超出指定大小限制');
  105. },
  106. onFormatError: function () {
  107. vm.$Message.error(file.name + '格式验证失败');
  108. },
  109. onError: function (error) {
  110. vm.$Message.error(file.name + '上传失败,(' + error + ')');
  111. },
  112. onSuccess: function (res, file) {
  113. if (res.code == 200) {
  114. file.url = res.data.filePath;
  115. } else {
  116. vm.$Message.error(res.msg);
  117. }
  118. },
  119. },
  120. },
  121. },
  122. //表单提交事件
  123. onSubmit: function (formData) {
  124. $f.btn.loading(true);
  125. $.ajax({
  126. url: '<?=$form->getAction()?>',
  127. type: '<?=$form->getMethod()?>',
  128. dataType: 'json',
  129. data: formData,
  130. success: function (res) {
  131. if (res.code == 200) {
  132. vm.$Message.success(res.msg);
  133. $f.btn.loading(false);
  134. formCreate.formSuccess && formCreate.formSuccess(res, $f, formData);
  135. callback && callback(0, res, $f, formData);
  136. location.href = "{:url('sms.smsTemplateApply/index')}";
  137. //TODO 表单提交成功!
  138. } else {
  139. vm.$Message.error(res.msg || '表单提交失败');
  140. $f.btn.loading(false);
  141. callback && callback(1, res, $f, formData);
  142. //TODO 表单提交失败
  143. }
  144. },
  145. error: function () {
  146. vm.$Message.error('表单提交失败');
  147. $f.btn.loading(false);
  148. }
  149. });
  150. }
  151. });
  152. return $f;
  153. };
  154. return window[name];
  155. }());
  156. window.$f = create();
  157. })();
  158. </script>
  159. </html>