Explorar o código

右侧文件资源类型,只点击打开查看,去掉预览下载

zq hai 1 mes
pai
achega
e7ae230a86
Modificáronse 1 ficheiros con 19 adicións e 62 borrados
  1. 19 62
      src/web_preview/index.vue

+ 19 - 62
src/web_preview/index.vue

@@ -234,27 +234,14 @@
                       <template v-else-if="parseInt(drawerType) === 4"> </template>
                       <template v-else-if="parseInt(drawerType) === 5">
                         <div class="file-name">
-                          <span>
-                            <SvgIcon icon-class="file" size="24" />
-                            <p>
-                              <span>{{ item.file_name }}</span>
-                            </p>
-                          </span>
-                          <div>
-                            <SvgIcon
-                              v-show="item.file_id"
-                              icon-class="uploadPreview"
-                              size="24"
-                              @click="viewDialog(item)"
-                            />
-
-                            <img
-                              style="width: 24px; height: 24px; cursor: pointer"
-                              src="@/assets/download.png"
-                              alt="download"
-                              @click="downLoad(item)"
-                            />
-                          </div>
+                          <el-link>
+                            <span @click="openFile(item)">
+                              <SvgIcon icon-class="file" size="24" />
+                              <p>
+                                <span>{{ item.file_name }}</span>
+                              </p>
+                            </span>
+                          </el-link>
                         </div>
                       </template>
                       <!-- 资源底部的操作 -->
@@ -349,20 +336,6 @@
       @confirm="saveNote"
       @cancel="delNote"
     />
-
-    <el-dialog
-      v-if="fileViewVisible"
-      :visible.sync="fileViewVisible"
-      :show-close="true"
-      :close-on-click-modal="true"
-      :modal-append-to-body="true"
-      :append-to-body="true"
-      :lock-scroll="true"
-      :width="isMobile ? '100%' : '80%'"
-      top="0"
-    >
-      <iframe v-if="fileViewVisible" :src="newpath" width="100%" :height="iframeHeight" frameborder="0"></iframe>
-    </el-dialog>
   </div>
 </template>
 
@@ -448,10 +421,6 @@ export default {
     return {
       projectId: book_id,
       select_node: this.id,
-      file_preview_url: getConfig() ? getConfig().doc_preview_service_address : '',
-      newpath: '',
-      fileViewVisible: false,
-      iframeHeight: `${window.innerHeight - 100}px`,
       courseware_info: {
         book_name: '',
         is_can_start_edit: 'false',
@@ -645,7 +614,7 @@ export default {
         ({ courseware_info }) => {
           this.courseware_info = { ...this.courseware_info, ...courseware_info };
           this.getLangList();
-        }
+        },
       );
     },
     /**
@@ -708,7 +677,7 @@ export default {
           });
 
           if (content_group_row_list) this.content_group_row_list = JSON.parse(content_group_row_list) || [];
-        }
+        },
       );
     },
     processHtmlString(pElements, styleConfig, isClear) {
@@ -732,7 +701,7 @@ export default {
       GetLanguageTypeList({ book_id: this.courseware_info.book_id, is_contain_zh: 'true' }).then(
         ({ language_type_list }) => {
           this.langList = language_type_list;
-        }
+        },
       );
     },
 
@@ -796,7 +765,7 @@ export default {
       this.$refs.courserware.handleResult(
         this.$refs.previewMain.scrollTop,
         this.$refs.previewMain.scrollLeft,
-        this.select_node
+        this.select_node,
       );
     },
 
@@ -1145,24 +1114,10 @@ export default {
         this.$refs.courserware.handleLocation(item);
       }
     },
-    downLoad(file) {
-      debugger
-      let userInfor = getToken();
-      let AccessToken = '';
-      if (userInfor) {
-        AccessToken = userInfor.access_token;
+    openFile(file) {
+      if (file && file.file_url) {
+        window.open(file.file_url);
       }
-      let FileID = file.file_id;
-      let data = {
-        AccessToken,
-        FileID,
-      };
-      location.href = `${process.env.VUE_APP_EEP}/FileServer/WebFileDownload?AccessToken=${data.AccessToken}&FileID=${data.FileID}`;
-    },
-    // 预览
-    viewDialog(file) {
-      this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(file.file_url)}`;
-      this.fileViewVisible = true;
     },
     /**
      * 获取笔记列表
@@ -1201,7 +1156,7 @@ export default {
           x.coursewareId === note.coursewareId &&
           x.blockId === note.blockId &&
           x.startIndex === note.startIndex &&
-          x.endIndex === note.endIndex
+          x.endIndex === note.endIndex,
       );
       if (old) {
         this.oldRichData = old;
@@ -1295,7 +1250,7 @@ export default {
           x.coursewareId === collect.coursewareId &&
           x.blockId === collect.blockId &&
           x.startIndex === collect.startIndex &&
-          x.endIndex === collect.endIndex
+          x.endIndex === collect.endIndex,
       );
       if (old) {
         this.$message({
@@ -1807,8 +1762,10 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
           }
 
           p {
+            max-width: 140px;
             color: #999;
             text-align: center;
+            word-break: break-all;
           }
 
           .card-box li {