events_survey_underway.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <{include file="header.html"}>
  2. <{include file="nav.html"}>
  3. <link rel="stylesheet" type="text/css" href="<{$web_cfg.cdn}>/public/static/css/swiper.min.css" />
  4. <link rel="stylesheet" type="text/css" href="<{$web_cfg.cdn}>/public/static/css/swiper.animate.min.css" />
  5. <script src="<{$web_cfg.cdn}>/public/static/js/swiper.jquery.min.js"></script>
  6. <script src="<{$web_cfg.cdn}>/public/static/js/swiper.animate.min.js"></script>
  7. <style>
  8. .mask {background-color: #fff;height: 100%;opacity: 0.5;position: absolute;width: 100%;display:none;
  9. </style>
  10. <{include file="common_header.html"}>
  11. <{include file="events_top.html"}>
  12. <div class="wrapper clear">
  13. <div class="clear">
  14. <div class="swiper-container">
  15. <div class="swiper-wrapper">
  16. <{assign var=count value=$surveyInfo.survery_question|@count }>
  17. <{foreach from=$surveyInfo.survery_question item=survery name=survery}>
  18. <{if $survery.type == 'img'}>
  19. <div class="swiper-slide">
  20. <div class="h3_title"><{$smarty.foreach.survery.iteration}>/<{$count}></div>
  21. <div class="article_content"><{$survery.question}></div>
  22. <div class="vote_show_box ques_img_box clear ques_cell" style="display:block">
  23. <div class="vote_cell_row clear">
  24. <div class="vote_item_show clear">
  25. <{foreach from=$survery.answer item=answer}>
  26. <dl class="vote_item">
  27. <dt>
  28. <img src="<{$web_cfg.cdn}>/public/static/img/ques_img_bg.jpg">
  29. <div class="vote_img_thumb" style="background-image:url(<{$answer.img_url}>);"></div>
  30. <div class="curr_icon"></div>
  31. </dt>
  32. <dd>
  33. <p class="vote_name"><{$answer.answer}></p>
  34. </dd>
  35. </dl>
  36. <{/foreach}>
  37. </div>
  38. </div>
  39. <input name="type" type="hidden" value="img">
  40. <input name="choice" type="hidden" value="<{$survery.choice}>">
  41. <{if $survery.choice}>
  42. <div class="vpage_next center"><a class="submit_btn_style next">下一题</a></div>
  43. <{/if}>
  44. </div>
  45. </div>
  46. <{else}>
  47. <div class="swiper-slide">
  48. <div class="h3_title"><{$smarty.foreach.survery.iteration}>/<{$count}></div>
  49. <div class="article_content"><{$survery.question}></div>
  50. <div class="vote_txt_box clear ques_cell" style="display:block">
  51. <div class="ques_txt_box">
  52. <{foreach from=$survery.answer item=answer name=answerName}>
  53. <div class="vt_cell">
  54. <div class="vt_index"><span class="vt_num"><em><{$smarty.foreach.answerName.iteration}></em></span></div>
  55. <div class="vt_title"><span><{$answer.answer}></span></div>
  56. <div class="curr_icon"></div>
  57. </div>
  58. <{/foreach}>
  59. </div>
  60. <input name="type" type="hidden" value="txt">
  61. <input name="choice" type="hidden" value="<{$survery.choice}>">
  62. <{if $survery.choice}>
  63. <div class="vpage_next center"><a class="submit_btn_style next">下一题</a></div>
  64. <{/if}>
  65. </div>
  66. </div>
  67. <{/if}>
  68. <{/foreach}>
  69. <div class="swiper-slide">
  70. <div class="ac_content">
  71. 请认真填写您的收货地址,以便获奖后能够及时收到您的奖品,奖品发货后,我们将更新状态在“我的奖品”中。
  72. </div>
  73. <{include file="event_forms_template.html"}>
  74. </div>
  75. <div class="swiper-slide">
  76. <!--调查完成显示结果 begin-->
  77. <div class="ques_end_box clear" style="display:block;">
  78. <p><img src="<{$web_cfg.cdn}>/public/static/img/right_icon.png"></p>
  79. <p>完成<{$surveyInfo.events_name}></p>
  80. <p><a href="<{$listUrl}>" class="submit_btn_style">其它活动</a></p>
  81. </div>
  82. <!--调查完成显示结果 end-->
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <!--公用提示背景遮罩层-->
  88. <div class="a_cover"></div>
  89. <div class="v_tips_box v_tips_box2" id="error_tips_box">
  90. <div class="v_close_btn" id="tips_close_btn"></div>
  91. <p class="tips_msg" id="error_msg">错误信息</p>
  92. </div>
  93. <script>
  94. var seconds = 2000;
  95. function showErrorMsg(data_msg, isShowClose){
  96. $('#tips_close_btn').show();
  97. $('#error_msg').html(data_msg);
  98. if (typeof(isShowClose) == 'undefined') {
  99. $('#tips_close_btn').hide();
  100. } else {
  101. $('#tips_close_btn').show();
  102. }
  103. $('#error_tips_box').fadeIn(200);
  104. $('.a_cover').fadeIn(200);
  105. }
  106. KISSY.use('node, dom, cookie, json, io', function (S, Node, DOM, Cookie, JSON, IO) {
  107. var $ = S.all;
  108. var answer = {};
  109. //$(".swiper-container").height('100%');
  110. $("#tips_close_btn").on('click', function(){
  111. $(".v_tips_box,.a_cover").hide();
  112. });
  113. var swiper = new Swiper('.swiper-container', {
  114. direction : 'horizontal'
  115. , speed: 200
  116. });
  117. swiper.lockSwipes();
  118. // 点击文字选项
  119. $(".ques_txt_box .vt_cell").on('click', function () {
  120. var choice = $(swiper.slides[swiper.activeIndex]).all('input[name=choice]').val();
  121. if (choice == 1) { //多选
  122. if (!$(this).hasClass('vt_cell_curr')) {
  123. $(this).addClass('vt_cell_curr');
  124. } else {
  125. $(this).removeClass('vt_cell_curr');
  126. }
  127. } else { //单选
  128. $(".ques_txt_box .vt_cell").removeClass('vt_cell_curr');
  129. $(this).addClass('vt_cell_curr');
  130. var ans = $(this).index() + 1;
  131. answer[swiper.activeIndex + 1] = ans;
  132. swiper.slideNext();
  133. }
  134. });
  135. // 点击图文选项
  136. $(".ques_img_box .vote_item").on('click', function () {
  137. var choice = $(swiper.slides[swiper.activeIndex]).all('input[name=choice]').val();
  138. if (choice == 1) { //多选
  139. if (!$(this).hasClass('vt_cell_curr')) {
  140. $(this).addClass('vt_cell_curr');
  141. } else {
  142. $(this).removeClass('vt_cell_curr');
  143. }
  144. } else { //单选
  145. $(".ques_img_box .vote_item").removeClass('vt_cell_curr');
  146. $(this).addClass('vt_cell_curr');
  147. var ans = $(this).index() + 1;
  148. answer[swiper.activeIndex + 1] = ans;
  149. swiper.slideNext();
  150. }
  151. });
  152. $(".next").on('click', function () {
  153. var slide = $(swiper.slides[swiper.activeIndex]);
  154. var type = slide.all('input[name=type]').val();
  155. if (type == 'txt') {
  156. $(".ques_txt_box .vt_cell", slide).each(function (item, index) {
  157. if ($(item).hasClass('vt_cell_curr')) {
  158. var ans = index + 1;
  159. answer[swiper.activeIndex + 1] = !S.isUndefined(answer[swiper.activeIndex + 1]) ? answer[swiper.activeIndex + 1] + ans+',' : ans+',';
  160. }
  161. });
  162. }
  163. if (type == 'img') {
  164. $(".ques_img_box .vote_item", slide).each(function (item, index) {
  165. if ($(item).hasClass('vt_cell_curr')) {
  166. var ans = index + 1;
  167. answer[swiper.activeIndex + 1] = !S.isUndefined(answer[swiper.activeIndex + 1]) ? answer[swiper.activeIndex + 1] + ans+',' : ans+',';
  168. }
  169. });
  170. }
  171. swiper.slideNext();
  172. });
  173. IO.on("send",function(){
  174. showErrorMsg('<i class="fa fa-spinner fa-pulse"></i>');
  175. $('.a_cover').fadeIn();
  176. });
  177. IO.on("complete",function(){
  178. //$("#error_tips_box").stop().hide();
  179. });
  180. $('#common_submit_btn').on('click', function () {
  181. var formData = IO.serialize('#ff');
  182. IO.post('<{$web_cfg.domain}>/?c=EventsSurvey&a=Submit&events_id=<{$surveyInfo.id}>&answer='+JSON.stringify(answer)
  183. , formData
  184. , function (data) {
  185. if (data.ok) {
  186. swiper.slideNext();
  187. $(".v_tips_box,.a_cover").hide();
  188. } else {
  189. showErrorMsg(data.msg, true);
  190. }
  191. }
  192. , 'json'
  193. );
  194. Cookie.remove('SURVEY_IS_UNDERWAY', null, '/');
  195. Cookie.remove('SURVEY_ANSWER', null, '/');
  196. return false;
  197. });
  198. //swiper.slidePrev();
  199. //swiper.slideNext();
  200. });
  201. </script>
  202. <{include file="bottom.html"}>