|
|
|
@ -1,18 +1,17 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="page"> |
|
|
|
|
<div class="tabs"> |
|
|
|
|
<a class="item" v-for="(item, index) in tabs" :key="index" :class="{ active: index == active }" |
|
|
|
|
@click="tabChange(index)">{{ item }}</a> |
|
|
|
|
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: item.id == active }" |
|
|
|
|
@click="tabChange(item)">{{ item.name }}</a> |
|
|
|
|
</div> |
|
|
|
|
<div class="page-content"> |
|
|
|
|
<Course v-if="active == 'tab1'" /> |
|
|
|
|
<Project v-if="active == 'tab2' || active == 'tab3'" ref="project" /> |
|
|
|
|
<Course v-if="active == 1" /> |
|
|
|
|
<Project v-if="active == 2 || active == 3" ref="project" /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import Setting from "@/setting"; |
|
|
|
|
import { mapState } from "vuex"; |
|
|
|
|
import Course from "./course"; |
|
|
|
|
import Project from "./project"; |
|
|
|
@ -25,12 +24,17 @@ export default { |
|
|
|
|
}, |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
active: this.$route.query.tab || "tab2", // 当前标签页 |
|
|
|
|
tabs: { |
|
|
|
|
tab1: '课程维度', |
|
|
|
|
tab2: '项目维度', |
|
|
|
|
tab3: '我的课程', |
|
|
|
|
}, |
|
|
|
|
active: this.$route.query.tab || 2, |
|
|
|
|
tabs: [ |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '课程维度' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '项目维度' |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
@ -40,17 +44,26 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.$store.commit('achievement/setRow', null) |
|
|
|
|
// Setting.dynamicRoute && this.initTabs(); |
|
|
|
|
this.getSchoolId() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
tabChange (i) { |
|
|
|
|
// 查询schoolId,处理备课管理的展示 |
|
|
|
|
async getSchoolId () { |
|
|
|
|
const { data } = await this.$get(this.api.logoDetail) |
|
|
|
|
data.schoolId === 901 && this.tabs.push({ |
|
|
|
|
id: 3, |
|
|
|
|
name: '我的课程' |
|
|
|
|
}) |
|
|
|
|
console.log("🚀 ~ getSchoolId ~ tabs:", this.tabs) |
|
|
|
|
}, |
|
|
|
|
tabChange ({ id }) { |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: 'list', |
|
|
|
|
query: { |
|
|
|
|
tab: i |
|
|
|
|
tab: id |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.active = i |
|
|
|
|
this.active = id |
|
|
|
|
|
|
|
|
|
const el = this.$refs.project |
|
|
|
|
if (el && el.getCourse) { |
|
|
|
@ -58,13 +71,6 @@ export default { |
|
|
|
|
el.getCourse() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
initTabs () { |
|
|
|
|
const { btns } = this |
|
|
|
|
const tab1 = btns.includes('/course/list:课程管理') |
|
|
|
|
const tab2 = btns.includes('/course/list:分类管理') |
|
|
|
|
tab1 || delete this.tabs.first |
|
|
|
|
tab2 || delete this.tabs.second |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|