This commit is contained in:
2025-05-12 19:45:27 +08:00
parent 2e9c403632
commit ce0587d2b6
47 changed files with 1355 additions and 310 deletions

View File

@@ -1,15 +1,31 @@
import {defineStore} from "pinia";
import {ref, reactive} from "vue";
import {clearObject, toPage} from "../../utils/uils.js";
import Api from "../../api/index.js";
export const useUserStore = defineStore('UserStore', () => {
const isLogin = ref(false);
const token = ref(null);
const userInfo = reactive({});
const logout = async () => {
isLogin.value = false;
token.value = null;
clearObject(userInfo);
await toPage("/pages/login/index");
}
const getUserInfo = async () => {
const {data} = await Api.system.getInfo();
Object.assign(userInfo, data);
}
return {
isLogin,
userInfo,
token,
logout,
getUserInfo,
}
}, {
persist: {