|
|
|
@ -1,6 +1,20 @@
|
|
|
|
|
// pages/look/look.js
|
|
|
|
|
const $api = require('../../utils/gisApi').API; |
|
|
|
|
const WKT = require('../../utils/terraformer-wkt-parser.min'); |
|
|
|
|
const gisUtil = require('../../utils/gitUtil') |
|
|
|
|
|
|
|
|
|
const global = {};
|
|
|
|
|
//年份范围
|
|
|
|
|
const date = new Date(); |
|
|
|
|
const year = date.getFullYear(); |
|
|
|
|
const yearSpan=3; |
|
|
|
|
const max = year + yearSpan; |
|
|
|
|
const min = 1949; |
|
|
|
|
const arryList =[]; |
|
|
|
|
for(let idx=min;idx < max;idx++){
|
|
|
|
|
arryList.push({index:idx-min,value:idx,label:''+idx+'年' }); |
|
|
|
|
} ; |
|
|
|
|
|
|
|
|
|
Page({ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -11,6 +25,10 @@ Page({
|
|
|
|
|
scale: 13, |
|
|
|
|
latitude: 29.543812, |
|
|
|
|
longitude: 106.434042, |
|
|
|
|
centerLocation:{
|
|
|
|
|
latitude: 29.543812, |
|
|
|
|
longitude: 106.434042, |
|
|
|
|
}, |
|
|
|
|
markers: [], |
|
|
|
|
circles:[], |
|
|
|
|
polygons: [], |
|
|
|
@ -49,9 +67,106 @@ Page({
|
|
|
|
|
id: 9, |
|
|
|
|
name: '小组团', |
|
|
|
|
state: false |
|
|
|
|
}] |
|
|
|
|
}], |
|
|
|
|
halfScreenDialogVisible: false,
|
|
|
|
|
dialogVisible: false, |
|
|
|
|
buttons: [{text: '取消'}, {text: '详情'}],
|
|
|
|
|
titleLand:'G01-XXXXXXXXXXX02',
|
|
|
|
|
totalConsArea:'42356', |
|
|
|
|
startingFloorPrice:'45852', |
|
|
|
|
transferPrice:'12553', |
|
|
|
|
auctionDate:'2021-07-18',
|
|
|
|
|
years:arryList, |
|
|
|
|
indexStart:0, |
|
|
|
|
indexEnd:0, |
|
|
|
|
}, |
|
|
|
|
bindPickerChangeStart(e){
|
|
|
|
|
let sIdx =Number(e.detail.value); |
|
|
|
|
if(sIdx>this.data.indexEnd){ |
|
|
|
|
sIdx=this.data.indexEnd; |
|
|
|
|
} |
|
|
|
|
this.setData({ |
|
|
|
|
start:arryList[sIdx].value,
|
|
|
|
|
indexStart:sIdx |
|
|
|
|
}) |
|
|
|
|
},
|
|
|
|
|
bindPickerChangeEnd(e){
|
|
|
|
|
let eIdx =Number(e.detail.value); |
|
|
|
|
if(eIdx<this.data.indexStart){ |
|
|
|
|
eIdx=this.data.indexStart; |
|
|
|
|
} |
|
|
|
|
this.setData({
|
|
|
|
|
end:arryList[eIdx].value, |
|
|
|
|
indexEnd:eIdx, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
openLandInfo(feature) { |
|
|
|
|
this.setData({ |
|
|
|
|
dialogVisible: true,
|
|
|
|
|
}); |
|
|
|
|
global.selectFeature=feature; |
|
|
|
|
// console.log(feature)
|
|
|
|
|
//tid 代表地块类型,1:已出让,2:挂牌中;3:拟挂牌。
|
|
|
|
|
let tid = feature.tid;//tid:1,2,3
|
|
|
|
|
//属性property 包含 地块id字段,按需使用。
|
|
|
|
|
let property =feature.properties;
|
|
|
|
|
//添加---接口对接---获取地块数据------以下全部替换
|
|
|
|
|
console.log('添加---接口对接---获取地块数据------以下全部替换') |
|
|
|
|
//变量 tid 代表地块类型,1:已出让,2:挂牌中;3:拟挂牌。
|
|
|
|
|
//变量 property 包含 地块id字段,按需使用。
|
|
|
|
|
console.log(property); |
|
|
|
|
this.setData({ |
|
|
|
|
titleLand:'G01-XXXXXXXXXXX03',
|
|
|
|
|
totalConsArea:'68749', |
|
|
|
|
startingFloorPrice:'25784', |
|
|
|
|
transferPrice:'23546', |
|
|
|
|
auctionDate:'2021-07-20', |
|
|
|
|
}); |
|
|
|
|
//---------------------------------------
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
showLayerSetting() { |
|
|
|
|
this.setData({ |
|
|
|
|
halfScreenDialogVisible: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
closeLayerSetting(e){ |
|
|
|
|
this.setData({ |
|
|
|
|
halfScreenDialogVisible: false |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
tapDialogButton(e) { |
|
|
|
|
let index = e.detail.index; |
|
|
|
|
if(index===0){ |
|
|
|
|
this.setData({ |
|
|
|
|
dialogVisible: false, |
|
|
|
|
titleLand:'',
|
|
|
|
|
totalConsArea:'', |
|
|
|
|
startingFloorPrice:'', |
|
|
|
|
transferPrice:'', |
|
|
|
|
auctionDate:'', |
|
|
|
|
}) ; |
|
|
|
|
global.selectFeature = null; |
|
|
|
|
} |
|
|
|
|
else{
|
|
|
|
|
console.log('跳转到地块详情页面') |
|
|
|
|
//跳转到地块详情页面
|
|
|
|
|
this.navigateToLandDetail(1) |
|
|
|
|
} |
|
|
|
|
},
|
|
|
|
|
//跳转到地块详情页面
|
|
|
|
|
navigateToLandDetail(id){ |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: '/pages/look-detail/look-detail?active=1', |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// closeDialog: function () {
|
|
|
|
|
// let qdDialog = this.data.qdDialog;
|
|
|
|
|
// qdDialog.show = false;
|
|
|
|
|
// qdDialog.buttons = [];
|
|
|
|
|
// this.setData({ qdDialog: qdDialog })
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
comeList() { |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: '/pages/look-list/look-list', |
|
|
|
@ -77,8 +192,8 @@ Page({
|
|
|
|
|
let { |
|
|
|
|
latitude, |
|
|
|
|
longitude, |
|
|
|
|
actives |
|
|
|
|
} = this.data; |
|
|
|
|
} = this.data.centerLocation; |
|
|
|
|
let {actives} = this.data; |
|
|
|
|
let state = false; |
|
|
|
|
let hasAc = actives.some(item => item === id); |
|
|
|
|
if (hasAc) { |
|
|
|
@ -100,6 +215,7 @@ Page({
|
|
|
|
|
// 已出让
|
|
|
|
|
if (state) { |
|
|
|
|
this.deletPolygon(id); |
|
|
|
|
this.removeFeaturesToList(id); |
|
|
|
|
} else { |
|
|
|
|
this.inWhich({ |
|
|
|
|
latitude, |
|
|
|
@ -111,6 +227,7 @@ Page({
|
|
|
|
|
// 挂牌中
|
|
|
|
|
if (state) { |
|
|
|
|
this.deletPolygon(id); |
|
|
|
|
this.removeFeaturesToList(id); |
|
|
|
|
} else { |
|
|
|
|
this.inQuotation({ |
|
|
|
|
latitude, |
|
|
|
@ -122,6 +239,7 @@ Page({
|
|
|
|
|
// 待挂牌
|
|
|
|
|
if (state) { |
|
|
|
|
this.deletPolygon(id); |
|
|
|
|
this.removeFeaturesToList(id); |
|
|
|
|
} else { |
|
|
|
|
this.toBelisted({ |
|
|
|
|
latitude, |
|
|
|
@ -191,16 +309,33 @@ Page({
|
|
|
|
|
this.clearCircles(id); |
|
|
|
|
} else { |
|
|
|
|
let data = [{ |
|
|
|
|
gid:1, |
|
|
|
|
latitude, |
|
|
|
|
longitude |
|
|
|
|
}]; |
|
|
|
|
console.log(data) |
|
|
|
|
}];
|
|
|
|
|
console.log(data); |
|
|
|
|
this.setCircles(data, id); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onMapTaped(e){ |
|
|
|
|
let that= this; |
|
|
|
|
let { |
|
|
|
|
latitude, |
|
|
|
|
longitude |
|
|
|
|
} = e.detail; |
|
|
|
|
let point = {latitude,longitude} // 地图点击点的经纬度
|
|
|
|
|
let features = that.selectFeatureList(point); |
|
|
|
|
console.log(features); |
|
|
|
|
if(features && features.length>0){ |
|
|
|
|
let f = features[0]; |
|
|
|
|
// console.log(f);
|
|
|
|
|
// console.log(f);
|
|
|
|
|
that.openLandInfo(f) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 清除地块
|
|
|
|
|
deletPolygon(id) { |
|
|
|
|
let { |
|
|
|
@ -234,8 +369,8 @@ Page({
|
|
|
|
|
latitude: item.lat, |
|
|
|
|
longitude: item.lon, |
|
|
|
|
iconPath, |
|
|
|
|
width: 40, |
|
|
|
|
height: 45, |
|
|
|
|
width: 12, |
|
|
|
|
height: 16, |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (markers.length > 0) { |
|
|
|
@ -259,13 +394,13 @@ Page({
|
|
|
|
|
index-- |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log('markers', markers); |
|
|
|
|
this.setData({ |
|
|
|
|
markers |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//设置圆环
|
|
|
|
|
setCircles(data, id) { |
|
|
|
|
let { |
|
|
|
@ -273,30 +408,27 @@ Page({
|
|
|
|
|
} = this.data |
|
|
|
|
|
|
|
|
|
let makeArr = data.map(item => { |
|
|
|
|
console.log('---') |
|
|
|
|
console.log(item) |
|
|
|
|
let { |
|
|
|
|
latitude, |
|
|
|
|
longitude |
|
|
|
|
}= item; |
|
|
|
|
return { |
|
|
|
|
id: item.gid, |
|
|
|
|
aid: id, |
|
|
|
|
latitude: item.latitude, |
|
|
|
|
longitude: item.longitude, |
|
|
|
|
latitude: latitude, |
|
|
|
|
longitude: longitude, |
|
|
|
|
color: '#2317da66', |
|
|
|
|
fillColor: '#7cb5ec88', |
|
|
|
|
radius: 3000, |
|
|
|
|
strokeWidth: 2
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (circles.length > 0) { |
|
|
|
|
circles = circles.concat(makeArr) |
|
|
|
|
console.log(circles) |
|
|
|
|
this.setData({ |
|
|
|
|
circles |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
circles = makeArr |
|
|
|
|
console.log(circles) |
|
|
|
|
this.setData({ |
|
|
|
|
circles |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
circles = makeArr;
|
|
|
|
|
this.setData({ |
|
|
|
|
circles |
|
|
|
|
}) |
|
|
|
|
},
|
|
|
|
|
//清除圆环
|
|
|
|
|
clearCircles(id) { |
|
|
|
@ -312,7 +444,6 @@ Page({
|
|
|
|
|
index-- |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log('circles', circles); |
|
|
|
|
this.setData({ |
|
|
|
|
circles |
|
|
|
|
}) |
|
|
|
@ -343,44 +474,96 @@ Page({
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
showCenterLocation(centerPoint){ |
|
|
|
|
let id = -1; |
|
|
|
|
let{ |
|
|
|
|
latitude, |
|
|
|
|
longitude,
|
|
|
|
|
}=centerPoint; |
|
|
|
|
this.clearPoint(id);
|
|
|
|
|
let { |
|
|
|
|
markers |
|
|
|
|
} = this.data |
|
|
|
|
let mark = { |
|
|
|
|
aid: id, |
|
|
|
|
id: id, |
|
|
|
|
latitude, |
|
|
|
|
longitude,
|
|
|
|
|
width: 16, |
|
|
|
|
height:24, |
|
|
|
|
} |
|
|
|
|
markers.push(mark) |
|
|
|
|
this.setData({ |
|
|
|
|
markers: markers |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//定位当前
|
|
|
|
|
scaleBack() { |
|
|
|
|
let that = this; |
|
|
|
|
wx.getLocation({ |
|
|
|
|
type: 'gcj02', |
|
|
|
|
success: function (res) { |
|
|
|
|
res = { |
|
|
|
|
latitude: 29.6267, |
|
|
|
|
longitude: 106.5682 |
|
|
|
|
}; //测试数据(发布时删除)
|
|
|
|
|
let latitude = res.latitude |
|
|
|
|
let longitude = res.longitude |
|
|
|
|
let { |
|
|
|
|
markers |
|
|
|
|
} = that.data |
|
|
|
|
let mark = { |
|
|
|
|
id: -1, |
|
|
|
|
latitude, |
|
|
|
|
longitude, |
|
|
|
|
} |
|
|
|
|
markers.push(mark) |
|
|
|
|
let latitude = Number(res.latitude) |
|
|
|
|
let longitude = Number(res.longitude) |
|
|
|
|
that.setData({ |
|
|
|
|
latitude: latitude, |
|
|
|
|
longitude: longitude, |
|
|
|
|
markers: markers |
|
|
|
|
}) |
|
|
|
|
centerLocation:{ |
|
|
|
|
latitude, |
|
|
|
|
longitude, |
|
|
|
|
}, |
|
|
|
|
})
|
|
|
|
|
that.showCenterLocation({latitude,longitude}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//点击MORE标记点
|
|
|
|
|
markertap(e) { |
|
|
|
|
let id = e.detail.markerId |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: '/pages/look-list/look-list?id=' + id, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
regionchange(e) {
|
|
|
|
|
if(e.type==='end'){ |
|
|
|
|
let { |
|
|
|
|
latitude, |
|
|
|
|
longitude |
|
|
|
|
} = e.detail.centerLocation;
|
|
|
|
|
this.data.longitude=longitude; |
|
|
|
|
this.data.longitude=longitude; |
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
centerLocation: e.detail.centerLocation |
|
|
|
|
}); |
|
|
|
|
let {actives} = this.data; |
|
|
|
|
let id9 = 9; |
|
|
|
|
let state9 = actives.some(item => item === id9);
|
|
|
|
|
if (state9) { |
|
|
|
|
this.clearCircles(id9); |
|
|
|
|
let data = [{ |
|
|
|
|
latitude, |
|
|
|
|
longitude |
|
|
|
|
}];
|
|
|
|
|
this.setCircles(data, id9); |
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.clearCircles(id9); |
|
|
|
|
} |
|
|
|
|
let id7 = 7; |
|
|
|
|
let state7= actives.some(item => item === id7);
|
|
|
|
|
if (state7) { |
|
|
|
|
this.clearPoint(id7); |
|
|
|
|
this.getComplete({ |
|
|
|
|
latitude, |
|
|
|
|
longitude |
|
|
|
|
}, id7); |
|
|
|
|
}
|
|
|
|
|
else { |
|
|
|
|
this.clearPoint(7); |
|
|
|
|
} |
|
|
|
|
//中心点--重绘
|
|
|
|
|
this.showCenterLocation({latitude,longitude}) |
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}, |
|
|
|
|
// 已出让
|
|
|
|
|
inWhich(res, id) { |
|
|
|
|
const that = this; |
|
|
|
@ -388,13 +571,14 @@ Page({
|
|
|
|
|
start, |
|
|
|
|
end |
|
|
|
|
} = this.data; |
|
|
|
|
$api.getLandListing({ |
|
|
|
|
$api.getLandList({ |
|
|
|
|
lon: res.longitude, |
|
|
|
|
lat: res.latitude, |
|
|
|
|
start: `${start}-01-01`, |
|
|
|
|
end: `${end}-01-01`, |
|
|
|
|
end: `${end}-12-31`, |
|
|
|
|
}).then(data => { |
|
|
|
|
that.setWKT(data, id); |
|
|
|
|
that.addFeaturesToList(data,id); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -406,6 +590,7 @@ Page({
|
|
|
|
|
lat: res.latitude |
|
|
|
|
}).then(data => { |
|
|
|
|
that.setWKT(data, id); |
|
|
|
|
that.addFeaturesToList(data,id); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -417,8 +602,66 @@ Page({
|
|
|
|
|
lat: res.latitude |
|
|
|
|
}).then(data => { |
|
|
|
|
that.setWKT(data, id); |
|
|
|
|
that.addFeaturesToList(data,id); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
addFeaturesToList(data, tid){
|
|
|
|
|
let key= 'key'+tid; |
|
|
|
|
let features = data.map(item => { |
|
|
|
|
let geomPoints = WKT.parse(item.geom).coordinates; |
|
|
|
|
let properties =item; |
|
|
|
|
properties.tid=tid;//类型
|
|
|
|
|
let polygon ={ |
|
|
|
|
key,tid,properties, |
|
|
|
|
type: "Feature", |
|
|
|
|
geometry: { |
|
|
|
|
type: "Polygon",
|
|
|
|
|
coordinates:geomPoints |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return polygon; |
|
|
|
|
}); |
|
|
|
|
if(global.features[key] && global.features[key].length>0){ |
|
|
|
|
global.features[key] = global.features[key].concat(features) |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
global.features[key] = features; |
|
|
|
|
}
|
|
|
|
|
}, |
|
|
|
|
removeFeaturesToList(tid){
|
|
|
|
|
let key= 'key'+tid; |
|
|
|
|
if(global.features[key] && global.features[key].length>0){
|
|
|
|
|
global.features[key]=[];
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
selectFeatureList(pt,maxCount){
|
|
|
|
|
maxCount = maxCount||1;
|
|
|
|
|
let x = pt.longitude; |
|
|
|
|
let y = pt.latitude;
|
|
|
|
|
let selectList = []; |
|
|
|
|
let features=[]; |
|
|
|
|
if(global.features['key1'] &&global.features['key1'].length>0){ |
|
|
|
|
features = features.concat(global.features['key1']); |
|
|
|
|
} |
|
|
|
|
if(global.features['key2'] &&global.features['key2'].length>0){ |
|
|
|
|
features = features.concat(global.features['key2']); |
|
|
|
|
} |
|
|
|
|
if(global.features['key3'] &&global.features['key3'].length>0){
|
|
|
|
|
features = features.concat(global.features['key3']); |
|
|
|
|
} |
|
|
|
|
for(let i =0; i < features.length;i++){ |
|
|
|
|
let feature =features[i];
|
|
|
|
|
let hitTest =gisUtil.isPointInPolygon(y,x,feature.geometry.coordinates[0]); |
|
|
|
|
if(hitTest){ |
|
|
|
|
selectList.push(feature); |
|
|
|
|
if(selectList.length>=maxCount){ |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return selectList |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// MORE地块
|
|
|
|
|
getMoreInfo(res, id) { |
|
|
|
@ -470,7 +713,19 @@ Page({
|
|
|
|
|
that.setWKT(data, id); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
* 10和16进制转换 |
|
|
|
|
* prin 为true将10进制转为16进制 |
|
|
|
|
* prin 为false将16进制转为10进制 |
|
|
|
|
*/ |
|
|
|
|
ten2XO(ten){ |
|
|
|
|
let val = Number(ten);
|
|
|
|
|
let xo= val.toString(16) |
|
|
|
|
if(val<16){ |
|
|
|
|
xo = '0'+xo |
|
|
|
|
}
|
|
|
|
|
return xo; |
|
|
|
|
}, |
|
|
|
|
// 地块数据解析
|
|
|
|
|
setWKT(data, id) { |
|
|
|
|
let { |
|
|
|
@ -495,12 +750,15 @@ Page({
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
let strokeColor = ''+ item.line_color + this.ten2XO(item.line_opaqueness); |
|
|
|
|
let strokeWidth = item.strokeWidth ? Number(item.strokeWidth):2; |
|
|
|
|
let fillColor = ''+ item.fill_color + this.ten2XO(item.fill_opaqueness); |
|
|
|
|
let polygon = { |
|
|
|
|
points, |
|
|
|
|
strokeColor: '#FFF', |
|
|
|
|
fillColor: '#FFCC4050', //`#${item.fillcolor}`,
|
|
|
|
|
strokeColor, |
|
|
|
|
strokeWidth, |
|
|
|
|
fillColor,
|
|
|
|
|
zIndex: 1, |
|
|
|
|
strokeWidth: 2, |
|
|
|
|
id |
|
|
|
|
} |
|
|
|
|
return polygon |
|
|
|
@ -511,12 +769,30 @@ Page({
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
|
*/ |
|
|
|
|
onLoad: function (options) { |
|
|
|
|
this.scaleBack() |
|
|
|
|
|
|
|
|
|
global.bboxkey=0; |
|
|
|
|
global.features={ |
|
|
|
|
key1:[], |
|
|
|
|
key2:[], |
|
|
|
|
key3:[], |
|
|
|
|
};
|
|
|
|
|
let sIdx = year-yearSpan-min; |
|
|
|
|
let eIdx = year-min; |
|
|
|
|
this.setData( |
|
|
|
|
{
|
|
|
|
|
indexStart:sIdx,
|
|
|
|
|
indexEnd:eIdx, |
|
|
|
|
start:arryList[sIdx].value, |
|
|
|
|
end:arryList[eIdx].value, |
|
|
|
|
} |
|
|
|
|
)
|
|
|
|
|
this.scaleBack(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|