feat: 升级前端框架,适配手机端

This commit is contained in:
xiaojunnuo
2025-03-06 21:11:07 +08:00
659 changed files with 37406 additions and 873 deletions
@@ -11,6 +11,7 @@ import { message, Modal, notification } from "ant-design-vue";
import { useI18n } from "vue-i18n";
import { mitter } from "/src/utils/util.mitt";
import { resetAllStores, useAccessStore } from "/@/vben/stores";
interface UserState {
userInfo: Nullable<UserInfoRes>;
@@ -39,8 +40,10 @@ export const useUserStore = defineStore({
}
},
actions: {
setToken(info: string, expire: number) {
this.token = info;
setToken(token: string, expire: number) {
this.token = token;
const accessStore = useAccessStore();
accessStore.setAccessToken(token);
LocalStorage.set(TOKEN_KEY, this.token, expire);
},
setUserInfo(info: UserInfoRes) {
@@ -92,11 +95,10 @@ export const useUserStore = defineStore({
},
async onLoginSuccess(loginData: any) {
await this.getUserInfoAction();
const userInfo = await this.getUserInfoAction();
mitter.emit("app.login", { userInfo, token: loginData });
// await this.getUserInfoAction();
// const userInfo = await this.getUserInfoAction();
mitter.emit("app.login", { token: loginData });
await router.replace("/");
return userInfo;
},
/**
@@ -104,6 +106,7 @@ export const useUserStore = defineStore({
*/
logout(goLogin = true) {
this.resetState();
resetAllStores();
goLogin && router.push("/login");
mitter.emit("app.logout");
},