Browse Source

修复了登陆时首页蓝点未点亮的bug

main
蒋吉兆 4 years ago
parent
commit
dfd61e8cea
  1. 1
      web/src/permission.js
  2. 13
      web/src/store/module/user.js
  3. 5
      web/src/view/layout/aside/historyComponent/history.vue

1
web/src/permission.js

@ -5,7 +5,6 @@ import getPageTitle from '@/utils/page'
let asyncRouterFlag = 0 let asyncRouterFlag = 0
const whiteList = ['login'] const whiteList = ['login']
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
const token = store.getters['user/token'] const token = store.getters['user/token']
// 在白名单中的判断情况 // 在白名单中的判断情况

13
web/src/store/module/user.js

@ -24,8 +24,8 @@ export const user = {
LoginOut(state) { LoginOut(state) {
state.userInfo = {} state.userInfo = {}
state.token = "" state.token = ""
router.push({ name: 'login', replace: true })
sessionStorage.clear() sessionStorage.clear()
router.push({ name: 'login', replace: true })
window.location.reload() window.location.reload()
}, },
ResetUserInfo(state, userInfo = {}) { ResetUserInfo(state, userInfo = {}) {
@ -43,12 +43,13 @@ export const user = {
await dispatch('router/SetAsyncRouter', {}, { root: true }) await dispatch('router/SetAsyncRouter', {}, { root: true })
const asyncRouters = rootGetters['router/asyncRouters'] const asyncRouters = rootGetters['router/asyncRouters']
router.addRoutes(asyncRouters) router.addRoutes(asyncRouters)
const redirect = router.history.current.query.redirect
if (redirect) {
router.push({ path: redirect })
} else {
// const redirect = router.history.current.query.redirect
// console.log(redirect)
// if (redirect) {
// router.push({ path: redirect })
// } else {
router.push({ name: getters["userInfo"].authority.defaultRouter }) router.push({ name: getters["userInfo"].authority.defaultRouter })
}
// }
return true return true
} }
}, },

5
web/src/view/layout/aside/historyComponent/history.vue

@ -43,7 +43,6 @@ export default {
rightActive: "" rightActive: ""
}; };
}, },
computed: { computed: {
...mapGetters("user", ["userInfo"]), ...mapGetters("user", ["userInfo"]),
defaultRouter() { defaultRouter() {
@ -69,7 +68,11 @@ export default {
]; ];
this.historys = this.historys =
JSON.parse(sessionStorage.getItem("historys")) || initHistorys; JSON.parse(sessionStorage.getItem("historys")) || initHistorys;
if(!window.sessionStorage.getItem("activeValue")){
this.activeValue = this.$route.name + JSON.stringify(this.$route.query)+JSON.stringify(this.$route.params)
}else{
this.activeValue = window.sessionStorage.getItem("activeValue"); this.activeValue = window.sessionStorage.getItem("activeValue");
}
this.setTab(this.$route); this.setTab(this.$route);
}, },

Loading…
Cancel
Save