up_event.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <{include file="admin/header.html"}>
  2. <{include file="admin/nav.html"}>
  3. <{include file="get_kindeditor.html"}>
  4. <div class="container">
  5. <form id="myform" method="post" action="<{$web_cfg.domain}>?c=admin_Lottery&a=UpEvent" enctype="multipart/form-data" >
  6. <table class="table">
  7. <input type="hidden" name="events_id" value="<{$events_Data.id}>">
  8. <tr>
  9. <td>活动名称:</td>
  10. <td><input type="text" id="events_name" name="events_name" value="<{$events_Data.events_name}>" size="50" /></td>
  11. </tr>
  12. <tr>
  13. <td>活动状态: </td>
  14. <td>
  15. <{if time()<$events_Data.begin_time}>
  16. <span style="color: #5151A2;">[未开始]</span>
  17. <{/if}>
  18. <{if time() > $events_Data.begin_time && time() < $events_Data.end_time}>
  19. <span style="color: #00EC00;">[进行中]</span>
  20. <{/if}>
  21. <{if time() > $events_Data.end_time}>
  22. <span style="color: red;">[结束]</span>
  23. <{/if}>
  24. </td>
  25. </tr>
  26. <tr>
  27. <td>开始时间:</td>
  28. <td>
  29. <input type="text" id="begin_time" name="begin_time" size="18" value="<{"Y-m-d H:i:s"|date:$events_Data.begin_time}>"/> 例:<{"Y-m-d H:i:s"|date}>
  30. <input type="hidden" id="begin_unix_time" name="begin_unix_time" />
  31. </td>
  32. </tr>
  33. <tr>
  34. <td>结束时间:</td>
  35. <td>
  36. <input type="text" id="end_time" name="end_time" value="<{"Y-m-d H:i:s"|date:$events_Data.end_time}>" size="18" />
  37. <input type="hidden" id="end_unix_time" name="end_unix_time" />
  38. </td>
  39. </tr>
  40. <tr>
  41. <td>奖品领取结束时间:</td>
  42. <td>
  43. <input type="text" id="end_time_receive_prizes" name="end_time_receive_prizes" value="<{if $events_Data.end_time_receive_prizes}><{"Y-m-d H:i:s"|date:$events_Data.end_time_receive_prizes}><{/if}>" size="18" />
  44. <input type="hidden" id="end_unix_time_receive_prizes" name="end_unix_time_receive_prizes" />
  45. </td>
  46. </tr>
  47. <tr>
  48. <td>活动类型:</td>
  49. <td>
  50. <input type="hidden" name="type" value="<{$events_Data.type}>"/>
  51. <{$eventsType[$events_Data.type].desc}>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td>活动显示状态:</td>
  56. <td>
  57. <{foreach from=$eventsDisplayStatus key=index item=display}>
  58. <{$display.desc}>:<input name="display" type="radio" value="<{$index}>" <{if $index==$events_Data.display}> checked <{/if}> />&nbsp;&nbsp;
  59. <{/foreach}>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td>活动发货状态:</td>
  64. <td>
  65. <{foreach from=$deliveryType key=index item=delivery}>
  66. <{$delivery.desc}>:<input name="delivery" type="radio" value="<{$index}>" <{if $index==$events_Data.delivery}> checked <{/if}> />&nbsp;&nbsp;
  67. <{/foreach}>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>活动授权参与:</td>
  72. <td>
  73. <{foreach from=$eventsAuthorize key=index item=authorize}>
  74. <{$authorize.desc}>:<input name="authorize" type="radio" value="<{$index}>" <{if $index==$events_Data.authorize}> checked <{/if}> />&nbsp;&nbsp;
  75. <{/foreach}>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td>活动头图:<br>[580*310px]</td>
  80. <td>
  81. <img src="<{$events_Data.img_url}>"></img>
  82. <input type="hidden" name='old_img_url' value="<{$events_Data.img_url}>" >
  83. <input type="file" accept="image/jpeg,image/png,image/bmp" name="image" multiple="multiple">
  84. </td>
  85. </tr>
  86. <tr>
  87. <td>活动提示:<br>
  88. 注:如拷贝内容,请先粘贴到记事本之后在粘贴到右侧
  89. </td>
  90. <td><textarea name="events_tips" id="events_tips"><{$events_Data.events_tips}></textarea></td>
  91. </tr>
  92. <tr>
  93. <td>活动操作提示语:</td>
  94. <td><input type="text" id="operationt_tips" name="operationt_tips" value="<{$events_Data.operationt_tips}>" size="50" /></td>
  95. </tr>
  96. <tr>
  97. <td>活动规则:<br>
  98. 注:如拷贝内容,请先粘贴到记事本之后在粘贴到右侧<br>
  99. 活动规则里的标题HTML代码示例:
  100. <pre style="font-size: 11px;padding: 2px;">&lt;div class=&quot;ac_title_com_line&quot;&gt;&lt;span&gt;活动规则&lt;/span&gt;&lt;/div&gt;</pre>
  101. </td>
  102. <td><textarea name="events_rules" id="events_rules"><{$events_Data.events_rules}></textarea></td>
  103. </tr>
  104. <{*领码*}>
  105. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_CODE'}>
  106. <tr style="display: none;">
  107. <td>二维码输出:</td>
  108. <td>
  109. <{foreach from=$eventsTwoDimensionalCodeType key=index item=codeType}>
  110. <{$codeType.desc}>:<input name="two_dimensional_code" type="radio" value="<{$index}>" <{if $index==$events_Data.two_dimensional_code}> checked <{/if}> />&nbsp;&nbsp;
  111. <{/foreach}>
  112. </td>
  113. </tr>
  114. <tr>
  115. <td>券名称:</td>
  116. <td>
  117. <input type="text" id="code_name" name="code_name" value="<{$events_Data.code_name}>" size="50" />
  118. </td>
  119. </tr>
  120. <tr>
  121. <td>券图片:<br>我的礼品中显示的图片</td>
  122. <td>
  123. <img src="<{$events_Data.code_img_url}>"></img>
  124. <input type="hidden" name='code_old_img_url' value="<{$events_Data.code_img_url}>" >
  125. <input type="file" accept="image/jpeg,image/png,image/bmp" name="code_image" multiple="multiple">
  126. </td>
  127. </tr>
  128. <tr>
  129. <td>允许每天用户参与次数:<br>注:0 不限制</td>
  130. <td><input name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>"></td>
  131. </tr>
  132. <tr>
  133. <td>允许每天IP参与次数:<br>注:0 不限制</td>
  134. <td><input name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>"></td>
  135. </tr>
  136. <tr>
  137. <td>允许用户获奖次数:<br>注:0 不限制</td>
  138. <td><input name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>"></td>
  139. </tr>
  140. <tr>
  141. <td>允许用户参与次数:<br>注:0 不限制</td>
  142. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  143. </tr>
  144. <{/if}>
  145. <{*试用*}>
  146. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_TRY'}>
  147. <input type="hidden" name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>">
  148. <input type="hidden" name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>">
  149. <input type="hidden" name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>">
  150. <tr>
  151. <td>允许用户参与次数:<br>注:0 不限制</td>
  152. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  153. </tr>
  154. <{/if}>
  155. <{*邀请涵*}>
  156. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_INVITATION'}>
  157. <input type="hidden" name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>">
  158. <input type="hidden" name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>">
  159. <input type="hidden" name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>">
  160. <tr>
  161. <td>允许用户参与次数:<br>注:0 不限制</td>
  162. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  163. </tr>
  164. <tr>
  165. <td>白名单:<br>注:@分割</td>
  166. <td><textarea id="invitation_white_list" name="invitation_white_list"><{"@"|join:$events_Data.invitation_white_list}></textarea></td>
  167. </tr>
  168. <tr>
  169. <td>最大上线参与人数:<br>注:0 不限制</td>
  170. <td>
  171. <input name="participation_user_max_num" id="participation_user_max_num" value="<{if $events_Data.participation_user_max_num}><{$events_Data.participation_user_max_num}><{else}>0<{/if}>">
  172. </tr>
  173. <{/if}>
  174. <{*投票*}>
  175. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_VOTE'}>
  176. <tr>
  177. <td>允许每天用户参与次数:<br>注:0 不限制</td>
  178. <td><input name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>"></td>
  179. </tr>
  180. <tr>
  181. <td>允许每天IP参与次数:<br>注:0 不限制</td>
  182. <td><input name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>"></td>
  183. </tr>
  184. <tr>
  185. <td>允许用户参与次数:<br>注:0 不限制</td>
  186. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  187. </tr>
  188. <input type="hidden" name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>">
  189. <{/if}>
  190. <{*收集字母*}>
  191. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_LETTERS'}>
  192. <tr>
  193. <td>允许每天用户参与次数:<br>注:0 不限制</td>
  194. <td><input name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>"></td>
  195. </tr>
  196. <tr>
  197. <td>允许每天IP参与次数:<br>注:0 不限制</td>
  198. <td><input name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>"></td>
  199. </tr>
  200. <tr>
  201. <td>允许用户获奖次数:<br>注:0 不限制</td>
  202. <td><input name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>"></td>
  203. </tr>
  204. <tr>
  205. <td>允许用户参与次数:<br>注:0 不限制</td>
  206. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  207. </tr>
  208. <{/if}>
  209. <{*刮刮卡*}>
  210. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_SCRATCH'}>
  211. <tr>
  212. <td>允许每天用户参与次数:<br>注:0 不限制</td>
  213. <td><input name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>"></td>
  214. </tr>
  215. <tr>
  216. <td>允许每天IP参与次数:<br>注:0 不限制</td>
  217. <td><input name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>"></td>
  218. </tr>
  219. <tr>
  220. <td>允许用户获奖次数:<br>注:0 不限制</td>
  221. <td><input name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>"></td>
  222. </tr>
  223. <tr>
  224. <td>允许用户参与次数:<br>注:0 不限制</td>
  225. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  226. </tr>
  227. <{/if}>
  228. <{*大转盘*}>
  229. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_TURNTABLE'}>
  230. <tr>
  231. <td>允许每天用户参与次数:<br>注:0 不限制</td>
  232. <td><input name="participation_user_num" id="participation_user_num" value="<{$events_Data.participation_user_num}>"></td>
  233. </tr>
  234. <tr>
  235. <td>允许每天IP参与次数:<br>注:0 不限制</td>
  236. <td><input name="participation_ip_num" id="participation_ip_num" value="<{$events_Data.participation_ip_num}>"></td>
  237. </tr>
  238. <tr>
  239. <td>允许用户获奖次数:<br>注:0 不限制</td>
  240. <td><input name="winning_user_num" id="winning_user_num" value="<{$events_Data.winning_user_num}>"></td>
  241. </tr>
  242. <tr>
  243. <td>允许用户参与次数:<br>注:0 不限制</td>
  244. <td><input name="participation_user_all_num" id="participation_user_all_num" value="<{$events_Data.participation_user_all_num}>"></td>
  245. </tr>
  246. <{/if}>
  247. <{*其他*}>
  248. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_OTHER'}>
  249. <tr>
  250. <td>跳转URL:</td>
  251. <td><input name="other_url" id="other_url" value="<{$events_Data.other_url}>"></td>
  252. </tr>
  253. <{/if}>
  254. <{*自定义表单*}>
  255. <{if $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_TRY'
  256. || $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_INVITATION'
  257. || $eventsType[$events_Data.type].kw == 'TYPE_EVENTS_CODE'
  258. }>
  259. <tr>
  260. <td>自定义表单: </td>
  261. <td>
  262. <table class="custom_from_table table">
  263. <tr>
  264. <th>名称</th>
  265. <th>类型</th>
  266. <th>最小长度</th>
  267. <th>验证规则</th>
  268. <th>是否必填</th>
  269. </tr>
  270. <{if $events_Data.forms}>
  271. <{foreach from=$events_Data.forms item=form}>
  272. <{if $form.type != 'select'}>
  273. <tr>
  274. <td><input name="f[0][name]" type="text" value="<{$form.name}>" /></td>
  275. <td>
  276. <select class="form_select" name="f[0][type]">
  277. <option value="text" <{if $form.type == 'text'}>selected<{/if}>>单行文本框</option>
  278. <option value="textarea" <{if $form.type == 'textarea'}>selected<{/if}>>多行文本框</option>
  279. <option value="select" <{if $form.type == 'select'}>selected<{/if}>>下拉菜单</option>
  280. </select>
  281. </td>
  282. <td><input name="f[0][rule][size]" type="text" value="<{$form.rule.size}>" /></td>
  283. <td>
  284. <select name="f[0][rule][regularid]">
  285. <option value="">无规则</option>
  286. <{foreach from=$formRegular item=item key=regularid}>
  287. <option value="<{$regularid}>" <{if $form.rule.regularid == $regularid}>selected="selected"<{/if}>><{$item.desc}></option>
  288. <{/foreach}>
  289. </select>
  290. </td>
  291. <td><input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}> /> </td>
  292. </tr>
  293. <{else}>
  294. <tr>
  295. <td><input name="f[0][name]" type="text" value="<{$form.name}>" /></td>
  296. <td>
  297. <select class="form_select" name="f[0][type]">
  298. <option value="text" <{if $form.type == 'text'}>selected<{/if}>>单行文本框</option>
  299. <option value="textarea" <{if $form.type == 'textarea'}>selected<{/if}>>多行文本框</option>
  300. <option value="select" <{if $form.type == 'select'}>selected<{/if}>>下拉菜单</option>
  301. </select>
  302. </td>
  303. <td>
  304. <textarea name="f[0][options]" class="form-control" placeholder=""><{$form.options}></textarea>
  305. </td>
  306. <td>多个选项换行分隔</td>
  307. <td><input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}> /> </td>
  308. </tr>
  309. <{/if}>
  310. <{/foreach}>
  311. <{else}>
  312. <tr>
  313. <td><input name="f[0][name]" type="text" value="" /></td>
  314. <td>
  315. <select class="form_select" name="f[0][type]">
  316. <option value="text">单行文本框</option>
  317. <option value="textarea">多行文本框</option>
  318. <option value="select">下拉菜单</option>
  319. </select>
  320. </td>
  321. <td><input name="f[0][rule][size]" type="text" value="" /></td>
  322. <td>
  323. <select name="f[0][rule][regularid]">
  324. <option value="">无规则</option>
  325. <{foreach from=$formRegular item=item key=regularid}>
  326. <option value="<{$regularid}>"><{$item.desc}></option>
  327. <{/foreach}>
  328. </select>
  329. </td>
  330. <td><input name="f[0][required]" type="checkbox" value="1" /> </td>
  331. </tr>
  332. <{/if}>
  333. </table>
  334. <a href="javascript:;" class="btn btn-primary btn-xs addRule">增加</a>
  335. </td>
  336. </tr>
  337. <{/if}>
  338. <{*/自定义表单*}>
  339. <{*微信分享*}>
  340. <tr>
  341. <td>微信分享设置:<br>
  342. </td>
  343. <td>
  344. <label>本活动不允许分享:<input name="weixinShare_notAllow" type="checkbox" <{if $events_Data.weixinShare.notAllow}>checked="checked"<{/if}> value="1"/></label>
  345. <table class="table">
  346. <tr>
  347. <td>标题</td>
  348. <td><input name="weixinShare_title" type="text" value="<{$events_Data.weixinShare.title}>" class="form-control"/></td>
  349. </tr>
  350. <tr>
  351. <td>内容</td>
  352. <td><textarea name="weixinShare_content" class="form-control" ><{$events_Data.weixinShare.content}></textarea></td>
  353. </tr>
  354. <tr>
  355. <td>图片</td>
  356. <td>
  357. <{if $events_Data.weixinShare.imgUrl}><img src="<{$events_Data.weixinShare.imgUrl}>" style="width:100px;" /><{/if}>
  358. <input name="weixinShare_imgUrl" type="hidden" value="<{$events_Data.weixinShare.imgUrl}>" />
  359. <input type="file" accept="image/jpeg,image/png,image/bmp" name="weixinShareImg" multiple="multiple">
  360. </td>
  361. </tr>
  362. </table>
  363. </td>
  364. </tr>
  365. <{*/微信分享*}>
  366. </table>
  367. <input type="submit" id="ti_sut" value="修改活动">
  368. </form>
  369. </div>
  370. <br>
  371. <div class="form_select_template" style="display:none;">
  372. <table>
  373. <tr>
  374. <td><input name="f[0][name]" type="text" value="" /></td>
  375. <td>
  376. <select class="form_select" name="f[0][type]">
  377. <option value="text">单行文本框</option>
  378. <option value="textarea">多行文本框</option>
  379. <option value="select" selected>下拉菜单</option>
  380. </select>
  381. </td>
  382. <td>
  383. <textarea name="f[0][options]" class="form-control" placeholder=""></textarea>
  384. </td>
  385. <td>多个选项换行分隔</td>
  386. <td><input name="f[0][required]" type="checkbox" value="1" /> </td>
  387. </tr>
  388. </table>
  389. </div>
  390. <div class="form_text_template" style="display:none;">
  391. <table>
  392. <tr>
  393. <td><input name="f[0][name]" type="text" value="" /></td>
  394. <td>
  395. <select class="form_select" name="f[0][type]">
  396. <option value="text" selected>单行文本框</option>
  397. <option value="textarea">多行文本框</option>
  398. <option value="select">下拉菜单</option>
  399. </select>
  400. </td>
  401. <td><input name="f[0][rule][size]" type="text" value="" /></td>
  402. <td>
  403. <select name="f[0][rule][regularid]">
  404. <option value="">无规则</option>
  405. <{foreach from=$formRegular item=item key=regularid}>
  406. <option value="<{$regularid}>"><{$item.desc}></option>
  407. <{/foreach}>
  408. </select>
  409. </td>
  410. <td><input name="f[0][required]" type="checkbox" value="1" /> </td>
  411. </tr>
  412. </table>
  413. </div>
  414. <div class="form_textarea_template" style="display:none;">
  415. <table>
  416. <tr>
  417. <td><input name="f[0][name]" type="text" value="" /></td>
  418. <td>
  419. <select class="form_select" name="f[0][type]">
  420. <option value="text">单行文本框</option>
  421. <option value="textarea" selected>多行文本框</option>
  422. <option value="select">下拉菜单</option>
  423. </select>
  424. </td>
  425. <td><input name="f[0][rule][size]" type="text" value="" /></td>
  426. <td>
  427. <select name="f[0][rule][regularid]">
  428. <option value="">无规则</option>
  429. <{foreach from=$formRegular item=item key=regularid}>
  430. <option value="<{$regularid}>"><{$item.desc}></option>
  431. <{/foreach}>
  432. </select>
  433. </td>
  434. <td><input name="f[0][required]" type="checkbox" value="1" /> </td>
  435. </tr>
  436. </table>
  437. </div>
  438. <script type="text/javascript">
  439. var ROOT_DOMAIN = '<{$web_cfg.domain}>';
  440. KindEditor.ready(function(K) {
  441. var editor_events_rules = K.create('textarea[name=events_rules]', {
  442. themeType:'simple',
  443. items:[
  444. 'source','image', 'multiimage'
  445. ],
  446. allowFileManager : true,
  447. uploadJson : ROOT_DOMAIN + '/?c=kindeditor&a=updateJson',
  448. fileManagerJson : ROOT_DOMAIN + '/?c=kindeditor&a=fileManagerJson'
  449. });
  450. var editor_events_tips = K.create('textarea[name=events_tips]', {
  451. allowFileManager : true,
  452. items:[
  453. 'source','image', 'multiimage'
  454. ],
  455. uploadJson : ROOT_DOMAIN + '/?c=kindeditor&a=updateJson',
  456. fileManagerJson : ROOT_DOMAIN + '/?c=kindeditor&a=fileManagerJson'
  457. });
  458. });
  459. KISSY.use("node, io, json,jquery", function(S, Node, IO, JSON, jQuery){
  460. $('#ti_sut').click(function(){
  461. $('.custom_from_table tr').each(function (i, item) {
  462. $(item).find('input,select,checkbox,textarea').each(function (j, input) {
  463. input.name = input.name.replace(/\[\d+\]/, '['+ i +']');
  464. });
  465. });
  466. var events_name = $('#events_name').val();
  467. var begin_time = $('#begin_time').val();
  468. var end_time = $('#end_time').val();
  469. var end_time_receive_prizes = $('#end_time_receive_prizes').val();
  470. if (events_name == '' || begin_time == '' || end_time == '') {
  471. alert('活动信息填写有误');
  472. return;
  473. }
  474. var begin_date = js_strto_time(begin_time);
  475. var end_date = js_strto_time(end_time);
  476. var end_unix_time_receive_prizes = '';
  477. if(end_time_receive_prizes){
  478. end_unix_time_receive_prizes = js_strto_time(end_time_receive_prizes);
  479. }
  480. $('#begin_unix_time').val(begin_date);
  481. $('#end_unix_time').val(end_date);
  482. $('#end_unix_time_receive_prizes').val(end_unix_time_receive_prizes);
  483. if(begin_date > end_date){
  484. alert('活动时间填写错误');
  485. return;
  486. }
  487. });
  488. $(".form_select").live('change', function () {
  489. var formType = $(this).val();
  490. console.log(formType);
  491. if (formType == 'select') {
  492. var form_select_template = $('.form_select_template tr:last').clone();
  493. $(this).parent().parent().replaceWith(form_select_template);
  494. }
  495. if (formType == 'text') {
  496. var form_select_template = $('.form_text_template tr:last').clone();
  497. $(this).parent().parent().replaceWith(form_select_template);
  498. }
  499. if (formType == 'textarea') {
  500. var form_select_template = $('.form_textarea_template tr:last').clone();
  501. $(this).parent().parent().replaceWith(form_select_template);
  502. }
  503. });
  504. $('.addRule').click(function () {
  505. var rule_template = $('.custom_from_table tr:last').clone();
  506. rule_template.find('input,select').val('');
  507. rule_template.find('input[name=required]').attr('checked', false);
  508. $('.custom_from_table tr:last').after(rule_template);
  509. });
  510. //判断正整数
  511. function forcheck(ss){
  512. var type = "^[0-9]*[1-9][0-9]*$";
  513. var re = new RegExp(type);
  514. if (ss.match(re) == null) {
  515. return false;
  516. }
  517. return true;
  518. }
  519. // 日期转换时间戳
  520. function js_strto_time(str_time){
  521. str_time = str_time.trim();
  522. var new_str = str_time.replace(/:/g, '-');
  523. new_str = new_str.replace(/ /g, '-');
  524. var arr = new_str.split("-");
  525. var datum = new Date(Date.UTC(arr[0], arr[1] - 1, arr[2], arr[3] - 8, arr[4], arr[5]));
  526. return strtotime = datum.getTime() / 1000;
  527. }
  528. String.prototype.trim = function() {
  529. return (this.replace(/^\s+|\s+$/g,""));
  530. }
  531. });
  532. </script>
  533. <{include file="admin/bottom.html"}>