From 0e21fab9785fcdb9e69513dedaf166673ca155e4 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Thu, 17 Sep 2020 12:44:05 +0800
Subject: [PATCH] token续期调整到后端&默认有效期延长
---
ruoyi-ui/src/views/index.vue | 28 ----------------------------
1 files changed, 0 insertions(+), 28 deletions(-)
diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue
index 57a4739..4828d88 100644
--- a/ruoyi-ui/src/views/index.vue
+++ b/ruoyi-ui/src/views/index.vue
@@ -35,7 +35,6 @@
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
-import { getToken, getExpiresIn, setExpiresIn } from '@/utils/auth'
const lineChartData = {
newVisitis: {
@@ -67,39 +66,12 @@
},
data() {
return {
- //刷新token锁
- refreshLock: false,
- //刷新token的时间
- refreshTime: '',
lineChartData: lineChartData.newVisitis
}
- },
- created() {
- this.refreshToken()
},
methods: {
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
- },
- // 实时检测刷新token
- refreshToken() {
- this.refreshTime = setInterval(() => {
- if (null === getToken()) {
- return;
- }
- const expires_in = getExpiresIn();
- if (expires_in <= 1200 && !this.refreshLock) {
- this.refreshLock = true
- this.$store
- .dispatch('RefreshToken')
- .catch(() => {
- clearInterval(this.refreshTime)
- });
- this.refreshLock = false
- }
- this.$store.commit("SET_EXPIRES_IN", expires_in - 10);
- setExpiresIn(expires_in - 10);
- }, 10000);
}
}
}
--
Gitblit v1.9.3