修改token超时后判断
This commit is contained in:
@@ -33,7 +33,9 @@ export async function pwdSm3(pwd: any, loginName?: string) {
|
|||||||
|
|
||||||
//登录获取token
|
//登录获取token
|
||||||
export async function login(params: any) {
|
export async function login(params: any) {
|
||||||
params.password = await pwdSm3(params.password, params.username)
|
if (params.refresh_token == undefined) {
|
||||||
|
params.password = await pwdSm3(params.password, params.username)
|
||||||
|
}
|
||||||
params.username = encrypt(params.username)
|
params.username = encrypt(params.username)
|
||||||
return request({
|
return request({
|
||||||
url: '/pqs-auth/oauth/token',
|
url: '/pqs-auth/oauth/token',
|
||||||
@@ -147,7 +149,7 @@ export function existMonitorDeptTree() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 获取用户
|
// 获取用户
|
||||||
export function getUserByRoleType(data:any) {
|
export function getUserByRoleType(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/user/getUserByRoleType?roleType=' + data,
|
url: '/user-boot/user/getUserByRoleType?roleType=' + data,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@@ -155,7 +157,7 @@ export function getUserByRoleType(data:any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取部门下所有用户
|
// 获取部门下所有用户
|
||||||
export function listAllUserByDeptId(data:any) {
|
export function listAllUserByDeptId(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/user/listAllUserByDeptId?deptId=' + data,
|
url: '/user-boot/user/listAllUserByDeptId?deptId=' + data,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
@@ -163,7 +165,7 @@ export function listAllUserByDeptId(data:any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据id获取所有用户信息
|
// 根据id获取所有用户信息
|
||||||
export function getUserListByIds(data:any) {
|
export function getUserListByIds(data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/user/getUserListByIds',
|
url: '/user-boot/user/getUserListByIds',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -176,7 +178,7 @@ export function getUserListByIds(data:any) {
|
|||||||
*/
|
*/
|
||||||
export const getUserSimpleList = () => {
|
export const getUserSimpleList = () => {
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/user/simpleList',
|
url: '/user-boot/user/simpleList',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -186,18 +188,14 @@ export const getUserSimpleList = () => {
|
|||||||
*/
|
*/
|
||||||
export const getAllUserSimpleList = () => {
|
export const getAllUserSimpleList = () => {
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/user/getAllUserSimpleList',
|
url: '/user-boot/user/getAllUserSimpleList',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getSysConfig = () => {
|
||||||
|
|
||||||
export const getSysConfig =()=> {
|
|
||||||
return request({
|
return request({
|
||||||
url: "/system-boot/config/getSysConfig",
|
url: '/system-boot/config/getSysConfig',
|
||||||
method: "get",
|
method: 'get'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -507,6 +507,7 @@ export default {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (waveDatas[0].unit === '电压') {
|
if (waveDatas[0].unit === '电压') {
|
||||||
if (this.value === 1) {
|
if (this.value === 1) {
|
||||||
unit = 'kV'
|
unit = 'kV'
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<MyEChart style="height: 400px;width: 100%" v-for="item in echartsList" :options="item" />
|
<!-- <MyEChart style="height: 400px;width: 100%" v-for="item in echartsList" :options="item" /> -->
|
||||||
|
<div id="container0" style="height:400px;width:100%;"></div>
|
||||||
|
<div id="container1" style="height:400px;width:100%;"></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import MyEChart from '@/components/echarts/MyEchart.vue'
|
import MyEChart from '@/components/echarts/MyEchart.vue'
|
||||||
import { ref, reactive } from 'vue'
|
|
||||||
|
import Highcharts from 'highcharts';
|
||||||
|
import { ref, reactive, onUnmounted } from 'vue'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
wp: {
|
wp: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -23,155 +28,315 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
|
|
||||||
})
|
})
|
||||||
|
// let data = [[-100, -3.41, -3.39, -3.34, 1, 2, 3], [-99.92, -5.19, -5.23, -5.19, 4, 5, 6], [-99.84, -7.28, -7.26, -7.26, 10, 20, 30]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const echartsList: any = ref([])
|
const echartsList: any = ref([])
|
||||||
|
const SA:any = ref([])
|
||||||
|
const SB:any = ref([])
|
||||||
|
const SC:any = ref([])
|
||||||
const info = () => {
|
const info = () => {
|
||||||
|
|
||||||
|
|
||||||
|
let result = props.wp?.listWaveData.map(item => {
|
||||||
|
let A = [[item[0], item[1]], [item[0], item[4]],];
|
||||||
|
let B = [[item[0], item[2]], [item[0], item[5]],]; // 注意:item[7] 会是 undefined,需要确保数据长度或调整索引
|
||||||
|
let C = [[item[0], item[3]], [item[0], item[6]],]; // 根据要求,这里 C 的第二个和第三个子数组的第二个元素取自 subArray[4] 和 subArray[6]
|
||||||
|
|
||||||
|
// 由于 subArray[7] 在原始数据中不存在,我们可以使用 subArray[5] 的下一个有效索引 subArray[6](对于 B 的第三个子数组的第二个元素)
|
||||||
|
|
||||||
|
|
||||||
|
return { A, B, C };
|
||||||
|
}).reduce((acc, { A, B, C }) => {
|
||||||
|
acc.A[0].push(A[0]);
|
||||||
|
acc.A[1].push(A[1]);
|
||||||
|
acc.B[0].push(B[0]);
|
||||||
|
acc.B[1].push(B[1]);
|
||||||
|
acc.C[0].push(C[0]);
|
||||||
|
acc.C[1].push(C[1]);
|
||||||
|
return acc;
|
||||||
|
}, { A: [[],[]], B: [[],[]], C: [[],[]] });
|
||||||
|
|
||||||
|
SA.value = result.A;
|
||||||
|
SB.value = result.B;
|
||||||
|
SC.value = result.C;
|
||||||
|
|
||||||
|
console.log( SA.value );
|
||||||
|
console.log( SB.value );
|
||||||
|
console.log( SC.value);
|
||||||
|
|
||||||
let num = (props.wp?.waveTitle.length - 1) / 3
|
let num = (props.wp?.waveTitle.length - 1) / 3
|
||||||
|
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
let A: any = [], B: any = [], C: any = []
|
// A.value = []
|
||||||
props.wp?.listWaveData.forEach((item: any,) => {
|
// B.value = []
|
||||||
A.push([item[0], item[i * 3 + 1]])
|
// C.value = []
|
||||||
B.push([item[0], item[i * 3 + 2]])
|
// props.wp?.listWaveData.forEach((item: any,) => {
|
||||||
C.push([item[0], item[i * 3 + 3]])
|
// A.value.push([item[0], item[i * 3 + 1]])
|
||||||
})
|
// B.value.push([item[0], item[i * 3 + 2]])
|
||||||
|
// C.value.push([item[0], item[i * 3 + 3]])
|
||||||
|
// })
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log("🚀 ~ info ~ A:", A)
|
|
||||||
|
|
||||||
echartsList.value.push({
|
// echartsList.value.push({
|
||||||
title: {
|
// title: {
|
||||||
text: i == 0 ? '123' : '',
|
// text: i == 0 ? '123' : '',
|
||||||
x: 'center',
|
// x: 'center',
|
||||||
},
|
// },
|
||||||
tooltip: {
|
// tooltip: {
|
||||||
axisPointer: {
|
// axisPointer: {
|
||||||
type: 'cross',
|
// type: 'cross',
|
||||||
label: {
|
// label: {
|
||||||
color: '#fff',
|
// color: '#fff',
|
||||||
fontSize: 16
|
// fontSize: 16
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
textStyle: {
|
// textStyle: {
|
||||||
color: '#fff',
|
// color: '#fff',
|
||||||
fontStyle: 'normal',
|
// fontStyle: 'normal',
|
||||||
opacity: 0.35,
|
// opacity: 0.35,
|
||||||
fontSize: 14
|
// fontSize: 14
|
||||||
},
|
// },
|
||||||
backgroundColor: 'rgba(0,0,0,0.55)',
|
// backgroundColor: 'rgba(0,0,0,0.55)',
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
},
|
// },
|
||||||
dataZoom: [
|
// dataZoom: [
|
||||||
{
|
// {
|
||||||
type: 'inside',
|
// type: 'inside',
|
||||||
height: 13,
|
// height: 13,
|
||||||
start: 0,
|
// start: 0,
|
||||||
bottom: '20px',
|
// bottom: '20px',
|
||||||
end: 25
|
// end: 25
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
start: 0,
|
// start: 0,
|
||||||
height: 13,
|
// height: 13,
|
||||||
bottom: '20px',
|
// bottom: '20px',
|
||||||
end: 25
|
// end: 25
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// xAxis: {
|
||||||
|
|
||||||
|
// // data: data.filter(item => item.phaseType == 'A').map(item => item.time),
|
||||||
|
// name: '时间',
|
||||||
|
// type: 'value',
|
||||||
|
// axisLine: {
|
||||||
|
// show: true,
|
||||||
|
// onZero: false //-----------重点
|
||||||
|
// },
|
||||||
|
// // splitLine: {
|
||||||
|
// // show: false,
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// },
|
||||||
|
// yAxis: {
|
||||||
|
// type: 'value',
|
||||||
|
// name: name,
|
||||||
|
// // splitLine: {
|
||||||
|
// // show: false,
|
||||||
|
// // }
|
||||||
|
// // max: max,
|
||||||
|
// // min: min
|
||||||
|
|
||||||
|
// },
|
||||||
|
// // legend: {
|
||||||
|
// // data: ['A', 'B', 'C']
|
||||||
|
// // // selectedMode: false,
|
||||||
|
// // },
|
||||||
|
// grid: {
|
||||||
|
// top: '30px',
|
||||||
|
// left: '30px'
|
||||||
|
// },
|
||||||
|
// color: ['#FFCC00', '#009900', '#CC0000'],
|
||||||
|
// series: [
|
||||||
|
// {
|
||||||
|
// name: 'A相',
|
||||||
|
// type: 'line',
|
||||||
|
// smooth: true,
|
||||||
|
// symbol: 'none',
|
||||||
|
// // 开启渐进式渲染
|
||||||
|
// progressive: 2000,
|
||||||
|
// // 渲染阈值,大于此值则启动渐进渲染
|
||||||
|
// progressiveThreshold: 5000,
|
||||||
|
// sampling: 'average',
|
||||||
|
// data: A
|
||||||
|
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'B相',
|
||||||
|
// type: 'line',
|
||||||
|
// smooth: true,
|
||||||
|
// symbol: 'none',
|
||||||
|
// // 开启渐进式渲染
|
||||||
|
// progressive: 2000,
|
||||||
|
// // 渲染阈值,大于此值则启动渐进渲染
|
||||||
|
// progressiveThreshold: 5000,
|
||||||
|
// sampling: 'average',
|
||||||
|
// data: B
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'C相',
|
||||||
|
// type: 'line',
|
||||||
|
// smooth: true,
|
||||||
|
// symbol: 'none',
|
||||||
|
// // 开启渐进式渲染
|
||||||
|
// progressive: 2000,
|
||||||
|
// // 渲染阈值,大于此值则启动渐进渲染
|
||||||
|
// progressiveThreshold: 5000,
|
||||||
|
// sampling: 'average',
|
||||||
|
// data: C
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// options: {
|
||||||
|
// animation: false,
|
||||||
|
// dataZoom: [{
|
||||||
|
// type: 'inside',
|
||||||
|
// height: 13,
|
||||||
|
// start: 0,
|
||||||
|
// bottom: '20px',
|
||||||
|
// end: 10
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// start: 0,
|
||||||
|
// height: 13,
|
||||||
|
// bottom: '20px',
|
||||||
|
// end: 10
|
||||||
|
// }]
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
Highcharts.chart(`container${i}`, {
|
||||||
|
|
||||||
|
chart: {
|
||||||
|
zooming: {
|
||||||
|
type: 'x'
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
|
|
||||||
|
title: {
|
||||||
|
text: '123',
|
||||||
|
align: 'left'
|
||||||
|
},
|
||||||
|
|
||||||
|
subtitle: {
|
||||||
|
text: 'Using the Boost module',
|
||||||
|
align: 'left'
|
||||||
|
},
|
||||||
|
|
||||||
|
accessibility: {
|
||||||
|
screenReaderSection: {
|
||||||
|
beforeChartFormat: '<{headingTagName}>' +
|
||||||
|
'{chartTitle}</{headingTagName}><div>{chartSubtitle}</div>' +
|
||||||
|
'<div>{chartLongdesc}</div><div>{xAxisDescription}</div><div>' +
|
||||||
|
'{yAxisDescription}</div>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
tooltip: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
type: 'datetime'
|
||||||
// data: data.filter(item => item.phaseType == 'A').map(item => item.time),
|
|
||||||
name: '时间',
|
|
||||||
type: 'value',
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
onZero: false //-----------重点
|
|
||||||
},
|
|
||||||
// splitLine: {
|
|
||||||
// show: false,
|
|
||||||
// }
|
|
||||||
|
|
||||||
},
|
},
|
||||||
yAxis: {
|
|
||||||
type: 'value',
|
|
||||||
name: name,
|
|
||||||
// splitLine: {
|
|
||||||
// show: false,
|
|
||||||
// }
|
|
||||||
// max: max,
|
|
||||||
// min: min
|
|
||||||
|
|
||||||
},
|
|
||||||
// legend: {
|
|
||||||
// data: ['A', 'B', 'C']
|
|
||||||
// // selectedMode: false,
|
|
||||||
// },
|
|
||||||
grid: {
|
|
||||||
top: '30px',
|
|
||||||
left: '30px'
|
|
||||||
},
|
|
||||||
color: ['#FFCC00', '#009900', '#CC0000'],
|
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: 'A相',
|
name: 'A相',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
lineWidth: 0.5,
|
||||||
symbol: 'none',
|
data: SA.value[i]
|
||||||
// 开启渐进式渲染
|
|
||||||
progressive: 2000,
|
|
||||||
// 渲染阈值,大于此值则启动渐进渲染
|
|
||||||
progressiveThreshold: 5000,
|
|
||||||
sampling: 'average',
|
|
||||||
data: A
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'B相',
|
name: 'B相',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
lineWidth: 0.5,
|
||||||
symbol: 'none',
|
data: SB.value[i]
|
||||||
// 开启渐进式渲染
|
|
||||||
progressive: 2000,
|
|
||||||
// 渲染阈值,大于此值则启动渐进渲染
|
|
||||||
progressiveThreshold: 5000,
|
|
||||||
sampling: 'average',
|
|
||||||
data: B
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'C相',
|
name: 'C相',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
lineWidth: 0.5,
|
||||||
symbol: 'none',
|
data: SC.value[i]
|
||||||
// 开启渐进式渲染
|
|
||||||
progressive: 2000,
|
|
||||||
// 渲染阈值,大于此值则启动渐进渲染
|
|
||||||
progressiveThreshold: 5000,
|
|
||||||
sampling: 'average',
|
|
||||||
data: C
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
options: {
|
|
||||||
animation: false,
|
});
|
||||||
dataZoom: [{
|
|
||||||
type: 'inside',
|
|
||||||
height: 13,
|
|
||||||
start: 0,
|
|
||||||
bottom: '20px',
|
|
||||||
end: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
start: 0,
|
|
||||||
height: 13,
|
|
||||||
bottom: '20px',
|
|
||||||
end: 10
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var init = () => {
|
||||||
|
Highcharts.chart('container', {
|
||||||
|
chart: {
|
||||||
|
type: 'spline'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Snow depth at Vikjafjellet, Norway'
|
||||||
|
},
|
||||||
|
subtitle: {
|
||||||
|
text: 'Irregular time data in Highcharts JS'
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'datetime',
|
||||||
|
dateTimeLabelFormats: {
|
||||||
|
// don't display the year
|
||||||
|
month: '%e. %b',
|
||||||
|
year: '%b'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Date'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
title: {
|
||||||
|
text: 'Snow depth (m)'
|
||||||
|
},
|
||||||
|
min: 0
|
||||||
|
},
|
||||||
|
// tooltip: {
|
||||||
|
// headerFormat: '<b>{series.name}</b><br>',
|
||||||
|
// pointFormat: '{point.x:%e. %b}: {point.y:.2f} m'
|
||||||
|
// },
|
||||||
|
|
||||||
|
plotOptions: {
|
||||||
|
series: {
|
||||||
|
marker: {
|
||||||
|
symbol: 'circle',
|
||||||
|
fillColor: '#FFFFFF',
|
||||||
|
enabled: true,
|
||||||
|
radius: 2.5,
|
||||||
|
lineWidth: 1,
|
||||||
|
lineColor: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
colors: ['#6CF', '#39F', '#06C', '#036', '#000'],
|
||||||
|
|
||||||
|
|
||||||
|
series: [
|
||||||
|
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
info()
|
info()
|
||||||
|
|
||||||
|
// init();
|
||||||
|
})
|
||||||
|
onUnmounted(() => {
|
||||||
|
SA.value = []
|
||||||
|
SB.value = []
|
||||||
|
SC.value = []
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export const useAdminInfo = defineStore('adminInfo', {
|
|||||||
this.refresh_token = ''
|
this.refresh_token = ''
|
||||||
},
|
},
|
||||||
setToken(token: string, type: 'auth' | 'refresh') {
|
setToken(token: string, type: 'auth' | 'refresh') {
|
||||||
const field = type == 'auth' ? 'token' : 'refresh_token'
|
const field = type == 'auth' ? 'access_token' : 'refresh_token'
|
||||||
this[field] = token
|
this[field] = token
|
||||||
},
|
},
|
||||||
getToken(type: 'auth' | 'refresh' = 'auth') {
|
getToken(type: 'auth' | 'refresh' = 'auth') {
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
config.url == '/system-boot/file/upload' ||
|
config.url == '/system-boot/file/upload' ||
|
||||||
|
|
||||||
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
||||||
config.url == '/system-boot/file/getFileVO' ||
|
config.url == '/system-boot/file/getFileVO' ||
|
||||||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData'
|
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData'
|
||||||
@@ -89,6 +88,9 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
config.headers.Authorization = 'Basic bmpjbnRlc3Q6bmpjbnBxcw=='
|
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
|
return config
|
||||||
},
|
},
|
||||||
@@ -120,12 +122,13 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
} else if (response.data.code == 'A0202') {
|
} else if (response.data.code == 'A0202') {
|
||||||
if (!window.tokenRefreshing) {
|
if (!window.tokenRefreshing) {
|
||||||
window.tokenRefreshing = true
|
window.tokenRefreshing = true
|
||||||
|
|
||||||
return refreshToken()
|
return refreshToken()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
adminInfo.setToken(res.data.token, 'auth')
|
adminInfo.setToken(res.data.access_token, 'auth')
|
||||||
response.headers.Authorization = `${res.data.token}`
|
window.requests.forEach(cb => cb(res.data.access_token))
|
||||||
window.requests.forEach(cb => cb(res.data.token))
|
|
||||||
window.requests = []
|
window.requests = []
|
||||||
|
|
||||||
return Axios(response.config)
|
return Axios(response.config)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -147,10 +150,10 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
}
|
}
|
||||||
} else if (response.data.code == 'A0024') {
|
} else if (response.data.code == 'A0024') {
|
||||||
// // 登录失效
|
// // 登录失效
|
||||||
// ElNotification({
|
ElNotification({
|
||||||
// type: 'error',
|
type: 'error',
|
||||||
// message: response.data.message
|
message: response.data.message
|
||||||
// })
|
})
|
||||||
adminInfo.removeToken()
|
adminInfo.removeToken()
|
||||||
router.push({ name: 'login' })
|
router.push({ name: 'login' })
|
||||||
return Promise.reject(response.data)
|
return Promise.reject(response.data)
|
||||||
|
|||||||
Reference in New Issue
Block a user