소스 검색

京博ppt模块图片改为后端接口上传

jwyu 8 달 전
부모
커밋
8398c3f90a
2개의 변경된 파일65개의 추가작업 그리고 34개의 파일을 삭제
  1. 33 22
      src/views/ppt_manage/newVersion/pptEditor.vue
  2. 32 12
      src/views/ppt_manage/newVersion/pptEnEditor.vue

+ 33 - 22
src/views/ppt_manage/newVersion/pptEditor.vue

@@ -635,30 +635,41 @@ export default {
       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||''
-
-      //直接走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()}`
+      
+      // 1走后端接口上传
+      const uploadType=this.$setting.dynamicOutLinks.PptUpdateApi ||
+                        this.$store.state.dynamicOutLinks.PptUpdateApi ||
+                        JSON.parse(localStorage.getItem('dynamicOutLinks')).PptUpdateApi
+      if(uploadType==1){
+        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||''
+        
+      }else{
+        //直接走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;
+        const res = await uploadFileDirect(clientType,$event.src,temName)
+        this.imgUrl = res;
+      }
+
+      
       
       //console.log('OK',$event)
       let temp_elements = this.addElement(

+ 32 - 12
src/views/ppt_manage/newVersion/pptEnEditor.vue

@@ -644,20 +644,40 @@ 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
-
-      //直接走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;
+      // 1走后端接口上传
+      const uploadType=this.$setting.dynamicOutLinks.PptUpdateApi ||
+                        this.$store.state.dynamicOutLinks.PptUpdateApi ||
+                        JSON.parse(localStorage.getItem('dynamicOutLinks')).PptUpdateApi
+      if(uploadType==1){
+        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||''
+      }else{
+        //直接走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(