Pārlūkot izejas kodu

ppt CV图片直接上传不走接口

Karsa 1 gadu atpakaļ
vecāks
revīzija
4211713ee6

+ 2 - 1
src/views/ppt_manage/newVersion/components/formatPage/mixins.js

@@ -170,7 +170,8 @@ export default {
                 readder.readAsDataURL(bolb);
                 const that = this
                 readder.onload = function (e) {
-                    imgObj.src= e.target.result;
+                    // imgObj.src= e.target.result;
+                    imgObj.src=bolb;
                     imgObj.position = position
                     that.$emit('pasteImg',imgObj)
                 };

+ 27 - 15
src/views/ppt_manage/newVersion/pptEditor.vue

@@ -272,6 +272,7 @@ import futuresInterface from '@/api/modules/futuresBaseApi';
 import chartRelevanceApi from '@/api/modules/chartRelevanceApi';
 import { fittingEquationInterface,statisticFeatureInterface } from '@/api/modules/chartRelevanceApi';
 import pptmixin from '../mixins/pptMixins';
+import {uploadFileDirect} from "@/utils/common.js"
 import mixins from '../mixins/mixins';
 import layerMixins from '../mixins/layerMixins';
 import pptEditorMixins from '../mixins/pptEditorMixins';
@@ -621,21 +622,32 @@ export default {
       if(this.isChartLoading) return
       this.chartLoadingText = "上传图片中..."
       this.isChartLoading = true
-      const params = new FormData();
-			params.append('Image',$event.src)
-      const res = await dataBaseInterface.uploadImg(params);
-      if(!res||res&&res.Ret!==200){
-        this.isChartLoading = false
-        return
-      }
-      const {Data} = res
-      if(!Data){
-        this.$message.warning("上传图片失败")
-        this.isChartLoading = false
-        return
-      }
-      this.imgUrl = Data.ResourceUrl||''
-      /* this.imgUrl = $event.src */
+
+      // const params = new FormData();
+			// params.append('Image',$event.src)
+      // const res = await dataBaseInterface.uploadImg(params);
+      // if(!res||res&&res.Ret!==200){
+      //   this.isChartLoading = false
+      //   return
+      // }
+      // const {Data} = res
+      // if(!Data){
+      //   this.$message.warning("上传图片失败")
+      //   this.isChartLoading = false
+      //   return
+      // }
+      // this.imgUrl = Data.ResourceUrl||''
+
+      //直接走oss不走接口
+      let clientType = this.$setting.dynamicOutLinks.ObjectStorageClient 
+        || this.$store.state.dynamicOutLinks.ObjectStorageClient 
+        || JSON.parse(localStorage.getItem('dynamicOutLinks')).ObjectStorageClient;
+      
+      let temName = `ppt/image/${new Date().getTime()}`
+
+      const res = await uploadFileDirect(clientType,$event.src,temName)
+      this.imgUrl = res;
+      
       //console.log('OK',$event)
       let temp_elements = this.addElement(
             this.currentItem.elements,

+ 16 - 5
src/views/ppt_manage/newVersion/pptEnEditor.vue

@@ -294,6 +294,7 @@ import ChooseCover from './components/editor/ChooseCoverEn.vue';
 import AddFormat from './components/editor/AddFormat.vue';
 import {pptEnInterface} from '@/api/modules/pptEnApi.js';
 import * as sheetInterface from '@/api/modules/sheetApi.js';
+import {uploadFileDirect} from "@/utils/common.js"
 import ShapePreview from './components/layer/shapePreview.vue';
 import LayerEditTool from './components/layer/layerEditTool.vue';
 import DeletePageDialog from './components/editor/DeletePageDialog.vue';
@@ -630,11 +631,21 @@ export default {
       if(this.isChartLoading) return
       this.chartLoadingText = "上传图片中..."
       this.isChartLoading = true
-      const params = new FormData();
-			params.append('Image',$event.src)
-      const { Data } = await dataBaseInterface.uploadImg(params);
-      this.imgUrl = Data.ResourceUrl
-      /* this.imgUrl = $event.src */
+      // const params = new FormData();
+			// params.append('Image',$event.src)
+      // const { Data } = await dataBaseInterface.uploadImg(params);
+      // this.imgUrl = Data.ResourceUrl
+
+      //直接走oss不走接口
+      let clientType = this.$setting.dynamicOutLinks.ObjectStorageClient 
+        || this.$store.state.dynamicOutLinks.ObjectStorageClient 
+        || JSON.parse(localStorage.getItem('dynamicOutLinks')).ObjectStorageClient;
+      
+      let temName = `ppt/image/${new Date().getTime()}`
+
+      const res = await uploadFileDirect(clientType,$event.src,temName)
+      this.imgUrl = res;
+
       //console.log('OK',$event)
       let temp_elements = this.addElement(
             this.currentItem.elements,