Przeglądaj źródła

1.文件预览优化

GouGengquan 1 rok temu
rodzic
commit
3bf674b885

+ 2 - 2
.env.development

@@ -36,10 +36,10 @@ VUE_APP_ONLYOFFICE_API_PREFIX=/onlyofficeApi
 VUE_APP_ONLYOFFICE_CALLBACK=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
 
 # Onlyoffice 文档构建接口地址,相关文档:https://api.onlyoffice.com/editors/documentbuilderapi
-VUE_APP_ONLYOFFICE_DOCBUILDER=$VUE_APP_API_SERVER/api/onlyoffice/callback
+VUE_APP_ONLYOFFICE_DOCBUILDER=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
 
 # Onlyoffice 文档转换接口地址,相关文档:https://api.onlyoffice.com/editors/conversionapi
-VUE_APP_ONLYOFFICE_CONVERT=$VUE_APP_HOST:81/api/onlyoffice/callback
+VUE_APP_ONLYOFFICE_CONVERT=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
 
 # Onlyoffice 入口 JS 文件
 VUE_APP_ONLYOFFICE_API_URL=$VUE_APP_ONLYOFFICE_SERVER/web-apps/apps/api/documents/api.js

+ 6 - 6
.env.production

@@ -19,25 +19,25 @@ VUE_APP_API_PREFIX=/api
 VUE_APP_API_PORT=80
 
 # 业务服务地址  https://kps.scdayou.com/dfs/2023/08/03/real-report.docx
-VUE_APP_API_SERVER=http://$VUE_APP_HOST
+VUE_APP_API_SERVER=http://$VUE_APP_HOST:81
 
 # Onlyoffice 服务端口号
 VUE_APP_ONLYOFFICE_PORT=8091
 
 # Onlyoffice 服务地址
-VUE_APP_ONLYOFFICE_SERVER=https://kps.scdayou.com/office
+VUE_APP_ONLYOFFICE_SERVER=http://kps.scdayou.com:8091
 
 # Onlyoffice 接口前缀配置
 VUE_APP_ONLYOFFICE_API_PREFIX=/onlyofficeApi
 
 # Onlyoffice 回调接口地址,相关文档:https://api.onlyoffice.com/editors/callback
-VUE_APP_ONLYOFFICE_CALLBACK=https://kps.scdayou.com/api/onlyoffice/callback
+VUE_APP_ONLYOFFICE_CALLBACK=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
 
 # Onlyoffice 文档构建接口地址,相关文档:https://api.onlyoffice.com/editors/documentbuilderapi
-VUE_APP_ONLYOFFICE_DOCBUILDER=https://kps.scdayou.com/api/onlyoffice/callback
+VUE_APP_ONLYOFFICE_DOCBUILDER=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
 
 # Onlyoffice 文档转换接口地址,相关文档:https://api.onlyoffice.com/editors/conversionapi
-VUE_APP_ONLYOFFICE_CONVERT=https://kps.scdayou.com/api/onlyoffice/callback
+VUE_APP_ONLYOFFICE_CONVERT=$VUE_APP_ONLYOFFICE_SERVER/api/onlyoffice/callback
 
 # Onlyoffice 入口 JS 文件
-VUE_APP_ONLYOFFICE_API_URL=https://kps.scdayou.com/office/web-apps/apps/api/documents/api.js
+VUE_APP_ONLYOFFICE_API_URL=$VUE_APP_ONLYOFFICE_SERVER/web-apps/apps/api/documents/api.js

+ 21 - 12
src/views/assets/orderDetail.vue

@@ -2349,7 +2349,7 @@ export default {
     },
     handleAttachmentPreview(file) {
       // window.open(file.url)
-      this.officeFileView(file.name,file.response.data.url);
+      this.officeFileView(file.name,file.url);
     },
     // 移除文件
     beforeRemove(file, fileList) {
@@ -3423,17 +3423,26 @@ export default {
     },
     // 文档预览
     officeFileView(name, url) {
-      const route = this.$router.resolve({
-        path: "/office/view/window",
-        query: {
-          // 文档标题
-          title: name,
-          // 文档url地址
-          url: url
-        }
-      });
-      // 在新窗口打开页面
-      window.open(route.href, "_blank");
+      if (name && url) {
+        const route = this.$router.resolve({
+          path: "/office/view/window",
+          query: {
+            // 文档标题
+            title: name,
+            // 文档url地址
+            url: url
+          }
+        });
+        // 在新窗口打开页面
+        window.open(route.href, "_blank");
+      } else {
+        this.$notify({
+          title: '失败',
+          message: 'url为空,无法打开,如未保存请保存后再试!',
+          type: 'error',
+          duration: 2000
+        });
+      }
     }
   }
 

+ 21 - 12
src/views/major/todoDetail.vue

@@ -2810,7 +2810,7 @@ export default {
     },
     handleAttachmentPreview(file) {
       // window.open(file.url)
-      this.officeFileView(file.name,file.response.data.url);
+      this.officeFileView(file.name,file.url);
     },
     beforeRemove(file, fileList) {
       let index = fileList[0].index;
@@ -3501,17 +3501,26 @@ export default {
     },
     // 文档预览
     officeFileView(name, url) {
-      const route = this.$router.resolve({
-        path: "/office/view/window",
-        query: {
-          // 文档标题
-          title: name,
-          // 文档url地址
-          url: url
-        }
-      });
-      // 在新窗口打开页面
-      window.open(route.href, "_blank");
+      if (name || url) {
+        const route = this.$router.resolve({
+          path: "/office/view/window",
+          query: {
+            // 文档标题
+            title: name,
+            // 文档url地址
+            url: url
+          }
+        });
+        // 在新窗口打开页面
+        window.open(route.href, "_blank");
+      } else {
+        this.$notify({
+          title: '失败',
+          message: 'url为空,无法打开,如未保存请保存后再试!',
+          type: 'error',
+          duration: 2000
+        });
+      }
     }
   },
 }

Plik diff jest za duży
+ 288 - 280
src/views/personal/todoDetail.vue