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) { export function getParentNode(id) {
try { try {
let menuList = JSON.parse(sessionStorage.getItem("menu")); let menuList = JSON.parse(sessionStorage.getItem("menu"));
console.log(menuList,"menuList")
for (let menu of menuList) { for (let menu of menuList) {
for (let child of menu.children) { for (let child of menu.children) {
if (id == child.encodeId) { if (id == child.encodeId) {

View File

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

View File

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

View File

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