Commit 983dfe1e authored by Morson's avatar Morson

修复页面回调问题

parent 0027a4a4
......@@ -129,10 +129,10 @@ export default {
if (userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息
util.setOpenid(userInfo.wxopenid);
this.$u.vuex("vuex_token", userInfo.token);
this.$u.vuex('vuex_token', userInfo.token);
uni.setStorageSync("user-info", userInfo);
} else {
this.$u.vuex("vuex_token", "");
this.$u.vuex('vuex_token', '');
}
},
......
......@@ -144,7 +144,7 @@ export default {
watch: {
vuex_token(val){
// 监听token变化,如果更新则重新加载页面数据
this.initSettleInfo()
val && this.initSettleInfo()
}
},
computed: {
......
......@@ -90,6 +90,7 @@ export default {
}).then(res => {
uni.hideLoading();
if (res) {
that.setUserData(res.data)
that.goBackPage()
} else {
this.setLoginStatus()
......@@ -124,6 +125,7 @@ export default {
}).then(res => {
uni.hideLoading()
if (res) {
that.setUserData(res.data)
that.goBackPage()
} else {
uni.showToast({
......@@ -167,6 +169,16 @@ export default {
}
},
setUserData(userInfo) {
if (userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息
util.setOpenid(userInfo.wxopenid);
this.$u.vuex('vuex_token', userInfo.token);
uni.setStorageSync("user-info", userInfo);
} else {
this.$u.vuex('vuex_token', '');
}
},
setLoginStatus(authed = true) {
if (authed) {
......
......@@ -33,8 +33,8 @@ function authorization(data) {
const res = await app.$vm.$u.api.loginWechatAuth(data)
if (res) {
if (res.code == 200 && res.data) {
app.setUserData(res.data)
app.getBaseInfo(app.$vm)
// app.setUserData(res.data)
// app.getBaseInfo(app.$vm)
resolve(res);
} else {
reject(res);
......@@ -55,8 +55,8 @@ function signup(data) {
const res = await app.$vm.$u.api.loginWechatAuth(data)
if (res) {
if (res.code == 200 && res.data) {
app.setUserData(res.data)
app.getBaseInfo(app.$vm)
// app.setUserData(res.data)
// app.getBaseInfo(app.$vm)
resolve(res);
} else {
uni.showModal({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment