|
@@ -92,7 +92,7 @@ export default {
|
|
|
var maxSize = 0.5 * 1024; // 4M
|
|
|
var fileSize = file.size / 1024; //kb 图片大小
|
|
|
var uploadSrc;
|
|
|
- var uploadFile;
|
|
|
+ var uploadFile,imgWidth=image.width,imgHeight=image.height;
|
|
|
// console.log(fileSize,'大小')
|
|
|
if (fileSize > maxSize) { // 如果图片大小大于4m,进行压缩
|
|
|
uploadSrc = canvas.toDataURL(file.type, 0.1);
|
|
@@ -112,7 +112,7 @@ export default {
|
|
|
that.$set(that.imgs, key, uploadSrc);
|
|
|
that.imgLen++;
|
|
|
// 将图片信息存到store
|
|
|
- that.$store.commit('setImgFile', { type: that.moduleType, pId: that.item.id, key: key, file: uploadFile })
|
|
|
+ that.$store.commit('setImgFile', { type: that.moduleType, pId: that.item.id, key: key, file: uploadFile,imgWidth:imgWidth, imgHeight:imgHeight})
|
|
|
that.$store.commit('setImgSrc', { key: key, src: uploadSrc, type: that.moduleType })
|
|
|
that.$previewRefresh(); //异步获取的图片需要刷新下
|
|
|
}
|