提交 7efa5286 authored 作者: 王拯's avatar 王拯

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

上级 58313b8d
<template>
<div class="err-empty">
<div class="tit">很抱歉,您当前没有课程</div>
</div>
</template>
<script>
export default {
mounted () {
}
}
</script>
<style lang="scss" scoped>
.err-empty {
margin: 30px;
padding: 0;
font-style: 500;
font-size: 16px;
}
</style>
......@@ -129,22 +129,61 @@ export default {
showHeaderData() {
const isOpenExamination = this.UserInfo.student_info.is_open_learning_notes || null
const isOpenExaminationNotes = this.UserInfo.student_info.is_open_examination_notes || null
const isOpenTextbookLearning = this.UserInfo.student_info.is_open_textbook_learning || null
const isOpenRequiredCourse = this.UserInfo.student_info.is_open_required_course || null
const isOpenXxtendedCourse = this.UserInfo.student_info.is_open_extended_course || null
var arrList = []
var obj
if (Number(isOpenExamination) === 0 && Number(isOpenExaminationNotes) === 0) {
if (Number(isOpenExamination) === 0 && Number(isOpenExaminationNotes) === 0 && (Number(isOpenTextbookLearning) || Number(isOpenRequiredCourse) || Number(isOpenXxtendedCourse))) {
this.headerData = this.arrHeader(this.headerData).filter(k => k.index !== '1')
this.defaultActive = '2'
this.$router.push({ path: '/app/learn/course' })
} else if (Number(isOpenExamination) === 0) {
obj = { name: '考前须知', index: '1-2' }
arrList = this.arrHeader(this.headerData)
if (this.defaultActive === '1-1' || this.defaultActive === '1-2') {
this.defaultActive = '2'
this.$router.push({ path: '/app/learn/course' })
}
} else if (Number(isOpenExamination) === 1 && !Number(isOpenExaminationNotes)) {
obj = { name: '学习须知', index: '1-1' }
if (Number(isOpenTextbookLearning) || Number(isOpenRequiredCourse) || Number(isOpenXxtendedCourse)) {
arrList = this.arrHeader(this.headerData)
} else {
arrList = this.arrHeader(this.headerData).filter(k => k.index !== '2')
}
arrList[0].children.push(obj)
this.headerData = arrList
} else if (Number(isOpenExaminationNotes) === 0) {
obj = { name: '学习须知', index: '1-1' }
arrList = this.arrHeader(this.headerData)
} else if (Number(isOpenExaminationNotes) === 1 && !Number(isOpenExamination)) {
obj = { name: '考前须知', index: '1-2' }
if (Number(isOpenTextbookLearning) || Number(isOpenRequiredCourse) || Number(isOpenXxtendedCourse)) {
arrList = this.arrHeader(this.headerData)
} else {
arrList = this.arrHeader(this.headerData).filter(k => k.index !== '2')
}
arrList[0].children.push(obj)
this.headerData = arrList
if (this.defaultActive === '1-1') {
this.defaultActive = '1-2'
this.$router.push({ path: '/app/tips/examina-tips' })
}
} else if (Number(isOpenExaminationNotes) === 1 && Number(isOpenExamination) === 1) {
obj = [{ name: '学习须知', index: '1-1' }, { name: '考前须知', index: '1-2' }]
if (Number(isOpenTextbookLearning) || Number(isOpenRequiredCourse) || Number(isOpenXxtendedCourse)) {
arrList = this.arrHeader(this.headerData)
} else {
arrList = this.arrHeader(this.headerData).filter(k => k.index !== '2')
}
obj.forEach((item) => {
arrList[0].children.push(item)
})
this.headerData = arrList
} else if (!Number(isOpenTextbookLearning) && !Number(isOpenRequiredCourse) && !Number(isOpenXxtendedCourse)) {
if (this.isExamination) {
this.headerData = this.headerData.filter(k => k.index === '3')
this.defaultActive = '3'
this.$router.push({ path: '/app/examination/my-examination' })
} else {
this.headerData = []
this.$router.push({ path: '/empty' })
}
}
},
goPages (str) {
......
......@@ -19,6 +19,11 @@ import store from './store'
require('promise.prototype.finally').shim()
/* 兼容处理 end */
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
return VueRouterPush.call(this, to).catch(err => err)
}
Vue.use(VueRouter)
Vue.use(UploadForm)
Vue.component(UploadForm.name, UploadForm)
......
......@@ -57,6 +57,10 @@ export default [
}
]
},
{
path: '/empty',
component: () => import('@/components/empty.vue')
},
{
path: 'learn',
redirect: 'error/404',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论