const app = getApp(); Page({ /** * 页面的初始数据 */ data: { id: 0, info: {}, list: [], keyword: '', page: 1, no_more: false, is_first: true, tabCur:0, total:{}, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let id = options.id; this.setData({id:id}); this.getSite(); }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { if (this.data.tabCur == 1) { this.setData({list:[],page:1,no_more:false,keyword:''}); this.getCount(); this.getList(); } else { this.getSite(); } wx.stopPullDownRefresh(); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { if (this.data.tabCur == 1) { this.getList(); } }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { let info = this.data.info return { title: info.site_name, path: "/pages/site/detail/detail?id="+info.id, }; }, //切换 tabSelect(e) { let tabCur = e.currentTarget.dataset.id; if (tabCur == 1 && this.data.is_first) { this.setData({is_first:false}); this.getCount(); this.getList(); } this.setData({tabCur: tabCur}); }, //站点 getSite(){ let self = this; app.post('activity/site/detail',{id:this.data.id},function(res){ if (res.image_display) { res.image_display = res.image_display.replace(/\ 0) { wx.openLocation({ latitude: info.latitude - 0, //维度 longitude: info.longitude - 0, //经度 name: info.site_name, //目的地定位名称 scale: 15, //缩放比例 address: info.address //导航详细地址 }) } else { app.msg('该驿站管理员暂未录入地址!'); } }, })