Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas
Commits
dae610b5
提交
dae610b5
authored
6月 19, 2022
作者:
haodaking
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
2adb4b1e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
13 行删除
+11
-13
Header.vue
src/components/layout/Header.vue
+7
-5
axios.ts
src/utils/axios.ts
+4
-8
没有找到文件。
src/components/layout/Header.vue
浏览文件 @
dae610b5
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
useUserStore
}
from
'@/stores/user'
import
{
useUserStore
}
from
'@/stores/user'
const
user
=
useUserStore
()
const
user
=
useUserStore
()
const
LOGINURL
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
const
loginUrl
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
// 退出登录
// 退出登录
function
handleLogout
()
{
function
handleLogout
()
{
...
@@ -22,8 +22,10 @@ function handleLogout() {
...
@@ -22,8 +22,10 @@ function handleLogout() {
</router-link>
</router-link>
</div>
</div>
<div
class=
"app-header-right"
>
<div
class=
"app-header-right"
>
<template
v-if=
"user.isLogin"
>
你好,
{{
user
.
userName
}}
<span
class=
"app-header-logout"
@
click=
"handleLogout"
>
退出
</span>
</
template
>
<template
v-if=
"user.isLogin"
>
<
template
v-else
><a
:href=
"LOGINURL"
>
登录
</a></
template
>
你好,
{{
user
.
userName
}}
<span
class=
"app-header-logout"
@
click=
"handleLogout"
>
退出
</span>
</
template
>
<
template
v-else
><a
:href=
"loginUrl"
>
登录
</a></
template
>
</div>
</div>
</div>
</div>
</header>
</header>
...
@@ -36,7 +38,7 @@ function handleLogout() {
...
@@ -36,7 +38,7 @@ function handleLogout() {
background
:
#fff
;
background
:
#fff
;
box-shadow
:
0px
0px
29px
rgba
(
0
,
0
,
0
,
0
.1
);
box-shadow
:
0px
0px
29px
rgba
(
0
,
0
,
0
,
0
.1
);
border-top
:
10px
solid
#aa1941
;
border-top
:
10px
solid
#aa1941
;
z-index
:
1000
;
z-index
:
2001
;
}
}
.app-header-inner
{
.app-header-inner
{
width
:
1440px
;
width
:
1440px
;
...
@@ -49,7 +51,6 @@ function handleLogout() {
...
@@ -49,7 +51,6 @@ function handleLogout() {
color
:
#aa1941
;
color
:
#aa1941
;
}
}
.app-header-left
{
.app-header-left
{
flex
:
1
;
.logo
{
.logo
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
@@ -61,6 +62,7 @@ function handleLogout() {
...
@@ -61,6 +62,7 @@ function handleLogout() {
line-height
:
26px
;
line-height
:
26px
;
font-weight
:
500
;
font-weight
:
500
;
letter-spacing
:
2px
;
letter-spacing
:
2px
;
white-space
:
nowrap
;
border-left
:
1px
solid
#707070
;
border-left
:
1px
solid
#707070
;
}
}
}
}
...
...
src/utils/axios.ts
浏览文件 @
dae610b5
...
@@ -51,19 +51,15 @@ httpRequest.interceptors.request.use(
...
@@ -51,19 +51,15 @@ httpRequest.interceptors.request.use(
httpRequest
.
interceptors
.
response
.
use
(
httpRequest
.
interceptors
.
response
.
use
(
function
(
response
)
{
function
(
response
)
{
const
{
data
}
=
response
const
{
data
}
=
response
if
(
data
.
code
===
0
)
{
return
data
}
// 未登录
// 未登录
if
(
data
.
code
===
4001
)
{
if
(
data
.
code
===
4001
)
{
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
location
.
href
=
`
${
import
.
meta
.
env
.
VITE_LOGIN_URL
}
?rd=
${
encodeURIComponent
(
location
.
href
)}
`
return
Promise
.
reject
(
data
)
return
Promise
.
reject
(
data
)
}
}
if
(
data
.
code
===
1
)
{
return
Promise
.
reject
(
data
)
return
Promise
.
reject
(
data
)
}
if
(
data
.
code
===
4008
)
{
ElMessage
.
error
(
data
.
message
||
data
.
msg
)
return
Promise
.
reject
(
data
)
}
return
data
},
},
function
(
error
)
{
function
(
error
)
{
if
(
error
.
response
)
{
if
(
error
.
response
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论