// subpages/redSail/pages/registerParty/registerParty.js var mapCtx = ""; Page({ /** * 页面的初始数据 */ data: { selectedValue:'', look:true, informFlag:false, longitude: 120.372537, latitude: 36.098056, scale: 13, mapCtx: mapCtx, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.data.mapCtx = wx.createMapContext("party-masses-map"); this.partyservicecenterlist(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, addMarkers (markerList) { var markers = []; markerList.forEach( (item, index)=> { markers.push({ id: index + 1, iconPath: "../../images/marker-icon.png", longitude: parseFloat(item.longitude), latitude: parseFloat(item.latitude), width: 30, height: 35, zIndex: 100, customCallout: { anchorY: 0, anchorX: 0, display: "ALWAYS" } }); }); this.data.mapCtx.addMarkers({ markers: markers }); }, partyservicecenterlist: function () { var _this = this; var params = { orgId: wx.getStorageSync("gridId"), orgType: "grid" }; index_1.partyservicecenterlist(params).then(function (res) { console.log("获取党群服务中心", res); _this.setData({ partyMassesList: res.data }); _this.addMarkers(_this.data.partyMassesList); }).catch(function (err) { console.error(err); }); }, onPickerChange (event) { const selectedIndex = event.detail.value; const selectedValue = ['是', '否'][selectedIndex]; this.setData({ selectedValue: selectedValue }); }, handleCheckbox(e){ console.log(e); if(e.detail .value.length!=0){ this.setData({ look:false }) }else{ this.setData({ look:true }) } }, handleBack(){ wx.navigateBack({ delta: 1 }) }, handleNext(){ this.setData({ informFlag:true }) } })