feat: sider调整

This commit is contained in:
rd
2025-08-18 17:22:11 +08:00
parent 7c7704c078
commit c0dfd6030f
25 changed files with 510 additions and 287 deletions

View File

@ -95,7 +95,7 @@ export const MENU_LIST = [
'PutAccountAccountData',
'PutAccountAccountDashboard',
'PutAccountInvestmentGuidelines',
'guideDetail',
'PutAccountInvestmentGuidelinesDetail',
],
},
// {

View File

@ -10,27 +10,35 @@ import { useEnterpriseStore } from '@/stores/modules/enterprise';
import { getTaskUnread, patchTaskRead } from '@/api/all/common';
interface sidebarState {
activeMenuId: number | null;
activeMenuKey: string | number | null;
menuList: any[];
allowAccessRoutes: any[];
unreadInfo: number[];
menuCollapse: boolean;
}
let unreadInfoTimer: number | null = null;
export const useSidebarStore = defineStore('sidebar', {
state: (): sidebarState => ({
activeMenuId: null, //
activeMenuKey: null, // 激活的菜单id
menuList: [], // 菜单信息
unreadInfo: [], // 未读消息
allowAccessRoutes: [], // 允许访问的路由列表
menuCollapse: false, // 菜单是否折叠
}),
actions: {
clearActiveMenuId() {
this.activeMenuId = null;
clearActiveMenuKey() {
this.activeMenuKey = null;
},
setActiveMenuId(id: number) {
this.activeMenuId = id;
setActiveMenuKey(key: string | number) {
this.activeMenuKey = key;
},
setMenuCollapse() {
this.menuCollapse = !this.menuCollapse;
},
clearMenuCollapse() {
this.menuCollapse = false;
},
clearUserNavbarMenuList() {
this.menuList = [];
@ -42,8 +50,8 @@ export const useSidebarStore = defineStore('sidebar', {
(item) => !item.permissionKey || enterpriseStore.enterpriseInfo?.permissions?.includes(item.permissionKey),
);
},
// 根据当前路由自动设置 activeMenuId
setActiveMenuIdByRoute(route: RouteLocationNormalized) {
// 根据当前路由自动设置 activeMenuKey
setActiveMenuKeyByRoute(route: RouteLocationNormalized) {
const appRoutes = router.options?.routes ?? [];
const findMenuGroup = (routes: any[]): number | null => {
@ -68,7 +76,7 @@ export const useSidebarStore = defineStore('sidebar', {
const menuId = findMenuGroup(appRoutes as any);
if (menuId !== null) {
this.activeMenuId = menuId;
this.activeMenuKey = menuId;
}
},
async getTaskUnreadInfo() {