提交 4533cbb2 authored 作者: 王拯's avatar 王拯

在字段为0的情况下隐藏特定导航条

上级 e2cba1aa
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<el-button type="text" class="com-txt out-login" @click="goOutLogin">{{ $t('components.learnSysLayout.sideBar.outLogin') }}</el-button> <el-button type="text" class="com-txt out-login" @click="goOutLogin">{{ $t('components.learnSysLayout.sideBar.outLogin') }}</el-button>
</el-menu-item> </el-menu-item>
<template v-for="(item, index) in headerData"> <template v-for="(item, index) in headerData">
<template v-if="item.children"> <template v-if="item.children && item.children.length > 0">
<el-submenu v-bind:key="index" :index="item.index"> <el-submenu v-bind:key="index" :index="item.index">
<template slot="title"><i :class="item.iconClass"></i><span slot="title">{{item.name}}</span></template> <template slot="title"><i :class="item.iconClass"></i><span slot="title">{{item.name}}</span></template>
<template v-for="(_item, _index) in item.children"> <template v-for="(_item, _index) in item.children">
...@@ -110,8 +110,41 @@ export default { ...@@ -110,8 +110,41 @@ export default {
}, },
mounted () { mounted () {
this.defineEvent() this.defineEvent()
this.showHeaderData()
}, },
methods: { methods: {
arrHeader(arr) {
var newArr = []
arr.map(k => {
newArr.push({
name: k.name,
iconClass: k.iconClass,
index: k.index,
children: []
})
return arr
})
return newArr
},
showHeaderData() {
const isOpenExamination = this.UserInfo.student_info.is_open_learning_notes || null
const isOpenExaminationNotes = this.UserInfo.student_info.is_open_examination_notes || null
var arrList = []
var obj
if (Number(isOpenExamination) === 0 && Number(isOpenExaminationNotes) === 0) {
this.headerData = this.arrHeader(this.headerData).filter(k => k.index !== '1')
} else if (Number(isOpenExamination) === 0) {
obj = { name: '考前须知', index: '1-2' }
arrList = this.arrHeader(this.headerData)
arrList[0].children.push(obj)
this.headerData = arrList
} else if (Number(isOpenExaminationNotes) === 0) {
obj = { name: '学习须知', index: '1-1' }
arrList = this.arrHeader(this.headerData)
arrList[0].children.push(obj)
this.headerData = arrList
}
},
goPages (str) { goPages (str) {
switch (str) { switch (str) {
case '1-1': this.$router.push({ path: '/app/tips/learning-tips' }); break case '1-1': this.$router.push({ path: '/app/tips/learning-tips' }); break
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="name">{{ item.name }}</div> <div class="name">{{ item.name }}</div>
<ul> <ul>
<template v-for="(item1, index1) in item.arrItem"> <template v-for="(item1, index1) in item.arrItem">
<li :class="['tab', (item.selectIndex == index1 ? 'active' : '')]" @click="selFindSelect" :key="index1" :data-index='index1' :data-i="index" :data-key='item.key' :data-val='item1.val'>{{item1.name}}</li> <li :class="['tab', (item.selectIndex == index1 ? 'active' : '')]" @click="selFindSelect" :key="index1" :data-index='index1' :data-i="index" :data-key='item.key' :data-val='item1.val' v-if="Number(item1.show) === 1">{{item1.name}}</li>
</template> </template>
</ul> </ul>
</div> </div>
...@@ -85,6 +85,7 @@ import cAction from '@action' ...@@ -85,6 +85,7 @@ import cAction from '@action'
export default { export default {
components: {}, components: {},
data () { data () {
const _global = this.$GLOBAL
return { return {
filter: { filter: {
studyEarly: 'down', studyEarly: 'down',
...@@ -96,9 +97,9 @@ export default { ...@@ -96,9 +97,9 @@ export default {
selectIndex: 0, selectIndex: 0,
key: 'course_type', key: 'course_type',
arrItem: [ arrItem: [
{ val: '1', name: this.$t('action.courseAction.mustLearn') }, { val: '1', name: this.$t('action.courseAction.mustLearn'), show: (_global && _global.UserInfo).student_info.is_open_textbook_learning },
{ val: '2', name: this.$t('action.courseAction.changeLearn') }, { val: '2', name: this.$t('action.courseAction.changeLearn'), show: (_global && _global.UserInfo).student_info.is_open_required_course },
{ val: '3', name: this.$t('action.courseAction.repeatLearn') } { val: '3', name: this.$t('action.courseAction.repeatLearn'), show: (_global && _global.UserInfo).student_info.is_open_extended_course }
] ]
}], }],
homeList: [], // 从后台请求 homeList: [], // 从后台请求
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论