1
jhzh
2024-11-29 8affe5beedfcd9f6fbf4826ec1a7f9ce0718a9d3
1
1 files modified
20 ■■■■■ changed files
src/page/authentication/index.vue 20 ●●●●● patch | view | raw | blame | history
src/page/authentication/index.vue
@@ -206,11 +206,26 @@
    }
  },
  methods: {
    checkImageFormat(url) {
      const img = new Image();
      img.onload = function() {
        console.log('图片加载成功,格式正确');
      };
      img.onerror = function() {
        console.log('图片加载失败,格式不支持');
      };
      img.src = url;
    },
    handleAvatarSuccess(res, file) {
      this.imgStatus = false;
      this.form.img1key = res.data.url;
    },
    beforeAvatarUpload(file) {
      const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
      if (!isJpgOrPng) {
        this.$message.error('只能上传 JPG 或 PNG 格式的图片!');
      }
      return isJpgOrPng;
      this.imgStatus = true;
    },
    handleError() {
@@ -221,6 +236,11 @@
      this.form.img2key = res.data.url; // URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload2(file) {
      const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
            if (!isJpgOrPng) {
              this.$message.error('Only images in JPG or PNG format can be uploaded!');
            }
            return isJpgOrPng;
      this.imgStatus2 = true;
      const isLt10M = file.size / 1024 / 1024 < 10;
      if (!isLt10M) {