From 4857cff30741ed009906b32c83518c4e5b7461d0 Mon Sep 17 00:00:00 2001
From: pixelqm <303176530@qq.com>
Date: Sun, 15 Sep 2019 21:17:08 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=BB=84=E4=BB=B6=E5=B5=8C?=
=?UTF-8?q?=E5=A5=97=E7=94=9F=E6=88=90=E5=B7=A6=E4=BE=A7=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E7=95=A5=E7=BC=A9=E5=9B=BE=E6=97=B6=E4=BC=9A=E4=BA=A7=E7=94=9F?=
=?UTF-8?q?=E5=86=85=E5=AD=98=E6=BA=A2=E5=87=BAbug=20=E7=AD=89=E5=BE=85?=
=?UTF-8?q?=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
QMPlusVuePage/src/permission.js | 9 +++++++++
QMPlusVuePage/src/store/module/user.js | 9 +++++++++
.../view/layout/aside/asideComponent/index.vue | 2 +-
.../view/layout/aside/asideComponent/menuItem.vue | 7 +++++--
QMPlusVuePage/src/view/layout/aside/index.vue | 15 ++++++++-------
QMPlusVuePage/src/view/layout/index.vue | 4 ++++
6 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/QMPlusVuePage/src/permission.js b/QMPlusVuePage/src/permission.js
index 7436485b..27bc8e21 100644
--- a/QMPlusVuePage/src/permission.js
+++ b/QMPlusVuePage/src/permission.js
@@ -4,8 +4,17 @@ import { store } from '@/store/index'
let asyncRouterFlag = 0
const whiteList = ['login', 'regist']
+
router.beforeEach(async(to, from, next) => {
const token = store.getters['user/token']
+ // if (token) {
+ // const expiresAt = store.getters['user/expiresAt']
+ // const nowUnix = new Date().getTime()
+ // const hasExpires = (expiresAt - nowUnix) < 0
+ // if (hasExpires) {
+ // store.dispatch['user/claerAll']
+ // }
+ // }
// 在白名单中的判断情况
if (whiteList.indexOf(to.name) > -1) {
if (token) {
diff --git a/QMPlusVuePage/src/store/module/user.js b/QMPlusVuePage/src/store/module/user.js
index 24b720d1..a94baa0f 100644
--- a/QMPlusVuePage/src/store/module/user.js
+++ b/QMPlusVuePage/src/store/module/user.js
@@ -25,7 +25,13 @@ export const user = {
setExpiresAt(state, expiresAt) {
// 这里的 `state` 对象是模块的局部状态
state.expiresAt = expiresAt
+ },
+ clearAll(state) {
+ state.userInfo = {}
+ state.token = ""
+ state.expiresAt = ""
}
+
},
actions: {
async LoginIn({ commit }, loginInfo) {
@@ -58,6 +64,9 @@ export const user = {
},
token(state) {
return state.token
+ },
+ expiresAt(state) {
+ return state.expiresAt
}
}
}
\ No newline at end of file
diff --git a/QMPlusVuePage/src/view/layout/aside/asideComponent/index.vue b/QMPlusVuePage/src/view/layout/aside/asideComponent/index.vue
index 4f18814c..21bed1bb 100644
--- a/QMPlusVuePage/src/view/layout/aside/asideComponent/index.vue
+++ b/QMPlusVuePage/src/view/layout/aside/asideComponent/index.vue
@@ -17,7 +17,7 @@ export default {
if(this.routerInfo.children.length){
return 'SubMenu'
}else{
- return 'menuItem'
+ return 'MenuItem'
}
}
},
diff --git a/QMPlusVuePage/src/view/layout/aside/asideComponent/menuItem.vue b/QMPlusVuePage/src/view/layout/aside/asideComponent/menuItem.vue
index dbbf3ddb..6a97091d 100644
--- a/QMPlusVuePage/src/view/layout/aside/asideComponent/menuItem.vue
+++ b/QMPlusVuePage/src/view/layout/aside/asideComponent/menuItem.vue
@@ -1,5 +1,8 @@
- {{routerInfo.meta.title}}
+
+
+ {{routerInfo.meta.title}}
+