-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.html
More file actions
executable file
·263 lines (258 loc) · 8.39 KB
/
task.html
File metadata and controls
executable file
·263 lines (258 loc) · 8.39 KB
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>candy_system</title>
<script src="js/jquery-2.1.0.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script src="js/jquery-2.1.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="layer/layer.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.zclip.js" type="text/javascript" charset="utf-8"></script>
<!--fackbook分享的内容 版本比较老旧 可能存在点问题-->
<meta property="og:title" content="分享到facebook">
<meta property="og:type" content="分享到facebook">
<meta property="og:image" content="//www.baidu.com/img/bd_logo1.png">
<meta property="og:description" content="百度一下,你就知道">
<!--fackbook分享的内容 版本比较老旧 可能存在点问题-->
</head>
<body>
<script>
$(function() {
//1、获取URL中的参数部分
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if(r != null)
return unescape(r[2]);
return null;
}
privateCode = getQueryString("privateCode");
//必须携带privateCode 否则跳转回去
if(privateCode==null){
//必须存在且必须为32位直接跳转过来返回去
window.location="index.html";
return false;
}
})
//分享到facebook
$(document).ready(function() {
$.ajaxSetup({
cache: true
});
$.getScript('https://connect.facebook.net/en_US/sdk.js', function() {
FB.init({
appId: '175191809927607',
version: 'v2.7' // or v2.1, v2.2, v2.3, ...
});
//触发分享功能
$('#facebookshare').click(function() {
//分享过禁用分享
if($(this).hasClass("hascompleted")) {
alert('在facebook上,您已经分享过了');
return false;
}
FB.ui({
method: 'share',
href: 'https://developers.facebook.com/docs/'
}, function(response) {
//分享成功的回调
$.ajax({
type: "POST",
url: "https://api.iotchain.io/shareFacebook",
dataTpye: 'json',
data: "privateCode=" + privateCode,
beforeSend: function (xhr) {
index = layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
},
success: function(data) {
if(data.code == 200) {
$('#facebookshare').html('').text("COMPLETED").addClass('hascompleted');
}
},
complete: function(){
layer.close(index);
}
});
});
})
});
});
</script>
<script>
//分享到twitter
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if(d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
twttr.ready(function(twttr) {
twttr.events.bind('tweet', function(event) {
//twitter 回调
$.ajax({
type: "POST",
url: "https://api.iotchain.io/shareTwitter",
dataTpye: 'json',
data: "privateCode=" + privateCode,
beforeSend: function (xhr) {
index = layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
},
success: function(data) {
//tw分享完成
if(data.code == 200) {
$('#twitterSharefa').html('').text("COMPLETED").addClass('hascompleted');
}
},
complete: function(){
layer.close(index);
}
});
})
});
$(function() {
$('#twitterSharefa').click(function() {
if($(this).hasClass('hascompleted')) {
alert('在twitter上,您已经分享过了');
}
})
})
</script>
<div class="wrapall">
<div class="wraptop">
<img src="imgs/logo.png" id="sharebtn" />
<div class="spacingline"></div>
<div class="task clearfix">
<div class="taskheader"></div>
<div class="taskbody clearfix">
<dl>
<dt>TASK 1 </dt>
<dd class="clearfix">
<img src="imgs/icon_03.png" />
<span>Invite your friends to join our system through your specific links.
<br />Your invitation link【<em style="font-style: normal;" id="copylink">www.xxxxxx.xxxxx.xxxxx</em>】
</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_07.png" />
<span>2018/2/25~2018/3/25</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_10.png" />
<span>1 ITC/Person</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_12.png" />
<span>Number of invitations : <em style="font-style: normal;" id="invnum">0</em></span>
</dd>
</dl>
<a href="javascript:void(0)" class="tasklink" id="copylinkBtn">COPY LINK</a>
</div>
<div class="taskfooter"></div>
</div>
<div class="task clearfix">
<div class="taskheader"></div>
<div class="taskbody clearfix">
<dl>
<dt>TASK 2</dt>
<dd class="clearfix">
<img src="imgs/icon_03.png" />
<span>Sharing the specified message about ITC on your FACEBOOK.</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_07.png" />
<span>2018/2/25~2018/3/25</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_10.png" />
<span>1 ITC</span>
</dd>
</dl>
<span class="tasklink" id="facebookshare"><img src="imgs/Facebook.png"/><em>SHARE</em></span>
</div>
<div class="taskfooter"></div>
</div>
<div class="task clearfix">
<div class="taskheader"></div>
<div class="taskbody clearfix">
<dl>
<dt>TASK 3</dt>
<dd class="clearfix">
<img src="imgs/icon_03.png" />
<span>Sharing the specified message about ITC on your Twitter.</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_07.png" />
<span>2018/2/25~2018/3/25</span>
</dd>
<dd class="clearfix">
<img src="imgs/icon_10.png" />
<span>1 ITC</span>
</dd>
</dl>
<span class="tasklink" id="twitterSharefa">
<a href="https://twitter.com/intent/tweet?text=分享的内容" id="twitterShare">
<img src="imgs/Twitter.png"/><em>SHARE</em>
</a>
</span>
</div>
<div class="taskfooter"></div>
</div>
</div>
</div>
<canvas id="space" style="height:100%;width:100%"></canvas>
<script type="text/javascript">
$(function() {
//1、复制分享链接
var sharelink = "https://candy.iotchain.io/index.html" + "?inviterCode=" + privateCode;
$('#copylink').html(sharelink);
var clipboard = new Clipboard('#copylinkBtn', {
text: function() {
return sharelink;
}
});
clipboard.on('success', function(e) {
alert("复制成功");
});
//2、传递参数从getMe接口中获取数据
var getMeUrl = "https://api.iotchain.io/getMe";
$.ajax({
type: "GET",
url: getMeUrl,
dataType: 'json',
timeout:20000, // 设置超时
data: "privateCode=" + privateCode,
success: function(data) {
var twitterTaskSign = data.data.twitterTaskSign; //twitterTaskSign分享是否完成
var facebookTaskSign = data.data.facebookTaskSign; //facebookTaskSign分享是否完成
if(data.code == 200) {
//fb分享完成
if(facebookTaskSign == false) {
$('#facebookshare').html('').text("COMPLETED").addClass('hascompleted');
}
//tw分享完成
if(twitterTaskSign == false) {
$('#twitterSharefa').html('').text("COMPLETED").addClass('hascompleted');
}
//要求到的人数
$('#invnum').text(data.data.inviteCount);
}
}
})
})
</script>
<script src="js/starcanvas.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>