Ver código fonte

优化

wulanhaote
liuminjian 3 anos atrás
pai
commit
44cf2a4326
1 arquivos alterados com 161 adições e 131 exclusões
  1. +161
    -131
      src/views/homestead/index.vue

+ 161
- 131
src/views/homestead/index.vue Ver arquivo

@@ -976,8 +976,8 @@ import {
currentLocation,
coordinatesUpdateGeo,
} from "@/api/homestead/index";
import {uploadFileBase} from "../../api/authenticRight";
import request from '@/utils/request'
import { uploadFileBase } from "../../api/authenticRight";
import request from "@/utils/request";

export default {
name: "homesteadLogin",
@@ -1001,8 +1001,8 @@ export default {
value: "value",
children: "children",
},
tGeoOrganization:{
orgCode: ""
tGeoOrganization: {
orgCode: "",
},
// 待租列表显示
ishcBotton: false,
@@ -1124,13 +1124,13 @@ export default {
//农房上传图片附件
//nfAddfileList: [],
//农房上传历史图片
nfAddfileListHistory:[],
nfAddfileListHistory: [],
//农房上传现状图片
nfAddfileListNow:[],
nfAddfileListNow: [],
//农地上传图片附件
//ndAddfileList: [],
ndAddfileListHistory:[],
ndAddfileListNow:[],
ndAddfileListHistory: [],
ndAddfileListNow: [],
// 当前是否地图点击状态
hasTable: false,
//查看农地\农房 显隐
@@ -1426,10 +1426,10 @@ export default {
})
.then(() => {
// on confirm
houseInfoList.theGeom ="["+houseInfoList.theGeom+"]"
houseInfoList.theGeom = "[" + houseInfoList.theGeom + "]";
//houseInfoList.frontHouse = location.protocol+"//"+location.host+request.defaults.baseURL+ this.houseInfoList.frontHouse;
console.log("地址"+houseInfoList.frontHouse);
console.log("地址"+houseInfoList.behindHouse);
console.log("地址" + houseInfoList.frontHouse);
console.log("地址" + houseInfoList.behindHouse);
houseAdd(houseInfoList).then((res) => {
if (res.code == 200) {
this.landHomesteadEditVisbileFun("hide");
@@ -1448,9 +1448,7 @@ export default {
// })
this.switchLoad();
this.tGeoOrganization.orgCode = houseInfoList.orgCode;
coordinatesUpdateGeo(this.tGeoOrganization).then((res) => {

});
coordinatesUpdateGeo(this.tGeoOrganization).then((res) => {});
}
});
})
@@ -1466,9 +1464,9 @@ export default {
.then(() => {
// on confirm
//houseInfoList.frontHouse = location.protocol+"//"+location.host+request.defaults.baseURL+ this.houseInfoList.frontHouse;
console.log("修改地址"+houseInfoList.frontHouse);
houseInfoList.behindHouse =this.houseInfoList.behindHouse;
console.log("修改地址"+houseInfoList.behindHouse);
console.log("修改地址" + houseInfoList.frontHouse);
houseInfoList.behindHouse = this.houseInfoList.behindHouse;
console.log("修改地址" + houseInfoList.behindHouse);
houseEdit(houseInfoList).then((res) => {
if (res.code == 200) {
this.landHomesteadEditVisbileFun("hide");
@@ -1545,7 +1543,7 @@ export default {
})
.then(() => {
// on confirm
landInfoList.theGeom ="["+landInfoList.theGeom+"]"
landInfoList.theGeom = "[" + landInfoList.theGeom + "]";
//landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ this.landInfoList.frontland;
//console.log("修改新增"+landInfoList.frontland)
landAdd(landInfoList).then((res) => {
@@ -1573,9 +1571,7 @@ export default {
//列表更新
this.switchLoad();
this.tGeoOrganization.orgCode = landInfoList.orgCode;
coordinatesUpdateGeo(this.tGeoOrganization).then((res) => {

});
coordinatesUpdateGeo(this.tGeoOrganization).then((res) => {});
}
});
})
@@ -1591,7 +1587,7 @@ export default {
.then(() => {
// on confirm
//landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ this.landInfoList.frontland;
console.log("修改农地"+landInfoList.frontland)
console.log("修改农地" + landInfoList.frontland);
landEdit(landInfoList).then((res) => {
if (res.code == 200) {
this.landHomesteadEditVisbileFun("hide");
@@ -3253,79 +3249,95 @@ export default {
// },
nfAddimgonReadHistory(file) {
// 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => {
const h = img.height
const w = img.width
let ch = img.height/4
let cw = img.width/4
let canvas = document.createElement('canvas')
let ctx = canvas.getContext('2d')
canvas.height = ch
canvas.width = cw
ctx.clearRect(0,0,cw,ch)
ctx.drawImage(img,0,0,cw,ch)
let base_img = canvas.toDataURL('image/jpeg')
const blobBin = atob(base_img.split(',')[1])
let d = []
for (let i=0;i<blobBin.length;i++){
d.push(blobBin.charCodeAt(i))
const h = img.height;
const w = img.width;
let ch = img.height / 4;
let cw = img.width / 4;
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
canvas.height = ch;
canvas.width = cw;
ctx.clearRect(0, 0, cw, ch);
ctx.drawImage(img, 0, 0, cw, ch);
let base_img = canvas.toDataURL("image/jpeg");
const blobBin = atob(base_img.split(",")[1]);
let d = [];
for (let i = 0; i < blobBin.length; i++) {
d.push(blobBin.charCodeAt(i));
}
const data2 = new FormData();
data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
uploadFileBase(data2).then(res => {
data2.append(
"file",
new Blob([new Uint8Array(d)], { type: "image/jpeg" })
);
uploadFileBase(data2).then((res) => {
//this.houseInfoList.frontHouse =res.fileName
if(res.code ==200){
this.houseInfoList.frontHouse = location.protocol+"//"+location.host+request.defaults.baseURL+ res.fileName;
console.log("历史"+this.houseInfoList.frontHouse);
}else{
return "图片上传失败"
if (res.code == 200) {
this.houseInfoList.frontHouse =
location.protocol +
"//" +
location.host +
request.defaults.baseURL +
res.fileName;
console.log("历史" + this.houseInfoList.frontHouse);
} else {
return "图片上传失败";
}
})
}
});
};
},
nfAddimgonReadNow(file) {
// 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => {
const h = img.height
const w = img.width
let ch = img.height/4
let cw = img.width/4
let canvas = document.createElement('canvas')
let ctx = canvas.getContext('2d')
canvas.height = ch
canvas.width = cw
ctx.clearRect(0,0,cw,ch)
ctx.drawImage(img,0,0,cw,ch)
let base_img = canvas.toDataURL('image/jpeg')
const blobBin = atob(base_img.split(',')[1])
let d = []
for (let i=0;i<blobBin.length;i++){
d.push(blobBin.charCodeAt(i))
const h = img.height;
const w = img.width;
let ch = img.height / 4;
let cw = img.width / 4;
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
canvas.height = ch;
canvas.width = cw;
ctx.clearRect(0, 0, cw, ch);
ctx.drawImage(img, 0, 0, cw, ch);
let base_img = canvas.toDataURL("image/jpeg");
const blobBin = atob(base_img.split(",")[1]);
let d = [];
for (let i = 0; i < blobBin.length; i++) {
d.push(blobBin.charCodeAt(i));
}
const data2 = new FormData();
data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
uploadFileBase(data2).then(res => {
if(res.code ==200){
this.houseInfoList.behindHouse = location.protocol+"//"+location.host+request.defaults.baseURL+ res.fileName;
}else{
return "图片上传失败"
data2.append(
"file",
new Blob([new Uint8Array(d)], { type: "image/jpeg" })
);
uploadFileBase(data2).then((res) => {
if (res.code == 200) {
this.houseInfoList.behindHouse =
location.protocol +
"//" +
location.host +
request.defaults.baseURL +
res.fileName;
} else {
return "图片上传失败";
}
})
}
});
};
},
//农地 -- 新建 上传图片方法
// ndAddimgonRead(file) {
@@ -3338,77 +3350,93 @@ export default {
// },
ndAddimgonReadHistory(file) {
// 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => {
const h = img.height
const w = img.width
let ch = img.height/4
let cw = img.width/4
let canvas = document.createElement('canvas')
let ctx = canvas.getContext('2d')
canvas.height = ch
canvas.width = cw
ctx.clearRect(0,0,cw,ch)
ctx.drawImage(img,0,0,cw,ch)
let base_img = canvas.toDataURL('image/jpeg')
const blobBin = atob(base_img.split(',')[1])
let d = []
for (let i=0;i<blobBin.length;i++){
d.push(blobBin.charCodeAt(i))
const h = img.height;
const w = img.width;
let ch = img.height / 4;
let cw = img.width / 4;
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
canvas.height = ch;
canvas.width = cw;
ctx.clearRect(0, 0, cw, ch);
ctx.drawImage(img, 0, 0, cw, ch);
let base_img = canvas.toDataURL("image/jpeg");
const blobBin = atob(base_img.split(",")[1]);
let d = [];
for (let i = 0; i < blobBin.length; i++) {
d.push(blobBin.charCodeAt(i));
}
const data2 = new FormData();
data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
uploadFileBase(data2).then(res => {
if(res.code ==200){
this.landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ res.fileName;
}else{
return "图片上传失败"
data2.append(
"file",
new Blob([new Uint8Array(d)], { type: "image/jpeg" })
);
uploadFileBase(data2).then((res) => {
if (res.code == 200) {
this.landInfoList.frontland =
location.protocol +
"//" +
location.host +
request.defaults.baseURL +
res.fileName;
} else {
return "图片上传失败";
}
})
}
});
};
},
ndAddimgonReadNow(file) {
// 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => {
const h = img.height
const w = img.width
let ch = img.height/4
let cw = img.width/4
let canvas = document.createElement('canvas')
let ctx = canvas.getContext('2d')
canvas.height = ch
canvas.width = cw
ctx.clearRect(0,0,cw,ch)
ctx.drawImage(img,0,0,cw,ch)
let base_img = canvas.toDataURL('image/jpeg')
const blobBin = atob(base_img.split(',')[1])
let d = []
for (let i=0;i<blobBin.length;i++){
d.push(blobBin.charCodeAt(i))
const h = img.height;
const w = img.width;
let ch = img.height / 4;
let cw = img.width / 4;
let canvas = document.createElement("canvas");
let ctx = canvas.getContext("2d");
canvas.height = ch;
canvas.width = cw;
ctx.clearRect(0, 0, cw, ch);
ctx.drawImage(img, 0, 0, cw, ch);
let base_img = canvas.toDataURL("image/jpeg");
const blobBin = atob(base_img.split(",")[1]);
let d = [];
for (let i = 0; i < blobBin.length; i++) {
d.push(blobBin.charCodeAt(i));
}
const data2 = new FormData();
data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
uploadFileBase(data2).then(res => {
if(res.code ==200){
this.landInfoList.behindland = location.protocol+"//"+location.host+request.defaults.baseURL+ res.fileName;
}else{
return "图片上传失败"
data2.append(
"file",
new Blob([new Uint8Array(d)], { type: "image/jpeg" })
);
uploadFileBase(data2).then((res) => {
if (res.code == 200) {
this.landInfoList.behindland =
location.protocol +
"//" +
location.host +
request.defaults.baseURL +
res.fileName;
} else {
return "图片上传失败";
}
})
}
});
};
},
},
};
@@ -4075,11 +4103,13 @@ export default {
}
.uploadPictures_block {
flex: 0 0 160px;
max-height: 160px;
display: flex;
max-width: 90%;
.statusQuo {
flex: 1;
display: flex;

&:first-child {
margin-right: 36px;
}


Carregando…
Cancelar
Salvar