Jelajahi Sumber

添加文件预览

aaa 3 tahun lalu
induk
melakukan
2e046f57e7
1 mengubah file dengan 14 tambahan dan 3 penghapusan
  1. 14 3
      src/views/home/learn/page-learn-content.vue

+ 14 - 3
src/views/home/learn/page-learn-content.vue

@@ -7,7 +7,7 @@
       @click-left="onClickLeft"
     />
     <div class="loading" v-if="loading">
-      <van-loading  type="spinner" vertical >加载中...</van-loading>
+      <van-loading type="spinner" vertical>加载中...</van-loading>
     </div>
     <div v-else>
       <div v-if="!isReadable" class="learn-content-rest-time">已学完</div>
@@ -59,7 +59,7 @@
               :key="index"
               class="linkListItem"
             >
-              <a :href="item">
+              <a :href="item" @click="previewFile(item)">
                 <div class="linkListItemIocn">
                   <img :src="getLinkIcon(item)" />
                 </div>
@@ -524,6 +524,17 @@ export default {
           break;
       }
       return img;
+    },
+    previewFile(url) {
+      let strArr = url.split(".");
+      let type = strArr[strArr.length - 1];
+      lx.utils.previewFile({
+        url: url,
+        name: "",
+        size: 1000,
+        type: type,
+        moreHidden: false
+      });
     }
   }
 };
@@ -542,7 +553,7 @@ export default {
     display: flex;
     justify-content: center;
     align-items: center;
-   }
+  }
   .learn-content-rest-time {
     height: 1.5rem;
     display: flex;