Procházet zdrojové kódy

perf: 完善注释,完善多语言

zhupei@smartai.com před 1 rokem
rodič
revize
25748db44d

+ 3 - 1
public/i18n/lang-en.json

@@ -415,6 +415,8 @@
     "copy": "Copy"
   },
   "common": {
-    "confirm_delete": "Are you sure delete?"
+    "confirm_delete": "Are you sure delete?",
+    "doc_error": "Document loading error",
+    "click_2_download": "Click to download the file"
   }
 }

+ 3 - 1
public/i18n/lang-zh.json

@@ -410,6 +410,8 @@
     "copy": "复制"
   },
   "common": {
-    "confirm_delete": "确定删除吗?"
+    "confirm_delete": "确定删除吗?",
+    "doc_error": "文档加载出错",
+    "click_2_download": "点击下载文件"
   }
 }

+ 1 - 1
src/modules/file-preview/FileItemDocDownload.vue

@@ -3,7 +3,7 @@
     <FileIcon :file_end_fix="file_end_fix" class="file-icon-box" />
 
     <div class="file-item-info-container">
-      <a-tooltip content="点击下载文件" position="top">
+      <a-tooltip :content="$t('common.click_2_download')" position="top">
         <div class="file-item-doc-title">{{ file.file_name }}</div>
       </a-tooltip>
 

+ 1 - 1
src/modules/viewer-docx/ViewerDocxFromFile.vue

@@ -7,7 +7,7 @@
   </div>
 
   <div class="loading-doc-box" v-if="load_status === 4">
-    <a-result status="error" title="文档加载出错">
+    <a-result status="error" :title="$t('common.doc_error')">
       <template #subtitle>
         {{ load_msg }}
       </template>

+ 1 - 1
src/modules/viewer-docx/ViewerDocxFromUrl.vue

@@ -7,7 +7,7 @@
   </div>
 
   <div class="loading-doc-box" v-if="load_status === 4">
-    <a-result status="error" title="文档加载出错">
+    <a-result status="error" :title="$t('common.doc_error')">
       <template #subtitle>
         {{ load_msg }}
       </template>

+ 0 - 88
src/modules/viewer-pdf/PdfReader.vue

@@ -1,88 +0,0 @@
-<template>
-  <div class="doc-viewer" ref="elementRef"></div>
-</template>
-<script>
-import '../../../public/pdf/image-viewer.umd';
-import '../../../public/pdf/style.css';
-import { defineComponent, onMounted, ref } from 'vue';
-export default defineComponent({
-  components: {},
-  props: ['fileUrl', 'fileName'],
-  setup(props, { emit }) {
-    const elementRef = ref(null);
-    onMounted(() => {
-      const options = {
-        defaultUrl: props.fileUrl,
-        resourcePath: 'pdf/',
-        disableCORSOriginCheck: true,
-        disableDocAnnotation: true,
-        disableDraggingAndDropping: true,
-        disablePopupList: false,
-        showAnnotationMenu: false,
-        textLayerMode: 1,
-        appConfig: {
-          toolbar: {
-            toolbarViewerLeft: {
-              pageNumber: false
-            }
-          }
-        },
-        toolbarControl: {
-          download: false
-        },
-        locale: 'zh-cn'
-      };
-      const app = ImageViewer.createViewer(elementRef.value, options);
-      app.readyPromise.then(() => {
-        document.querySelector('#pdfFileName').innerHTML = props.fileName;
-      });
-    });
-    return {
-      elementRef
-    };
-  }
-});
-</script>
-<style>
-html[dir='ltr'] [data-id='toolbarViewerRight'] {
-  display: none;
-}
-.pdf-document-viewer .toolbar {
-  z-index: 999;
-}
-.pdf-document-viewer .annotation-control-bar__bottom {
-  opacity: 0;
-  display: none;
-}
-.pdf-document-viewer .annotation[data-subtype='Highlight'][data-custom-type='search'] .annotation-quad {
-  fill: rgba(250, 200, 80, 0.3);
-}
-
-.pdf-document-viewer .annotation[data-subtype='Highlight'][data-custom-type='search'] .widget-content {
-  fill: rgba(250, 200, 80, 0.3);
-}
-[data-id='toolbarContainer'],
-.findbar,
-.secondaryToolbar {
-  height: 50px;
-  padding-left: 50px;
-}
-.pdf-document-viewer input,
-.pdf-document-viewer button,
-.pdf-document-viewer select {
-  border: none;
-  cursor: pointer;
-}
-.pdfFileName {
-  margin-top: 8px;
-  flex: 1;
-}
-[data-id='toolbarViewerLeft'] {
-  display: flex;
-}
-</style>
-<style scoped>
-.doc-viewer {
-  height: 100%;
-}
-</style>

+ 0 - 2
src/modules/viewer-pdf/README.md

@@ -2,6 +2,4 @@
 
 此目录下为 pdf web 端预览解决方案。
 
-`PDFReader.vue`组件为旧版,位于`components/PDFReader.vue`,但是未经任何组件依赖,也就是说此组件未被使用,于是我将其迁移到此目录下。
-
 `PDFViewer.vue`组件是为了实现`文档引用效果`而写。

+ 1 - 1
src/modules/viewer-pdf/ViewerPDFFromFile.vue

@@ -7,7 +7,7 @@
   </div>
 
   <div class="loading-pdf-box" v-if="load_status === 4">
-    <a-result status="error" title="文档加载出错">
+    <a-result status="error" :title="$t('common.doc_error')">
       <template #subtitle>
         {{ load_msg }}
       </template>

+ 1 - 1
src/modules/viewer-pdf/ViewerPDFFromUrl.vue

@@ -7,7 +7,7 @@
   </div>
 
   <div class="loading-pdf-box" v-if="load_status === 4">
-    <a-result status="error" title="文档加载出错">
+    <a-result status="error" :title="$t('common.doc_error')">
       <template #subtitle>
         {{ load_msg }}
       </template>