1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-05-01 14:49:00 +08:00

fix: 当用户访问一个当前用户没有的权限时导航区404

This commit is contained in:
leipu 2024-12-20 11:17:58 +08:00
commit 9a22ac1659
7 changed files with 1857 additions and 1192 deletions

View File

@ -19,6 +19,5 @@
"markdown", "markdown",
"json", "json",
"jsonc" "jsonc"
], ]
"common-intellisense.ui": ["naiveUi2"]
} }

View File

@ -13,42 +13,42 @@
}, },
"dependencies": { "dependencies": {
"@arco-design/color": "^0.4.0", "@arco-design/color": "^0.4.0",
"@vueuse/core": "^11.1.0", "@vueuse/core": "^12.0.0",
"axios": "^1.7.7", "axios": "^1.7.9",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"echarts": "^5.5.1", "echarts": "^5.5.1",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"naive-ui": "^2.40.1", "naive-ui": "^2.40.3",
"pinia": "^2.2.4", "pinia": "^2.3.0",
"pinia-plugin-persistedstate": "^4.1.1", "pinia-plugin-persistedstate": "^4.1.3",
"vue": "^3.5.12", "vue": "^3.5.13",
"vue-echarts": "^7.0.3", "vue-echarts": "^7.0.3",
"vue-router": "^4.4.5", "vue-router": "^4.5.0",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^3.8.0", "@antfu/eslint-config": "^3.12.0",
"@iconify/json": "^2.2.262", "@iconify/json": "^2.2.282",
"@unocss/eslint-config": "^0.63.6", "@unocss/eslint-config": "^0.65.1",
"@unocss/eslint-plugin": "^0.63.6", "@unocss/eslint-plugin": "^0.65.1",
"@unocss/preset-rem-to-px": "^0.63.6", "@unocss/preset-rem-to-px": "^0.65.1",
"@vitejs/plugin-vue": "^5.1.4", "@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.0.1", "@vitejs/plugin-vue-jsx": "^4.1.1",
"eslint": "^9.13.0", "eslint": "^9.17.0",
"eslint-plugin-format": "^0.1.2", "eslint-plugin-format": "^0.1.3",
"esno": "^4.8.0", "esno": "^4.8.0",
"fs-extra": "^11.2.0", "fs-extra": "^11.2.0",
"glob": "^11.0.0", "glob": "^11.0.0",
"lint-staged": "^15.2.10", "lint-staged": "^15.2.11",
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",
"simple-git-hooks": "^2.11.1", "simple-git-hooks": "^2.11.1",
"taze": "^0.17.2", "taze": "^0.18.0",
"unocss": "^0.63.6", "unocss": "^0.65.1",
"unplugin-auto-import": "^0.18.3", "unplugin-auto-import": "^0.19.0",
"unplugin-vue-components": "^0.27.4", "unplugin-vue-components": "^0.27.5",
"vite": "^5.4.9", "vite": "^6.0.3",
"vite-plugin-router-warn": "^1.0.0", "vite-plugin-router-warn": "^1.0.0",
"vite-plugin-vue-devtools": "^7.5.2", "vite-plugin-vue-devtools": "^7.6.8",
"vue3-intro-step": "^1.0.5" "vue3-intro-step": "^1.0.5"
}, },
"simple-git-hooks": { "simple-git-hooks": {

2978
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -12,16 +12,15 @@
<Vue3IntroStep <Vue3IntroStep
ref="myIntroStep" ref="myIntroStep"
v-model:show="show" v-model:show="show"
class="beginner-guide"
:config="config" :config="config"
> >
<template #prev="{ tipItem, index }"> <template #prev="{ tipItem, index }">
<NButton type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="prev(tipItem, index)"> <NButton class="mr-12" type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="prev(tipItem, index)">
上一步 上一步
</NButton> </NButton>
</template> </template>
<template #next="{ tipItem }"> <template #next="{ tipItem }">
<NButton type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="next(tipItem)"> <NButton class="mr-12" type="primary" color="#fff" text-color="#fff" ghost round size="small" @click="next(tipItem)">
下一步 下一步
</NButton> </NButton>
</template> </template>
@ -128,11 +127,3 @@ function prev() {
myIntroStep.value.prev() myIntroStep.value.prev()
} }
</script> </script>
<style lang="scss" scoped>
.beginner-guide {
.n-button {
margin-right: 12px;
}
}
</style>

View File

@ -43,6 +43,11 @@ export function createPermissionGuard(router) {
return { ...to, replace: true } return { ...to, replace: true }
} }
router.addRoute({
path: '/:catchAll(.*)',
redirect: '/404',
})
const routes = router.getRoutes() const routes = router.getRoutes()
if (routes.find(route => route.name === to.name)) if (routes.find(route => route.name === to.name))
return true return true

View File

@ -50,7 +50,7 @@ export const useAppStore = defineStore('app', {
}, },
}, },
persist: { persist: {
paths: ['collapsed', 'layout', 'primaryColor', 'naiveThemeOverrides'], pick: ['collapsed', 'layout', 'primaryColor', 'naiveThemeOverrides'],
storage: sessionStorage, storage: sessionStorage,
}, },
}) })

View File

@ -88,7 +88,7 @@ export const useTabStore = defineStore('tab', {
}, },
}, },
persist: { persist: {
paths: ['tabs'], pick: ['tabs'],
storage: sessionStorage, storage: sessionStorage,
}, },
}) })