%%5E^5EF^5EF8E36D%%interactive_code.html.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <?php /* Smarty version 2.6.17, created on 2018-04-25 15:03:51
  2. compiled from admin/activity/interactive_code.html */ ?>
  3. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  4. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
  5. $this->_tpl_vars = $_smarty_tpl_vars;
  6. unset($_smarty_tpl_vars);
  7. ?>
  8. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  9. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
  10. $this->_tpl_vars = $_smarty_tpl_vars;
  11. unset($_smarty_tpl_vars);
  12. ?>
  13. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  14. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
  15. $this->_tpl_vars = $_smarty_tpl_vars;
  16. unset($_smarty_tpl_vars);
  17. ?>
  18. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  19. $this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
  20. $this->_tpl_vars = $_smarty_tpl_vars;
  21. unset($_smarty_tpl_vars);
  22. ?>
  23. <style>
  24. .set-nav {
  25. margin: 0 auto;
  26. }
  27. .set-nav-hr {
  28. background-color: #ddd;
  29. height: 1px;
  30. position: relative;
  31. }
  32. .form-group label {
  33. font-weight: 600;
  34. }
  35. .checkbox-inline, .radio-inline {
  36. font-weight: 400!important;
  37. }
  38. .rowlabel {
  39. font-weight: 300!important;
  40. }
  41. .music_play_hide {
  42. display:none;
  43. }
  44. </style>
  45. <div id="activity_container">
  46. <form id="activity_form">
  47. <div class="activity_center">
  48. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  49. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
  50. $this->_tpl_vars = $_smarty_tpl_vars;
  51. unset($_smarty_tpl_vars);
  52. ?>
  53. <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  54. ">
  55. <div class="panel panel-default">
  56. <div class="panel-body">
  57. <div class="form-group">
  58. <label>券名称:</label>
  59. <input name="code_name" type="text" class="form-control" value="<?php echo $this->_tpl_vars['events_Data']['events']['code_name']; ?>
  60. ">
  61. </div>
  62. <div class="form-group">
  63. <label>券图片:</label>
  64. <div>
  65. <img id="img_url_tag" src="<?php if ($this->_tpl_vars['events_Data']['events']['code_img_url']): ?><?php echo $this->_tpl_vars['events_Data']['events']['code_img_url']; ?>
  66. <?php else: ?>http://placehold.it/100&text=100x100<?php endif; ?>" style="width:100px;" class="img-thumbnail">
  67. <input id="img_url_input" name="code_img_url" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['code_img_url']; ?>
  68. ">
  69. <input id="image_upload" type="button" value="选择图片" >
  70. </div>
  71. </div>
  72. <div class="form-group">
  73. <label>券数量:</label>
  74. <div>
  75. <?php $this->assign('num', $this->_tpl_vars['codeDataNum']-$this->_tpl_vars['useCodeDataNum']); ?>
  76. 总数: <?php echo $this->_tpl_vars['codeDataNum']; ?>
  77. &nbsp;&nbsp;已发放: <?php echo $this->_tpl_vars['useCodeDataNum']; ?>
  78. &nbsp;&nbsp;剩余: <?php echo $this->_tpl_vars['num']; ?>
  79. &nbsp;&nbsp;
  80. <a href="<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  81. /?c=Admin_Activity_SetInteractive&a=ReqShowEventCode&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  82. ">查看</a>
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <label>添加新券: <small class="text-danger">每次不超过200条,换行分割</small></label>
  87. <div>
  88. <textarea name="code_data" rows="2" class="form-control" style="width:220px;"></textarea>
  89. </div>
  90. </div>
  91. <div class="form-group">
  92. <label>设置表单:</label>
  93. <div>
  94. <table class="custom_from_table table table-condensed">
  95. <thead>
  96. <tr>
  97. <th>名称</th>
  98. <th>类型</th>
  99. <th>最小长度</th>
  100. <th>验证规则</th>
  101. <th>是否必填</th>
  102. </tr>
  103. </thead>
  104. <tbody>
  105. <?php if (! $this->_tpl_vars['events_Data']['events']['forms']): ?>
  106. <tr class="not_input">
  107. <td colspan='6' align="center">没有设置表单</td>
  108. </tr>
  109. <?php else: ?>
  110. <?php $_from = $this->_tpl_vars['events_Data']['events']['forms']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
  111. foreach ($_from as $this->_tpl_vars['form']):
  112. ?>
  113. <?php if ($this->_tpl_vars['form']['type'] == 'text'): ?>
  114. <tr>
  115. <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?>
  116. " class="form-control" /></td>
  117. <td>
  118. <select class="form-control form_select" name="f[0][type]">
  119. <option value="text" selected>单行文本框</option>
  120. <option value="textarea">多行文本框</option>
  121. <option value="select">下拉菜单</option>
  122. </select>
  123. </td>
  124. <td><input name="f[0][rule][size]" type="text" value="<?php echo $this->_tpl_vars['form']['rule']['size']; ?>
  125. " class="form-control" /></td>
  126. <td>
  127. <select class="form-control" name="f[0][rule][regularid]">
  128. <option value="">无规则</option>
  129. <option value="1" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 1): ?>selected<?php endif; ?>>手机验证</option>
  130. <option value="2" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 2): ?>selected<?php endif; ?>>邮箱验证</option>
  131. </select>
  132. </td>
  133. <td>
  134. <input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/>
  135. </td>
  136. </tr>
  137. <?php endif; ?>
  138. <?php if ($this->_tpl_vars['form']['type'] == 'select'): ?>
  139. <tr>
  140. <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?>
  141. " class="form-control"/></td>
  142. <td>
  143. <select class="form_select form-control" name="f[0][type]">
  144. <option value="text">单行文本框</option>
  145. <option value="textarea">多行文本框</option>
  146. <option value="select" selected>下拉菜单</option>
  147. </select>
  148. </td>
  149. <td>
  150. <textarea name="f[0][options]" class="form-control" placeholder=""><?php echo $this->_tpl_vars['form']['options']; ?>
  151. </textarea>
  152. </td>
  153. <td>多个选项换行分隔</td>
  154. <td><input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/></td>
  155. </tr>
  156. <?php endif; ?>
  157. <?php if ($this->_tpl_vars['form']['type'] == 'textarea'): ?>
  158. <tr>
  159. <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?>
  160. " class="form-control"/></td>
  161. <td>
  162. <select class="form_select form-control" name="f[0][type]">
  163. <option value="text">单行文本框</option>
  164. <option value="textarea" selected>多行文本框</option>
  165. <option value="select">下拉菜单</option>
  166. </select>
  167. </td>
  168. <td><input name="f[0][rule][size]" type="text" value="<?php echo $this->_tpl_vars['form']['rule']['size']; ?>
  169. " class="form-control"/></td>
  170. <td>
  171. <select name="f[0][rule][regularid]" class="form-control">
  172. <option value="">无规则</option>
  173. <option value="1" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 1): ?>selected<?php endif; ?>>手机验证</option>
  174. <option value="2" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 2): ?>selected<?php endif; ?>>邮箱验证</option>
  175. </select>
  176. </td>
  177. <td><input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/> </td>
  178. </tr>
  179. <?php endif; ?>
  180. <?php endforeach; endif; unset($_from); ?>
  181. <?php endif; ?>
  182. </tbody>
  183. </table>
  184. <a href="javascript:;" class="addRule js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加表单字段</a>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. <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>
  190. </div>
  191. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  192. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array()));
  193. $this->_tpl_vars = $_smarty_tpl_vars;
  194. unset($_smarty_tpl_vars);
  195. ?>
  196. <div style="clear:both;"></div>
  197. </form>
  198. </div>
  199. <div class="form_select_template" style="display:none;">
  200. <table>
  201. <tr>
  202. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  203. <td>
  204. <select class="form_select form-control" name="f[0][type]">
  205. <option value="text">单行文本框</option>
  206. <option value="textarea">多行文本框</option>
  207. <option value="select" selected>下拉菜单</option>
  208. </select>
  209. </td>
  210. <td>
  211. <textarea name="f[0][options]" class="form-control" placeholder=""></textarea>
  212. </td>
  213. <td>多个选项换行分隔</td>
  214. <td><input name="f[0][required]" type="checkbox" value="1"/></td>
  215. </tr>
  216. </table>
  217. </div>
  218. <div class="form_text_template" style="display:none;">
  219. <table>
  220. <tr>
  221. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  222. <td>
  223. <select class="form_select form-control" name="f[0][type]">
  224. <option value="text" selected>单行文本框</option>
  225. <option value="textarea">多行文本框</option>
  226. <option value="select">下拉菜单</option>
  227. </select>
  228. </td>
  229. <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td>
  230. <td>
  231. <select name="f[0][rule][regularid]" class="form-control">
  232. <option value="">无规则</option>
  233. <option value="1">手机验证</option>
  234. <option value="2">邮箱验证</option>
  235. </select>
  236. </td>
  237. <td><input name="f[0][required]" type="checkbox" value="1"/></td>
  238. </tr>
  239. </table>
  240. </div>
  241. <div class="form_textarea_template" style="display:none;">
  242. <table>
  243. <tr>
  244. <td><input name="f[0][name]" type="text" value="" class="form-control"/></td>
  245. <td>
  246. <select class="form_select form-control" name="f[0][type]">
  247. <option value="text">单行文本框</option>
  248. <option value="textarea" selected>多行文本框</option>
  249. <option value="select">下拉菜单</option>
  250. </select>
  251. </td>
  252. <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td>
  253. <td>
  254. <select name="f[0][rule][regularid]" class="form-control">
  255. <option value="">无规则</option>
  256. <option value="1">手机验证</option>
  257. <option value="2">邮箱验证</option>
  258. </select>
  259. </td>
  260. <td><input name="f[0][required]" type="checkbox" value="1"/> </td>
  261. </tr>
  262. </table>
  263. </div>
  264. <script>
  265. KISSY.use('node, io, event, jquery', function (S, Node, IO, Event, jQuery) {
  266. var $ = S.all;
  267. $('.addRule').on('click', function () {
  268. $(".not_input").hide();
  269. var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true);
  270. $('.custom_from_table tbody').last().after(form_text_template);
  271. });
  272. Event.delegate(document,'change','.form_select',function(e){
  273. var formType = e.target.value;
  274. if (formType == 'select') {
  275. var form_select_template = $('.form_select_template table tbody').last().clone(true, true, true);
  276. $(e.target).parent('tr').replaceWith(form_select_template);
  277. }
  278. if (formType == 'text') {
  279. var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true);
  280. $(e.target).parent('tr').replaceWith(form_text_template);
  281. }
  282. if (formType == 'textarea') {
  283. var form_textarea_template = $('.form_textarea_template table tbody').last().clone(true, true, true);
  284. $(e.target).parent('tr').replaceWith(form_textarea_template);
  285. }
  286. });
  287. var activity_submit_status = false; //按钮状态
  288. function submit_button_active() {
  289. activity_submit_status = true;
  290. $("#activity_submit").addClass('active').all('i').show();
  291. }
  292. function submit_button_default() {
  293. activity_submit_status = false;
  294. $("#activity_submit").removeClass('active').all('i').hide();
  295. }
  296. $("#activity_submit").on('click', function () {
  297. if (activity_submit_status) {
  298. return false;
  299. }
  300. submit_button_active();
  301. jQuery('.custom_from_table tr').each(function (i, item) {
  302. jQuery(item).find('input,select,checkbox,textarea').each(function (j, input) {
  303. input.name = input.name.replace(/\[\d+\]/, '['+ i +']');
  304. });
  305. });
  306. formData = IO.serialize("#activity_form");
  307. new IO({
  308. type: "post"
  309. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqUpCode'
  310. , data: formData
  311. , success: function (data) {
  312. if (data.ok) { //ok
  313. location.href = location.href;
  314. } else {
  315. alert('操作失败,原因:'+data.msg);
  316. location.href = location.href;
  317. }
  318. return false;
  319. }
  320. , error: function (NULL, textStatus) {
  321. alert("请求服务器失败,原因:"+textStatus);
  322. }
  323. , dataType: "json"
  324. });
  325. });
  326. });
  327. //列表默认图
  328. KindEditor.ready(function(K) {
  329. var uploadbutton = K.uploadbutton({
  330. button : K('#image_upload')[0],
  331. fieldName : 'imgFile',
  332. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  333. afterUpload : function(data) {
  334. if (data.error === 0) {
  335. var url = K.formatUrl(data.url, 'absolute');
  336. K('#img_url_input').val(data.url);
  337. K('#img_url_tag').attr('src', data.url);
  338. } else {
  339. alert(data.message);
  340. }
  341. },
  342. afterError : function(str) {
  343. alert('自定义错误信息: ' + str);
  344. }
  345. });
  346. uploadbutton.fileBox.change(function(e) {
  347. uploadbutton.submit();
  348. });
  349. });
  350. </script>
  351. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  352. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
  353. $this->_tpl_vars = $_smarty_tpl_vars;
  354. unset($_smarty_tpl_vars);
  355. ?>