Commit f99ef3bf authored by wangxl's avatar wangxl

2222

parent c5f18317
...@@ -293,7 +293,7 @@ export function changeProjType (type) { ...@@ -293,7 +293,7 @@ export function changeProjType (type) {
new Promise(async (resolve, reject) => { new Promise(async (resolve, reject) => {
try { try {
this.$store.commit('app/clearStore') this.$store.commit('app/clearStore')
setType(type) setType(type + '')
this.$store.commit('app/setProjType', type) this.$store.commit('app/setProjType', type)
let menuList = JSON.parse(window.sessionStorage.getItem('menuList')) let menuList = JSON.parse(window.sessionStorage.getItem('menuList'))
this.$store.commit('app/initStore', [menuList[0].id]) this.$store.commit('app/initStore', [menuList[0].id])
...@@ -329,6 +329,10 @@ router.beforeEach(async (to, from, next) => { ...@@ -329,6 +329,10 @@ router.beforeEach(async (to, from, next) => {
NProgress.done() NProgress.done()
} }
} else { } else {
if (!!!hasUser.projType) {
setType(hasUser.type + '')
this.$store.commit('app/setProjType', hasUser.type)
}
await store.dispatch('app/auth', to.path) await store.dispatch('app/auth', to.path)
next() next()
NProgress.done() NProgress.done()
......
// @ts-nocheck // @ts-nocheck
import router from '@/router' import router from '@/router'
import api from '@/api' import api from '@/api'
import { getType, setType } from '@/views/utils/auth' import { getType } from '@/views/utils/auth'
const state = { const state = {
...@@ -18,10 +18,8 @@ const actions = { ...@@ -18,10 +18,8 @@ const actions = {
await api.base.getUser().then(({ data = {} }) => { await api.base.getUser().then(({ data = {} }) => {
if (data) { if (data) {
try { try {
window.sessionStorage.setItem('user', JSON.stringify(data.userInfo)) window.sessionStorage.setItem('user', JSON.stringify(data.userInfo))
window.sessionStorage.setItem('menuList', JSON.stringify(data.menuList)) window.sessionStorage.setItem('menuList', JSON.stringify(data.menuList))
setType(hasUser.type)
this.commit('app/setProjType', hasUser.type)
this.commit('app/setComplete', data.complete) this.commit('app/setComplete', data.complete)
this.commit('app/initStore', [data.menuList[0].id]) this.commit('app/initStore', [data.menuList[0].id])
resolve(data) resolve(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