async uploadImg(file) {
   let formData= new FormData();
   formData.append("photo", file);
   const { data: data } = await uploadProductPicture(formData);
   console.log(data);
   this.imgName.push(data);
 },




async updateGood(state) {
      for (let i = 0; i < this.file.length; i++) {
      //MVP: await
        await this.uploadImg(this.file[i]);
      }
      console.log(this.oldPhoto.concat(this.imgName));
      const res = await updateBasicsProduct({
        id: this.goodId,
        name: this.newName,
        schoolId: this.newSchool,
        areaId: this.newArea,
        photos: this.oldPhoto.concat(this.imgName)
      });
      // console.log(res);
      if (res.code === 200) {
        this.$Message["success"]({
          background: true,
          content: "修改成功"
        });
        this.$router.push("/goods");
      }
    }
Logo

前往低代码交流专区

更多推荐