index.js
1.86 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
let app = getApp();
Page({
data: {
canIUse: wx.canIUse('button.open-type.getUserInfo'),
tipsRuleVisible: false,
authorizeVisible: false,
indexInfo: {}
},
onShareAppMessage() {},
showAuth() {
this.setData({
authorizeVisible: true
})
},
onLoad(options) {
// this.initData();
},
initData() {
// app.queryIndex({
// auth: false
// }).then((result) => {
// this.setData({
// indexInfo: app.globalData.indexInfo
// })
// })
},
// 开始互动游戏 判断是否会员
onStartHandler() {
app.queryIndex({
auth: false
}).then((result) => {
this.setData({
indexInfo: app.globalData.indexInfo
})
let {
wishBillCode
} = app.globalData.indexInfo;
// 判断页面跳转
let path = "createWish";
if (wishBillCode) {
path = "wish"
}
console.log("path:",path);
app.router.push({
path: path
})
})
},
// 显示规则页面
onShowRuleHandler() {
this.setData({
tipsRuleVisible: true
})
},
hideMask() {
this.setData({
tipsRuleVisible: false,
authorizeVisible: false,
})
},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide_mask":
this.hideMask();
break;
default:
break;
}
},
bindGetUserInfo(e) {
wx.showLoading();
this.getUserInfo(e.detail);
},
getUserInfo(e) {
let _this = this;
app.post({
url: app.api.register,
sid: false,
data: {
encryptedData: e.encryptedData,
iv: e.iv,
code: app.globalData.wxcode,
tlMemberCode: app.globalData.tlMemberCode
}
}).then((res2) => {
wx.hideLoading();
_this.onStartHandler();
}).catch((err) => {})
},
})