zhuanqu.js 1.8 KB
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    page:1,
    zhuanqulist:[],
    activeid: '',
    activelist:[]
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      activeid:options.id
    })
    this.getmorelist()

  },

  //轮播图
  look_more(e) {
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/shop_detail/shop_detail?id=' + id
    })
    // let style = e.currentTarget.dataset.style
    // if (style == 2) {
    //   wx.navigateTo({
    //     url: '/pages/outerChain/outerChain?src=' + e.currentTarget.dataset.src
    //   })
    // } else {
      
    // }
  },

  getmorelist(){
    let that = this
    let url = '/activity/get_product';
    let data = {
      activity_id:that.data.activeid,
      page: that.data.page,
      pageNum: 10,

    }
    app.post(url, data, "POST").then((r) => {
      console.log(r)
      that.setData({
        activelist: that.data.activelist.concat(r.msg)
      })

      console.log(that.data.activelist)

    }).catch((err) => { })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    let newpage=this.data.page;
    newpage++;
   this.setData({
     page:newpage
   })

    this.getmorelist()
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})