clay fix : 关闭一系列bug

This commit is contained in:
clay
2022-10-04 20:01:16 +08:00
parent 65e7a1ad86
commit 324f0dc26a
4 changed files with 65 additions and 32 deletions

View File

@@ -15,7 +15,6 @@ export function setThis(that) {
export function getParentNode(id) {
try {
let menuList = JSON.parse(sessionStorage.getItem("menu"));
console.log(menuList,"menuList")
for (let menu of menuList) {
for (let child of menu.children) {
if (id == child.encodeId) {

View File

@@ -3,8 +3,8 @@
<el-row>
<el-col>
<div class="context">
<div v-if="value" class="title">{{ value.title }}</div>
<div v-if="value" class="text" v-html="value.content"></div>
<div v-if="introductionData" class="title">{{ introductionData.title }}</div>
<div v-if="introductionData" class="text" v-html="introductionData.content"></div>
</div>
</el-col>
</el-row>
@@ -29,7 +29,7 @@ export default {
}
},
watch:{
value(val){
introduction(val){
this.introductionData = val
}
},

View File

@@ -24,7 +24,7 @@
<div class="left_lab" ref="lab">
<div class="lab" v-if="navList">
<div v-for="(nav,index) in navList" class="lab_div">
<div v-if="index === showIndex" class="lab_list lab_select" @click="navClick(nav,index)">
<div v-if="index === showIndex&& nav" class="lab_list lab_select" @click="navClick(nav,index)">
<div class="lab_img">
<img src="@/assets/school_profile/eji_icon_xz.png" alt="">
</div>
@@ -32,7 +32,7 @@
{{ nav.title }}
</div>
</div>
<div v-if="index !== showIndex" class="lab_list" @click="navClick(nav,index)">
<div v-if="index !== showIndex&& nav" class="lab_list" @click="navClick(nav,index)">
<div class="lab_img">
<img src="@/assets/school_profile/eji_icon_xz.png" alt="">
</div>
@@ -235,7 +235,7 @@ export default {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
} catch (e) {
}
if (this.secondId == id) {
if (this.secondId == id && this.navList) {
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
@@ -253,6 +253,7 @@ export default {
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
console.log(this.type,"this.type")
setTimeout(() => {
this.getNav()
}, 200);
@@ -310,34 +311,60 @@ export default {
/**
* 获得节点信息
*/
getNodes() {
async getNodes() {
this.navList = []
getNode({id: this.secondId}).then(res => {
this.navList = res.data
try {
setTimeout(() => {
this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
}, 100);
} catch (e) {
console.log(e)
// await getNode({id: this.secondId}).then(res => {
// this.navList = res.data
// try {
// setTimeout(() => {
// this.$refs.lab.style.height = this.navList.length * 8 + 10 + 'rem'
// }, 100);
// } catch (e) {
// console.log(e)
// }
// // if (!this.navList){
// // return
// // }
// for (let i = 0; i < this.navList.length; i++) {
// if (this.navId == this.navList[i].encodeId) {
// this.showIndex = i
// }
// }
// let arcId = this.$route.query && this.$route.query.id
// if (arcId != undefined) {
// this.getContext(arcId)
// } else {
// console.log("测试,我被触发了!")
// if (this.navId == undefined) {
// this.getContent(this.navList[0])
// } else {
// this.getContent(this.navList[this.showIndex])
// }
// }
// })
let res = await getNode({id: this.secondId})
// todo 延时异步问题
this.$refs.lab.style.height = res.data.length * 8 + 10 + 'rem'
this.navList = res.data
// if (!this.navList){
// return
// }
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
}
for (let i = 0; i < this.navList.length; i++) {
if (this.navId == this.navList[i].encodeId) {
this.showIndex = i
}
}
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
}
let arcId = this.$route.query && this.$route.query.id
if (arcId != undefined) {
this.getContext(arcId)
} else {
console.log("测试,我被触发了!")
if (this.navId == undefined) {
this.getContent(this.navList[0])
} else {
console.log("测试,我被触发了!")
if (this.navId == undefined) {
this.getContent(this.navList[0])
} else {
this.getContent(this.navList[this.showIndex])
}
this.getContent(this.navList[this.showIndex])
}
})
}
},
/**
* 获取三级菜单
@@ -345,6 +372,10 @@ export default {
*/
getContent(menu) {
console.log("getContent内部,menu:", menu)
console.log(menu)
if (menu == undefined){
return
}
this.type = menu.type
this.contextData = null
this.bgImage = menu.link

View File

@@ -110,6 +110,7 @@ export default {
this.getContext(arcId)
} else {
this.menuData = getParentNode(this.navId)
console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
}
@@ -125,6 +126,7 @@ export default {
},
methods: {
init(){
console.log(this.navId)
this.menuData = getParentNode(this.navId)
crumbs(this.secondId).then(res => {
this.crumbs = res.data
@@ -148,6 +150,7 @@ export default {
if (arcId != undefined) {
this.getContext(arcId)
} else {
console.log(this.menuData,"menuData")
this.getContent(this.menuData.three)
}
},
@@ -161,7 +164,7 @@ export default {
},
getContent(menu) {
console.log(menu)
//let menu = this.menuData.three
// let menu = this.menuData.three
this.type = menu.type
this.contextData = null
this.bgImage = menu.link