2 次代碼提交 1c74859d0d ... 6ce7639e57

作者 SHA1 備註 提交日期
  liutian 6ce7639e57 add: UI 新增 closeDocument API 3 月之前
  liutian 1c74859d0d add: UI 新增 closeDocument API 3 月之前

+ 5 - 1
packages/webview/src/components/DocumentContainer/DocumentContainer.vue

@@ -49,7 +49,7 @@
   <PreventDialog />
   <MeasurePop />
   <div v-if="loading && loadingPercent < 100" class="loading-state">{{ $t('loading') }}...</div>
-  <div v-show="!load && loadingPercent <= 0 && activePanelTab !== 'COMPARISON' && ['compare', 'view'].includes(toolMode)" class="upload-container">
+  <div v-show="!load && loadingPercent <= 0 && showUploadButton && activePanelTab !== 'COMPARISON' && ['compare', 'view'].includes(toolMode)" class="upload-container">
     <input id="fileInput" type="file" accept=".pdf" @change="handleUpload" />
     <label for="fileInput">{{ $t('upload') }}</label>
   </div>
@@ -85,6 +85,7 @@ const topSpace = computed(() => {
 })
 const loading = computed(() => useViewer.getUploadLoading && useViewer.getUpload)
 const activePanelTab = computed(() => useViewer.getActiveElementTab('leftPanelTab'))
+const showUploadButton = computed(() => useViewer.getShowUploadButton)
 const load = computed(() => useViewer.getUpload)
 
 async function handleUpload(evt) {
@@ -173,6 +174,9 @@ window.instance.initOptions = async (options) => {
   // const res = await initConfig({
   //   license: 'NjY0ZGE0N2ZhYTBiZQ=='
   // })
+  if (showUploadButton in options) {
+    useViewer.setShowUploadButton(options.showUploadButton)
+  }
   const webviewerMode = !!(options && options.webviewerServer) ? options.webviewerServer : 'Standalone'
   useViewer.setWebviewerMode(webviewerMode)
   if (!res) return

+ 10 - 3
packages/webview/src/stores/modules/viewer.js

@@ -350,7 +350,8 @@ export const useViewerStore = defineStore({
     upload: true, // 未上传文件的upload按钮
     uploadLoading: false, // 上传中的loading效果
     compareMode: 'content',
-    contentEditorType: 'text'
+    contentEditorType: 'text',
+    showUploadButton: true,
   }),
   getters: {
     getLanguage () {
@@ -445,7 +446,10 @@ export const useViewerStore = defineStore({
     },
     getContentEditorType () {
       return this.contentEditorType
-    }
+    },
+    getShowUploadButton () {
+      return this.showUploadButton
+    },
   },
   actions: {
     resetSetting () {
@@ -609,6 +613,9 @@ export const useViewerStore = defineStore({
     },
     setContentEditorType (type) {
       this.contentEditorType = type
-    }
+    },
+    setShowUploadButton (bool) {
+      this.showUploadButton = bool
+    },
   }
 })