imgChange() {
if (event.target.files.length == 0) {
return;
} else {
let that = this;
var mapPictureSize = [];
let file = event.target.files[0];
var reader = new FileReader;
reader.onload = function (evt) {
var image = new Image();
image.onload = function () {
mapPictureSize[0] = this.width + "";
mapPictureSize[1] = this.height + "";
console.log(mapPictureSize);
let size = 500 * 1024;
if (file.size > size) {
that.$refs.imgupload.value = '';
return that.uploadStatus = true;
}
if (mapPictureSize[0] != 800 && mapPictureSize[1] != 600) {
that.$refs.imgupload.value = '';
return that.uploadStatus = true;
}
that.uploadStatus = false;
let fromdata = new FormData();
fromdata.append('files', file);
uploadFile(fromdata).then((res) => {
that.info.coverUrl = res.result[0].fileId;
})
that.$refs.imgupload.value = '';
};
image.src = evt.target.result;
};
reader.readAsDataURL(file);
}
}