|
@@ -69,6 +69,8 @@ export default { |
|
@@ -69,6 +69,8 @@ export default { |
69
|
if (res.statusCode == 200) {
|
69
|
if (res.statusCode == 200) {
|
70
|
this.openid = res.data.openid;
|
70
|
this.openid = res.data.openid;
|
71
|
this.session_key = res.data.session_key;
|
71
|
this.session_key = res.data.session_key;
|
|
|
72
|
+ //设置全局变量openId
|
|
|
73
|
+ getApp().globalData.openId = res.data.openid;
|
72
|
}
|
74
|
}
|
73
|
},
|
75
|
},
|
74
|
complete: e => {
|
76
|
complete: e => {
|
|
@@ -88,8 +90,8 @@ export default { |
|
@@ -88,8 +90,8 @@ export default { |
88
|
...mapMutations(['setUserInfo']),
|
90
|
...mapMutations(['setUserInfo']),
|
89
|
...mapActions(['updateBadgeTotal']),
|
91
|
...mapActions(['updateBadgeTotal']),
|
90
|
//微信授权登录
|
92
|
//微信授权登录
|
91
|
- //#ifdef MP
|
|
|
92
|
- onAuthorization(e) {
|
93
|
+ //#ifdef MP-WEIXIN
|
|
|
94
|
+ onAuthorization() {
|
93
|
/**
|
95
|
/**
|
94
|
* 注意:通过wx.getUserProfile并不能获取用户的openid,openid是唯一识别用户的标识,
|
96
|
* 注意:通过wx.getUserProfile并不能获取用户的openid,openid是唯一识别用户的标识,
|
95
|
* 所以最好在用户授权登录时就获取。调用wx.login()获取
|
97
|
* 所以最好在用户授权登录时就获取。调用wx.login()获取
|
|
@@ -113,8 +115,12 @@ export default { |
|
@@ -113,8 +115,12 @@ export default { |
113
|
if (res.token == '' || res.token == null) {
|
115
|
if (res.token == '' || res.token == null) {
|
114
|
//需要绑定,跳转我的页面进行绑定,显示绑定按钮
|
116
|
//需要绑定,跳转我的页面进行绑定,显示绑定按钮
|
115
|
uni.reLaunch({
|
117
|
uni.reLaunch({
|
116
|
- url: '/pages/personal/personal'
|
118
|
+ url: '../../pages/personal/personal'
|
117
|
});
|
119
|
});
|
|
|
120
|
+ let userInfo = {
|
|
|
121
|
+ isThirdLogin: true //token用于判断是否登录
|
|
|
122
|
+ };
|
|
|
123
|
+ this.setUserInfo(userInfo);
|
118
|
} else {
|
124
|
} else {
|
119
|
// 不需要绑定
|
125
|
// 不需要绑定
|
120
|
// 储存登录信息
|
126
|
// 储存登录信息
|
|
@@ -135,6 +141,9 @@ export default { |
|
@@ -135,6 +141,9 @@ export default { |
135
|
});
|
141
|
});
|
136
|
this.saveUserInfo();
|
142
|
this.saveUserInfo();
|
137
|
this.getAlarmTotalData();
|
143
|
this.getAlarmTotalData();
|
|
|
144
|
+ uni.reLaunch({
|
|
|
145
|
+ url: '../../pages/personal/personal'
|
|
|
146
|
+ });
|
138
|
}
|
147
|
}
|
139
|
})
|
148
|
})
|
140
|
.catch(e => {
|
149
|
.catch(e => {
|
|
@@ -147,7 +156,7 @@ export default { |
|
@@ -147,7 +156,7 @@ export default { |
147
|
// #ifdef MP
|
156
|
// #ifdef MP
|
148
|
setTimeout(() => {
|
157
|
setTimeout(() => {
|
149
|
uni.reLaunch({
|
158
|
uni.reLaunch({
|
150
|
- url: '/pages/personal/personal?obj=' + encodeURIComponent(JSON.stringify(obj))
|
159
|
+ url: '../../pages/personal/personal?obj=' + encodeURIComponent(JSON.stringify(obj))
|
151
|
});
|
160
|
});
|
152
|
}, 500);
|
161
|
}, 500);
|
153
|
// #endif
|
162
|
// #endif
|
|
@@ -202,7 +211,8 @@ export default { |
|
@@ -202,7 +211,8 @@ export default { |
202
|
};
|
211
|
};
|
203
|
let userInfo = {
|
212
|
let userInfo = {
|
204
|
...resObj,
|
213
|
...resObj,
|
205
|
- token: true //token用于判断是否登录
|
214
|
+ token: true, //token用于判断是否登录
|
|
|
215
|
+ isThirdLogin: false
|
206
|
};
|
216
|
};
|
207
|
if (userInfo.token) {
|
217
|
if (userInfo.token) {
|
208
|
this.setUserInfo(userInfo);
|
218
|
this.setUserInfo(userInfo);
|