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

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

上级 e2cba1aa
......@@ -15,7 +15,7 @@
<el-button type="text" class="com-txt out-login" @click="goOutLogin">{{ $t('components.learnSysLayout.sideBar.outLogin') }}</el-button>
</el-menu-item>
<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">
<template slot="title"><i :class="item.iconClass"></i><span slot="title">{{item.name}}</span></template>
<template v-for="(_item, _index) in item.children">
......@@ -110,8 +110,41 @@ export default {
},
mounted () {
this.defineEvent()
this.showHeaderData()
},
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) {
switch (str) {
case '1-1': this.$router.push({ path: '/app/tips/learning-tips' }); break
......
......@@ -14,7 +14,7 @@
<div class="name">{{ item.name }}</div>
<ul>
<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>
</ul>
</div>
......@@ -85,6 +85,7 @@ import cAction from '@action'
export default {
components: {},
data () {
const _global = this.$GLOBAL
return {
filter: {
studyEarly: 'down',
......@@ -96,9 +97,9 @@ export default {
selectIndex: 0,
key: 'course_type',
arrItem: [
{ val: '1', name: this.$t('action.courseAction.mustLearn') },
{ val: '2', name: this.$t('action.courseAction.changeLearn') },
{ val: '3', name: this.$t('action.courseAction.repeatLearn') }
{ 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'), show: (_global && _global.UserInfo).student_info.is_open_required_course },
{ val: '3', name: this.$t('action.courseAction.repeatLearn'), show: (_global && _global.UserInfo).student_info.is_open_extended_course }
]
}],
homeList: [], // 从后台请求
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论