|
|
@@ -954,6 +954,8 @@ import { |
|
|
|
currentLocation, |
|
|
|
coordinatesUpdateGeo, |
|
|
|
} from "@/api/homestead/index"; |
|
|
|
import {uploadFileBase} from "../../api/authenticRight"; |
|
|
|
import request from '@/utils/request' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "homesteadLogin", |
|
|
@@ -1397,6 +1399,8 @@ export default { |
|
|
|
.then(() => { |
|
|
|
// on confirm |
|
|
|
houseInfoList.theGeom ="["+houseInfoList.theGeom+"]" |
|
|
|
//houseInfoList.frontHouse = location.protocol+"//"+location.host+request.defaults.baseURL+ this.houseInfoList.frontHouse; |
|
|
|
//console.log("地址"+houseInfoList.frontHouse); |
|
|
|
houseAdd(houseInfoList).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.landHomesteadEditVisbileFun("hide"); |
|
|
@@ -1432,6 +1436,7 @@ export default { |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
// on confirm |
|
|
|
//houseInfoList.frontHouse = location.protocol+"//"+location.host+request.defaults.baseURL+ this.houseInfoList.frontHouse; |
|
|
|
houseEdit(houseInfoList).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.landHomesteadEditVisbileFun("hide"); |
|
|
@@ -1509,6 +1514,8 @@ export default { |
|
|
|
.then(() => { |
|
|
|
// on confirm |
|
|
|
landInfoList.theGeom ="["+landInfoList.theGeom+"]" |
|
|
|
//landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ this.landInfoList.frontland; |
|
|
|
//console.log("修改新增"+landInfoList.frontland) |
|
|
|
landAdd(landInfoList).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.landHomesteadEditVisbileFun("hide"); |
|
|
@@ -1551,6 +1558,8 @@ export default { |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
// on confirm |
|
|
|
//landInfoList.frontland = location.protocol+"//"+location.host+request.defaults.baseURL+ this.landInfoList.frontland; |
|
|
|
console.log("修改农地"+landInfoList.frontland) |
|
|
|
landEdit(landInfoList).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.landHomesteadEditVisbileFun("hide"); |
|
|
@@ -3196,21 +3205,97 @@ export default { |
|
|
|
this.landInfoList.sfylzyx = value; |
|
|
|
}, |
|
|
|
//农房 -- 新建 上传图片方法 |
|
|
|
// nfAddimgonRead(file) { |
|
|
|
// var formData = new FormData(); //构造一个 FormData,把后台需要发送的参数添加 |
|
|
|
// formData.append("file", file.file); //接口需要传的参数 |
|
|
|
// console.log(formData); |
|
|
|
// commonUpload(formData).then((res) => { |
|
|
|
// this.houseInfoList.frontHouse = res.url; |
|
|
|
// }); |
|
|
|
// }, |
|
|
|
nfAddimgonRead(file) { |
|
|
|
var formData = new FormData(); //构造一个 FormData,把后台需要发送的参数添加 |
|
|
|
formData.append("file", file.file); //接口需要传的参数 |
|
|
|
console.log(formData); |
|
|
|
commonUpload(formData).then((res) => { |
|
|
|
this.houseInfoList.frontHouse = res.url; |
|
|
|
}); |
|
|
|
// 创建Canvas对象(画布) |
|
|
|
let canvas = document.createElement('canvas') |
|
|
|
// 获取对应的CanvasRenderingContext2D对象(画笔) |
|
|
|
let context = canvas.getContext('2d') |
|
|
|
// 创建新的图片对象 |
|
|
|
let img = new Image() |
|
|
|
// 指定图片的DataURL(图片的base64编码数据) |
|
|
|
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 data2 = new FormData(); |
|
|
|
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; |
|
|
|
}else{ |
|
|
|
return "图片上传失败" |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
//农地 -- 新建 上传图片方法 |
|
|
|
// ndAddimgonRead(file) { |
|
|
|
// var formData = new FormData(); //构造一个 FormData,把后台需要发送的参数添加 |
|
|
|
// formData.append("file", file.file); //接口需要传的参数 |
|
|
|
// commonUpload(formData).then((res) => { |
|
|
|
// this.landInfoList.frontland = res.url; |
|
|
|
// console.log(this.landInfoList.frontland); |
|
|
|
// }); |
|
|
|
// }, |
|
|
|
ndAddimgonRead(file) { |
|
|
|
var formData = new FormData(); //构造一个 FormData,把后台需要发送的参数添加 |
|
|
|
formData.append("file", file.file); //接口需要传的参数 |
|
|
|
commonUpload(formData).then((res) => { |
|
|
|
this.landInfoList.frontland = res.url; |
|
|
|
}); |
|
|
|
// 创建Canvas对象(画布) |
|
|
|
let canvas = document.createElement('canvas') |
|
|
|
// 获取对应的CanvasRenderingContext2D对象(画笔) |
|
|
|
let context = canvas.getContext('2d') |
|
|
|
// 创建新的图片对象 |
|
|
|
let img = new Image() |
|
|
|
// 指定图片的DataURL(图片的base64编码数据) |
|
|
|
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 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 "图片上传失败" |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|