Commit c891a12f authored by wangxl's avatar wangxl

3333

parent bb21ff48
......@@ -27,8 +27,6 @@ export default {
},
data () {
return {
current: 0,
routerList: [],
collapsed: false,
menuList: [],
openKeys: [],
......@@ -83,7 +81,6 @@ export default {
if (value) {
this.menuList = JSON.parse(window.sessionStorage.getItem('menuList'))
this.openKeys = [this.menuList[0].id]
this.$store.commit('app/setOpenKeys', this.menuList[0].id)
}
}
}
......
......@@ -317,12 +317,16 @@ export function changeSystemType (type) {
try {
this.$store.commit('app/clearStore')
setType(type + '')
this.$store.commit('app/setsystemType', type)
let menuList = JSON.parse(window.sessionStorage.getItem('menuList'))
this.$store.commit('app/initStore', [menuList[0].id])
await store.dispatch('user/getMenuList')
this.$store.commit('app/setSystemType', type)
this.$router.push('/')
resolve(true)
} catch (e) {
this.$api.base.logout().then(({ data }) => { }).catch(() => { })
removeToken()
window.sessionStorage.clear();
this.$store.commit('app/clearStore')
this.$router.push(`/login`)
reject(false)
}
})
......@@ -341,8 +345,7 @@ router.beforeEach(async (to, from, next) => {
NProgress.done()
} else {
const hasUser = JSON.parse(window.sessionStorage.getItem('user'))
const hasMenu = JSON.parse(window.sessionStorage.getItem('menuList'))
if (hasUser && hasMenu) {
if (hasUser) {
if (hasUser.type === '3' && !!!hasUser.systemType && hasUser.roles != '4') {
if (to.path === '/sys') {
next()
......
......@@ -18,7 +18,7 @@ const mutations = {
setTabsArray: (state, payload) => {
state.tabsArray = payload
},
setsystemType: (state, payload) => {
setSystemType: (state, payload) => {
state.systemType = payload
},
addTabs: (state, payload) => {
......@@ -142,7 +142,7 @@ const mutations = {
this.commit('app/setTabsArray', [])
this.commit('app/setTabsActive', '')
this.commit('app/setCachedViews', [])
this.commit('app/setsystemType', null)
this.commit('app/setSystemType', null)
},
}
......
......@@ -19,8 +19,6 @@ const actions = {
if (data) {
try {
window.sessionStorage.setItem('user', JSON.stringify(data.userInfo))
window.sessionStorage.setItem('menuList', JSON.stringify(data.menuList))
this.commit('app/initStore', [data.menuList[0].id])
resolve(data)
} catch (error) {
reject(error)
......@@ -35,7 +33,7 @@ const actions = {
},
getMenuList ({ dispatch }) {
return new Promise(async (resolve, reject) => {
await api.base.getMenuList().then(({ data = {} }) => {
await api.base.getMenuList({ systemType: getType() }).then(({ data = {} }) => {
if (data) {
try {
window.sessionStorage.setItem('menuList', JSON.stringify(data))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment