diff --git a/admin/src/assets/images/no_perms.png b/admin/src/assets/images/no_perms.png
new file mode 100644
index 00000000..c37c89bb
Binary files /dev/null and b/admin/src/assets/images/no_perms.png differ
diff --git a/admin/src/permission.ts b/admin/src/permission.ts
index 7b3f5dbd..b3e1cfa9 100644
--- a/admin/src/permission.ts
+++ b/admin/src/permission.ts
@@ -44,7 +44,7 @@ router.beforeEach(async (to, from, next) => {
const routeName = findFirstValidRoute(routes)
// 没有有效路由跳转到403页面
if (!routeName) {
- await userStore.logout()
+ clearAuthInfo()
next(PageEnum.ERROR_403)
return
}
diff --git a/admin/src/stores/modules/user.ts b/admin/src/stores/modules/user.ts
index 8ac6a42a..d5248d6b 100644
--- a/admin/src/stores/modules/user.ts
+++ b/admin/src/stores/modules/user.ts
@@ -28,6 +28,11 @@ const useUserStore = defineStore({
}),
getters: {},
actions: {
+ resetState() {
+ this.token = ''
+ this.userInfo = {}
+ this.perms = []
+ },
login(playload: any) {
const { account, password } = playload
return new Promise((resolve, reject) => {
diff --git a/admin/src/utils/auth.ts b/admin/src/utils/auth.ts
index cbcc5194..e7a6877a 100644
--- a/admin/src/utils/auth.ts
+++ b/admin/src/utils/auth.ts
@@ -11,7 +11,7 @@ export function getToken() {
export function clearAuthInfo() {
const userStore = useUserStore()
const tabsStore = useTabsStore()
- userStore.$reset()
+ userStore.resetState()
tabsStore.$reset()
cache.remove(TOKEN_KEY)
resetRouter()
diff --git a/admin/src/utils/request/axios.ts b/admin/src/utils/request/axios.ts
index cb07fd5e..65703e02 100644
--- a/admin/src/utils/request/axios.ts
+++ b/admin/src/utils/request/axios.ts
@@ -72,10 +72,9 @@ export class Axios {
}
if (err.code == AxiosError.ECONNABORTED || err.code == AxiosError.ERR_NETWORK) {
- setTimeout(() => {
- console.log(err)
+ return new Promise((resolve) => setTimeout(resolve, 500)).then(() =>
this.retryRequest(err)
- }, 500)
+ )
}
return Promise.reject(err)
}
@@ -103,17 +102,17 @@ export class Axios {
retryRequest(error: AxiosError) {
const config = error.config
const { retryCount, isOpenRetry } = config.requestOptions
- if (!isOpenRetry && config.method?.toUpperCase() == RequestMethodsEnum.POST) {
- return
+ if (!isOpenRetry || config.method?.toUpperCase() == RequestMethodsEnum.POST) {
+ return Promise.reject(error)
}
config.retryCount = config.retryCount ?? 0
if (config.retryCount >= retryCount) {
- return
+ return Promise.reject(error)
}
config.retryCount++
- this.axiosInstance.request(config)
+ return this.axiosInstance.request(config)
}
/**
* @description get请求
diff --git a/admin/src/views/error/403.vue b/admin/src/views/error/403.vue
index 30fa26dc..53905ece 100644
--- a/admin/src/views/error/403.vue
+++ b/admin/src/views/error/403.vue
@@ -1,10 +1,12 @@
-
+
+
+
+

+
+
+
diff --git a/admin/src/views/error/components/error.vue b/admin/src/views/error/components/error.vue
index 51e68d54..5f0b9590 100644
--- a/admin/src/views/error/components/error.vue
+++ b/admin/src/views/error/components/error.vue
@@ -1,8 +1,10 @@
-
{{ code }}
-
{{ title }}
+
+ {{ code }}
+
+
{{ title }}
{{ second }} 秒后返回上一页