Browse Source

feat: 处理rgb图片上传,接口添加参数处理成功

332777428@qq.com 5 months ago
parent
commit
b5136c68e7
2 changed files with 11 additions and 5 deletions
  1. 10 5
      src/components/Upload/index.vue
  2. 1 0
      src/views/operation/piano/index.vue

+ 10 - 5
src/components/Upload/index.vue

@@ -18,8 +18,8 @@
       :on-progress="onProgress"
       :on-progress="onProgress"
       :on-success="onSuccess"
       :on-success="onSuccess"
       :on-error="onError"
       :on-error="onError"
-      :width="width"
-      :height="height"
+      :width="480"
+      :height="480"
     >
     >
       <!-- <el-button v-if="listType !== 'picture-card'" :type="type" ref="upload"> -->
       <!-- <el-button v-if="listType !== 'picture-card'" :type="type" ref="upload"> -->
       <el-button
       <el-button
@@ -103,7 +103,8 @@ export default {
       type: String,
       type: String,
       default: "",
       default: "",
     },
     },
-    // 文件名
+
+    // 文件名  multipartFile
     name: {
     name: {
       type: String,
       type: String,
       default: "multipartFile",
       default: "multipartFile",
@@ -175,13 +176,11 @@ export default {
 
 
   created() {
   created() {
     // 根据上传类型 变更 上传地址
     // 根据上传类型 变更 上传地址
-    console.log("gadfqwerqewrqr===00==" + this.listType);
     if (this.listTypes == "picture-rgb") {
     if (this.listTypes == "picture-rgb") {
       this.action = this.obj[this.listTypes];
       this.action = this.obj[this.listTypes];
     } else {
     } else {
       this.action = this.obj[this.listType];
       this.action = this.obj[this.listType];
     }
     }
-    console.log("gadfqwerqewrqr===11==" + this.action);
     // 回显图片
     // 回显图片
     this.form.file = this.url;
     this.form.file = this.url;
   },
   },
@@ -192,6 +191,11 @@ export default {
       var platformId = this.$props.platformId;
       var platformId = this.$props.platformId;
       this.form.platformId = platformId;
       this.form.platformId = platformId;
       this.data.platformId = platformId;
       this.data.platformId = platformId;
+      this.form.width = this.width;
+      this.data.width = this.width;
+      this.form.height = this.height;
+      this.data.height = this.height;
+
       // console.log("beforeUpload:", this.width, this.height)
       // console.log("beforeUpload:", this.width, this.height)
       if (this.width && this.height) {
       if (this.width && this.height) {
         // var w = Number(this.width);
         // var w = Number(this.width);
@@ -203,6 +207,7 @@ export default {
           typeof this.height === "String" ? Number(this.height) : this.height;
           typeof this.height === "String" ? Number(this.height) : this.height;
         // console.log("传入的:", w, h, "666", typeof this.height === 'string')
         // console.log("传入的:", w, h, "666", typeof this.height === 'string')
         const data = await this.readerImg(file);
         const data = await this.readerImg(file);
+
         let _width =
         let _width =
           data.width % w === 0 || w % data.width === 0 ? true : false;
           data.width % w === 0 || w % data.width === 0 ? true : false;
         let _height =
         let _height =

+ 1 - 0
src/views/operation/piano/index.vue

@@ -72,6 +72,7 @@
           <Upload
           <Upload
             listType="picture-card"
             listType="picture-card"
             listTypes="picture-rgb"
             listTypes="picture-rgb"
+            name="file"
             width="480"
             width="480"
             height="480"
             height="480"
             :url="dialogData.pic"
             :url="dialogData.pic"