mirror of
https://github.com/certd/certd.git
synced 2026-05-15 12:37:30 +08:00
feat: 升级前端框架,适配手机端
This commit is contained in:
@@ -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");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user