jiangping
2024-10-21 1ae471941bbdf9dde5dba668d33acf415fc6ec07
admin/src/components/common/UploadAvatarImage.vue
@@ -2,7 +2,7 @@
  <div>
    <el-upload
      class="avatar-uploader"
      accept=".png,.jpg"
      accept=".png,.jpg,.jpeg"
      :style="customStyle"
      :action="uploadImgUrl"
      :data="uploadData"
@@ -30,13 +30,13 @@
    tipsLabel: '',
    customStyle: {
      type: String,
      default: 'width: 90px; height: 90px;'
      default: 'width: 90px; max-height: 90px;'
    },
    uploadData: Object
  },
  data() {
    return {
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload'
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/upload'
    }
  },
@@ -50,13 +50,13 @@
        this.$message.success('上传成功')
        this.$emit('uploadSuccess', { imgurl: data.imgaddr, imgurlfull: data.url, name: data.originname })
      } else {
        this.$tip.apiFailed('上传失败')
        this.$message.error('上传失败')
      }
      this.$emit('uploadEnd')
    },
    uploadError() {
      this.$tip.apiFailed('上传失败')
      this.$emit('endUpload')
      this.$message.error('上传失败')
      this.$emit('uploadEnd')
    },
    // // 拦截
    beforeAvatarUpload(file) {
@@ -92,8 +92,8 @@
  text-align: center;
}
.avatar {
  width: 100% !important;
  height: auto !important;
  width: 90px;
  max-height: 90px;
  display: block;
}
.tips-style {