feat: 登录与websocket 初始化相关的调整
This commit is contained in:
@@ -6,8 +6,13 @@ import {
|
||||
import { getWeChatAuthCode } from "./AuthManager";
|
||||
import { useAppStore } from "@/store";
|
||||
import { clientId } from "@/constant/base";
|
||||
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
|
||||
|
||||
const loginAuth = () => {
|
||||
uni.setStorageSync("token", "");
|
||||
const appStore = useAppStore();
|
||||
appStore.setHasToken(false);
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const openIdCode = await getWeChatAuthCode();
|
||||
console.log("获取到的微信授权code:", openIdCode);
|
||||
@@ -25,6 +30,8 @@ const loginAuth = () => {
|
||||
uni.setStorageSync("token", response.access_token);
|
||||
const appStore = useAppStore();
|
||||
appStore.setHasToken(true);
|
||||
// 登录成功后,触发登录成功事件
|
||||
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
|
||||
resolve();
|
||||
} else {
|
||||
reject(response.message || "登录失败");
|
||||
|
||||
Reference in New Issue
Block a user