You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
237 lines
4.1 KiB
237 lines
4.1 KiB
// pages/look/look.js |
|
Page({ |
|
|
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
satellite: 1, |
|
scale: 13, |
|
latitude: 29.543812, |
|
longitude: 106.434042, |
|
markers: [], |
|
once: { |
|
id: '001', |
|
name: '已出让', |
|
state: false |
|
}, |
|
tabs: [{ |
|
id: '002', |
|
name: '挂牌中', |
|
state: false |
|
}, { |
|
id: '003', |
|
name: '待挂牌', |
|
state: false |
|
}, { |
|
id: '004', |
|
name: '地块信息', |
|
state: false |
|
}, { |
|
id: '005', |
|
name: 'MORE', |
|
state: false |
|
}, { |
|
id: '006', |
|
name: '配套', |
|
state: true |
|
}, { |
|
id: '007', |
|
name: '控规', |
|
state: false |
|
}, { |
|
id: '008', |
|
name: '环线', |
|
state: false |
|
}, { |
|
id: '009', |
|
name: '行政区', |
|
state: true |
|
}, { |
|
id: '010', |
|
name: '大板块', |
|
state: false |
|
}, { |
|
id: '011', |
|
name: '小版块', |
|
state: false |
|
}] |
|
}, |
|
|
|
comeList(){ |
|
wx.navigateTo({ |
|
url: '/pages/look-list/look-list', |
|
}) |
|
}, |
|
|
|
checkBtn(e) { |
|
let id = e.currentTarget.dataset.id |
|
this.setMore(); |
|
if (id === '001') { |
|
let { |
|
once |
|
} = this.data |
|
once.state = !once.state |
|
this.setData({ |
|
once |
|
}) |
|
} else { |
|
let {tabs} = this.data |
|
tabs.forEach(item=>{ |
|
if(item.id===id){ |
|
item.state = !item.state |
|
} |
|
}) |
|
this.setData({tabs}) |
|
} |
|
}, |
|
|
|
setMore() { |
|
let { |
|
markers |
|
} = this.data |
|
let makeArr = [{ |
|
id: 1, |
|
latitude: 29.627668, |
|
longitude: 106.511395, |
|
iconPath: "../../assets/images/more.png", |
|
width: 40, |
|
height: 50, |
|
}, { |
|
id: 2, |
|
latitude: 29.607063, |
|
longitude: 106.550777, |
|
iconPath: "../../assets/images/more.png", |
|
width: 40, |
|
height: 50, |
|
}]; |
|
if (markers.length < 3) { |
|
markers = markers.concat(makeArr) |
|
this.setData({ |
|
markers |
|
}) |
|
} |
|
}, |
|
|
|
mapTabItem(e) { |
|
let satellite = e.currentTarget.dataset.id |
|
if (satellite !== this.data.satellite) { |
|
this.setData({ |
|
satellite |
|
}) |
|
} |
|
}, |
|
|
|
scaleDown(e) { |
|
let type = e.currentTarget.dataset.type |
|
let { |
|
scale |
|
} = this.data |
|
if (type === 'add' && scale < 20) { |
|
this.setData({ |
|
scale: ++scale |
|
}) |
|
} else if (type === 'reduce' && scale > 3) { |
|
this.setData({ |
|
scale: --scale |
|
}) |
|
} |
|
}, |
|
//定位当前 |
|
scaleBack() { |
|
let that = this; |
|
wx.getLocation({ |
|
type: 'gcj02', |
|
success: function (res) { |
|
let latitude = res.latitude |
|
let longitude = res.longitude |
|
let { |
|
markers |
|
} = that.data |
|
let mark = { |
|
id: res.accuracy, |
|
latitude, |
|
longitude, |
|
iconPath: "../../assets/images/user-address.png", |
|
width: 40, |
|
height: 50, |
|
} |
|
markers.push(mark) |
|
that.setData({ |
|
latitude: latitude, |
|
longitude: longitude, |
|
markers: markers |
|
}) |
|
} |
|
}) |
|
}, |
|
|
|
//点击标记点 |
|
markertap(e) { |
|
let id = e.detail.markerId |
|
wx.navigateTo({ |
|
url: '/pages/look-list/look-list?id=' + id, |
|
}) |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
onLoad: function (options) { |
|
this.scaleBack() |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function () { |
|
if (typeof this.getTabBar === 'function' && |
|
this.getTabBar()) { |
|
this.getTabBar().setData({ |
|
selected: 1 |
|
}) |
|
} |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |