feat: 优化登录逻辑

This commit is contained in:
2026-01-06 19:42:10 +08:00
parent 7e02429f6e
commit 9c658e9f9f
6 changed files with 30 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
import { wxLogin, bindUserPhone } from "../request/api/LoginApi";
import { oauthToken, bindUserPhone } from "../request/api/LoginApi";
import { getWeChatAuthCode } from "./AuthManager";
import { clientId } from "@/constant/base";
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
@@ -17,15 +17,11 @@ const loginAuth = (e) => {
clientId: clientId,
};
console.log("获取到的微信授权params:", JSON.stringify(params));
const response = await wxLogin(params);
const response = await oauthToken(params);
console.log("获取到的微信授权response:", response);
if (response.access_token) {
console.log("进入条件");
setAccessToken(response.access_token);
// 登录成功后,触发登录成功事件
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
resolve();
} else {
reject(response.message || "登录失败");