Commit 2bc269db authored by 张俊's avatar 张俊

router

parent f43e17b6
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
getUser() { getUser() {
Promise.all([this.getUserInfo(), this.getMenu('apaas')]).then((res) => { Promise.all([this.getUserInfo(), this.getMenu('apaas')]).then((res) => {
if (res[0].data.code == 200 && res[1].data.code == 200) { if (res[0].data.code == 200 && res[1].data.code == 200) {
let data = res[1].data.data[0].children || []; let data = res[1].data.data&&res[1].data.data[0].children || [];
this.$store.commit("setUserInfo", res[0].data.data); this.$store.commit("setUserInfo", res[0].data.data);
// if (res.data.data.userType == 1) { // if (res.data.data.userType == 1) {
//超管 //超管
......
...@@ -64,7 +64,7 @@ Promise.all([getUser(),getMenu('apaas')]).then(res => { ...@@ -64,7 +64,7 @@ Promise.all([getUser(),getMenu('apaas')]).then(res => {
console.log(res); console.log(res);
if (res[0].data.code == 200&&res[1].data.code == 200) { if (res[0].data.code == 200&&res[1].data.code == 200) {
//已登录则记录菜单和用户信息 //已登录则记录菜单和用户信息
let data = res[1].data.data[0].children||[] let data = res[1].data.data&&res[1].data.data[0].children||[]
store.commit('setUserInfo', res[0].data.data) store.commit('setUserInfo', res[0].data.data)
// if (res[0].data.data.userType == 1) {//超管 // if (res[0].data.data.userType == 1) {//超管
......
<template> <template>
<div> <div>
首页
</div> </div>
</template> </template>
......
...@@ -285,11 +285,7 @@ var menuToRouter = (menu) => { ...@@ -285,11 +285,7 @@ var menuToRouter = (menu) => {
console.log(`@/page/main${e.path}/index.vue`); console.log(`@/page/main${e.path}/index.vue`);
//叶子层级需要加载到对应文件 //叶子层级需要加载到对应文件
//对首页做兼容 //对首页做兼容
if (e.path == "/") {
e.component = () => import("../page/main/index/index.vue");
} else {
e.component = getViews(e.path); e.component = getViews(e.path);
}
menuToRouter(e.children); menuToRouter(e.children);
} else { } else {
console.log(`@/page/main${e.path}/index.vue`); console.log(`@/page/main${e.path}/index.vue`);
......
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