Browse Source

优化

wulanhaote
liuminjian 3 years ago
parent
commit
44cf2a4326
1 changed files with 161 additions and 131 deletions
  1. +161
    -131
      src/views/homestead/index.vue

+ 161
- 131
src/views/homestead/index.vue View File

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

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

});
coordinatesUpdateGeo(this.tGeoOrganization).then((res) => {});
} }
}); });
}) })
@@ -1591,7 +1587,7 @@ export default {
.then(() => { .then(() => {
// on confirm // on confirm
//landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ this.landInfoList.frontland; //landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ this.landInfoList.frontland;
console.log("修改农地"+landInfoList.frontland)
console.log("修改农地" + landInfoList.frontland);
landEdit(landInfoList).then((res) => { landEdit(landInfoList).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.landHomesteadEditVisbileFun("hide"); this.landHomesteadEditVisbileFun("hide");
@@ -3253,79 +3249,95 @@ export default {
// }, // },
nfAddimgonReadHistory(file) { nfAddimgonReadHistory(file) {
// 创建Canvas对象(画布) // 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔) // 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象 // 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据) // 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => { 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(); 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 //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) { nfAddimgonReadNow(file) {
// 创建Canvas对象(画布) // 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔) // 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象 // 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据) // 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => { 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(); 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) { // ndAddimgonRead(file) {
@@ -3338,77 +3350,93 @@ export default {
// }, // },
ndAddimgonReadHistory(file) { ndAddimgonReadHistory(file) {
// 创建Canvas对象(画布) // 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔) // 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象 // 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据) // 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => { 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(); 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) { ndAddimgonReadNow(file) {
// 创建Canvas对象(画布) // 创建Canvas对象(画布)
let canvas = document.createElement('canvas')
let canvas = document.createElement("canvas");
// 获取对应的CanvasRenderingContext2D对象(画笔) // 获取对应的CanvasRenderingContext2D对象(画笔)
let context = canvas.getContext('2d')
let context = canvas.getContext("2d");
// 创建新的图片对象 // 创建新的图片对象
let img = new Image()
let img = new Image();
// 指定图片的DataURL(图片的base64编码数据) // 指定图片的DataURL(图片的base64编码数据)
img.src = file.content
img.src = file.content;
img.onload = () => { 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(); 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 { .uploadPictures_block {
flex: 0 0 160px; flex: 0 0 160px;
max-height: 160px;
display: flex; display: flex;
max-width: 90%; max-width: 90%;
.statusQuo { .statusQuo {
flex: 1; flex: 1;
display: flex; display: flex;

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


Loading…
Cancel
Save