Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-psp
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-psp
Commits
22f7729a
提交
22f7729a
authored
4月 29, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updates
上级
3a947d95
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
3 行删除
+22
-3
Header.vue
src/components/layout/Header.vue
+7
-3
index.ts
src/modules/error/index.ts
+8
-0
401.vue
src/modules/error/views/401.vue
+0
-0
axios.ts
src/utils/axios.ts
+7
-0
没有找到文件。
src/components/layout/Header.vue
浏览文件 @
22f7729a
...
...
@@ -8,10 +8,14 @@ import { useUserStore } from '@/stores/user'
withDefaults
(
defineProps
<
{
hasTitle
?:
boolean
}
>
(),
{
hasTitle
:
true
})
const
userStore
=
useUserStore
()
const
userInfo
=
userStore
.
user
const
logout
=
()
=>
{
userStore
.
logout
()
const
logout
=
async
()
=>
{
await
userStore
.
logout
()
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
}
</
script
>
...
...
@@ -28,7 +32,7 @@ const logout = () => {
<img
:src=
"userInfo.avatar || 'https://webapp-pub.ezijing.com/website/base/images/avatar.svg'"
/>
</div>
<template
#
dropdown
>
<el-dropdown-menu>
<el-dropdown-menu
style=
"width: 280px"
>
<div
class=
"app-header-user"
>
<div
class=
"app-header-user-avatar"
>
<img
:src=
"userInfo.avatar || 'https://webapp-pub.ezijing.com/website/base/images/avatar.svg'"
/>
...
...
src/modules/error/index.ts
0 → 100644
浏览文件 @
22f7729a
const
routes
=
[
{
path
:
'/401'
,
component
:
()
=>
import
(
'./views/401.vue'
)
}
]
export
{
routes
}
src/modules/error/views/401.vue
0 → 100644
浏览文件 @
22f7729a
差异被折叠。
点击展开。
src/utils/axios.ts
浏览文件 @
22f7729a
import
axios
from
'axios'
import
qs
from
'qs'
import
{
ElMessage
}
from
'element-plus'
import
router
from
'@/router'
const
httpRequest
=
axios
.
create
({
// baseURL: 'https://project-api.ezijing.com',
...
...
@@ -39,6 +41,7 @@ httpRequest.interceptors.response.use(
return
Promise
.
reject
(
data
)
}
if
(
data
.
code
===
1
)
{
ElMessage
.
error
(
data
.
message
||
data
.
msg
)
return
Promise
.
reject
(
data
)
}
return
data
...
...
@@ -49,7 +52,11 @@ httpRequest.interceptors.response.use(
// 未登录
if
(
status
===
403
)
{
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
}
else
if
(
status
===
400
)
{
// 未授权
router
.
push
(
'/401'
)
}
else
{
ElMessage
.
error
(
message
)
console
.
error
(
`
${
status
}
:
${
message
}
`
)
}
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论