-
Notifications
You must be signed in to change notification settings - Fork 89
/
index.html
175 lines (159 loc) · 5.47 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>weixin</title>
</head>
<style>
body {
background-color: white;
}
h1,
.h1 {
font-size: 22px;
font-family: PingFang SC;
font-weight: 500;
color: #000000;
text-align: center;
margin-top: 16%;
}
h2,
.h2 {
font-size: 17px;
font-family: PingFang SC;
font-weight: 400;
color: #000000;
text-align: center;
margin-top: 1em;
margin-left: 24px;
margin-right: 24px;
}
#captcha-view {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#weixin_logo {
margin-left: auto;
margin-right: auto;
width: 99px;
height: 20px;
background-image: url('https://gtimg.wechatpay.cn/resource/xres/img/202209/d7848659d4f4bdd60411c1ade223c4f7_297x60.png');
background-size: cover;
position: absolute;
top: 92%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
<body>
<h1>请进行微信支付安全验证</h1>
<h2>向转转付款<nobr>¥13.50</nobr></h2>
<div id="captcha-view"></div>
<div id="weixin_logo"></div>
<script src="https://t.captcha.qq.com/TCaptcha.js"></script>
<script type="text/javascript">
// 是否采用 postMessage 模式
const is_postmsg = "";
function displayErrmsg(errmsg) {
if (is_postmsg === "1") {
parent.postMessage(JSON.stringify({
action: "send_deeplink_fail",
error: {
error_msg: errmsg,
}
}), "");
} else {
alert(errmsg);
window.history.back();
}
}
// 验证成功回调
function callback(res) {
if (res.ret !== 0) {
displayErrmsg("系统繁忙,请稍后重试");
return;
}
if (!res.ticket) {
displayErrmsg("系统繁忙,请稍后重试");
return;
}
if (is_postmsg === "1") {
// 通知商户可以隐藏iframe
parent.postMessage(JSON.stringify({
action : "hide_captcha",
}), "");
}
var xhr = new XMLHttpRequest();
var params = "ticket=" + res.ticket + "&randstr=" + res.randstr + "&prepayid=" + "wx05192742360236aa64c421bbb8750f0000" + "&package=" + "3121462423";
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status !== 200) {
displayErrmsg("系统繁忙,请稍后重试");
return;
}
var resp = JSON.parse(xhr.response);
if (resp.retcode !== 1) {
displayErrmsg("系统繁忙,请稍后重试");
return;
}
if (is_postmsg === "1") {
parent.postMessage(JSON.stringify({
action : "send_deeplink",
data : {
deeplink : resp.deeplink
}
}), "");
} else {
top.location.href = resp.deeplink;
var redirect_url = "https://m.zhuanzhuan.com/open/ZZBActivity/index.html#/pay-complete?needHideHead=3&orderId=1709893114445450668";
if (redirect_url) {
setTimeout(
function () {
top.location.href = redirect_url;
},
5000
);
} else {
setTimeout(
function () {
window.history.back();
},
5000);
}
}
}
}
xhr.open("GET", "https://tx.alang.run/wxpay/checkcaptcha?" + params, true);
xhr.send();
}
try {
if(is_postmsg === "1") {
parent.postMessage(JSON.stringify({
action : "show_captcha",
}), "");
}
// 生成一个验证码对象
var captcha = new TencentCaptcha(document.getElementById('captcha-view'),
'2093769752',
callback,
{
ready: function () { },
needFeedBack: false,
type: "embed",
enableDarkMode: "force"
}
);
// 显示验证码
captcha.show();
} catch (error) {
displayErrmsg("验证码加载失败,请稍后重试");
}
</script>
</body>
</html>