Merge branch 'dev'
Showing
3 changed files
with
7 additions
and
7 deletions
... | @@ -68,7 +68,7 @@ | ... | @@ -68,7 +68,7 @@ |
68 | if (process.env.NODE_ENV === 'development') { | 68 | if (process.env.NODE_ENV === 'development') { |
69 | localStorage.removeItem('token') | 69 | localStorage.removeItem('token') |
70 | } else { | 70 | } else { |
71 | Cookies.remove('ACCESS-TOKEN') | 71 | Cookies.remove('ACCESS_TOKEN') |
72 | } | 72 | } |
73 | if (window._config.casEnable) { | 73 | if (window._config.casEnable) { |
74 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(window.location.href); | 74 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(window.location.href); | ... | ... |
1 | /* | 1 | /* |
2 | * @Description: 项目权限 | 2 | * @Description: 项目权限 |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-06-13 16:23:56 | 4 | * @LastEditTime: 2023-06-13 16:28:25 |
5 | */ | 5 | */ |
6 | import Vue from 'vue' | 6 | import Vue from 'vue' |
7 | import axios from 'axios' | 7 | import axios from 'axios' |
... | @@ -23,7 +23,7 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -23,7 +23,7 @@ router.beforeEach(async (to, from, next) => { |
23 | let hasAddDict = store.state.dict.addDict | 23 | let hasAddDict = store.state.dict.addDict |
24 | let hasAddRoute = store.state.permission.addRoutes | 24 | let hasAddRoute = store.state.permission.addRoutes |
25 | // cas操作 | 25 | // cas操作 |
26 | const token = localStorage.getItem("token") || Cookies.get('ACCESS-TOKEN'); | 26 | const token = localStorage.getItem("token") || Cookies.get('ACCESS_TOKEN'); |
27 | if (to.path === '/login') { | 27 | if (to.path === '/login') { |
28 | if (token) { | 28 | if (token) { |
29 | next('/') | 29 | next('/') |
... | @@ -46,7 +46,7 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -46,7 +46,7 @@ router.beforeEach(async (to, from, next) => { |
46 | if (process.env.NODE_ENV === 'development') { | 46 | if (process.env.NODE_ENV === 'development') { |
47 | localStorage.setItem('token', res.data.content.accessToken) | 47 | localStorage.setItem('token', res.data.content.accessToken) |
48 | } else { | 48 | } else { |
49 | Cookies.set('ACCESS-TOKEN', res.data.content.accessToken) | 49 | Cookies.set('ACCESS_TOKEN', res.data.content.accessToken) |
50 | } | 50 | } |
51 | window.location.href = localStorage.getItem('location') | 51 | window.location.href = localStorage.getItem('location') |
52 | 52 | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | /* | 2 | /* |
3 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 | 3 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 |
4 | * @Autor: renchao | 4 | * @Autor: renchao |
5 | * @LastEditTime: 2023-06-13 16:24:20 | 5 | * @LastEditTime: 2023-06-13 16:28:57 |
6 | */ | 6 | */ |
7 | import axios from 'axios' | 7 | import axios from 'axios' |
8 | import Router from '@/router' | 8 | import Router from '@/router' |
... | @@ -35,7 +35,7 @@ service.interceptors.request.use( | ... | @@ -35,7 +35,7 @@ service.interceptors.request.use( |
35 | config.headers.delete('Authorization') | 35 | config.headers.delete('Authorization') |
36 | } | 36 | } |
37 | } else { | 37 | } else { |
38 | const token = Cookies.get('ACCESS-TOKEN') | 38 | const token = Cookies.get('ACCESS_TOKEN') |
39 | // 添加请求头 | 39 | // 添加请求头 |
40 | if (token) { | 40 | if (token) { |
41 | config.headers['Authorization'] = 'Bearer ' + token | 41 | config.headers['Authorization'] = 'Bearer ' + token |
... | @@ -78,7 +78,7 @@ service.interceptors.response.use( | ... | @@ -78,7 +78,7 @@ service.interceptors.response.use( |
78 | if (process.env.NODE_ENV === 'development') { | 78 | if (process.env.NODE_ENV === 'development') { |
79 | localStorage.removeItem('token') | 79 | localStorage.removeItem('token') |
80 | } else { | 80 | } else { |
81 | Cookies.remove('ACCESS-TOKEN') | 81 | Cookies.remove('ACCESS_TOKEN') |
82 | } | 82 | } |
83 | if (window._config.casEnable) { | 83 | if (window._config.casEnable) { |
84 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(locationUrl); | 84 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(locationUrl); | ... | ... |
-
Please register or sign in to post a comment