add_event.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <{include file="admin/header.html"}><{include file="admin/nav.html"}>
  2. <{include file="get_kindeditor.html"}>
  3. <div class="container">
  4. <form id="myform" method="post" action="<{$web_cfg.domain}>?c=admin_Lottery&a=AddEvent" enctype="multipart/form-data" >
  5. <table class="table">
  6. <tr>
  7. <td>活动名称:</td>
  8. <td><input type="text" id="events_name" name="events_name" size="50" /></td>
  9. </tr>
  10. <tr>
  11. <td>开始时间:</td>
  12. <td>
  13. <input type="text" id="begin_time" name="begin_time" size="18" value="<{"Y-m-d H:i:s"|date}>" /> 例:<{"Y-m-d H:i:s"|date}>
  14. <input type="hidden" id="begin_unix_time" name="begin_unix_time" value="<{"Y-m-d H:i:s"|date}>" />
  15. </td>
  16. </tr>
  17. <tr>
  18. <td>结束时间:</td>
  19. <td>
  20. <input type="text" id="end_time" name="end_time" size="18" value="<{"Y-m-d H:i:s"|date}>"/>
  21. <input type="hidden" id="end_unix_time" name="end_unix_time" value="<{"Y-m-d H:i:s"|date}>" />
  22. </td>
  23. </tr>
  24. <tr>
  25. <td>活动类型:</td>
  26. <td>
  27. <select name="type" id="type">
  28. <{foreach from=$eventsType key=index item=type}>
  29. <option value="<{$index}>"><{$type.desc}></option>
  30. <{/foreach}>
  31. </select>
  32. </td>
  33. </tr>
  34. <tr>
  35. <td>活动头图:<br>[580*310px]</td>
  36. <td><input type="file" accept="image/jpeg,image/png,image/bmp" name="image" multiple="multiple"></td>
  37. </tr>
  38. <tr>
  39. <td>活动提示:<br>
  40. 注:如拷贝内容,请先粘贴到记事本之后在粘贴到右侧</td>
  41. <td><textarea name="events_tips" id="events_tips" rows="5" cols="40"></textarea></td>
  42. </tr>
  43. <tr>
  44. <td>活动规则:<br>
  45. 注:如拷贝内容,请先粘贴到记事本之后在粘贴到右侧</td>
  46. <td><textarea name="events_rules" id="events_rules" rows="5" cols="40"></textarea></td>
  47. </tr>
  48. </table>
  49. <input type="submit" id="ti_sut" value="创建活动">
  50. </form>
  51. </div>
  52. <br>
  53. <script type="text/javascript">
  54. var ROOT_DOMAIN = '<{$web_cfg.domain}>';
  55. KindEditor.ready(function(K) {
  56. var editor_events_rules = K.create('textarea[name=events_rules]', {
  57. themeType:'simple',
  58. items:[
  59. 'source','image', 'multiimage'
  60. ],
  61. allowFileManager : true,
  62. uploadJson : ROOT_DOMAIN + '/?c=kindeditor&a=updateJson',
  63. fileManagerJson : ROOT_DOMAIN + '/?c=kindeditor&a=fileManagerJson'
  64. });
  65. var editor_events_tips = K.create('textarea[name=events_tips]', {
  66. allowFileManager : true,
  67. items:[
  68. 'source','image', 'multiimage'
  69. ],
  70. uploadJson : ROOT_DOMAIN + '/?c=kindeditor&a=updateJson',
  71. fileManagerJson : ROOT_DOMAIN + '/?c=kindeditor&a=fileManagerJson'
  72. });
  73. });
  74. KISSY.use("node, io, json,jquery", function(S, Node, IO, JSON, jQuery){
  75. $('#ti_sut').click(function(){
  76. var events_name = $('#events_name').val();
  77. var begin_time = $('#begin_time').val();
  78. var end_time = $('#end_time').val();
  79. if (events_name == '' || begin_time == '' || end_time == '') {
  80. alert('活动信息填写有误');
  81. return;
  82. }
  83. var begin_date = js_strto_time(begin_time);
  84. var end_date = js_strto_time(end_time);
  85. $('#begin_unix_time').val(begin_date);
  86. $('#end_unix_time').val(end_date);
  87. if(begin_date > end_date){
  88. alert('活动时间填写错误');
  89. return;
  90. }
  91. var type = $('#type').val();
  92. if(type==0){
  93. alert('请选择活动类型');
  94. return ;
  95. }
  96. });
  97. //判断正整数
  98. function forcheck(ss){
  99. var type = "^[0-9]*[1-9][0-9]*$";
  100. var re = new RegExp(type);
  101. if (ss.match(re) == null) {
  102. return false;
  103. }
  104. return true;
  105. }
  106. // 日期转换时间戳
  107. function js_strto_time(str_time){
  108. str_time = str_time.trim();
  109. var new_str = str_time.replace(/:/g, '-');
  110. new_str = new_str.replace(/ /g, '-');
  111. var arr = new_str.split("-");
  112. var datum = new Date(Date.UTC(arr[0], arr[1] - 1, arr[2], arr[3] - 8, arr[4], arr[5]));
  113. return strtotime = datum.getTime() / 1000;
  114. }
  115. String.prototype.trim = function() {
  116. return (this.replace(/^\s+|\s+$/g,""));
  117. }
  118. });
  119. </script>
  120. <{include file="admin/bottom.html"}>