WXL
2024-07-18 b09476a8669551619c1f8b57158c064b13499437
src/components/Regular/index.vue
@@ -150,6 +150,27 @@
          >
        </div>
      </el-form-item>
      <el-form-item label="选项文件" prop="sickness">
        <div style="width: 40vw">
          <el-upload
            class="upload-demo"
            :action="uploadImgUrl"
            :headers="headers"
            :accept="'image/*,video/*'"
            :on-success="handleChange.bind(this, item)"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
          <div style="margin: 20px">
            <el-image
              style="width: 100px; height: 100px"
              :src="item.picturePath"
              :preview-src-list="[...item.picturePath]"
            >
            </el-image>
          </div>
        </div>
      </el-form-item>
      <el-row :gutter="10">
        <el-col :span="16" v-if="intent">
@@ -205,6 +226,7 @@
<script>
import store from "@/store";
import { getToken } from "@/utils/auth";
export default {
  data() {
@@ -217,6 +239,10 @@
          url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
        },
      ],
      headers: {
        Authorization: "Bearer " + getToken(),
      },
      uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/uploadSort",
      whether: 1, //1为关键词,2为否定关键词
      inputValue: "",
      inputVisible: false,
@@ -364,6 +390,13 @@
      console.log(this.TargetoptionList);
      this.$emit("handleSelectionChange", selection);
    },
    // 选项文件上传
    handleChange(item, response, file, fileList) {
      let index = this.TargetoptionList.findIndex(
        (obj) => obj.id == item.id && obj.name == item.name
      );
      this.TargetoptionList[index].picturePath = response.url;
    },
  },
};
</script>