市北党建引领小程序初始化
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.
 

72 lines
2.3 KiB

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("../../api/index");
var mapCtx = "";
var arr = [];
Page({
data: {
longitude: 120.372537,
latitude: 36.098056,
scale: 13,
mapCtx: mapCtx,
partyMassesList: arr
},
onLoad: function () {
this.data.mapCtx = wx.createMapContext("party-masses-map");
this.partyservicecenterlist();
},
addMarkers: function (markerList) {
var markers = [];
markerList.forEach(function (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
});
},
markertap: function (e) {
console.log("markertap", e);
wx.navigateTo({
url: "/subpages/partyMassesServiceCenter/pages/partyMassesDetail/partyMassesDetail?partyServiceCenterId=" + this.data.partyMassesList[e.detail.markerId - 1].partyServiceCenterId
});
},
navigateToBookList: function () {
wx.navigateTo({
url: "/subpages/partyMassesServiceCenter/pages/bookList/bookList"
});
},
navigateToPartyMassesList: function () {
wx.redirectTo({
url: "/subpages/partyMassesServiceCenter/pages/partyMassesList/partyMassesList"
});
},
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);
});
}
});