diff --git a/.eslintrc.js b/.eslintrc.js index 839eaf06b67cb7a16f1eb9439accd65cc87cfe5a..e1aa19ee3a80aa8b6b3d8d6d5e71f8c06be897f8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -66,5 +66,7 @@ module.exports = { 'no-param-reassign': 0, 'prefer-regex-literals': 0, 'import/no-extraneous-dependencies': 0, + 'no-underscore-dangle': 0, + 'import/no-cycle': 1, }, }; diff --git a/.gitignore b/.gitignore index 6a86981ba9593a418f1c26eb29e0dfd602c48f35..d5ccaa92ebf4e81cb15ecae53f60b5f54306f436 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ dist-ssr .idea package-lock.json yarn.lock +pnpm-lock.yaml +*.log diff --git a/config/plugin/styleImport.ts b/config/plugin/styleImport.ts index acd74ddde2ff2532b6f80d75ca57dc6479332fea..80e81c3a5e08b4c3db3b7d193aaa256506728665 100644 --- a/config/plugin/styleImport.ts +++ b/config/plugin/styleImport.ts @@ -74,6 +74,7 @@ export default function configStyleImportPlugin() { if (ignoreList.includes(name)) return ''; // eslint-disable-next-line no-prototype-builtins return replaceList.hasOwnProperty(name) + // @ts-ignore ? `@arco-design/web-vue/es/${replaceList[name]}/style/css.js` : `@arco-design/web-vue/es/${name}/style/css.js`; // less diff --git a/package.json b/package.json index 98c1f00273ab4166ba14a935568bd7b894766084..42f2cb257fc01a3cdfd1b901768b6e596a404663 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "mitt": "^3.0.0", "nprogress": "^0.2.0", "pinia": "^2.0.9", + "pinia-plugin-persistedstate": "^2.3.0", "query-string": "^7.0.1", "vue": "^3.2.31", "vue-echarts": "^6.0.0", diff --git a/src/api/user.ts b/src/api/user.ts index 35b8812098b416efbe9c6094b1e57088ba78277d..04ca91e3fbf650b22f281a77cdbb0684a87b6092 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,6 +1,6 @@ import axios from 'axios'; -import type { RouteRecordNormalized } from 'vue-router'; -import { UserState } from '@/store/modules/user/types'; +import type { UserState } from '@/store/modules/user/types'; +import type { Menu } from "@/types/modules/system"; export interface LoginData { username: string; @@ -23,5 +23,5 @@ export function getUserInfo() { } export function getMenuList() { - return axios.post('/api/user/menu'); + return axios.post('/api/user/menu'); } diff --git a/src/components/global-setting/block.vue b/src/components/global-setting/block.vue index 340c6b8e7a8e1d390da954f749e19bf04da20786..b8a2bb44c560bf3a8c93a58a1d95d607bdcc50b0 100644 --- a/src/components/global-setting/block.vue +++ b/src/components/global-setting/block.vue @@ -44,7 +44,7 @@ key: string; value: unknown; }) => { - if (key === 'menuFromServer' && value) { + if (value) { await appStore.fetchServerMenuConfig(); } appStore.updateSettings({ [key]: value }); diff --git a/src/components/global-setting/index.vue b/src/components/global-setting/index.vue index 7712bada2cc4feb713ce80e575cdcc49dc067baf..a887b8c53b2fb8139949ab7c34b38269e8db62d2 100644 --- a/src/components/global-setting/index.vue +++ b/src/components/global-setting/index.vue @@ -43,11 +43,6 @@ }, { name: '底部', key: 'footer', defaultVal: appStore.footer }, { name: '多页签', key: 'tabBar', defaultVal: appStore.tabBar }, - { - name: '菜单来源于后台', - key: 'menuFromServer', - defaultVal: appStore.menuFromServer, - }, { name: '菜单宽度 (px)', key: 'menuWidth', diff --git a/src/components/menu/index.vue b/src/components/menu/index.vue index f7b3ef8f58ca7421e702e8d200d0242a77e7cb82..2361dc965c5ef56ded2ddf4d09dc96bd0e3537ad 100644 --- a/src/components/menu/index.vue +++ b/src/components/menu/index.vue @@ -71,8 +71,8 @@ return result; }; listenerRouteChange((newRoute) => { - const { requiresAuth, activeMenu, hidden } = newRoute.meta; - if (requiresAuth && (!hidden || activeMenu)) { + const { activeMenu, hidden } = newRoute.meta; + if (!hidden || activeMenu) { const menuOpenKeys = findMenuOpenKeys( (activeMenu || newRoute.name) as string ); diff --git a/src/components/menu/useMenuTree.ts b/src/components/menu/useMenuTree.ts index 5b95ded085d4dd2b2895f83f1bd2fb0714d0afd7..7787da916d1be6136f3de8d0e5c26f6ce2424cea 100644 --- a/src/components/menu/useMenuTree.ts +++ b/src/components/menu/useMenuTree.ts @@ -2,17 +2,11 @@ import { computed } from 'vue'; import { RouteRecordRaw, RouteRecordNormalized } from 'vue-router'; import usePermission from '@/hooks/permission'; import { useAppStore } from '@/store'; -import appClientMenus from '@/router/app-menus'; export default function useMenuTree() { const permission = usePermission(); const appStore = useAppStore(); - const appRoute = computed(() => { - if (appStore.menuFromServer) { - return appStore.appAsyncMenus; - } - return appClientMenus; - }); + const appRoute = computed(() => appStore.appAsyncMenus); const menuTree = computed(() => { const copyRouter = JSON.parse(JSON.stringify(appRoute.value)); copyRouter.sort((a: RouteRecordNormalized, b: RouteRecordNormalized) => { diff --git a/src/components/tab-bar/tab-item.vue b/src/components/tab-bar/tab-item.vue index bc4e49278f2e6dd0c891d3b27e2e0483f825bc77..fc67b750f06a13961067c0189117a44d346ea00e 100644 --- a/src/components/tab-bar/tab-item.vue +++ b/src/components/tab-bar/tab-item.vue @@ -45,7 +45,7 @@ import { useRouter, useRoute } from 'vue-router'; import { useTabBarStore } from '@/store'; import type { TagProps } from '@/store/modules/tab-bar/types'; - import { DEFAULT_ROUTE_NAME } from '@/router/routes'; + import { DEFAULT_ROUTE_NAME } from '@/router/constants'; // eslint-disable-next-line no-shadow enum Eaction { diff --git a/src/config/settings.json b/src/config/settings.json index 8ee24c35bea86c5599adbc0d6cfd5b0b6390f03b..4e16fd8076da8be930294a560566b306eaf4f895 100644 --- a/src/config/settings.json +++ b/src/config/settings.json @@ -10,6 +10,5 @@ "globalSettings": false, "device": "desktop", "tabBar": true, - "menuFromServer": true, "serverMenu": [] } diff --git a/src/layout/default-layout.vue b/src/layout/default-layout.vue index 7f5888fcb22896fbf398fdcaeeb287aa1eb93426..eafdb6c44f14464beec7fbc3af4021de3fc43fd3 100644 --- a/src/layout/default-layout.vue +++ b/src/layout/default-layout.vue @@ -34,7 +34,7 @@ - +