feat: 登录逻辑的调整

This commit is contained in:
2025-10-12 13:55:35 +08:00
parent 14945914ea
commit 2abce21c49
7 changed files with 58 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
import { loginAuth, bindPhone } from "@/manager/LoginManager";
import { loginAuth, bindPhone, checkPhone } from "@/manager/LoginManager";
import { clientId } from "@/constant/base";
import { useAppStore } from "@/store";
@@ -10,16 +10,28 @@ export const goBack = () => uni.navigateBack({ delta: 1 });
// 登录逻辑
export const onLogin = async (e) => {
console.info("onLogin code: ", e.detail);
console.info("onLogin code: ", e);
return new Promise(async (resolve, reject) => {
// 判断用户拒绝
if (e.detail.errno === 104) {
if (e !== undefined && e && e.detail && e.detail.errno === 104) {
reject();
return;
}
await loginAuth(e).then(async () => {
// 检查手机号是否绑定
const checkRes = await checkPhone();
if (checkRes.data) {
resolve();
return;
}
if (e === undefined) {
resolve();
return;
}
const { code } = e.detail;
// 绑定手机号