// pages/activity/springten/index.js import commonApi from "../../../utils/https/common" import util from "../../../utils/util" let app = getApp() Page({ /** * 页面的初始数据 */ data: { types:['必赏','必吃','必游','必玩','必购','必住','夜戏','夜饮','夜宴','夜市'], type:0, list:[], total:1 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getList() }, changeType:function(e){ this.setData({ type:e.currentTarget.dataset.type, list:[], total:1 }) this.getList(); }, getList:function(){ if(this.data.total<=this.data.list.length) return; commonApi._post("scene/get_scene_by_tag",{ offset:this.data.list.length, limit:10, tag_id:17+Number(this.data.type) }).then(res=>{ res.data.list.map(item=>{ if(item.scene_tags && item.scene_tags.indexOf('运河十景')!=-1){ item.isYunHe = true; } else { item.isYunHe = false; } item.display_tags = item.display_tags?item.display_tags.split(","):[]; item.display_tags = item.display_tags.splice(0,2); }) this.setData({ list:this.data.list.concat(res.data.list), total:res.data.count }) }) }, gotoWeb:function(e){ let item = e.currentTarget.dataset.item; app.globalData.weburl = item.ext_link; wx.navigateTo({ url: '/pages/pbService/web/index', }) }, gotoDetail:function(e){ let item = e.currentTarget.dataset.item; util.gotoDetail(item) }, gotoLocation:function(e){ let item = e.currentTarget.dataset.item; wx.openLocation({ latitude: item.lat, longitude: item.lon }) }, gotoFoodInfo:function(e){ let item = e.currentTarget.dataset.item; wx.navigateTo({ url: '/pages/info/foodInfo/index?id='+item.id, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.getList() }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })