|
@@ -21,18 +21,10 @@
|
|
|
<div class="common1280 chapterAll">
|
|
|
<h4>课程章节</h4>
|
|
|
<div class="unitAll">
|
|
|
- <!-- <div class="unitPart" v-for="(item,index) in 2" :key="index">
|
|
|
- <div class="UnitTitle">01单元</div>
|
|
|
- <div class="UnitChapter">
|
|
|
- <div class="singleUnitChapter">章节一</div>
|
|
|
- <div class="singleUnitChapter">章节二</div>
|
|
|
- <div class="singleUnitChapter">章节三</div>
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
- <el-collapse class="unitAll" v-model="activeNames" @change="handleChange" accordion >
|
|
|
- <el-collapse-item title="单元1" :name="index" v-for="(item,index) in 4" :key="index" @click="handleUnit(item)">
|
|
|
+ <el-collapse class="unitAll" v-model="activeNames" accordion >
|
|
|
+ <el-collapse-item :title="item.name" :name="index" v-for="(item,index) in unitNames" :key="index" @click="handleUnit(item,index)">
|
|
|
<div class="UnitChapter">
|
|
|
- <div class="singleUnitChapter" v-for="(item,index) in 3" :key="index">章节{{ index }}</div>
|
|
|
+ <div class="singleUnitChapter" v-for="(item,secindex) in unitChapters[index]" :key="secindex" @click="toDetail(item)">{{ item.kf_name }}</div>
|
|
|
</div>
|
|
|
</el-collapse-item>
|
|
|
|
|
@@ -73,13 +65,16 @@ import { user } from "@/store/user.js";
|
|
|
sourceListData: [],
|
|
|
kkID:'',
|
|
|
searchKey: '',
|
|
|
- activeNames: ['1']
|
|
|
+ activeNames: ['1'],
|
|
|
+ unitNames: [],
|
|
|
+ unitChapters: [] // 用数组存储数据
|
|
|
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initDetail();
|
|
|
this.initSourceData();
|
|
|
+ this.initUnitDetail();
|
|
|
},
|
|
|
methods: {
|
|
|
/**初始化详情数据*/
|
|
@@ -119,7 +114,7 @@ import { user } from "@/store/user.js";
|
|
|
},
|
|
|
initUnitDetail() {
|
|
|
let transObj = {
|
|
|
- kk_id:kkId,
|
|
|
+ kk_id:this.$route.query.id,
|
|
|
}
|
|
|
attribDetail(transObj)
|
|
|
.then(res => {
|
|
@@ -151,13 +146,29 @@ import { user } from "@/store/user.js";
|
|
|
searchBtn() {
|
|
|
this.initSourceData();
|
|
|
},
|
|
|
- /**单元手风琴*/
|
|
|
- handleChange(val) {
|
|
|
- console.log(val);
|
|
|
- },
|
|
|
/**单元点击*/
|
|
|
- handleUnit(item) {
|
|
|
- console.log('item',item);
|
|
|
+ handleUnit(item,chapterIndex) {
|
|
|
+ this.kkID = this.$route.query.id;
|
|
|
+ let transObj = {
|
|
|
+ token:user?.token,
|
|
|
+ kk_id: this.kkID,
|
|
|
+ ka_attrib_level_1:item.id,
|
|
|
+ }
|
|
|
+ courseSourceList(transObj)
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == "1") {
|
|
|
+ this.unitChapters[chapterIndex] = res.data.page_data;
|
|
|
+ // 触发响应式更新
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ toDetail(allItem) {
|
|
|
+ this.$router.push({ path: '/resourceChapter', query: { id: this.$route.query.id , filterText: allItem.kf_name } });
|
|
|
},
|
|
|
|
|
|
},
|