MrShi
4 天以前 05aec1e9986fbe3e907259bb1a1396f129bd0fa1
admin/src/components/common/UploadFaceImg.vue
@@ -6,6 +6,7 @@
        :style="customStyle"
        action=""
        :auto-upload="false"
        :before-upload="beforeUpload"
        :show-file-list="false"
        :on-change='openUpdateIcon'>
      <img v-if=" file.imgurlfull" style="width: 100%;" :src="file.imgurlfull" :style="customStyle" class="avatar">
@@ -57,6 +58,10 @@
      type: String,
      default: 'width: 90px; height: 90px;'
    },
    size: {
      type: Number,
      default: () => 5
    },
    uploadData: Object
  },
  data () {
@@ -71,6 +76,14 @@
  },
  methods: {
    beforeUpload (file) {
      const isLt2M = file.size / 1024 / 1024 < this.size;
      if (!isLt2M) {
        this.$message.error(`上传图片大小不能超过${this.size}mb!`);
        return false
      }
      return true
    },
    uploadIcon () {
      // 获取裁剪后的图片
      this.$refs.iconShot.getImagecropper().getCropBlob((fileData) => { // 获取当前裁剪好的数据