diff --git a/src/views/Layout.vue b/src/views/Layout.vue index c4b62e3..3be3665 100644 --- a/src/views/Layout.vue +++ b/src/views/Layout.vue @@ -99,24 +99,6 @@ export default { } } menuFun(menu) - debugger - if(menuData.length==0){ - this.$api.login.logout().then(_ => { - this.$message.warning('暂无权限,请联系管理员授权') - this.$store.commit('saveUserInfo', null) - this.$store.commit('setHandleProcess', null) - this.$store.commit('savePathUrl', null) - this.$store.commit('removeDicts', null) - // var sevice = "http://"+window.location.host+"/"; - // var serviceUrl = encodeURIComponent(sevice); - // 正式 - // window.open("https://caddmuat.changan.com.cn/cas/logout?service=http://10.64.23.30:7766/home", '_self'); - // 测试 - // window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self'); - this.$router.push('/login') - }) - return - }else{ const treeData = menuData.map(item => ({ id: item.id, parentId: item.parentId, @@ -136,7 +118,7 @@ export default { this.menuAllDate = Object.values(obj) this.getMenu() - } + }) diff --git a/src/views/Login.vue b/src/views/Login.vue index af45ce0..75cd736 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -111,15 +111,42 @@ export default { res.data.roleIdList=res.data.roleEOList.map(item=>{ return item.id }) - this.$message.success('登录成功') + this.$store.commit('saveUserInfo', res.data) - this.getMarket().then((resx)=>{ - this.$store.commit('setMarketpre', resx) - this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } }) - }).catch((resx)=>{ - this.$store.commit('setMarketpre', '') - this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } }) - }) + this.$api.menu.getSysMenu({ roleId: this.$store.getters.userInfo.roleIdList[0] }).then(({ data }) => { + if (data === null) { + data = [] + } + data = data.sort((a, b) => a.sort - b.sort) + const menu = data.filter(item => item.belong && item.isButton == '0') + if(menu.length==0){ + this.$api.login.logout().then(_ => { + this.$message.warning('暂无权限,请联系管理员授权') + this.$store.commit('saveUserInfo', null) + this.$store.commit('setHandleProcess', null) + this.$store.commit('savePathUrl', null) + this.$store.commit('removeDicts', null) + // var sevice = "http://"+window.location.host+"/"; + // var serviceUrl = encodeURIComponent(sevice); + // 正式 + // window.open("https://caddmuat.changan.com.cn/cas/logout?service=http://10.64.23.30:7766/home", '_self'); + // 测试 + // window.open(BASE_URL.BASE_CHANGAN + "/logout?service=" + BASE_URL.BASE_LOCAL + "/login?loginType=1", '_self'); + this.$router.push('/login') + }) + return + }else{ + this.$message.success('登录成功') + this.getMarket().then((resx)=>{ + this.$store.commit('setMarketpre', resx) + this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } }) + }).catch((resx)=>{ + this.$store.commit('setMarketpre', '') + this.$router.push({ path: '/report/list', query: { id: 'AEHJB8YNJ3' } }) + }) + } + }) + }).catch(err => { this.verifyCode()