interactive_update_one_vote.html 3.9 KB

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