Bladeren bron

h5游戏预览

natasha 2 dagen geleden
bovenliggende
commit
61651677b9

+ 11 - 7
src/views/book/courseware/create/components/base/common/SelectResource.vue

@@ -69,9 +69,7 @@
               <p class="name">
                 {{ item.name
                 }}<SvgIcon
-                  v-show="
-                    item.file_id && (type_index === 5 || type_index === 3 || type_index === 2 || type_index === 1)
-                  "
+                  v-show="item.file_id && type_index !== 0"
                   icon-class="uploadPreview"
                   size="16"
                   @click="viewDialog(item)"
@@ -295,10 +293,16 @@ export default {
     viewDialog(file) {
       this.newpath = '';
       if (this.type_index === 3) {
-        H5StartupFile({ file_id: file.file_id, index_file_name: 'index.html' }).then((res) => {
-          this.newpath = res.file_url;
-          this.visible_flag = true;
-        });
+        const suffix = file.name.slice(file.name.lastIndexOf('.') + 1, file.name.length).toLowerCase();
+        if (suffix === 'html') {
+          this.newpath = file.file_url;
+          this.visible = true;
+        } else {
+          H5StartupFile({ file_id: file.file_id, index_file_name: 'index.html' }).then((res) => {
+            this.newpath = res.file_url;
+            this.visible = true;
+          });
+        }
       } else {
         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])}`;

+ 10 - 4
src/views/personal_workbench/project/ProductionResourceManage.vue

@@ -325,7 +325,7 @@ export default {
       file_id_list: [],
       file_list: [],
       loading: false,
-      acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '.zip', '.fbx,.obj,.gltf,.glb', '.txt'],
+      acceptFileTypeList: ['.jpg,.png,.jpeg', '.mp3', '.mp4', '.zip,.html', '.fbx,.obj,.gltf,.glb', '.txt'],
       limit: 10,
       uploadTip: '',
       boxLoading: false,
@@ -649,10 +649,16 @@ export default {
     viewDialog(file) {
       this.newpath = '';
       if (this.type_index === 3) {
-        H5StartupFile({ file_id: file.file_id, index_file_name: 'index.html' }).then((res) => {
-          this.newpath = res.file_url;
+        const suffix = file.name.slice(file.name.lastIndexOf('.') + 1, file.name.length).toLowerCase();
+        if (suffix === 'html') {
+          this.newpath = file.file_url;
           this.visible = true;
-        });
+        } else {
+          H5StartupFile({ file_id: file.file_id, index_file_name: 'index.html' }).then((res) => {
+            this.newpath = res.file_url;
+            this.visible = true;
+          });
+        }
       } else if (this.type_index === 4) {
         this.visible3D = true;
         this.loadModel(file.file_id);