c3b4f9d8 by renchao@pashanhoo.com

Merge branch 'dev'

2 parents e908c7b0 bddd7abf
......@@ -75,7 +75,7 @@
if (process.env.NODE_ENV === 'development') {
localStorage.removeItem('token')
} else {
Cookies.remove('token')
Cookies.remove('accessToken')
}
if (window._config.casEnable) {
window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(window.location.href);
......
/*
* @Description: 项目权限
* @Autor: renchao
* @LastEditTime: 2023-06-13 10:28:05
* @LastEditTime: 2023-06-13 10:49:43
*/
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('token');
const token = localStorage.getItem("token") || Cookies.get('accessToken');
if (to.path === '/login') {
if (token) {
next('/')
......@@ -43,11 +43,10 @@ router.beforeEach(async (to, from, next) => {
'service': locationUrl
}
}).then(async (res) => {
debugger
if (process.env.NODE_ENV === 'development') {
localStorage.setItem('token', res.data.content.accessToken)
} else {
Cookies.set('token', res.data.content.accessToken)
Cookies.set('accessToken', res.data.content.accessToken)
}
window.location.href = localStorage.getItem('location')
......
......@@ -2,7 +2,7 @@
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-06-13 09:38:06
* @LastEditTime: 2023-06-13 10:50:32
*/
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('token')
const token = Cookies.get('accessToken')
// 添加请求头
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('token')
Cookies.remove('accessToken')
}
if (window._config.casEnable) {
window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(locationUrl);
......