diff --git a/src/layout/components/userbar.vue b/src/layout/components/userbar.vue index 357f769e..c54d57c5 100644 --- a/src/layout/components/userbar.vue +++ b/src/layout/components/userbar.vue @@ -165,9 +165,8 @@ export default { confirmButtonClass: "el-button--danger", }) .then(() => { - this.$router.replace({ path: "/login" }).then(() => { - location.reload(); - }); + this.$TOOL.data.remove("TOKEN") + this.$router.push(`/login?redirect=${this.$route.fullPath}`) }) .catch(() => { //取消退出 diff --git a/src/router/index.js b/src/router/index.js index 6eae7adf..65e8bee7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -36,7 +36,7 @@ router.beforeEach(async (to, from, next) => { //动态标题 document.title = to.meta.title ? `${to.meta.title} - ${config.APP_NAME}` : `${config.APP_NAME}` - let token = tool.cookie.get("TOKEN"); + let token = tool.data.get("TOKEN"); //去往登录页 if (to.path === "/login") { //删除路由(替换当前layout路由) diff --git a/src/utils/request.js b/src/utils/request.js index 8d4594b7..fed0882e 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -15,7 +15,7 @@ let requests = []; // HTTP request 拦截器 axios.interceptors.request.use( (config) => { - let token = tool.cookie.get("TOKEN")?tool.cookie.get("TOKEN"):tool.data.get("TOKEN"); + let token = tool.data.get("TOKEN"); if(token){ config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + token } @@ -47,49 +47,41 @@ axios.interceptors.response.use( title: '请求失败', message: "账户密码错误或已禁用" }); - // if (!isRefreshing) { - // isRefreshing = true; - // axios({ - // method: 'post', - // url: sysConfig.API_URL+'/auth/token/refresh/', - // headers: { - // Authorization: `Bearer ${tool.cookie.get("TOKEN")}`, - // }, - // data:{refresh:tool.cookie.get("TOKEN_REFRESH")} - // }).then(res=>{ - // debugger; - // console.log(res.data.access); - // // 替换本地的token - // tool.cookie.set("TOKEN", res.data.access); - // tool.data.set("TOKEN_TIME", new Date().getTime()); - // error.config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + res.data.access; - // isRefreshing = false; - // requests.forEach(cb => cb()) - // //发起后将requests置空 - // requests=[]; - // return axios(error.config) - // }).catch(()=>{ - // // refresh_token 有值 , 但是过期了, 请求失败 - // router.push('/login') - // }) - - // }else{ - // //如果正在刷新token,将发起的请求暂存在requests中 - // return new Promise((resolve)=>{ - // requests.push(()=>{ - // resolve(axios(error.config)); - // }) - // }) - // } }else{ - // ElMessageBox.confirm('当前用户已被登出或无权限访问当前资源,请尝试重新登录后再操作。', '无权限访问', { - // type: 'error', - // closeOnClickModal: false, - // center: true, - // confirmButtonText: '重新登录' - // }).then(() => { - router.replace({path: '/login'}); - // }).catch(() => {}) + if (error.config.url.indexOf('auth/token/refresh/') != -1) { + isRefreshing = false; + requests=[]; + router.push('/login'); + return + } + if (!isRefreshing) { + isRefreshing = true; + axios({ + method: 'post', + url: sysConfig.API_URL+'/auth/token/refresh/', + headers: { + Authorization: `Bearer ${tool.data.get("TOKEN")}`, + }, + data:{refresh:tool.data.get("TOKEN_REFRESH")} + }).then(res=>{ + // 替换本地的token + tool.data.set("TOKEN", res.data.access); + tool.data.set("TOKEN_TIME", new Date().getTime()); + error.config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + res.data.access; + isRefreshing = false; + requests.forEach(cb => cb()) + //发起后将requests置空 + requests=[]; + return axios(error.config) + }) + }else{ + //如果正在刷新token,将发起的请求暂存在requests中 + return new Promise((resolve)=>{ + requests.push(()=>{ + resolve(axios(error.config)); + }) + }) + } } } else { diff --git a/src/views/bigScreen/index_enm.vue b/src/views/bigScreen/index_enm.vue index 29421f56..62714a85 100644 --- a/src/views/bigScreen/index_enm.vue +++ b/src/views/bigScreen/index_enm.vue @@ -67,7 +67,8 @@
产品产量
+ style="height: 24px;vertical-align:middle;" />产品产量 +
{{ sectionData.total_production }} (t) @@ -76,7 +77,8 @@ -
运转率
+
运转率 +
{{ sectionData.run_rate }} (%) @@ -402,11 +404,10 @@ export default { }, init() { var that = this - // console.log(tool.cookie.get("TOKEN")) if (typeof (WebSocket) === "undefined") { alert("您的浏览器不支持socket") } else { - this.ws = new WebSocket(this.path + tool.cookie.get("TOKEN")) + this.ws = new WebSocket(this.path + tool.data.get("TOKEN")) //监听是否连接成功 this.ws.onopen = () => { // console.log("socket连接成功"); diff --git a/src/views/home/widgets/index_enm.vue b/src/views/home/widgets/index_enm.vue index b5a07eca..5d8e85a6 100644 --- a/src/views/home/widgets/index_enm.vue +++ b/src/views/home/widgets/index_enm.vue @@ -8,63 +8,75 @@
-
-
{{ monthData.电石渣.total_production }}
+
+
{{ monthData.电石渣.total_production + }}
月电石渣产量
90%
-
-
{{ monthData.原料磨.total_production }}
+
+
{{ monthData.原料磨.total_production + }}
月生料产量
95%
-
-
{{ monthData.回转窑.total_production }}
+
+
{{ monthData.回转窑.total_production + }}
月熟料产量
98%
-
-
{{ monthData.水泥磨.total_production }}
+
+
{{ monthData.水泥磨.total_production + }}
月水泥产量
95%
-
-
{{ yearData.电石渣.total_production }}
+
+
{{ + yearData.电石渣.total_production }}
本年累计电石渣产量
- + 75%
-
-
{{ yearData.原料磨.total_production }}
+
+
{{ + yearData.原料磨.total_production }}
本年累计生料产量
- + 70%
-
-
{{ yearData.回转窑.total_production }}
+
+
{{ + yearData.回转窑.total_production }}
本年累计熟料产量
- + 80%
-
-
{{ yearData.水泥磨.total_production }}
+
+
{{ + yearData.水泥磨.total_production }}
本年累计水泥产量
- + 75% -
+
@@ -72,76 +84,92 @@
-
-
{{ monthData.电石渣.elec_consume_unit }}
+
+
{{ monthData.电石渣.elec_consume_unit + }}
月电石渣分布电耗
-
-
{{ monthData.原料磨.elec_consume_unit }}
+
+
{{ monthData.原料磨.elec_consume_unit + }}
月生料分布电耗
-
-
{{ monthData.回转窑.elec_consume_unit }}
+
+
{{ monthData.回转窑.elec_consume_unit + }}
月熟料分布电耗
-
-
{{ monthData.回转窑.coal_consume_unit }}
+
+
{{ monthData.回转窑.coal_consume_unit + }}
熟料月单位标煤耗
-
-
{{ monthData.回转窑.celec_consume_unit }}
-
熟料月综合电耗
-
- -
-
{{ monthData.回转窑.cen_consume_unit }}
-
熟料月综合能耗
-
-
-
{{ monthData.水泥磨.elec_consume_unit }}
-
月水泥粉磨分布电耗
-
-
-
{{ monthData.水泥磨.cen_consume_unit }}
-
水泥月综合能耗
-
+
+
{{ + monthData.回转窑.celec_consume_unit }}
+
熟料月综合电耗
+
+ +
+
{{ + monthData.回转窑.cen_consume_unit }}
+
熟料月综合能耗
+
+
+
{{ + monthData.水泥磨.elec_consume_unit }}
+
月水泥粉磨分布电耗
+
+
+
{{ + monthData.水泥磨.cen_consume_unit }}
+
水泥月综合能耗
+
-
-
{{ yearData.电石渣.elec_consume_unit }}
+
+
{{ yearData.电石渣.elec_consume_unit + }}
本年度电石渣分布电耗
-
-
{{ yearData.原料磨.elec_consume_unit }}
+
+
{{ yearData.原料磨.elec_consume_unit + }}
本年度生料分布电耗
-
-
{{ yearData.回转窑.elec_consume_unit }}
+
+
{{ yearData.回转窑.elec_consume_unit + }}
本年度熟料分布电耗
-
-
{{ yearData.回转窑.coal_consume_unit }}
+
+
{{ yearData.回转窑.coal_consume_unit + }}
本年度熟料单位标煤耗
-
-
{{ yearData.回转窑.celec_consume_unit }}
+
+
{{ + yearData.回转窑.celec_consume_unit }}
本年度熟料综合电耗
-
-
{{ yearData.回转窑.cen_consume_unit }}
+
+
{{ + yearData.回转窑.cen_consume_unit }}
本年度熟料综合能耗
-
-
{{ yearData.水泥磨.elec_consume_unit }}
+
+
{{ + yearData.水泥磨.elec_consume_unit }}
本年度水泥粉磨分布电耗
-
-
-
{{ yearData.水泥磨.cen_consume_unit }}
+
+
+
{{ + yearData.水泥磨.cen_consume_unit }}
本年度水泥综合能耗
-
+
@@ -150,21 +178,25 @@
-
{{ monthData.电石渣.production_cost_unit }}
+
{{ + monthData.电石渣.production_cost_unit }}
月电石渣成本
-
-
{{ monthData.原料磨.production_cost_unit }}
+
+
{{ + monthData.原料磨.production_cost_unit }}
月生料成本
-
-
{{ monthData.回转窑.production_cost_unit }}
+
+
{{ + monthData.回转窑.production_cost_unit }}
月熟料成本
-
-
{{ monthData.水泥磨.production_cost_unit }}
+
+
{{ + monthData.水泥磨.production_cost_unit }}
月水泥成本
-
+
@@ -173,12 +205,12 @@
能耗超标报警
-
+
设备检验
-
+
@@ -189,216 +221,225 @@
diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue index 31c2a4fd..a91258f3 100644 --- a/src/views/login/components/passwordForm.vue +++ b/src/views/login/components/passwordForm.vue @@ -24,7 +24,7 @@ {{ $t("login.signIn") - }} + }}