guangrongpaihang.js 913 字节
//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) => {

    })

  },









})