修改页面log输出并修改tonken超时判断

This commit is contained in:
GGJ
2024-12-18 14:15:13 +08:00
parent 21831dda90
commit 8089fcb7de
43 changed files with 203 additions and 155 deletions

View File

@@ -45,7 +45,7 @@ export const yMethod = (arr: any) => {
*/
// 导出csv文件
const convertToCSV = (title: object, data: any) => {
console.log('🚀 ~ convertToCSV ~ data:', data)
// console.log('🚀 ~ convertToCSV ~ data:', data)
let csv = ''
// 添加列头
csv += ',' + title.join(',') + '\n'

View File

@@ -57,7 +57,7 @@ export function getAwesomeIconfontNames() {
nextTick(() => {
const iconfonts = []
const sheets = getStylesFromVite('all.css')
console.log(sheets)
// console.log(sheets)
for (const key in sheets) {
const rules: any = sheets[key].cssRules
for (const k in rules) {

View File

@@ -88,6 +88,9 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
}
}
if (config.url == '/user-boot/user/generateSm2Key' || config.url == '/pqs-auth/oauth/token') {
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
}
return config
},
@@ -117,10 +120,10 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
window.tokenRefreshing = true
return refreshToken()
.then(res => {
adminInfo.setToken(res.data.token, 'auth')
response.headers.Authorization = `${res.data.token}`
window.requests.forEach(cb => cb(res.data.token))
adminInfo.setToken(res.data.access_token, 'auth')
window.requests.forEach(cb => cb(res.data.access_token))
window.requests = []
return Axios(response.config)
})
.catch(err => {
@@ -141,11 +144,11 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
})
}
} else if (response.data.code == 'A0024') {
// // 登录失效
// ElNotification({
// type: 'error',
// message: response.data.message
// })
// 登录失效
ElMessage({
type: 'error',
message: response.data.message
})
adminInfo.removeToken()
router.push({ name: 'login' })
return Promise.reject(response.data)