mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-12-02 16:59:01 +08:00
Compare commits
No commits in common. "fb4d18cc0a8e9dc29e7843260b476422497eb996" and "e593ba3ca54a3a841547c7b6f21c31f3b0336cea" have entirely different histories.
fb4d18cc0a
...
e593ba3ca5
@ -5,7 +5,7 @@
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="./LICENSE"><img alt="MIT License" src="https://badgen.net/github/license/zclzone/vue-naive-admin"/></a>
|
||||
<a href="https://gitcode.com/zclzone/vue-naive-admin"><img alt="GitCode" src="https://gitcode.com/zclzone/vue-naive-admin/star/badge.svg
|
||||
<a href="https://gitcode.com/isme-admin/vue-naive-admin"><img alt="GitCode" src="https://gitcode.com/isme-admin/vue-naive-admin/star/badge.svg
|
||||
"/></a>
|
||||
</p>
|
||||
|
||||
@ -57,7 +57,7 @@ Vue Naive Admin 提供一套后端代码,技术栈使用 Nestjs + TypeOrm + My
|
||||
|
||||
- 源码-github: [isme-nest-serve | github](https://github.com/zclzone/isme-nest-serve)
|
||||
- 源码-gitee: [isme-nest-serve | gitee](https://gitee.com/isme-admin/isme-nest-serve)
|
||||
- 源码-gitcode: [isme-nest-serve | gitcode](https://gitcode.com/zclzone/isme-nest-serve)
|
||||
- 源码-gitcode: [isme-nest-serve | gitcode](https://gitcode.com/isme-admin/isme-nest-serve)
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
@ -10,15 +10,16 @@
|
||||
import { useAuthStore } from '@/store'
|
||||
|
||||
let isConfirming = false
|
||||
|
||||
function handleAuthExpired(content, needTip) {
|
||||
export function resolveResError(code, message, needTip = true) {
|
||||
switch (code) {
|
||||
case 401:
|
||||
if (isConfirming || !needTip)
|
||||
return
|
||||
isConfirming = true
|
||||
$dialog.confirm({
|
||||
title: '提示',
|
||||
type: 'info',
|
||||
content,
|
||||
content: '登录已过期,是否重新登录?',
|
||||
confirm() {
|
||||
useAuthStore().logout()
|
||||
window.$message?.success('已退出登录')
|
||||
@ -29,15 +30,25 @@ function handleAuthExpired(content, needTip) {
|
||||
},
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
export function resolveResError(code, message, needTip = true) {
|
||||
switch (code) {
|
||||
case 401:
|
||||
return handleAuthExpired('登录已过期,是否重新登录?', needTip)
|
||||
case 11007:
|
||||
case 11008:
|
||||
return handleAuthExpired(`${message},是否重新登录?`, needTip)
|
||||
if (isConfirming || !needTip)
|
||||
return
|
||||
isConfirming = true
|
||||
$dialog.confirm({
|
||||
title: '提示',
|
||||
type: 'info',
|
||||
content: `${message},是否重新登录?`,
|
||||
confirm() {
|
||||
useAuthStore().logout()
|
||||
window.$message?.success('已退出登录')
|
||||
isConfirming = false
|
||||
},
|
||||
cancel() {
|
||||
isConfirming = false
|
||||
},
|
||||
})
|
||||
return false
|
||||
case 403:
|
||||
message = '请求被拒绝'
|
||||
break
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user