interactive_add_survey_prize.html 4.1 KB

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