🔨 修改路由配置.
This commit is contained in:
@@ -4,8 +4,8 @@ import type { MenuQueryResponse } from '@/api/system/menu';
|
||||
import router from '@/router';
|
||||
import { defineStore } from 'pinia';
|
||||
import { Notification } from '@arco-design/web-vue';
|
||||
import { getMenuList } from '@/api/user/auth';
|
||||
import { EnabledStatus } from '@/types/const';
|
||||
import { getUserMenuList } from '@/api/user/permission';
|
||||
|
||||
export default defineStore('menu', {
|
||||
state: (): MenuState => ({
|
||||
@@ -54,7 +54,7 @@ export default defineStore('menu', {
|
||||
async fetchMenu() {
|
||||
try {
|
||||
// 查询菜单
|
||||
const { data } = await getMenuList();
|
||||
const { data } = await getUserMenuList();
|
||||
// 转换菜单
|
||||
this.serverMenus = data.map(s => {
|
||||
// 构建父目录
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { TabBarState, TagProps } from './types';
|
||||
import { defineStore } from 'pinia';
|
||||
import { DEFAULT_ROUTE_NAME, DEFAULT_TAB } from '@/router/constants';
|
||||
import { isString } from '@/utils/is';
|
||||
|
||||
export default defineStore('tabBar', {
|
||||
state: (): TabBarState => ({
|
||||
cacheTabList: new Set([DEFAULT_ROUTE_NAME]),
|
||||
tagList: [DEFAULT_TAB],
|
||||
cacheTabList: new Set([]),
|
||||
tagList: [],
|
||||
}),
|
||||
|
||||
getters: {
|
||||
@@ -55,9 +54,8 @@ export default defineStore('tabBar', {
|
||||
|
||||
// 重设 tab
|
||||
resetTabList() {
|
||||
this.tagList = [DEFAULT_TAB];
|
||||
this.tagList = [];
|
||||
this.cacheTabList.clear();
|
||||
this.cacheTabList.add(DEFAULT_ROUTE_NAME);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type { UserState } from './types';
|
||||
import type { LoginRequest } from '@/api/user/auth';
|
||||
import { getUserPermission, login as userLogin, logout as userLogout } from '@/api/user/auth';
|
||||
import { userLogin, userLogout } from '@/api/user/auth';
|
||||
import { md5 } from '@/utils';
|
||||
import { defineStore } from 'pinia';
|
||||
import { clearToken, setToken } from '@/utils/auth';
|
||||
import { md5 } from '@/utils';
|
||||
import { removeRouteListener } from '@/utils/route-listener';
|
||||
import { getUserPermission } from '@/api/user/permission';
|
||||
import { useAppStore, useCacheStore, useMenuStore, useTabBarStore, useTipsStore } from '@/store';
|
||||
|
||||
export default defineStore('user', {
|
||||
@@ -25,15 +26,15 @@ export default defineStore('user', {
|
||||
|
||||
actions: {
|
||||
// 设置用户信息
|
||||
setInfo(partial: Partial<UserState>) {
|
||||
setUserInfo(partial: Partial<UserState>) {
|
||||
this.$patch(partial);
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
async info() {
|
||||
async getUserInfo() {
|
||||
const { data } = await getUserPermission();
|
||||
// 设置用户信息
|
||||
this.setInfo({
|
||||
this.setUserInfo({
|
||||
id: data.user.id,
|
||||
username: data.user.username,
|
||||
nickname: data.user.nickname,
|
||||
@@ -42,11 +43,10 @@ export default defineStore('user', {
|
||||
permission: data.permissions,
|
||||
});
|
||||
// 设置用户偏好
|
||||
const appStore = useAppStore();
|
||||
appStore.updateSettings(data.user.systemPreference);
|
||||
useAppStore().updateSettings(data.systemPreference);
|
||||
// 设置已经提示的key
|
||||
const tipsStore = useTipsStore();
|
||||
tipsStore.set(data.user.tippedKeys);
|
||||
useTipsStore().set(data.tippedKeys);
|
||||
return data;
|
||||
},
|
||||
|
||||
// 登录
|
||||
|
||||
Reference in New Issue
Block a user