diff --git a/CHANGELOG.md b/CHANGELOG.md index a946318..e557e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,47 @@ # Changelog +## v0.0.3 + +[compare changes](https://github.com/yisibell/vue3-admin-starter/compare/v0.0.2...v0.0.3) + +### 🚀 Enhancements + +- 1. add env support; fix tags view types ([5d2e9b1](https://github.com/yisibell/vue3-admin-starter/commit/5d2e9b1)) +- Add navigation guard ([964e99c](https://github.com/yisibell/vue3-admin-starter/commit/964e99c)) +- Login page, api repo and dynamic routes ([a59aeba](https://github.com/yisibell/vue3-admin-starter/commit/a59aeba)) +- System resource config page ([8cdf899](https://github.com/yisibell/vue3-admin-starter/commit/8cdf899)) +- Anonymous mode ([fd4819d](https://github.com/yisibell/vue3-admin-starter/commit/fd4819d)) +- Role management ([15fb60b](https://github.com/yisibell/vue3-admin-starter/commit/15fb60b)) +- Upgrade permission control ([5e71b84](https://github.com/yisibell/vue3-admin-starter/commit/5e71b84)) +- Upgrade vite config ([5af3e01](https://github.com/yisibell/vue3-admin-starter/commit/5af3e01)) +- 404 page ([c6dc011](https://github.com/yisibell/vue3-admin-starter/commit/c6dc011)) + +### 🩹 Fixes + +- Import trickling style ([df8a20c](https://github.com/yisibell/vue3-admin-starter/commit/df8a20c)) +- **tagsview:** Tags-view refresh error problem ([19e20d8](https://github.com/yisibell/vue3-admin-starter/commit/19e20d8)) + +### 🏡 Chore + +- **docs:** Update readme ([8e7c222](https://github.com/yisibell/vue3-admin-starter/commit/8e7c222)) +- **docs:** Update readme ([94fef14](https://github.com/yisibell/vue3-admin-starter/commit/94fef14)) +- Update readme ([d43e2bc](https://github.com/yisibell/vue3-admin-starter/commit/d43e2bc)) +- Update readme ([5c4ced6](https://github.com/yisibell/vue3-admin-starter/commit/5c4ced6)) +- Update readme ([d6b69ad](https://github.com/yisibell/vue3-admin-starter/commit/d6b69ad)) +- Update readme ([afa975a](https://github.com/yisibell/vue3-admin-starter/commit/afa975a)) +- **docs:** Update readme ([42d36ff](https://github.com/yisibell/vue3-admin-starter/commit/42d36ff)) + +### 🤖 CI + +- Add gihub actions for example ([c74260f](https://github.com/yisibell/vue3-admin-starter/commit/c74260f)) +- Add nojekyll file ([05bf7ce](https://github.com/yisibell/vue3-admin-starter/commit/05bf7ce)) +- **deploy:** Fix deploy base url ([640cfbd](https://github.com/yisibell/vue3-admin-starter/commit/640cfbd)) + +### ❤️ Contributors + +- Wenqing + ## v0.0.2 [compare changes](https://undefined/undefined/compare/v0.0.1...v0.0.2) diff --git a/package.json b/package.json index f8dc6b5..aa69140 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue3-admin-starter", - "version": "0.0.2", + "version": "0.0.3", "description": "A vue admin template powered by vite + typescript + vue3 + vue-router + pinia + element-plus + axios.", "author": { "name": "elenh", diff --git a/src/layouts/default/TagsView/index.vue b/src/layouts/default/TagsView/index.vue index 145c69d..010f2ad 100644 --- a/src/layouts/default/TagsView/index.vue +++ b/src/layouts/default/TagsView/index.vue @@ -41,6 +41,7 @@ import { useTagsViewStore } from '@/stores/tagsView' import type { IRouteRecord } from '@/router/interfaces/core' import type { ITagView } from '@/stores/tagsView' import ScrollPane from './ScrollPane.vue' +import { inWhiteList } from '@/permission' defineOptions({ name: 'TagsView' @@ -66,9 +67,11 @@ const router = useRouter() watch( () => route, - () => { - addTags() - moveToCurrentTag() + (view) => { + if (!inWhiteList(view.path)) { + addTags() + moveToCurrentTag() + } }, { deep: true } ) diff --git a/src/permission.ts b/src/permission.ts index 13e4028..734956e 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -5,14 +5,18 @@ import { usePermissionStore } from '@/stores/permission' import { ElMessage } from 'element-plus' import settings from './settings' -const whiteList = ['/login', '/404'] +export const whiteList = ['/login', '/404', '/redirect'] + +export const inWhiteList = (path: string) => { + return whiteList.some((v) => path.includes(v)) +} export const initPermissionGuard = (router: Router) => { router.beforeEach(async (to, from, next) => { // start progress bar tricklingProgress.start() - if (!router.hasRoute(to.name || '')) { + if (!inWhiteList(to.path) && !router.hasRoute(to.name || '')) { next('/404') return } @@ -54,7 +58,7 @@ export const initPermissionGuard = (router: Router) => { } } else { // Has no token - if (whiteList.indexOf(to.path) !== -1 || settings.anonymousMode) { + if (inWhiteList(to.path) || settings.anonymousMode) { // In the free login whitelist, go directly next() } else { diff --git a/src/router/staticRoutes/hiddenRoutes.ts b/src/router/staticRoutes/hiddenRoutes.ts index d4ef5ee..3ae98ce 100644 --- a/src/router/staticRoutes/hiddenRoutes.ts +++ b/src/router/staticRoutes/hiddenRoutes.ts @@ -11,7 +11,8 @@ export const hiddenRoutes: IRouteRecord[] = [ children: [ { path: '/redirect/:path(.*)', - component: () => import('@/views/redirect/index.vue') + name: 'RedirectView', + component: () => import('@/views/app/RedirectView.vue') } ] }, diff --git a/src/router/staticRoutes/index.ts b/src/router/staticRoutes/index.ts index 3fb2695..859cb61 100644 --- a/src/router/staticRoutes/index.ts +++ b/src/router/staticRoutes/index.ts @@ -30,13 +30,13 @@ export const constantRoutes: IRouteRecord[] = ( ] as IRouteRecord[] ).concat(labRoutes, hiddenRoutes) -// 捕获 404 页面 export const latestRoutes: IRouteRecord[] = [ - { - path: '/:pathMatch(.*)*', - redirect: '/404', - meta: { hidden: true } - } + // 捕获 404 页面 + // { + // path: '/:pathMatch(.*)*', + // redirect: '/404', + // meta: { hidden: true } + // } ] export const getFullRoutes = (routes: IRouteRecord[], concatDynamicRoutes: boolean = true) => { diff --git a/src/views/redirect/index.vue b/src/views/app/RedirectView.vue similarity index 65% rename from src/views/redirect/index.vue rename to src/views/app/RedirectView.vue index 9a56322..ba11965 100644 --- a/src/views/redirect/index.vue +++ b/src/views/app/RedirectView.vue @@ -1,22 +1,18 @@ + + -