feat: 调整登录逻辑

This commit is contained in:
duanshuwen
2025-09-12 22:20:01 +08:00
parent 07752394eb
commit c03a4200be
12 changed files with 248 additions and 175 deletions

View File

@@ -1 +1,33 @@
import { loginAuth, checkPhone, bindPhone } from "@/manager/LoginManager";
// 跳转登录
export const goLogin = () => uni.reLaunch({ url: "/pages/login/index" });
// 登录逻辑
export const onLogin = (e) => {
const { code } = e.detail;
console.info("onLogin code: ", code);
loginAuth().then(async () => {
// 检测是否绑定手机号
const res = await checkPhone();
if (res.data) return;
const params = { wechatPhoneCode: code, clientId: "2" };
// 绑定手机号
bindPhone(params);
});
};
// 检测token
export const checkToken = async () => {
return new Promise((resolve) => {
const token = uni.getStorageSync("token");
if (!token) return;
resolve(token);
});
};