%%F2^F25^F25DA589%%events_vote.html.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <?php /* Smarty version 2.6.17, created on 2018-05-28 14:57:36
  2. compiled from events_vote.html */ ?>
  3. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  4. $this->_smarty_include(array('smarty_include_tpl_file' => "header.html", 'smarty_include_vars' => array()));
  5. $this->_tpl_vars = $_smarty_tpl_vars;
  6. unset($_smarty_tpl_vars);
  7. ?>
  8. <!--公用标题居中显示-->
  9. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  10. $this->_smarty_include(array('smarty_include_tpl_file' => "common_header.html", 'smarty_include_vars' => array()));
  11. $this->_tpl_vars = $_smarty_tpl_vars;
  12. unset($_smarty_tpl_vars);
  13. ?>
  14. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  15. $this->_smarty_include(array('smarty_include_tpl_file' => "events_top.html", 'smarty_include_vars' => array()));
  16. $this->_tpl_vars = $_smarty_tpl_vars;
  17. unset($_smarty_tpl_vars);
  18. ?>
  19. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  20. $this->_smarty_include(array('smarty_include_tpl_file' => "events_infos.html", 'smarty_include_vars' => array()));
  21. $this->_tpl_vars = $_smarty_tpl_vars;
  22. unset($_smarty_tpl_vars);
  23. ?>
  24. <!--公用提示背景遮罩层-->
  25. <div class="a_cover"></div>
  26. <!--vote_tips begin-->
  27. <div class="v_tips_box" id="vote_tips_box">
  28. <div class="v_close_btn" id="tips_close_btn"></div>
  29. <p class="vote_result">投票成功</p>
  30. </div>
  31. <!--vote_tips end-->
  32. <script>
  33. var seconds = 1000;
  34. var goUrl = '';
  35. var config_total_vote_num = '<?php echo $this->_tpl_vars['voteInfo']['total_vote_num']; ?>
  36. ';
  37. function go_page(){
  38. location.href = goUrl;
  39. }
  40. function authorizeRun(data_msg_url){
  41. $(".vote_result").html('本活动需登录后才可以参与');
  42. $('.tips_close_btn').show();
  43. $('.v_tips_box, .a_cover').fadeIn();
  44. goUrl= '<?php echo $this->_tpl_vars['loginUrl']; ?>
  45. ';
  46. setInterval("go_page();",seconds+100);
  47. }
  48. function Percentage(num, total) {
  49. return Math.round(num / total * 100);// 小数点后两位百分比
  50. }
  51. $("#tips_close_btn").on('click', function(){
  52. $(".v_tips_box,.a_cover").hide();
  53. if(goUrl){
  54. go_page();
  55. }
  56. });
  57. KISSY.use('node, io, json', function (S, Node, IO, JSON) {
  58. var cell_colors = JSON.parse('<?php echo $this->_tpl_vars['cell_colors']; ?>
  59. ');
  60. //视频自适应
  61. var screenWidth = $(window).width();
  62. var baseWidth = 510;
  63. var video_scale = screenWidth / baseWidth;
  64. $(".video_iframe").each(function () {
  65. var new_width = $(this).width() * video_scale;
  66. $(this).width(new_width - 20);
  67. var new_height = $(this).height() * video_scale;
  68. $(this).height(new_height - 20);
  69. });
  70. <?php if ($this->_tpl_vars['voteInfo']['vote_type'] == 1): ?>
  71. <?php if ($this->_tpl_vars['eventsStatus']): ?> refreshVoteBox(false);
  72. <?php else: ?>
  73. $(".lable_div").on('click', function () {
  74. var _self = $(this);
  75. var voteid = $(this).data('voteid');
  76. var total_vote_num = config_total_vote_num;
  77. if (!voteid) {
  78. return false
  79. }
  80. IO.on("send",function(){
  81. showLoading();
  82. });
  83. IO.get('<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  84. /?c=eventsVote&a=vote'
  85. , {
  86. events_id: '<?php echo $this->_tpl_vars['voteInfo']['id']; ?>
  87. ',
  88. voteid: voteid
  89. }
  90. , function (data) {
  91. goUrl = '';
  92. if (data.ok) {
  93. showMsg('投票成功', function () {
  94. var addNum = _self.find('em').data('num') + 1;
  95. _self.find('em').data('num', addNum);
  96. total_vote_num = Number(total_vote_num) + 1;
  97. config_total_vote_num = total_vote_num;
  98. refreshVoteBox(true);
  99. });
  100. } else {
  101. if(data.msg.url){
  102. authorizeRun(data.msg.url);
  103. return false;
  104. }
  105. showMsg(data.msg, null, function () {
  106. refreshVoteBox(false);
  107. });
  108. }
  109. }
  110. , 'json'
  111. );
  112. });
  113. $(".vote_btn").click(function(){
  114. $(this).find("span").addClass("h_selected");
  115. $(".vote_btn p").each(function(){
  116. $(this).show(600);//右侧推出显示投票数,速度可控制
  117. });
  118. });
  119. <?php endif; ?>
  120. <?php else: ?>
  121. <?php if ($this->_tpl_vars['eventsStatus']): ?> $(".vote_btn p").each(function(){
  122. $(this).show(600);//右侧推出显示投票数,速度可控制
  123. });
  124. <?php else: ?>
  125. $(".vote_btn").click(function () {
  126. var _self = $(this);
  127. var voteid = $(this).data('voteid');
  128. S.log(voteid);
  129. if (voteid == '') {
  130. return false
  131. }
  132. IO.on("send",function(){
  133. showLoading();
  134. });
  135. IO.get('<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
  136. /?c=eventsVote&a=vote'
  137. , {
  138. events_id: '<?php echo $this->_tpl_vars['voteInfo']['id']; ?>
  139. ',
  140. voteid: voteid
  141. }
  142. , function (data) {
  143. goUrl = '';
  144. if (data.ok) {
  145. showMsg('投票成功', function () {
  146. _self.find("span").addClass("h_selected");
  147. var addNum = _self.data('num') + 1;
  148. _self.data('num', addNum);
  149. _self.find('p').text(addNum);
  150. $(this).find("span").addClass("h_selected");
  151. $(".vote_btn p").each(function(){
  152. $(this).show(600);//右侧推出显示投票数,速度可控制
  153. });
  154. });
  155. } else {
  156. if(data.msg.url){
  157. authorizeRun(data.msg.url);
  158. return false;
  159. }
  160. showMsg(data.msg, function () {
  161. $(this).find("span").addClass("h_selected");
  162. $(".vote_btn p").each(function(){
  163. $(this).show(600);//右侧推出显示投票数,速度可控制
  164. });
  165. });
  166. }
  167. }
  168. , 'json'
  169. );
  170. });
  171. <?php endif; ?>
  172. <?php endif; ?>
  173. function refreshVoteBox(isHide) {
  174. // 隐藏cell
  175. if (isHide) {
  176. $(".data_show_cell").fadeOut();
  177. $(".data_show_cell em").css({width:"0px"});
  178. }
  179. var cell_lens = {};
  180. var total = 0;
  181. $(".vt_cell .vt_num").removeClass("vt_num");
  182. $(".vt_cell").addClass("vt_result_cell");
  183. $(".dv_title").addClass("dv_title_after");//增加投票选项点击后的样式
  184. $(".data_show_cell em").each(function (i) {
  185. var num = $(this).data('num');
  186. cell_lens[i] = num;
  187. total += num;
  188. });
  189. var total_vote_num = config_total_vote_num;
  190. $(".data_show_cell").fadeIn();
  191. $(".data_show_cell em").each(function (i) {
  192. var perNum = Percentage(cell_lens[i], total_vote_num);
  193. //$(this).parent().find('b').text(perNum+'%');
  194. $(this).parent().addClass(cell_colors[i-1]);
  195. var len_num = (cell_lens[i] / total) * 200;
  196. $(this).animate({width:len_num+"px"},1000);
  197. });
  198. }
  199. function showMsg($msg, $callback) {
  200. $('.tips_close_btn').show();
  201. $('.vote_result').html($msg);
  202. $('.a_cover').fadeIn().delay(seconds).fadeOut();
  203. $('.v_tips_box').fadeIn().delay(seconds).fadeOut(function () {
  204. if ($callback) $callback();
  205. });
  206. }
  207. function showLoading() {
  208. $('.tips_close_btn').hide();
  209. $('.vote_result').html('加载中..');
  210. $('.v_tips_box, .a_cover').fadeIn();
  211. }
  212. $(".tips_close_btn").on('click', function(){
  213. $(".v_tips_box, .a_cover").hide();
  214. });
  215. //判断当前页图片加载完成loading消失
  216. $(".vote_show_box dl dt img").each(function(){
  217. $(this).load(function(){
  218. $(this).parent().css("background","none");
  219. })
  220. });
  221. });
  222. </script>
  223. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  224. $this->_smarty_include(array('smarty_include_tpl_file' => "bottom.html", 'smarty_include_vars' => array()));
  225. $this->_tpl_vars = $_smarty_tpl_vars;
  226. unset($_smarty_tpl_vars);
  227. ?>