修改bug

This commit is contained in:
Gao xiaosong
2020-09-27 23:48:01 +08:00
parent e380e64198
commit 4955c2198a
7 changed files with 33 additions and 34 deletions

View File

@ -16,7 +16,6 @@
// import request from "@//api/request";
import {
wxappAuth,
getUser
} from "@/api/user";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
@ -56,7 +55,9 @@
if (this.$store.getters.token) {
// 如果token存在直接进行进页面
console.log('登录状态存在,直接进页面')
this.toLaunch();
this.getUser().finally(() => {
this.toLaunch();
})
return;
}
console.log('进行登录操作')
@ -67,15 +68,14 @@
});
},
methods: {
...mapActions(["changeAuthorization", "setUserInfo"]),
...mapActions(["changeAuthorization", "setUserInfo", "getUser"]),
toLaunch() {
console.log("loading home");
this.changeAuthorization(false);
let redirect = cookie.get('redirect')
if (redirect) {
redirect = redirect.split('/pages')[1]
if (redirect && redirect.indexOf('/pages') != -1) {
this.$yrouter.replace({
path: '/pages' + redirect,
path: '/pages' + redirect.split('/pages')[1],
});
cookie.remove('redirect');
} else {