moreActivity.js 1.5 KB
import {
  request
} from "../../request/index.js"
const a = getApp()
Page({
  data: {
    imagesUrl: a.globalData.baseUrl,
    id: '',
    moreActivity: '',
  },
  onLoad: function (options) {

  },
  ToActivityDetails(e) {
    let id = e.currentTarget.dataset.id
    let type = e.currentTarget.dataset.types
    if (type == 1) {
      wx.navigateTo({
        url: '/pages/activityDetails/activityDetails?id=' + id + '&type=' + type
      })
    } else {
      wx.navigateTo({
        url: '/pages/details/details?id=' + id + '&type=' + type
      })
    }
    // let id = e.currentTarget.dataset.id
    // wx.navigateTo({
    //   url: '?id=' + id
    // }) 
  },
  onReady: function () {

  },
  onShow: function () {
    wx.showToast({
      title: '加载中',
      icon: "loading",
      duration: 1000
    })
    this.getMoreActivity()
  },

  async getMoreActivity() {
    let that = this
    try {
      const {
        data: {
          data
        }
      } = await request({
        url: 'api/index/moreActive'
      })
      that.setData({
        moreActivity: data
      })
      //  console.log(data, "更多活动");
    } catch (err) {
      that.setData({
        msg: err.msg
      })
      that.popMaskTest()
    }


  },
  popMaskTest() {
    wx.showToast({
      title: this.data.msg,
      duration: 2000,
      icon: 'none',
      mask: true //是否有透明蒙层,默认为false 
      //如果有透明蒙层,弹窗的期间不能点击文档内容 
    })
  },
})