mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-12-18 00:00:37 +08:00
feat: 新增登录页面
This commit is contained in:
@@ -39,4 +39,5 @@ export type setType = {
|
||||
export type userType = {
|
||||
username?: string;
|
||||
roles?: Array<string>;
|
||||
currentPage?: number;
|
||||
};
|
||||
|
||||
@@ -10,13 +10,15 @@ import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||
import { type DataInfo, setToken, removeToken, sessionKey } from "@/utils/auth";
|
||||
|
||||
export const useUserStore = defineStore({
|
||||
id: "pure-user",
|
||||
id: "ag-user",
|
||||
state: (): userType => ({
|
||||
// 用户名
|
||||
username:
|
||||
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "",
|
||||
// 页面级别权限
|
||||
roles: storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? []
|
||||
roles: storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [],
|
||||
// 判断登录页面显示哪个组件(0:登录(默认)、1:手机登录、2:二维码登录、3:注册、4:忘记密码)
|
||||
currentPage: 0
|
||||
}),
|
||||
actions: {
|
||||
/** 存储用户名 */
|
||||
@@ -27,6 +29,10 @@ export const useUserStore = defineStore({
|
||||
SET_ROLES(roles: Array<string>) {
|
||||
this.roles = roles;
|
||||
},
|
||||
/** 存储登录页面显示哪个组件 */
|
||||
SET_CURRENTPAGE(value: number) {
|
||||
this.currentPage = value;
|
||||
},
|
||||
/** 登入 */
|
||||
async loginByUsername(data) {
|
||||
return new Promise<UserResult>((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user