guangrongpaihang.js 1.2 KB
//index.js
const app = getApp();
Page({
  data: {
    nav: 1,
    navs: 1,
    list: [],

  },
  //切换


  bindNav(e) {
    var nav = e.currentTarget.dataset.nav
    console.log(nav)
    this.setData({
      nav
    })

    this.getaList();

  },
  bindtype(e) {
    var navs = e.currentTarget.dataset.navs
    console.log(navs)
    this.setData({
      navs
    })

    this.getaList();
  },





  onShow() {

    let that = this;
    this.getaList();

  },

  onLoad: function () {

  },

  getaList() {

    let that = this;
    let url = '/index/second/getRank';
    let head = {
      'XX-Token': wx.getStorageSync('token')
    }

    let params = {
      type: that.data.nav,
      star: that.data.navs
    }

    console.log(params)
    app.post(url, params, head).then((res) => {
      console.log(res)
      that.setData({
        list: res

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

    })

  },

  //志愿者详情 
  getdetail(e) {
    var id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/more_other/more_other?id=' + id,
    })



  },
  // 团队详情
  getteam(e){
    var id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/Volunteer_detail/Volunteer_detail?id=' + id,
    })

  }



})