%%19^19C^19C5EC22%%interactive_question.html.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php /* Smarty version 2.6.17, created on 2018-04-25 19:29:39
  2. compiled from admin/activity/interactive_question.html */ ?>
  3. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  4. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
  5. $this->_tpl_vars = $_smarty_tpl_vars;
  6. unset($_smarty_tpl_vars);
  7. ?>
  8. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  9. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
  10. $this->_tpl_vars = $_smarty_tpl_vars;
  11. unset($_smarty_tpl_vars);
  12. ?>
  13. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  14. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
  15. $this->_tpl_vars = $_smarty_tpl_vars;
  16. unset($_smarty_tpl_vars);
  17. ?>
  18. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  19. $this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
  20. $this->_tpl_vars = $_smarty_tpl_vars;
  21. unset($_smarty_tpl_vars);
  22. ?>
  23. <style>
  24. .set-nav {
  25. margin: 0 auto;
  26. }
  27. .set-nav-hr {
  28. background-color: #ddd;
  29. height: 1px;
  30. position: relative;
  31. }
  32. .form-group label {
  33. font-weight: 600;
  34. }
  35. .checkbox-inline, .radio-inline {
  36. font-weight: 400!important;
  37. }
  38. .rowlabel {
  39. font-weight: 300!important;
  40. }
  41. .music_play_hide {
  42. display:none;
  43. }
  44. </style>
  45. <div id="activity_container">
  46. <form id="activity_form">
  47. <div class="activity_center">
  48. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  49. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
  50. $this->_tpl_vars = $_smarty_tpl_vars;
  51. unset($_smarty_tpl_vars);
  52. ?>
  53. <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  54. ">
  55. <div class="panel panel-default">
  56. <div class="panel-heading"><h3 class="panel-title" id="panel-title">设置问题</h3></div>
  57. <div class="panel-body" style="padding: 10px; display: none;" id="show_div">
  58. <div style="margin: 10px; display: none;" >排序: &nbsp; &nbsp; &nbsp; <font id="f_sort"></font></div>
  59. <input type="hidden" value="<?php echo $this->_tpl_vars['nextSort']; ?>
  60. " id="f_sort_h" name="f_sort_h">
  61. <div style="margin: 10px;">问题: &nbsp; &nbsp; &nbsp; <font id="f_question"></font></div>
  62. <input type="hidden" value="" id="f_question_h" name="f_question_h">
  63. <div style="margin: 10px;">选项类型: &nbsp; &nbsp; &nbsp; <font id="f_type"></font></div>
  64. <div style="margin: 10px;">选项规则: &nbsp; &nbsp; &nbsp; <font id="f_choice"></font></div>
  65. <input type="hidden" value="" id="f_type_h" name="f_type_h">
  66. <input type="hidden" value="" id="f_num_h" name="f_num_h">
  67. <input type="hidden" value="" id="f_choice_h" name="f_choice_h">
  68. <div style="clear:both;"></div>
  69. <div id="show_html">
  70. </div>
  71. <div style="clear:both;"></div>
  72. <div style="margin: 10px; text-align: left: ;">
  73. <a href="javascript:;" id="add_but" class="button button-3d button-primary button-rounded">点击保存</a>
  74. <div style="text-align: right;"><a href="?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  75. &typ=question" style="text-align: right;"><<返回上一级</a></div>
  76. </div>
  77. </div>
  78. <div id="img_html" style="display:none;">
  79. <div class="panel panel-default" style="padding:10px 10px 0px 10px;">
  80. <div class="form-group">
  81. <div>
  82. <img id="img_url_tag" src="http://placehold.it/200&text=290x(>290)" style="width:100px;" class="img-thumbnail">
  83. <input id="img_url_input" name="img_url" type="hidden" value="">
  84. <input id="image_upload" type="button" value="选择图片" >
  85. </div>
  86. </div>
  87. <p> 答案: <input type="text" name="img_url_answer"></p>
  88. </div>
  89. </div>
  90. <div id="txt_html" style="display:none;">
  91. <div class="panel panel-default" style="padding:10px 10px 0px 10px;">
  92. <p>答案: <input type="text" name="txt" id="txt"></p>
  93. </div>
  94. </div>
  95. <div class="panel-body" id="add_div" >
  96. <div class="form-group">
  97. <p style="display: none;">顺序:<input type="text" id="sort" size="2" value="<?php echo $this->_tpl_vars['nextSort']; ?>
  98. " ></p>
  99. <p>问题:<input type="text" id="question" size="50" ></p>
  100. <p>选项:<input type="text" id ="num" value="0" size="2" >个</p>
  101. <p>选项类型:<select name="type" id="type">
  102. <option value="img">图片</option>
  103. <option value="txt">文字</option>
  104. </select>
  105. </p>
  106. <p>选项规则:<select name="choice" id="choice">
  107. <option value="0">单选</option>
  108. <option value="1">多选</option>
  109. </select>
  110. </p>
  111. <div>
  112. <p style="margin-top: 20px;"><a href="javascript:;" id="add"><i class="fa fa-plus"></i> 点击创建问题</a></p>
  113. <div style="text-align: right;"><a href="?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  114. " style="text-align: right;"><<返回上一级</a></div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  121. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array()));
  122. $this->_tpl_vars = $_smarty_tpl_vars;
  123. unset($_smarty_tpl_vars);
  124. ?>
  125. <div style="clear:both;"></div>
  126. </form>
  127. </div>
  128. <script>
  129. KISSY.use('node, io, event, jquery', function (S, Node, IO, Event, jQuery) {
  130. var $ = S.all;
  131. $("#add").on('click', function () {
  132. var tyepData = {'img':'图片','txt':'文字'};
  133. var choiceData = {'1':'多选','0':'单选'};
  134. var question = $('#question').val();
  135. var sort = $('#sort').val();
  136. var num = $('#num').val();
  137. var type = $('#type').val();
  138. var choice = $('#choice').val();
  139. $('#f_sort').html(sort);
  140. $('#f_question').html(question);
  141. $('#f_type').html(tyepData[type]);
  142. $('#f_choice').html(choiceData[choice]);
  143. $('#f_sort_h').val(sort);
  144. $('#f_question_h').val(question);
  145. $('#f_type_h').val(type);
  146. $('#f_choice_h').val(choice);
  147. $('#f_num_h').val(num);
  148. $('#add_div').hide();
  149. $('#show_div').show();
  150. if(type == 'img'){
  151. var inHtml = '';
  152. for (var i=1;i<=num;i++){
  153. var html = $('#img_html').html();
  154. html = html.replace("img_url_tag", "img_url_tag_"+i);
  155. html = html.replace("img_url_input", "img_url_input_"+i);
  156. html = html.replace("image_upload", "image_upload_"+i);
  157. html = html.replace("name=\"img_url", "name=\"img_url_"+i);
  158. html = html.replace("img_url_answer", "img_url_answer_"+i);
  159. inHtml+=html;
  160. }
  161. $('#show_html').html(inHtml);
  162. for (var i=1;i<=num;i++){
  163. runImg('image_upload_'+i,'img_url_input_'+i,'img_url_tag_'+i);
  164. }
  165. return ;
  166. }
  167. if(type=='txt'){
  168. var inHtml = '';
  169. for (var i=1;i<=num;i++){
  170. var html = $('#txt_html').html();
  171. html = html.replace("\"txt\"", '"txt_'+i+'"');
  172. html = html.replace("\"txt\"", '"txt_'+i+'"');
  173. inHtml+=html;
  174. }
  175. $('#show_html').html(inHtml);
  176. return ;
  177. }
  178. });
  179. $("#add_but").on('click', function () {
  180. var formData = IO.serialize("#activity_form");
  181. new IO({
  182. type: "post"
  183. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqAddSurveyQuestion'
  184. , data: formData
  185. , success: function (data) {
  186. if (data.ok) { //ok
  187. location.href = VG.conf.root_domain + '?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  188. ';
  189. } else {
  190. alert('操作失败,原因:'+data.msg);
  191. }
  192. return false;
  193. }
  194. , error: function (NULL, textStatus) {
  195. alert("请求服务器失败,原因:"+textStatus);
  196. }
  197. , dataType: "json"
  198. });
  199. });
  200. //图片上传
  201. function runImg(image_upload,img_url_input,img_url_tag){
  202. var K = KindEditor;
  203. var uploadbutton = K.uploadbutton({
  204. button : K('#'+image_upload)[0],
  205. fieldName : 'imgFile',
  206. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  207. afterUpload : function(data) {
  208. if (data.error === 0) {
  209. var url = K.formatUrl(data.url, 'absolute');
  210. K('#'+img_url_input).val(data.url);
  211. K('#'+img_url_tag).attr('src', data.url);
  212. } else {
  213. alert(data.message);
  214. }
  215. },
  216. afterError : function(str) {
  217. alert('自定义错误信息: ' + str);
  218. }
  219. });
  220. uploadbutton.fileBox.change(function(e) {
  221. uploadbutton.submit();
  222. });
  223. }
  224. });
  225. </script>
  226. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  227. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
  228. $this->_tpl_vars = $_smarty_tpl_vars;
  229. unset($_smarty_tpl_vars);
  230. ?>