// pages/activity/suyear/index.js import commonApi from "../../../utils/https/common" import util from "../../../utils/util" Page({ /** * 页面的初始数据 */ data: { tabs:[{ areaid:"", imgname:'all' },{ areaid:"320508", imgname:'gs' },{ areaid:"320506", imgname:'wz' },{ areaid:"320507", imgname:'xc' },{ areaid:"320509", imgname:'wj' },{ areaid:"320510", imgname:'yq' },{ areaid:"320582", imgname:'zjg' },{ areaid:"320585", imgname:'tc' },{ areaid:"320583", imgname:'ks' },{ areaid:"320581", imgname:'cs' }], list:[], total:1, areas_id:"" }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getList() }, changeArea:function(e){ let areas_id = e.currentTarget.dataset.area; this.setData({ total:1, list:[], areas_id:areas_id }) this.getList() }, getList:function(){ if(this.data.total<=this.data.list.length) return; commonApi._post('product/get_product_by_tag',{ tag_id:23, offset:this.data.list.length, areas_id:this.data.areas_id, limit:10 }).then(res=>{ this.setData({ list:this.data.list.concat(res.data.list), total:res.data.total }) }) }, gotoDetail:function(e){ let item = e.currentTarget.dataset.item; if(item.title=='沙家浜景区'){ wx.navigateToMiniProgram({ appId: 'wx98a352b4689e46d8', path:'pages/sightspots/booking?id=32&type=default' }) return; } util.gotoDetail(item) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.getList() }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })