Explorar o código

onlyoffice模板上传接口变更

cfort hai 1 ano
pai
achega
26b928cbcb

+ 6 - 0
src/business/platform/file/uploader/index.vue

@@ -24,6 +24,7 @@
                     :height="height"
                     :height="height"
                     :init="dialogVisible"
                     :init="dialogVisible"
                     :limit="limit"
                     :limit="limit"
+                    :upload-method="uploadMethod"
                     @callback="uploadCallback"
                     @callback="uploadCallback"
                 />
                 />
             </el-tab-pane>
             </el-tab-pane>
@@ -95,6 +96,11 @@ export default {
         fileExt: {
         fileExt: {
             type: Array,
             type: Array,
             default: () => []
             default: () => []
+        },
+        // 上传类型:normal:普通上传,onlyoffice:onlyoffice文件上传
+        uploadMethod: {
+            type: String,
+            default: 'normal'
         }
         }
     },
     },
     data () {
     data () {

+ 6 - 1
src/business/platform/file/uploader/upload.vue

@@ -60,6 +60,7 @@
 </template>
 </template>
 <script>
 <script>
 import { uploadFile, remove, deleteFile } from '@/api/platform/file/attachment'
 import { uploadFile, remove, deleteFile } from '@/api/platform/file/attachment'
+import { uploadTemplateFile } from '@/api/platform/file/onlyoffice'
 import { fileTypes, allFileTypes, accept as acceptTypes } from '@/business/platform/file/constants/fileTypes'
 import { fileTypes, allFileTypes, accept as acceptTypes } from '@/business/platform/file/constants/fileTypes'
 export default {
 export default {
     props: {
     props: {
@@ -102,7 +103,11 @@ export default {
          * 文件上传
          * 文件上传
          */
          */
         httpRequest (options) {
         httpRequest (options) {
-            return uploadFile(options.file, {})
+            const uploadMap = {
+                normal: uploadFile,
+                onlyoffice: uploadTemplateFile
+            }
+            return uploadMap[this.uploadMethod || 'normal'](options.file, {})
         },
         },
         // 做文件校验
         // 做文件校验
         beforeUpload (file) {
         beforeUpload (file) {