-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelegram.html
More file actions
executable file
·122 lines (118 loc) · 3.91 KB
/
telegram.html
File metadata and controls
executable file
·122 lines (118 loc) · 3.91 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
<!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>
<script src="layer/layer.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.zclip.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="wrapall">
<div class="wraptop">
<img src="imgs/logo.png" />
<div class="spacingline"></div>
<div class="step clearfix">
<div class="stepheader"></div>
<div class="stepbody clearfix">
<ul>
<li><strong>STEP 1</strong></li>
<li><span>Send the sequence code to our Telegram</span></li>
<li><span>Sequence code:<em id="privateCode" style="font-style: normal;"></em></span></li>
</ul>
<a href="javascript:void(0)" id="paste">PASTE</a>
</div>
<div class="stepfooter"></div>
</div>
<div class="step clearfix">
<div class="stepheader"></div>
<div class="stepbody clearfix">
<ul>
<li><strong>STEP 2</strong></li>
<li><span>Join our telegram</span></li>
</ul>
<a href="https://t.me/IoTChain" target="_blank">JOIN</a>
</div>
<div class="stepfooter"></div>
</div>
<button id="done">DONE</button>
</div>
</div>
<canvas id="space" style="height:100%;width:100%"></canvas>
<script type="text/javascript">
$(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;
}
var privateCode = getQueryString("privateCode");
//必须携带privateCode 否则跳转回去
if(privateCode==null){
window.location="index.html";
return false;
}
//邮箱验证
$.ajax({
type: "POST",
url: "https://api.iotchain.io/mailVerify",
dataType:"json",
timeout:20000,
data: "privateCode=" + privateCode,
success: function(msg){
console.log(msg.code);
}
});
//2、将url中的参数部分添加到 Sequence code中去
$('#privateCode').text(privateCode);
//3、复制粘贴
var echoinfo = "/echo " + privateCode;
var clipboard = new Clipboard('#paste', {
text: function() {
return echoinfo;
}
});
clipboard.on('success', function(e) {
alert("复制成功");
});
//3、点击检测是否加入telegram
var taskpage = "task.html"; // task跳转地址
var telegramVerification = "https://api.iotchain.io/telegramVerify"; // 检验是否加入telegram接口
$('#done').click(function() {
$.ajax({
type: "POST",
url: telegramVerification,
dataType: 'json',
timeout: 20000, // 设置超时
data: "privateCode=" + privateCode,
beforeSend: function (xhr) {
index = layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
},
success: function(data) {
if(data.code == 200) { // 已经加入
// 用户存在跳转到下个页面
window.location = taskpage + "?privateCode=" + privateCode;
}
if(data.code == 400) {
// 未加入给予提升
alert("用户不存在,或您尚未加入我们的telegram");
}
},
complete: function(){
layer.close(index);
}
});
})
})
</script>
<script src="js/starcanvas.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>