123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <{include file="header.html"}>
- <!--公用标题居中显示-->
- <{include file="common_header.html"}>
- <{include file="events_top.html"}>
- <{include file="events_infos.html"}>
- <!--公用提示背景遮罩层-->
- <div class="a_cover"></div>
- <!--vote_tips begin-->
- <div class="v_tips_box" id="vote_tips_box">
- <div class="v_close_btn" id="tips_close_btn"></div>
- <p class="vote_result">投票成功</p>
- </div>
- <!--vote_tips end-->
- <script>
- var seconds = 1000;
- var goUrl = '';
- var config_total_vote_num = '<{$voteInfo.total_vote_num}>';
- function go_page(){
- location.href = goUrl;
- }
- function authorizeRun(data_msg_url){
- $(".vote_result").html('本活动需登录后才可以参与');
- $('.tips_close_btn').show();
- $('.v_tips_box, .a_cover').fadeIn();
- goUrl= '<{$loginUrl}>';
- setInterval("go_page();",seconds+100);
- }
- function Percentage(num, total) {
- return Math.round(num / total * 100);// 小数点后两位百分比
- }
- $("#tips_close_btn").on('click', function(){
- $(".v_tips_box,.a_cover").hide();
- if(goUrl){
- go_page();
- }
- });
- KISSY.use('node, io, json', function (S, Node, IO, JSON) {
- var cell_colors = JSON.parse('<{$cell_colors}>');
-
- //视频自适应
- var screenWidth = $(window).width();
- var baseWidth = 510;
- var video_scale = screenWidth / baseWidth;
- $(".video_iframe").each(function () {
- var new_width = $(this).width() * video_scale;
- $(this).width(new_width - 20);
- var new_height = $(this).height() * video_scale;
- $(this).height(new_height - 20);
- });
-
- <{if $voteInfo.vote_type == 1}>
- <{if $eventsStatus}> <{*活动结束时*}>
- refreshVoteBox(false);
-
- <{else}>
-
-
-
-
- $(".lable_div").on('click', function () {
-
- var _self = $(this);
- var voteid = $(this).data('voteid');
- var total_vote_num = config_total_vote_num;
- if (!voteid) {
- return false
- }
-
- IO.on("send",function(){
- showLoading();
- });
-
- IO.get('<{$web_cfg.domain}>/?c=eventsVote&a=vote'
- , {
- events_id: '<{$voteInfo.id}>',
- voteid: voteid
- }
- , function (data) {
- goUrl = '';
- if (data.ok) {
- showMsg('投票成功', function () {
- var addNum = _self.find('em').data('num') + 1;
- _self.find('em').data('num', addNum);
- total_vote_num = Number(total_vote_num) + 1;
- config_total_vote_num = total_vote_num;
- refreshVoteBox(true);
- });
- } else {
- if(data.msg.url){
- authorizeRun(data.msg.url);
- return false;
- }
- showMsg(data.msg, null, function () {
- refreshVoteBox(false);
- });
- }
- }
- , 'json'
- );
- });
-
- $(".vote_btn").click(function(){
- $(this).find("span").addClass("h_selected");
- $(".vote_btn p").each(function(){
- $(this).show(600);//右侧推出显示投票数,速度可控制
- });
- });
- <{/if}>
- <{else}>
- <{if $eventsStatus}> <{*活动结束时*}>
- $(".vote_btn p").each(function(){
- $(this).show(600);//右侧推出显示投票数,速度可控制
- });
- <{else}>
- $(".vote_btn").click(function () {
-
- var _self = $(this);
- var voteid = $(this).data('voteid');
- S.log(voteid);
- if (voteid == '') {
- return false
- }
-
- IO.on("send",function(){
- showLoading();
- });
-
- IO.get('<{$web_cfg.domain}>/?c=eventsVote&a=vote'
- , {
- events_id: '<{$voteInfo.id}>',
- voteid: voteid
- }
- , function (data) {
- goUrl = '';
- if (data.ok) {
- showMsg('投票成功', function () {
- _self.find("span").addClass("h_selected");
- var addNum = _self.data('num') + 1;
- _self.data('num', addNum);
- _self.find('p').text(addNum);
- $(this).find("span").addClass("h_selected");
- $(".vote_btn p").each(function(){
- $(this).show(600);//右侧推出显示投票数,速度可控制
- });
- });
- } else {
- if(data.msg.url){
- authorizeRun(data.msg.url);
- return false;
- }
-
-
- showMsg(data.msg, function () {
- $(this).find("span").addClass("h_selected");
- $(".vote_btn p").each(function(){
- $(this).show(600);//右侧推出显示投票数,速度可控制
- });
- });
- }
- }
- , 'json'
- );
- });
- <{/if}>
- <{/if}>
-
-
-
-
-
- function refreshVoteBox(isHide) {
- // 隐藏cell
- if (isHide) {
- $(".data_show_cell").fadeOut();
- $(".data_show_cell em").css({width:"0px"});
- }
-
- var cell_lens = {};
- var total = 0;
-
- $(".vt_cell .vt_num").removeClass("vt_num");
- $(".vt_cell").addClass("vt_result_cell");
-
- $(".dv_title").addClass("dv_title_after");//增加投票选项点击后的样式
- $(".data_show_cell em").each(function (i) {
- var num = $(this).data('num');
- cell_lens[i] = num;
- total += num;
- });
-
- var total_vote_num = config_total_vote_num;
-
- $(".data_show_cell").fadeIn();
- $(".data_show_cell em").each(function (i) {
- var perNum = Percentage(cell_lens[i], total_vote_num);
- //$(this).parent().find('b').text(perNum+'%');
-
- $(this).parent().addClass(cell_colors[i-1]);
- var len_num = (cell_lens[i] / total) * 200;
- $(this).animate({width:len_num+"px"},1000);
- });
- }
-
- function showMsg($msg, $callback) {
- $('.tips_close_btn').show();
- $('.vote_result').html($msg);
- $('.a_cover').fadeIn().delay(seconds).fadeOut();
- $('.v_tips_box').fadeIn().delay(seconds).fadeOut(function () {
- if ($callback) $callback();
- });
- }
-
-
- function showLoading() {
- $('.tips_close_btn').hide();
- $('.vote_result').html('加载中..');
- $('.v_tips_box, .a_cover').fadeIn();
- }
-
- $(".tips_close_btn").on('click', function(){
- $(".v_tips_box, .a_cover").hide();
- });
-
- //判断当前页图片加载完成loading消失
- $(".vote_show_box dl dt img").each(function(){
- $(this).load(function(){
- $(this).parent().css("background","none");
- })
- });
-
- });
- </script>
- <{include file="bottom.html"}>
|