feat: 授权token保持登录
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { wxLogin } from "../request/api/LoginApi";
|
||||
import { loginAuth, bindPhone, checkPhone } from "@/manager/LoginManager";
|
||||
import { clientId } from "@/constant/base";
|
||||
import { useAppStore } from "@/store";
|
||||
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
|
||||
|
||||
// 跳转登录
|
||||
@@ -48,14 +47,14 @@ export const onLogin = async (e) => {
|
||||
|
||||
// 检测token
|
||||
export const checkToken = () => {
|
||||
const token = uni.getStorageSync("token");
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const appStore = useAppStore();
|
||||
console.log("appStore.hasToken: ", appStore.hasToken);
|
||||
if (!appStore.hasToken) {
|
||||
console.log("没有token,跳转到登录页");
|
||||
if (!token) {
|
||||
goLogin();
|
||||
return;
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
@@ -68,8 +67,6 @@ export const refreshToken = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
uni.login({
|
||||
provider: "weixin", //使用微信登录
|
||||
success: async ({ code }) => {
|
||||
|
||||
Reference in New Issue
Block a user