Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4f1755d2
authored
2023-06-13 16:29:56 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:ACCESS_TOKEN
1 parent
b3142f7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
src/layout/components/Navbar.vue
src/permission.js
src/utils/request.js
src/layout/components/Navbar.vue
View file @
4f1755d
...
...
@@ -68,7 +68,7 @@
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
localStorage
.
removeItem
(
'token'
)
}
else
{
Cookies
.
remove
(
'ACCESS
-
TOKEN'
)
Cookies
.
remove
(
'ACCESS
_
TOKEN'
)
}
if
(
window
.
_config
.
casEnable
)
{
window
.
location
.
href
=
window
.
_config
.
casBaseURL
+
'/logout?service='
+
encodeURIComponent
(
window
.
location
.
href
);
...
...
src/permission.js
View file @
4f1755d
/*
* @Description: 项目权限
* @Autor: renchao
* @LastEditTime: 2023-06-13 16:2
3:56
* @LastEditTime: 2023-06-13 16:2
8:25
*/
import
Vue
from
'vue'
import
axios
from
'axios'
...
...
@@ -23,7 +23,7 @@ router.beforeEach(async (to, from, next) => {
let
hasAddDict
=
store
.
state
.
dict
.
addDict
let
hasAddRoute
=
store
.
state
.
permission
.
addRoutes
// cas操作
const
token
=
localStorage
.
getItem
(
"token"
)
||
Cookies
.
get
(
'ACCESS
-
TOKEN'
);
const
token
=
localStorage
.
getItem
(
"token"
)
||
Cookies
.
get
(
'ACCESS
_
TOKEN'
);
if
(
to
.
path
===
'/login'
)
{
if
(
token
)
{
next
(
'/'
)
...
...
@@ -46,7 +46,7 @@ router.beforeEach(async (to, from, next) => {
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
localStorage
.
setItem
(
'token'
,
res
.
data
.
content
.
accessToken
)
}
else
{
Cookies
.
set
(
'ACCESS
-
TOKEN'
,
res
.
data
.
content
.
accessToken
)
Cookies
.
set
(
'ACCESS
_
TOKEN'
,
res
.
data
.
content
.
accessToken
)
}
window
.
location
.
href
=
localStorage
.
getItem
(
'location'
)
...
...
src/utils/request.js
View file @
4f1755d
...
...
@@ -2,7 +2,7 @@
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-06-13 16:2
4:20
* @LastEditTime: 2023-06-13 16:2
8:57
*/
import
axios
from
'axios'
import
Router
from
'@/router'
...
...
@@ -35,7 +35,7 @@ service.interceptors.request.use(
config
.
headers
.
delete
(
'Authorization'
)
}
}
else
{
const
token
=
Cookies
.
get
(
'ACCESS
-
TOKEN'
)
const
token
=
Cookies
.
get
(
'ACCESS
_
TOKEN'
)
// 添加请求头
if
(
token
)
{
config
.
headers
[
'Authorization'
]
=
'Bearer '
+
token
...
...
@@ -78,7 +78,7 @@ service.interceptors.response.use(
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
localStorage
.
removeItem
(
'token'
)
}
else
{
Cookies
.
remove
(
'ACCESS
-
TOKEN'
)
Cookies
.
remove
(
'ACCESS
_
TOKEN'
)
}
if
(
window
.
_config
.
casEnable
)
{
window
.
location
.
href
=
window
.
_config
.
casBaseURL
+
'/logout?service='
+
encodeURIComponent
(
locationUrl
);
...
...
Please
register
or
sign in
to post a comment