This commit is contained in:
clay
2022-01-19 20:38:16 +08:00
parent d0b9848102
commit d6374440d2
5 changed files with 118 additions and 64 deletions

View File

@@ -141,24 +141,29 @@ export default {
},
watch: {
$route(to, from) {
console.log("触发了 $route")
let arcId = this.$route.params && this.$route.query.id
this.navId = this.$route.params && this.$route.params.navId;
this.secondId = this.$route.params && this.$route.params.secondId;
let id = this.$route.params && this.$route.params.secondId
this.type = this.$route.query && this.$route.query.type
if (this.type != null&&this.type!=0){
console.log("触发了 $route")
if (this.type==3||this.type==1||this.type==2){
this.secondId = id
this.showSecond = false
let info = getParentNode(this.secondId);
console.log("获取到info",info)
if (arcId != undefined) {
console.log("getContext")
this.getContext(arcId)
} else {
console.log("getContent")
this.getContent(info.second)
}
return
}
this.showSecond = true
if (arcId != undefined) {
this.getContext(arcId)
}
let id = this.$route.params && this.$route.params.secondId
try {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
} catch (e) {
@@ -171,12 +176,19 @@ export default {
}
}
} else {
this.secondId = id
this.getNav()
}
}
},
created() {
this.getNav()
this.secondId = this.$route.params && this.$route.params.secondId;
this.navId = this.$route.params && this.$route.params.navId;
this.type = this.$route.query && this.$route.query.type
setTimeout(() => {
this.getNav()
}, 200);
//this.getNav()
crumbs(this.secondId).then(res => {
this.crumbs = res.data
})
@@ -184,28 +196,36 @@ export default {
methods: {
getContext(arcId) {
article(arcId).then(res => {
console.log(res);
this.detailsData = res.data.data
this.type = null
})
},
getNav() {
this.secondId = this.$route.params && this.$route.params.secondId;
this.navId = this.$route.params && this.$route.params.navId;
this.type = this.$route.query && this.$route.query.type
if (this.type != null&&this.type!=0){
if (this.type==3||this.type==1||this.type==2){
console.log("进入二级")
this.showSecond = false
let info = getParentNode(this.secondId);
let arcId = this.$route.query && this.$route.query.id
let info =null
info = getParentNode(this.secondId);
if (info == null){
location.reload();
}
let arcId = null
arcId = this.$route.query && this.$route.query.id
console.log(arcId)
if (arcId != undefined) {
this.getContext(arcId)
} else {
console.log("获取二级列表")
this.getContent(info.second)
}
return
}else {
this.showSecond = true
}
this.showSecond = true
this.getNodes()
},
getNodes(){
this.navList = []
getNode({id: this.secondId}).then(res => {
this.navList = res.data
@@ -231,10 +251,13 @@ export default {
this.getContent(this.navList[this.showIndex])
}
}
})
},
getContent(menu) {
console.log("getContent内部,menu:",menu)
this.type = menu.type
this.contextData = null
this.bgImage = menu.link
@@ -251,6 +274,7 @@ export default {
}
}
getNode(data).then(res => {
console.log(res,"res值")
if (this.type == 2) {
this.contextData = {
data: res.rows,