Skip to content

Commit

Permalink
Merge branch 'main' into release/gh-page
Browse files Browse the repository at this point in the history
  • Loading branch information
wenqing committed Sep 1, 2023
2 parents a85f8bb + 9fbc852 commit 73aae99
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 24 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 <wenqing@kerrylan.com>

## v0.0.2

[compare changes](https://undefined/undefined/compare/v0.0.1...v0.0.2)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 6 additions & 3 deletions src/layouts/default/TagsView/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -66,9 +67,11 @@ const router = useRouter()
watch(
() => route,
() => {
addTags()
moveToCurrentTag()
(view) => {
if (!inWhiteList(view.path)) {
addTags()
moveToCurrentTag()
}
},
{ deep: true }
)
Expand Down
10 changes: 7 additions & 3 deletions src/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/router/staticRoutes/hiddenRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
]
},
Expand Down
12 changes: 6 additions & 6 deletions src/router/staticRoutes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
16 changes: 6 additions & 10 deletions src/views/redirect/index.vue → src/views/app/RedirectView.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<template>
<div>&nbsp;</div>
</template>

<script lang="ts" setup>
import { onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
onMounted(() => {
const { params, query } = route
const { path } = params
router.replace({ path: '/' + path, query })
})
</script>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'RedirectView',
render() {
return ''
}
router.replace({ path: '/' + path, query })
})
</script>

0 comments on commit 73aae99

Please sign in to comment.