index.js
1.5 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
import config from "../../../utils/config.js"
Page({
data: {
code: 'QJ234W85' // 这里是二维码下方的变量文本
},
onInputChange(e) {
this.setData({ code: e.detail.value });
},
onOpenReward() {
if (!this.data.code.trim()) {
wx.showToast({
title: '请输入明码',
icon: 'none'
});
return;
}
wx.showToast({
title: '正在验证...',
icon: 'loading'
});
// 请求服务器验证明码
setTimeout(() => {
// let latitude = getApp().globalData.userInfo.latitude
// let longitude = getApp().globalData.userInfo.longitude
const apiBase = config.dataServer
wx.request({
url: apiBase + `/junyao/${this.data.code}`,
header: {
'Authorization': `Bearer ${getApp().globalData.userInfo?.token}`,
'serialId': getApp().userInfo?.serialId
},
method: "POST",
data: {},
timeout: 30 * 1000,
success: (res) => {
let tag = res.data.tag
wx.navigateTo({
url: `/scanGroup/jyScan/index/index?tag=${tag}`,
})
},
fail: (res) => {
console.log(res)
// const msg = await getErrortxt()
// wx.showModal({
// title: '提示',
// content: msg,
// showCancel: false,
// confirmText: '知道了',
// confirmColor: '#fe8600'
// })
},
complete: () => {
// wx.hideNavigationBarLoading()
// if (showLoading) {
// wx.hideLoading()
// }
}
})
// wx.showToast({
// title: '奖励已领取!',
// icon: 'success'
// });
}, 2000);
}
});