interactive_add_one_vote.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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="form-group">
  33. <label class="control-label rowlabel">投票项标题:</label>
  34. <input name="title" type="text" value="" class="form-control"/>
  35. </div>
  36. <{if $events_Data.events.vote_type == 2}>
  37. <div class="form-group">
  38. <label class="control-label rowlabel">图片:<small class="text-danger">(JPG、PNG,290x(高>290,统一固定图片高度),小于20k)</small></label>
  39. <div>
  40. <img id="img_url_tag" src="http://placehold.it/200&text=290x(>290)" style="width:100px;" class="img-thumbnail">
  41. <input id="img_url_input" name="img_url" type="hidden" value="">
  42. <input id="image_upload" type="button" value="选择图片" >
  43. </div>
  44. </div>
  45. <{/if}>
  46. <div class="form-group">
  47. <label class="control-label rowlabel">作弊数:</label>
  48. <input name="add_num" type="text" value="0" class="form-control" style="width:100px;"/>
  49. </div>
  50. <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>
  51. </div>
  52. <{include file="./admin/activity/common_right.html"}>
  53. <div style="clear:both;"></div>
  54. </form>
  55. </div>
  56. <script>
  57. KISSY.use('node, io', function (S, Node, IO) {
  58. var $ = S.all;
  59. var activity_submit_status = false; //按钮状态
  60. function submit_button_active() {
  61. activity_submit_status = true;
  62. $("#activity_submit").addClass('active').all('i').show();
  63. }
  64. function submit_button_default() {
  65. activity_submit_status = false;
  66. $("#activity_submit").removeClass('active').all('i').hide();
  67. }
  68. $("#activity_submit").on('click', function () {
  69. if (activity_submit_status) {
  70. return false;
  71. }
  72. submit_button_active();
  73. var title = S.trim($("input[name=title]").val());
  74. if (!title) {
  75. alert('请填写投票项标题');
  76. submit_button_default();
  77. return false;
  78. }
  79. formData = IO.serialize("#activity_form");
  80. new IO({
  81. type: "post"
  82. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqCreateOneVote'
  83. , data: formData
  84. , success: function (data) {
  85. if (data.ok) { //ok
  86. var url = data.msg;
  87. location.href = data.msg;
  88. } else {
  89. alert('操作失败,原因:'+data.msg);
  90. }
  91. return false;
  92. }
  93. , error: function (NULL, textStatus) {
  94. alert("请求服务器失败,原因:"+textStatus);
  95. }
  96. , dataType: "json"
  97. });
  98. });
  99. });
  100. //图片上传
  101. KindEditor.ready(function(K) {
  102. var uploadbutton = K.uploadbutton({
  103. button : K('#image_upload')[0],
  104. fieldName : 'imgFile',
  105. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  106. afterUpload : function(data) {
  107. if (data.error === 0) {
  108. var url = K.formatUrl(data.url, 'absolute');
  109. K('#img_url_input').val(data.url);
  110. K('#img_url_tag').attr('src', data.url);
  111. } else {
  112. alert(data.message);
  113. }
  114. },
  115. afterError : function(str) {
  116. alert('自定义错误信息: ' + str);
  117. }
  118. });
  119. uploadbutton.fileBox.change(function(e) {
  120. uploadbutton.submit();
  121. });
  122. });
  123. </script>
  124. <{include file="./admin/bottom.html"}>