feat: 优化登录逻辑
This commit is contained in:
@@ -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 || "登录失败");
|
||||
|
||||
Reference in New Issue
Block a user