|
@@ -1,18 +1,24 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <template
|
|
|
- v-if="courseHandoutsData.fileList && courseHandoutsData.fileList.length"
|
|
|
- >
|
|
|
+ <template v-if="courseHandoutsData.handoutsId">
|
|
|
<u-search
|
|
|
placeholder="搜索讲义名称"
|
|
|
bg-color="#ffffff"
|
|
|
margin="0 0 20rpx"
|
|
|
- v-model="keyword"
|
|
|
+ v-model="fileName"
|
|
|
@custom="search"
|
|
|
@search="search"
|
|
|
></u-search>
|
|
|
- <view class="handouts-box" v-for="item in searchList" :key="item.fileId">
|
|
|
- <handouts-tree :canDownload="courseHandoutsData.canDownload" :fileInfo="item"></handouts-tree>
|
|
|
+
|
|
|
+ <view
|
|
|
+ class="handouts-box"
|
|
|
+ v-for="item in courseHandoutsData.fileList"
|
|
|
+ :key="item.fileId"
|
|
|
+ >
|
|
|
+ <handouts-tree
|
|
|
+ :canDownload="courseHandoutsData.canDownload"
|
|
|
+ :fileInfo="item"
|
|
|
+ ></handouts-tree>
|
|
|
</view>
|
|
|
</template>
|
|
|
<view v-else style="text-align: center">暂无讲义</view>
|
|
@@ -30,9 +36,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- keyword: "",
|
|
|
- searchList: [],
|
|
|
- courseHandoutsData: [],
|
|
|
+ fileName: "",
|
|
|
+ courseHandoutsData: {},
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -41,32 +46,17 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
search(val) {
|
|
|
- if (!val) {
|
|
|
- this.searchList = this.backClone();
|
|
|
- return;
|
|
|
- }
|
|
|
- this.searchList = this.filterList(this.backClone(), []);
|
|
|
- },
|
|
|
- filterList(list, res) {
|
|
|
- list.forEach((ele) => {
|
|
|
- if (ele.type == 1 && ele.urlName.includes(this.keyword)) {
|
|
|
- res.push(ele);
|
|
|
- }
|
|
|
- if (ele.children && ele.children.length) {
|
|
|
- this.filterList(ele.children, res);
|
|
|
- }
|
|
|
- });
|
|
|
- return res;
|
|
|
- },
|
|
|
- backClone() {
|
|
|
- return JSON.parse(JSON.stringify(this.courseHandoutsData.fileList));
|
|
|
+ this.courseHandouts();
|
|
|
},
|
|
|
courseHandouts() {
|
|
|
- this.$api.courseHandouts(this.handoutsId).then((res) => {
|
|
|
- this.courseHandoutsData = res.data.data;
|
|
|
- this.searchList = this.backClone();
|
|
|
- console.log(this.courseHandoutsData,666)
|
|
|
- });
|
|
|
+ this.$api
|
|
|
+ .courseHandouts({
|
|
|
+ handoutsId: this.handoutsId,
|
|
|
+ fileName: this.fileName,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.courseHandoutsData = res.data.data;
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
|