1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>宝贝,因“喂”爱你</title>
<link rel="stylesheet" href="css/activity.css">
<link rel="stylesheet" href="css/toast.css">
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="js/html2Json.js"></script>
<script type="text/javascript" src="js/pageJson/userJson.js"></script>
<script type="text/javascript" src="js/modalJson/shareModal.js"></script>
<script type="text/javascript" src="js/modalJson/voteModal.js"></script>
<script type="text/javascript" src="js/autoFontsize.min.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script type="text/javascript">
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: '${appId!}', // 必填,公众号的唯一标识
timestamp:'${timestamp!}', // 必填,生成签名的时间戳
nonceStr: '${noncestr!}', // 必填,生成签名的随机串
signature: '${signature!}',// 必填,签名,见附录1
jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','startRecord','stopRecord','onVoiceRecordEnd','playVoice','pauseVoice','stopVoice','onVoicePlayEnd'
,'uploadVoice','downloadVoice','chooseImage','previewImage','uploadImage','downloadImage','translateVoice','openLocation'
,'getLocation','hideOptionMenu','showOptionMenu','hideMenuItems','showMenuItems','scanQRCode','chooseWXPay','addCard','chooseCard','openCard'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
</script>
</head>
<body>
</body>
</html>
<script type="text/javascript">
// 公共变量
var xtoken = "123123";
var activityCode = "hdtbsztest1";
var pageNumber = "1";
var baseUrl = "http://space-api.check.icaremgt.com";
$('body').prepend(json2html(userObj));
$('body').prepend(json2html(shareModal));
$('body').prepend(json2html(voteModal));
$('#html-template-4').addClass('global-none')
$('#html-template-8').addClass('global-none')
$(function(){
btnBindClick();// 绑定点击事件
userCountDown(10,$('#act31142119991744 span')); //倒计时
userTabInfo();
wxpermission();
});
// 微信鉴权
function wxpermission() {
wx.ready(function(){
var shareData = {
title: "",
imgUrl: "",
desc: "",
link: ""
}
/**
*分享给朋友
*/
wx.onMenuShareAppMessage({
title: shareData.title, // 分享标题
desc: shareData.desc, // 分享描述
link: shareData.link, // 分享链接
imgUrl: shareData.imgUrl, // 分享图标
type: 'link', // 分享类型,music、video或link,不填默认为link
dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
/**
*分享到朋友圈
*/
wx.onMenuShareTimeline({
title: shareData.title, // 分享标题
desc: shareData.desc, // 分享描述
link: shareData.link, // 分享链接
imgUrl: shareData.imgUrl, // 分享图标
success: function () {
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
}
// 元素点击事件绑定
function btnBindClick() {
// 返回首页
$("#act3110143885264").off("click").on("click",function(){
window.location.href = '/index.html'
});
// 拉票
$('#act31119351441050').off("click").on("click",function(){
$('#html-template-8').removeClass('global-none')
});
// 分享弹框关闭
$(document).on('click','#html-template-8 .modal-close',function(){
$('#html-template-8').addClass('global-none')
});
// 投票
$('#act31119414834381').off("click").on("click",function(){
$('#html-template-4').removeClass('global-none')
});
// 我要拉票
$('#act2172989331265').off("click").on("click",function(){
$('#html-template-8').removeClass('global-none')
});
// 继续投票
$('#act21728433893489').off("click").on("click",function(){
});
// 投票弹框关闭
$(document).on('click','#html-template-4 .modal-close',function(){
$('#html-template-4').addClass('global-none')
});
// 排行榜
$("#act41612547506702").off('click').on("click", function(){
window.location.href = '/index.html'
});
// 选手主页
$("#act4161336684689").off("click").on("click", function(){
window.location.href = '/user.html'
});
// 活动秘籍
$("#act41613113951133").off("click").on("click", function(){
$('#html-template-8').removeClass('global-none')
});
}
// 倒计时
function userCountDown(times,ids){
var timer=null;
var self = this
var times = times
timer=setInterval(function(){
var day=0,
hour=0,
minute=0,
second=0;//时间默认值
if(times > 0){
day = Math.floor(times / (60 * 60 * 24));
hour = Math.floor(times / (60 * 60)) - (day * 24);
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (day <= 9) day = '0' + day;
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
ids.html((day != 00 ? day + "天" : '')+hour+"时"+minute+"分"+second+"秒")
times--;
if(times<0){
clearInterval(timer);
ids.parent().addClass('global-none')
}
},1000);
}
function userTabInfo() {
var userInfoObj = {
userImg: 'http://qnfile.icareyou.net/e1e347fa1d3a4eb79839e40c6ba312531560307520219.jpg',
userName: '小米',
userNo: '2939393',
userRank: '29',
userVoteNum: '200',
userState: '拉票宣言',
showImg: 'http://qnfile.icareyou.net/e1e347fa1d3a4eb79839e40c6ba312531560307520219.jpg'
}
$('#act3932189955 .user-info .inner-pic').attr('src',userInfoObj.userImg);
var innerInfo = $('#act3932189955 .user-info .inner-info')
innerInfo.find('.userName span').text(userInfoObj.userName)
innerInfo.find('.userNo span').text(userInfoObj.userNo)
innerInfo.find('.userRank span').text(userInfoObj.userRank)
innerInfo.find('.userVoteNum span').text(userInfoObj.userVoteNum)
$('#act3932189955 .userState').val(userInfoObj.userState)
$('#act3932189955 .user-info .inner-pic').attr('src',userInfoObj.userImg);
$('#act3932189955 .show-pic').attr('src',userInfoObj.showImg);
}
// 页面跳转
function transPage(_pageNumber,_activityCode, _token, _urlParam){
var url = ''
if(typeof _urlParam !=='undefined' && _urlParam !== ''){
url = baseUrl + "/ACTIVITY/view/"+ _activityCode +"/" + _pageNumber + '?' + _urlParam;
}else {
url = baseUrl + "/ACTIVITY/view/"+ _activityCode +"/" + _pageNumber;
}
var _form = document.createElement('form');
_form.action = url;
_form.method = "post";
_form.style.display = "none";
var inputToken = document.createElement('input');
inputToken.value = _token;
inputToken.name = 'x-token';
_form.appendChild(inputToken);
document.body.appendChild(_form);
_form.submit();
}
</script>