谢杰标 2 rokov pred
rodič
commit
5ebe8869b2

+ 3 - 2
common/httpList/course.js

@@ -116,8 +116,9 @@ export default {
 
 	courseHandouts(data) {
 		return myRequest({
-			url: '/course/handouts/' + data,
-			method: 'get'
+			url: '/course/handouts/file/detail' ,
+			method: 'get',
+			data
 		})
 	},
 	getHandoutList(data) {

+ 23 - 33
components/course/handoutsBox.vue

@@ -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;
+        });
     },
   },
 

+ 21 - 3
components/course/handoutsTree.vue

@@ -8,7 +8,12 @@
       >
         <u-icon name="arrow-down" color="#999" size="24" v-if="!down"></u-icon>
         <u-icon name="arrow-right" color="#999" size="24" v-if="down"></u-icon>
-        <text class="menu_name u-line-1">{{ fileInfo.urlName }}</text>
+        <view class="menu_name">
+          <view class="u-line-1">{{ fileInfo.urlName }}</view>
+          <view v-if="fileInfo.filePath" class="pathtips u-line-1">
+            {{ fileInfo.filePath }}
+          </view>
+        </view>
       </view>
       <view v-show="!down">
         <view v-for="item in fileInfo.children" :key="item.fileId">
@@ -21,9 +26,13 @@
     </view>
     <view v-if="fileInfo.type == 1">
       <view class="fl_c u-border-bottom level1">
-        <view class="title u-line-1">
-          {{ fileInfo.urlName }}
+        <view class="title">
+          <view class="u-line-1">{{ fileInfo.urlName }}</view>
+          <view v-if="fileInfo.filePath" class="pathtips u-line-1">
+            {{ fileInfo.filePath }}
+          </view>
         </view>
+
         <view @click="openDocument">
           <image
             v-if="!downLoading"
@@ -121,6 +130,10 @@ export default {
   font-weight: bold;
   color: #333;
   margin-left: 14rpx;
+  .pathtips {
+    font-size: 24rpx;
+    color: #999;
+  }
 }
 
 .level1 {
@@ -129,6 +142,11 @@ export default {
   .title {
     flex: 1;
     font-size: 26rpx;
+    color: #333;
+    .pathtips {
+      font-size: 22rpx;
+      color: #999;
+    }
   }
   .loading_down {
     transform: rotate(360deg);