<template>
  <view class="page">
    <!-- #ifdef H5-->
    <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"
                 left-icon="left" title="交友圈排行榜" @clickLeft="back"/>
    <!-- #endif -->

    <view class="example-body">
      <uni-datetime-picker v-model="range" type="daterange" @change="maskClick"/>
    </view>
    <view>
      <mescroll-item ref="MescrollItem" :i="0" :index="0" :startDate='startDate' :endDate='endDate' :height="height">
      </mescroll-item>
    </view>


    <!--#ifdef H5-->
    <liu-drag-button v-if="$isWxBrowser()" @clickBtn="back">返回</liu-drag-button>
    <!--#endif-->
  </view>
</template>

<script>
import MescrollItem from "./module/mescrollUni-item.vue";

export default {
  components: {
    MescrollItem
  },
  data() {
    return {
      startDate: '',
      endDate: '',
      height: '',
      range: null,

    }
  },
  onLoad(e) {
    this.getRanking()
    let sysInfo = uni.getSystemInfoSync()
    this.height = sysInfo.windowHeight - 90 + 'px' //除标题栏栏外的屏幕可用高度
  },
  methods: {
    getRanking(date) {
      this.$api.service.getRank(date).then((res) => {
        this.rankDate = res.data.data
      })
    },
    maskClick(e) {
      console.log(e)
      this.range = e
      this.startDate = e[0]
      this.endDate = e[1]

    },
    back() {
      let pages = getCurrentPages()
      if (pages.length > 1) {
        uni.navigateBack({
          delta: 1,
          fail: err => {
            console.log(err)
          }
        })
      } else {
        uni.switchTab({
          url: '/pages/my/my'
        });
      }
    },

  }
}
</script>

<style>

</style>
