feat: 授权token保持登录

This commit is contained in:
duanshuwen
2025-11-18 19:44:55 +08:00
parent de412aed9c
commit c2c4f323dc

View File

@@ -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 }) => {