jiangping
2024-05-10 753244324eb25da1648de79a4b2b1df3d1a3d49c
admin/src/components/common/UploadImage.vue
@@ -33,15 +33,15 @@
        </span>
      </div>
    </el-upload>
    <el-image-viewer
      v-if="showViewer"
    <el-image-viewer
      v-if="showViewer"
      :on-close="closeViewer"
      :initialIndex="tempIndex"
      :url-list="srcList"
      :z-index="3000"
    />
  </div>
</template>
<script>
@@ -59,8 +59,8 @@
  },
  data() {
    return {
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadLocal',
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadLocal',
      realList: [],
      srcList: [],
      tempIndex: 0,
@@ -76,20 +76,20 @@
          this.srcList = []
        }
      }
    }
  },
  methods: {
    beforeUpload(file) {
      this.$emit('beginUpload')
      return true
    },
     // 上传图片成功
     uploadSuccess (res, file, fileList) {
     uploadSuccess (res, file, fileList) {
      // console.log('this.fileList', this.fileList);
      // console.log('fileList', fileList);
      this.$emit('endUpload')
      this.$emit('uploadEnd')
      this.realList = fileList
      this.srcList.push(res.data.url)
      // console.log('file', file);
@@ -106,7 +106,7 @@
      }
    },
    fail (err, file, fileList) {
      this.$emit('endUpload')
      this.$emit('uploadEnd')
      this.$message.error('上传失败')
    },
    handlePictureCardPreview(file) {
@@ -127,7 +127,7 @@
      this.realList.splice(tempIndex, 1)
      this.fileList.splice(tempIndex, 1)
      this.srcList.splice(tempIndex, 1)
    },
  },
}