feat: 调整登录逻辑

This commit is contained in:
duanshuwen
2025-12-25 22:45:55 +08:00
parent b7fbe99cd0
commit f027685072
3 changed files with 28 additions and 23 deletions

View File

@@ -2,6 +2,7 @@
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { getEvnUrl } from "@/request/api/config";
import { refreshToken } from "@/hooks/useGoLogin";
import { checkPhone } from "@/manager/LoginManager";
onLaunch(async () => {
await getEvnUrl({ versionValue: "1.0.3" });

View File

@@ -61,8 +61,14 @@ export const checkToken = () => {
};
// 刷新token
export const refreshToken = () => {
export const refreshToken = async () => {
return new Promise((resolve) => {
checkPhone().then(async (checkRes) => {
if (!checkRes.data) {
resolve(true);
return;
}
uni.login({
provider: "weixin", //使用微信登录
success: async ({ code }) => {
@@ -80,11 +86,9 @@ export const refreshToken = () => {
setStorageSyncToken(response.access_token);
// 登录成功后,触发登录成功事件
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
resolve(false)
} else {
resolve(true)
}
},
});
});
});
};

View File

@@ -83,7 +83,7 @@ const logo = computed(() => getCurrentConfig().logo);
const handleAgreeAndGetPhone = () => {
// 如果需要微信登录,直接返回
if (needWxLogin.value) {
return
return;
}
if (!isAgree.value) {