
var app = getApp()
var that;
Page({
  data: {
    // dataList:[],
    isShowGs:true,
    disabled:false,
  },
  onLoad() {
    that = this;
    // dd.getStorage({
    //   key: 'isShowGs',
    //   success: function(res) {
    //     if(res.data){
    //       that.setData({
    //         isShowGs: false
    //       })
    //     }
    //   },
    // });
    dd.setNavigationBar({ title: "我的排名" });
  },
  onShow(){
    this.getData();
  },
  activeGs(){
      this.setData({
        isShowGs: false
      })
      dd.setStorage({
        key: 'isShowGs',
        data: true,
        success: function() {}
      });
  },
  getData(){
    app.$get('api/integral/statistics/ranking/list').then((res) => {
      var data = res.data.data.list;
        this.setData({
          dataList: data
        })
    })
  },
  //打开编辑
  openCompile(e){
    var item=e.target.dataset.item;
    dd.navigateTo({
      url: '../addCustom/addCustom?id='+item.id
    })
  },
    //打开排名
  openDetail(e){
    var item = e.target.dataset.item;
    var url = '';
    if (item.type == 'normal') {
      url = '../../statistics/sectionRanking/sectionRanking';
    } else if (item.type == 'all') {
      url = '../../statistics/B_ranking/B_ranking';
    } else {
      url = '../../statistics/C_ranking/C_ranking?id=' + item.target_id + '&name=' + item.group_name+'&date_interval='+item.date_interval;
    }
    dd.navigateTo({
      url: url
    })
  },
  //打开添加
  openAdd(){
    dd.navigateTo({
      url: '../addCustom/addCustom'
    })
  },
});
