|
@@ -1020,31 +1020,38 @@
|
|
},
|
|
},
|
|
//上传
|
|
//上传
|
|
handleAvatarSuccess(res, file, type) {
|
|
handleAvatarSuccess(res, file, type) {
|
|
|
|
+ console.log('上传图片')
|
|
// console.log('res',res);
|
|
// console.log('res',res);
|
|
// console.log('file',file);
|
|
// console.log('file',file);
|
|
// console.log('type',type);
|
|
// console.log('type',type);
|
|
- if(res){
|
|
|
|
- this.loadingInstance.close();
|
|
|
|
- if(res.data){
|
|
|
|
- if(res.data.url){
|
|
|
|
- this.$set(this,'mapSrc',res.data.url)
|
|
|
|
- if (type == 1){
|
|
|
|
|
|
+ if (type == 1){
|
|
|
|
+ if(res){
|
|
|
|
+ this.loadingInstance.close();
|
|
|
|
+ if(res.data){
|
|
|
|
+ if(res.data.url){
|
|
|
|
+ this.$set(this,'mapSrc',res.data.url)
|
|
this.$set(this, 'shadeBoxType', 1);
|
|
this.$set(this, 'shadeBoxType', 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }else if(type == 2){
|
|
|
|
+
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeAvatarUpload(file) {
|
|
beforeAvatarUpload(file) {
|
|
|
|
+ console.log('校验图片')
|
|
if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
|
|
if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
|
|
this.asyncImgChecked(file).then(data => {
|
|
this.asyncImgChecked(file).then(data => {
|
|
- if (data) {
|
|
|
|
|
|
+ if (data.code == 200) {
|
|
// console.log('data',data);
|
|
// console.log('data',data);
|
|
this.loadingInstance = Loading.service({ spinner:"", background: 'rgba(255, 255, 255, 0.1)' })
|
|
this.loadingInstance = Loading.service({ spinner:"", background: 'rgba(255, 255, 255, 0.1)' })
|
|
return true;
|
|
return true;
|
|
- } else {
|
|
|
|
|
|
+ } else if(data.code == 201){
|
|
this.$message.error('图片尺寸不能大于于1500 X 1000')
|
|
this.$message.error('图片尺寸不能大于于1500 X 1000')
|
|
return false;
|
|
return false;
|
|
|
|
+ } else if(data.code == 202){
|
|
|
|
+ this.$message.error('图片尺寸小于当前布局尺寸')
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}else{
|
|
}else{
|
|
@@ -1065,14 +1072,34 @@
|
|
image.onload = _=>{
|
|
image.onload = _=>{
|
|
let width = image.width
|
|
let width = image.width
|
|
let height= image.height
|
|
let height= image.height
|
|
|
|
+
|
|
|
|
+ let maxWidth = 0
|
|
|
|
+ let maxHeight = 0
|
|
|
|
+ let upImgType = false
|
|
|
|
+ for(let i=0;i<self.mapList.length;i++){
|
|
|
|
+ if ((self.mapList[i].x + self.mapList[i].w) > maxWidth) {
|
|
|
|
+ maxWidth = self.mapList[i].x + self.mapList[i].w
|
|
|
|
+ }
|
|
|
|
+ if ((self.mapList[i].y + self.mapList[i].h) > maxHeight) {
|
|
|
|
+ maxHeight = self.mapList[i].y + self.mapList[i].h
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(maxWidth>width||maxHeight>height){
|
|
|
|
+ upImgType = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
if(width >1500 || height > 1000){
|
|
if(width >1500 || height > 1000){
|
|
- resolve(false)
|
|
|
|
|
|
+ //超出限制
|
|
|
|
+ resolve({code:201})
|
|
|
|
+ }else if(upImgType){
|
|
|
|
+ //超出当前布局尺寸
|
|
|
|
+ resolve({code:202})
|
|
}else{
|
|
}else{
|
|
self.$set(self,'layerWidth',width);
|
|
self.$set(self,'layerWidth',width);
|
|
self.$set(self,'layerHeight',height);
|
|
self.$set(self,'layerHeight',height);
|
|
self.$set(self,'maxWidth',width);
|
|
self.$set(self,'maxWidth',width);
|
|
self.$set(self,'maxHeight',height);
|
|
self.$set(self,'maxHeight',height);
|
|
- resolve(true)
|
|
|
|
|
|
+ resolve({code:200})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|