0203
This commit is contained in:
parent
e28f557d45
commit
0d533ea8fb
|
@ -66,7 +66,6 @@
|
||||||
"vue/multi-word-component-names": 0,
|
"vue/multi-word-component-names": 0,
|
||||||
"no-debugger": "off",
|
"no-debugger": "off",
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"drop_debugger":true,
|
|
||||||
"no-trailing-spaces": "off"
|
"no-trailing-spaces": "off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,18 +27,6 @@
|
||||||
// ]
|
// ]
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
|
||||||
"path": "/bigScreen",
|
|
||||||
"name": "bigScreen",
|
|
||||||
"meta": {
|
|
||||||
"title": "驾驶舱",
|
|
||||||
"icon": "el-icon-position",
|
|
||||||
"perms": ["bigScreen"],
|
|
||||||
"fullpage": true,
|
|
||||||
"type": "link",
|
|
||||||
},
|
|
||||||
"component": "bigScreen"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "home",
|
"name": "home",
|
||||||
"path": "/home",
|
"path": "/home",
|
||||||
|
@ -68,7 +56,6 @@ const routes = [
|
||||||
"icon": "el-icon-position",
|
"icon": "el-icon-position",
|
||||||
"perms": ["bigScreen"],
|
"perms": ["bigScreen"],
|
||||||
"fullpage": true,
|
"fullpage": true,
|
||||||
"type": "link",
|
|
||||||
},
|
},
|
||||||
"component": "bigScreen"
|
"component": "bigScreen"
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-sub-menu v-else :index="navMenu.path">
|
<el-sub-menu v-else :index="navMenu.path">
|
||||||
<template #title>
|
<template #title>
|
||||||
<a v-if="navMenu.meta.type=='link'" href="javascript:void(0)" @click="blankPageClick(navMenu.path)"></a>
|
|
||||||
<el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
|
<el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
|
||||||
<span>{{navMenu.meta.title}}</span>
|
<span>{{navMenu.meta.title}}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -38,9 +37,9 @@
|
||||||
blankPageClick(path){
|
blankPageClick(path){
|
||||||
// console.log(window.location);
|
// console.log(window.location);
|
||||||
// console.log(path);
|
// console.log(path);
|
||||||
// let linkUrl = window.location.origin+"/#"+path;
|
let linkUrl = window.location.origin+"/#"+path;
|
||||||
// console.log(linkUrl)
|
console.log(linkUrl)
|
||||||
// debugger;
|
debugger;
|
||||||
|
|
||||||
|
|
||||||
let routeUrl = this.$router.resolve({path: path});
|
let routeUrl = this.$router.resolve({path: path});
|
||||||
|
|
|
@ -40,44 +40,44 @@ axios.interceptors.response.use(
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
if (error.response.status == 401) {
|
if (error.response.status == 401) {
|
||||||
if(error.response.data.err_code == 'no_active_account'){
|
if(error.response.data.err_code == 'no_active_account'){
|
||||||
// ElNotification.warning({
|
ElNotification.warning({
|
||||||
// title: '请求失败',
|
title: '请求失败',
|
||||||
// message: "账户密码错误或已禁用"
|
message: "账户密码错误或已禁用"
|
||||||
// });
|
});
|
||||||
if (!isRefreshing) {
|
// if (!isRefreshing) {
|
||||||
isRefreshing = true;
|
// isRefreshing = true;
|
||||||
axios({
|
// axios({
|
||||||
method: 'post',
|
// method: 'post',
|
||||||
url: sysConfig.API_URL+'/auth/token/refresh/',
|
// url: sysConfig.API_URL+'/auth/token/refresh/',
|
||||||
headers: {
|
// headers: {
|
||||||
Authorization: `Bearer ${tool.cookie.get("TOKEN")}`,
|
// Authorization: `Bearer ${tool.cookie.get("TOKEN")}`,
|
||||||
},
|
// },
|
||||||
data:{refresh:tool.cookie.get("TOKEN_REFRESH")}
|
// data:{refresh:tool.cookie.get("TOKEN_REFRESH")}
|
||||||
}).then(res=>{
|
// }).then(res=>{
|
||||||
debugger;
|
// debugger;
|
||||||
console.log(res.data.access);
|
// console.log(res.data.access);
|
||||||
// 替换本地的token
|
// // 替换本地的token
|
||||||
tool.cookie.set("TOKEN", res.data.access);
|
// tool.cookie.set("TOKEN", res.data.access);
|
||||||
tool.data.set("TOKEN_TIME", new Date().getTime());
|
// tool.data.set("TOKEN_TIME", new Date().getTime());
|
||||||
error.config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + res.data.access;
|
// error.config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + res.data.access;
|
||||||
isRefreshing = false;
|
// isRefreshing = false;
|
||||||
requests.forEach(cb => cb())
|
// requests.forEach(cb => cb())
|
||||||
//发起后将requests置空
|
// //发起后将requests置空
|
||||||
requests=[];
|
// requests=[];
|
||||||
return axios(error.config)
|
// return axios(error.config)
|
||||||
}).catch(()=>{
|
// }).catch(()=>{
|
||||||
// refresh_token 有值 , 但是过期了, 请求失败
|
// // refresh_token 有值 , 但是过期了, 请求失败
|
||||||
router.push('/login')
|
// router.push('/login')
|
||||||
})
|
// })
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
//如果正在刷新token,将发起的请求暂存在requests中
|
// //如果正在刷新token,将发起的请求暂存在requests中
|
||||||
return new Promise((resolve)=>{
|
// return new Promise((resolve)=>{
|
||||||
requests.push(()=>{
|
// requests.push(()=>{
|
||||||
resolve(axios(error.config));
|
// resolve(axios(error.config));
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
// ElMessageBox.confirm('当前用户已被登出或无权限访问当前资源,请尝试重新登录后再操作。', '无权限访问', {
|
// ElMessageBox.confirm('当前用户已被登出或无权限访问当前资源,请尝试重新登录后再操作。', '无权限访问', {
|
||||||
// type: 'error',
|
// type: 'error',
|
||||||
|
|
Loading…
Reference in New Issue