interactive_input.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <{include file="./admin/header.html"}>
  2. <{include file="./admin/left.html"}>
  3. <{include file="./admin/nav.html"}>
  4. <{include file="get_kindeditor.html"}>
  5. <style>
  6. .set-nav {
  7. margin: 0 auto;
  8. }
  9. .set-nav-hr {
  10. background-color: #ddd;
  11. height: 1px;
  12. position: relative;
  13. }
  14. .form-group label {
  15. font-weight: 600;
  16. }
  17. .checkbox-inline, .radio-inline {
  18. font-weight: 400!important;
  19. }
  20. .rowlabel {
  21. font-weight: 300!important;
  22. }
  23. .music_play_hide {
  24. display:none;
  25. }
  26. </style>
  27. <div id="activity_container">
  28. <form id="activity_form">
  29. <div class="activity_center">
  30. <{include file="./admin/activity/common_nav.html"}>
  31. <input name="events_id" type="hidden" value="<{$events_Data.events.id}>">
  32. <div class="panel panel-default">
  33. <div class="panel-heading">
  34. <h3 class="panel-title" id="panel-title">设置表单</h3>
  35. </div>
  36. <div class="panel-body">
  37. <div class="form-group">
  38. <div>
  39. <table class="custom_from_table table table-condensed">
  40. <thead>
  41. <tr>
  42. <th>名称</th>
  43. <th>类型</th>
  44. <th>最小长度</th>
  45. <th>验证规则</th>
  46. <th>是否必填</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. <{if !$events_Data.events.forms}>
  51. <tr class="not_input">
  52. <td colspan='6' align="center">没有设置表单</td>
  53. </tr>
  54. <{else}>
  55. <{foreach from=$events_Data.events.forms item=form}>
  56. <{if $form.type == 'text'}>
  57. <tr>
  58. <td><input name="f[0][name]" type="text" value="<{$form.name}>" class="form-control" /></td>
  59. <td>
  60. <select class="form-control form_select" name="f[0][type]">
  61. <option value="text" selected>单行文本框</option>
  62. <option value="textarea">多行文本框</option>
  63. <option value="select">下拉菜单</option>
  64. </select>
  65. </td>
  66. <td><input name="f[0][rule][size]" type="text" value="<{$form.rule.size}>" class="form-control" /></td>
  67. <td>
  68. <select class="form-control" name="f[0][rule][regularid]">
  69. <option value="">无规则</option>
  70. <option value="1" <{if $form.rule.regularid == 1}>selected<{/if}>>手机验证</option>
  71. <option value="2" <{if $form.rule.regularid == 2}>selected<{/if}>>邮箱验证</option>
  72. </select>
  73. </td>
  74. <td>
  75. <input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}>/>
  76. </td>
  77. </tr>
  78. <{/if}>
  79. <{if $form.type == 'select'}>
  80. <tr>
  81. <td><input name="f[0][name]" type="text" value="<{$form.name}>" class="form-control"/></td>
  82. <td>
  83. <select class="form_select form-control" name="f[0][type]">
  84. <option value="text">单行文本框</option>
  85. <option value="textarea">多行文本框</option>
  86. <option value="select" selected>下拉菜单</option>
  87. </select>
  88. </td>
  89. <td>
  90. <textarea name="f[0][options]" class="form-control" placeholder=""><{$form.options}></textarea>
  91. </td>
  92. <td>多个选项换行分隔</td>
  93. <td><input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}>/></td>
  94. </tr>
  95. <{/if}>
  96. <{if $form.type == 'textarea'}>
  97. <tr>
  98. <td><input name="f[0][name]" type="text" value="<{$form.name}>" class="form-control"/></td>
  99. <td>
  100. <select class="form_select form-control" name="f[0][type]">
  101. <option value="text">单行文本框</option>
  102. <option value="textarea" selected>多行文本框</option>
  103. <option value="select">下拉菜单</option>
  104. </select>
  105. </td>
  106. <td><input name="f[0][rule][size]" type="text" value="<{$form.rule.size}>" class="form-control"/></td>
  107. <td>
  108. <select name="f[0][rule][regularid]" class="form-control">
  109. <option value="">无规则</option>
  110. <option value="1" <{if $form.rule.regularid == 1}>selected<{/if}>>手机验证</option>
  111. <option value="2" <{if $form.rule.regularid == 2}>selected<{/if}>>邮箱验证</option>
  112. </select>
  113. </td>
  114. <td><input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}>/> </td>
  115. </tr>
  116. <{/if}>
  117. <{/foreach}>
  118. <{/if}>
  119. </tbody>
  120. </table>
  121. <a href="javascript:;" class="addRule js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加表单字段</a>
  122. </div>
  123. </div>
  124. <a id="activity_submit" href="javascript:;" class="button button-3d button-primary button-rounded"><i class="fa fa-refresh fa-spin" style="display:none;"></i> 保存设置</a>
  125. <{if $typ}>
  126. <div style="text-align:right;">
  127. <a href="?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<{$events_Data.events.id}>" >返回互动设置</a>
  128. </div>
  129. <{/if}>
  130. </div>
  131. </div>
  132. </div>
  133. <{include file="./admin/activity/common_right.html"}>
  134. <div style="clear:both;"></div>
  135. </form>
  136. </div>
  137. <div class="form_select_template" style="display:none;">
  138. <table>
  139. <tr>
  140. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  141. <td>
  142. <select class="form_select form-control" name="f[0][type]">
  143. <option value="text">单行文本框</option>
  144. <option value="textarea">多行文本框</option>
  145. <option value="select" selected>下拉菜单</option>
  146. </select>
  147. </td>
  148. <td>
  149. <textarea name="f[0][options]" class="form-control" placeholder=""></textarea>
  150. </td>
  151. <td>多个选项换行分隔</td>
  152. <td><input name="f[0][required]" type="checkbox" value="1"/></td>
  153. </tr>
  154. </table>
  155. </div>
  156. <div class="form_text_template" style="display:none;">
  157. <table>
  158. <tr>
  159. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  160. <td>
  161. <select class="form_select form-control" name="f[0][type]">
  162. <option value="text" selected>单行文本框</option>
  163. <option value="textarea">多行文本框</option>
  164. <option value="select">下拉菜单</option>
  165. </select>
  166. </td>
  167. <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td>
  168. <td>
  169. <select name="f[0][rule][regularid]" class="form-control">
  170. <option value="">无规则</option>
  171. <option value="1">手机验证</option>
  172. <option value="2">邮箱验证</option>
  173. </select>
  174. </td>
  175. <td><input name="f[0][required]" type="checkbox" value="1"/></td>
  176. </tr>
  177. </table>
  178. </div>
  179. <div class="form_textarea_template" style="display:none;">
  180. <table>
  181. <tr>
  182. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  183. <td>
  184. <select class="form_select form-control" name="f[0][type]">
  185. <option value="text">单行文本框</option>
  186. <option value="textarea" selected>多行文本框</option>
  187. <option value="select">下拉菜单</option>
  188. </select>
  189. </td>
  190. <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td>
  191. <td>
  192. <select name="f[0][rule][regularid]" class="form-control">
  193. <option value="">无规则</option>
  194. <option value="1">手机验证</option>
  195. <option value="2">邮箱验证</option>
  196. </select>
  197. </td>
  198. <td><input name="f[0][required]" type="checkbox" value="1"/> </td>
  199. </tr>
  200. </table>
  201. </div>
  202. <script>
  203. KISSY.use('node, io, event, jquery', function (S, Node, IO, Event, jQuery) {
  204. var $ = S.all;
  205. $('.addRule').on('click', function () {
  206. $(".not_input").hide();
  207. var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true);
  208. $('.custom_from_table tbody').last().after(form_text_template);
  209. });
  210. Event.delegate(document,'change','.form_select',function(e){
  211. var formType = e.target.value;
  212. if (formType == 'select') {
  213. var form_select_template = $('.form_select_template table tbody').last().clone(true, true, true);
  214. $(e.target).parent('tr').replaceWith(form_select_template);
  215. }
  216. if (formType == 'text') {
  217. var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true);
  218. $(e.target).parent('tr').replaceWith(form_text_template);
  219. }
  220. if (formType == 'textarea') {
  221. var form_textarea_template = $('.form_textarea_template table tbody').last().clone(true, true, true);
  222. $(e.target).parent('tr').replaceWith(form_textarea_template);
  223. }
  224. });
  225. var activity_submit_status = false; //按钮状态
  226. function submit_button_active() {
  227. activity_submit_status = true;
  228. $("#activity_submit").addClass('active').all('i').show();
  229. }
  230. function submit_button_default() {
  231. activity_submit_status = false;
  232. $("#activity_submit").removeClass('active').all('i').hide();
  233. }
  234. $("#activity_submit").on('click', function () {
  235. if (activity_submit_status) {
  236. return false;
  237. }
  238. submit_button_active();
  239. jQuery('.custom_from_table tr').each(function (i, item) {
  240. jQuery(item).find('input,select,checkbox,textarea').each(function (j, input) {
  241. input.name = input.name.replace(/\[\d+\]/, '['+ i +']');
  242. });
  243. });
  244. formData = IO.serialize("#activity_form");
  245. new IO({
  246. type: "post"
  247. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqUpForm'
  248. , data: formData
  249. , success: function (data) {
  250. if (data.ok) { //ok
  251. var url = data.msg;
  252. alert('保存成功');
  253. location.reload();
  254. } else {
  255. alert('操作失败,原因:'+data.msg);
  256. }
  257. return false;
  258. }
  259. , error: function (NULL, textStatus) {
  260. alert("请求服务器失败,原因:"+textStatus);
  261. }
  262. , dataType: "json"
  263. });
  264. });
  265. });
  266. </script>
  267. <{include file="./admin/bottom.html"}>