فهرست منبع

资源上传文本类型

natasha 1 روز پیش
والد
کامیت
498a112248
1فایلهای تغییر یافته به همراه57 افزوده شده و 5 حذف شده
  1. 57 5
      src/views/personal_workbench/project/ProductionResourceManage.vue

+ 57 - 5
src/views/personal_workbench/project/ProductionResourceManage.vue

@@ -53,10 +53,13 @@
             :key="index"
             @click="selectSourceNode(item)"
             class="sources-item"
-            :class="[select_sources_id === item.id ? 'active' : '']"
+            :class="[
+              select_sources_id === item.id ? 'active' : '',
+              type_index === 5 ? 'sources-item-txt' : type_index === 3 ? 'sources-item-zip' : '',
+            ]"
           >
             <template v-if="type_index === 0"> <el-image :src="item.file_url" fit="contain"></el-image></template>
-            <template v-if="type_index === 1">
+            <template v-else-if="type_index === 1">
               <AudioLine
                 ref="audioLine"
                 :audio-id="'resource-audio-' + index"
@@ -65,9 +68,28 @@
                 :width="200"
               />
             </template>
-            <template v-if="type_index === 2">
+            <template v-else-if="type_index === 2">
               <video controls :src="item.file_url" width="100%" height="140px"></video>
             </template>
+            <template v-else-if="type_index === 3">
+              <iframe
+                class="sources-item-border"
+                :src="item.new_path"
+                width="100%"
+                height="300px"
+                frameborder="0"
+              ></iframe>
+            </template>
+            <template v-else-if="type_index === 4"> </template>
+            <template v-else-if="type_index === 5">
+              <iframe
+                class="sources-item-border"
+                :src="item.new_path"
+                width="100%"
+                height="300px"
+                frameborder="0"
+              ></iframe>
+            </template>
 
             <el-popover placement="bottom" width="300" trigger="hover">
               <div class="sources-info">
@@ -181,6 +203,9 @@ import PaginationPage from '@/components/PaginationPage.vue';
 import { PageQueryProjectResourceList } from '@/api/list';
 import UploadFile from './components/UploadFile.vue';
 import AudioLine from './components/AudioLine.vue';
+const Base64 = require('js-base64').Base64;
+import { getConfig } from '@/utils/auth';
+import { H5StartupFile } from '@/api/app';
 
 export default {
   name: 'ProjectResourceManager',
@@ -252,7 +277,7 @@ export default {
       file_id_list: [],
       file_list: [],
       loading: false,
-      acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '*', '*', '*'],
+      acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '.zip', '*', '.txt'],
       limit: 10,
       uploadTip: '',
       boxLoading: false,
@@ -264,6 +289,7 @@ export default {
       },
       sourceMoveFlag: false,
       sourceMoveId: '',
+      file_preview_url: getConfig() ? getConfig().doc_preview_service_address : '',
     };
   },
   created() {
@@ -427,8 +453,22 @@ export default {
       };
       PageQueryProjectResourceList(datas)
         .then(({ total_count, resource_list }) => {
-          this.boxLoading = false;
           this.total = total_count;
+          if (this.type_index === 5) {
+            resource_list.forEach((item) => {
+              item.new_path = `${this.file_preview_url}onlinePreview?url=${Base64.encode(item.file_url)}`;
+            });
+            this.boxLoading = false;
+          } else if (this.type_index === 3) {
+            resource_list.forEach((item) => {
+              H5StartupFile({ file_id: item.file_id, index_file_name: 'index.html' }).then((res) => {
+                item.new_path = res.file_url;
+                this.boxLoading = false;
+              });
+            });
+          } else {
+            this.boxLoading = false;
+          }
           this.list = resource_list;
         })
         .catch(() => {
@@ -642,6 +682,18 @@ export default {
         width: 200px;
         cursor: pointer;
 
+        &-txt {
+          width: 400px;
+        }
+
+        &-zip {
+          width: 500px;
+        }
+
+        &-border {
+          border: 1px solid #ccc;
+        }
+
         .el-image {
           width: 100%;
           height: 140px;