Browse Source

资源类型

natasha 2 days ago
parent
commit
6bf14a6ca7

+ 21 - 17
src/views/book/courseware/create/components/base/common/SelectResource.vue

@@ -25,18 +25,18 @@
         v-for="(item, index) in list"
         :key="index"
         class="sources-item"
-        :class="[select_sources_id === item.id ? 'active' : '', type_index === 5 ? 'sources-item-txt' : '']"
+        :class="[select_sources_id === item.id ? 'active' : '']"
         @click="selectSourceNode(item)"
       >
         <template v-if="type_index === 0"> <el-image :src="item.file_url" fit="contain" /></template>
         <template v-else-if="type_index === 1">
-          <AudioLine
+          <!-- <AudioLine
             ref="audioLine"
             :audio-id="'resource-audio-' + index"
             :mp3="item.file_url"
             :get-cur-time="getCurTime"
             :width="200"
-          />
+          /> -->
         </template>
         <template v-else-if="type_index === 2">
           <video
@@ -53,7 +53,7 @@
         </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>
+          <!-- <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">
@@ -69,7 +69,9 @@
               <p class="name">
                 {{ item.name
                 }}<SvgIcon
-                  v-show="item.file_id && (type_index === 3 || type_index === 2)"
+                  v-show="
+                    item.file_id && (type_index === 5 || type_index === 3 || type_index === 2 || type_index === 1)
+                  "
                   icon-class="uploadPreview"
                   size="16"
                   @click="viewDialog(item)"
@@ -108,7 +110,7 @@ import PaginationPage from '@/components/PaginationPage.vue';
 import AudioLine from '@/views/personal_workbench/project/components/AudioLine.vue';
 
 import { PageQueryProjectResourceList } from '@/api/list';
-import { H5StartupFile } from '@/api/app';
+import { H5StartupFile, GetFileURLMap } from '@/api/app';
 
 const Base64 = require('js-base64').Base64;
 import { getConfig } from '@/utils/auth';
@@ -243,12 +245,12 @@ export default {
       })
         .then(({ total_count, resource_list }) => {
           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.loading = false;
-          }
+          // if (this.type_index === 5) {
+          //   resource_list.forEach((item) => {
+          //     item.new_path = `${this.file_preview_url}onlinePreview?url=${Base64.encode(item.file_url)}`;
+          //   });
+          //   this.loading = false;
+          // }
           // else if (this.type_index === 3) {
           //   resource_list.forEach((item) => {
           //     H5StartupFile({ file_id: item.file_id, index_file_name: 'index.html' }).then((res) => {
@@ -257,9 +259,9 @@ export default {
           //     });
           //   });
           // }
-          else {
-            this.loading = false;
-          }
+          // else {
+          this.loading = false;
+          // }
           this.list = resource_list;
         })
         .catch(() => {
@@ -298,8 +300,10 @@ export default {
           this.visible_flag = true;
         });
       } else {
-        this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(file.file_url)}`;
-        this.visible_flag = true;
+        GetFileURLMap({ file_id_list: [file.file_id] }).then(({ url_map }) => {
+          this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(url_map[file.file_id])}`;
+          this.visible = true;
+        });
       }
     },
   },

+ 1 - 1
src/views/book/courseware/data/videoInteraction.js

@@ -27,7 +27,7 @@ export function getVideoInteractionData() {
     video_id_list: [], // 视频文件 id
     file_list: [], // 文件列表
     file_info_list: [],
-    file_id_list: [], // 视频文件 id
+    file_id_list: [], // 文件 id
     mind_map: {
       node_list: [
       ], // 思维导图数据

+ 7 - 34
src/views/book/courseware/preview/components/video_interaction/VideoInteractionPreview.vue

@@ -10,6 +10,7 @@
         height="400"
         controls
         @timeupdate="handleTimeUpdate"
+        controlsList="nodownload"
       ></video>
     </div>
     <el-dialog
@@ -103,41 +104,13 @@ export default {
 <style lang="scss" scoped>
 @use '@/styles/mixin.scss' as *;
 
-.img-box {
-  position: relative;
-  margin: 20px auto;
-}
-
-.pen {
-  display: flex;
-  align-items: center;
-  justify-content: flex-end;
-
-  .save {
-    box-sizing: border-box;
-    width: 65px;
-    height: 32px;
-    margin-left: 16px;
-    font-size: 16px;
-    font-weight: 400;
-    line-height: 32px;
-    color: #000;
-    text-align: center;
-    cursor: pointer;
-    background: rgba(0, 0, 0, 5%);
-    border: 1px solid rgba(0, 0, 0, 10%);
-    border-radius: 6px;
-  }
-
-  .save:hover {
-    background: rgba(0, 0, 0, 25%);
+video:full-screen {
+  :fullscreen::-webkit-media-controls-fullscreen-button {
+    display: none;
   }
+}
 
-  > img {
-    width: 24px;
-    height: 24px;
-    margin: 0 8px;
-    cursor: pointer;
-  }
+video::-webkit-media-controls-fullscreen-button {
+  display: none;
 }
 </style>

+ 24 - 19
src/views/personal_workbench/project/ProductionResourceManage.vue

@@ -52,18 +52,19 @@
             v-for="(item, index) in list"
             :key="index"
             class="sources-item"
-            :class="[select_sources_id === item.id ? 'active' : '', type_index === 5 ? 'sources-item-txt' : '']"
+            :class="[select_sources_id === item.id ? 'active' : '']"
             @click="selectSourceNode(item)"
           >
             <template v-if="type_index === 0"> <el-image :src="item.file_url" fit="contain" /></template>
             <template v-else-if="type_index === 1">
-              <AudioLine
+              <!-- <AudioLine
                 ref="audioLine"
                 :audio-id="'resource-audio-' + index"
                 :mp3="item.file_url"
                 :get-cur-time="getCurTime"
                 :width="200"
-              />
+              /> -->
+              <!-- {{ item.media_duration }} -->
             </template>
             <template v-else-if="type_index === 2">
               <video
@@ -86,13 +87,13 @@
             </template>
             <template v-else-if="type_index === 4"> </template>
             <template v-else-if="type_index === 5">
-              <iframe
+              <!-- <iframe
                 class="sources-item-border"
                 :src="item.new_path"
                 width="100%"
                 height="300px"
                 frameborder="0"
-              ></iframe>
+              ></iframe> -->
             </template>
 
             <el-popover placement="bottom" width="300" trigger="hover">
@@ -108,7 +109,9 @@
                   <p class="name">
                     {{ item.name }}
                     <SvgIcon
-                      v-show="item.file_id && (type_index === 3 || type_index === 2)"
+                      v-show="
+                        item.file_id && (type_index === 5 || type_index === 3 || type_index === 2 || type_index === 1)
+                      "
                       icon-class="uploadPreview"
                       size="16"
                       @click="viewDialog(item)"
@@ -231,7 +234,7 @@ 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';
+import { H5StartupFile, GetFileURLMap } from '@/api/app';
 
 export default {
   name: 'ProjectResourceManager',
@@ -303,7 +306,7 @@ export default {
       file_id_list: [],
       file_list: [],
       loading: false,
-      acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '.zip', '*', '.txt'],
+      acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '.zip', '.fbx,.obj,.gltf,.glb', '.txt'],
       limit: 10,
       uploadTip: '',
       boxLoading: false,
@@ -486,12 +489,12 @@ export default {
       PageQueryProjectResourceList(datas)
         .then(({ total_count, resource_list }) => {
           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;
-          }
+          // 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) => {
@@ -500,9 +503,9 @@ export default {
           //     });
           //   });
           // }
-          else {
-            this.boxLoading = false;
-          }
+          // else {
+          this.boxLoading = false;
+          // }
           this.list = resource_list;
         })
         .catch(() => {
@@ -625,8 +628,10 @@ export default {
           this.visible = true;
         });
       } else {
-        this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(file.file_url)}`;
-        this.visible = true;
+        GetFileURLMap({ file_id_list: [file.file_id] }).then(({ url_map }) => {
+          this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(url_map[file.file_id])}`;
+          this.visible = true;
+        });
       }
     },
   },