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
<!DOCTYPE html>
<html>
<head>
<meta lang="zh-cn">
<title>QRCode</title>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
<style>
.qr-code {
text-align: center;
padding-top: 50px;
}
.qr-code>#image {
display: inline-block;
width: 60%;
}
</style>
</head>
<body>
<!-- <div id="uri">Uri:</div> -->
<div class="qr-code">
<img id="image" src="" alt />
</div>
<!--<h1>Hola qrCode.</h1>-->
<!-- <img src="./3.png"> -->
<script>
const cleanUrlAndPostQRInfo = () => {
// alert(`--->qrCode: cleanUrlAndPostQRInfo: IN.`)
let nowUrl = ''
let id = ''
let actionid = ''
let activeId = ''
let voucherId = ''
let unionId = ''
nowUrl = document.location.toString().slice(42);
// alert(`--->nowUrl =${nowUrl}`)
id = String(nowUrl.split("?")[1].slice(3).split("&")[0]);
actionid = String(nowUrl.split("?")[1].slice(3).split("&")[1].split("=")[1]);
activeId = String(nowUrl.split("?")[1].slice(3).split("&")[2].split("=")[1]);
voucherId = String(nowUrl.split("?")[1].slice(3).split("&")[3].split("=")[1]);
unionId = String(nowUrl.split("?")[1].slice(3).split("&")[4].split("=")[1]);
// let pageUri = `${nowUrl}&detailid=${voucherId}&actionid=${activeId}&unionid=${unionId}`;
let pageUri = `${nowUrl}`;
pageUri = pageUri.split('&').slice(0, 5).join('&')
let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${pageUri}`;
// document.getElementById('uri').innerHTML = 'Uri=' + String(pageUri)
// alert(`--->qrCode: Ajax: POST: pageUrl = ${pageUrl}`)
// document.location = pageUri
$.ajax({
type: "POST",
url: pageUrl,
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
data: {},
success: function (res) {
// alert(`--->qrCode: ajax: res.`)
// alert(`--->qrCode: ajax: res: res =${JSON.stringify(res)}`)
console.log(res)
$('#image').attr('src', res.data)
// $('#image').attr('src', 'http://qywx2.100smartdata.com/qrCode/1584512690487.jpeg')
},
error: function (data) {
alert(`--->qrCode: ajax: err.`)
alert(`--->qrCode: ajax: err: err =${JSON.stringify(err)}`)
alert('error' + JSON.stringify(data))
console.log(data);
}
});
}
const __main = () => {
cleanUrlAndPostQRInfo()
}
__main()
</script>
</body>
</html>