<template>
  <u-navbar
      :title="title"
      :auto-back="true"
      left-icon-size="40rpx"
      :safe-area-inset-top="true"
      :placeholder="true"
      bgColor="#fff"
      fixed
  ></u-navbar>

  <view id="why">
    <u-image :src="staticImage.plan1" :lazy-load="true" width="100%" height="auto" mode="widthFix"></u-image>
  </view>
  <view id="do">
    <u-image @click="api.navTo('/pages/Pages/cronTab')" :src="staticImage.plan2" :lazy-load="true" width="100%" height="auto" mode="widthFix"></u-image>
  </view>
  <view id="what">
    <u-image :src="staticImage.plan3" :lazy-load="true" width="100%" height="auto" mode="widthFix"></u-image>
  </view>
  <view id="cron">
    <u-image :src="staticImage.plan4" :lazy-load="true" width="100%" height="auto" mode="widthFix"></u-image>
  </view>

</template>

<script>
import {
  imghost
} from '@/config/host.js'
import MzSubsection from '@/components/MzSubsection/Index.vue';
import api from '@/utils/functions.js';

export default {
  components: {
    MzSubsection
  },
  data() {
    return {
      current: 1,
      title: '招募计划',
      loading: true,
      staticImage: {
        bg: imghost + '/BG.png',
        newIcon: imghost + '/new-icon.png',
        fxxLogo: imghost + '/fxx-logo.png',
        fxxDone: imghost + '/fxx-done.png',
        fxx1: imghost + '/fxx-1.png',
        plan1: imghost + '/zm_01_1115.png',
        plan2: imghost + '/zm_02_1115.png',
        plan3: imghost + '/zm_03_1115.png',
        plan4: imghost + '/zm_04_1115.png',
        // plan5: imghost + '/zm_05.png',
      },
      isTop: false,
      size: {
        height: 500,
      }
    }
  },
  onLoad(option) {
    if(option.scroll){
      uni.$u.sleep(500).then(()=>{
        uni.pageScrollTo({
          selector: option.scroll,
          success:(res)=>{
            console.log('res',res)
          },
          fail:(err) => {
            console.log('err',err)
          }
        });
      })
    }
  },
  computed: {
    api() {
      return api
    }
  },
  methods: {
    checkLogin(){
      if(uni.getStorageSync('user')){
        uni.showToast({'title':'您已登录,无需再次登录'})
      }else{
        this.navTo('/pages/Login/index');
      }
    },
    navTo(url,token = false) {
      if(token){
        if(uni.getStorageSync('token')){
          uni.navigateTo({
            url: url
          })
        }else{
          uni.navigateTo({
            url: '/pages/Login/index'
          })
        }
      }else{
        uni.navigateTo({
          url: url
        })
      }
    },
  },
  onPageScroll(res) {
    if (res.scrollTop <= 20) {
      uni.$emit('isTop', true);
    } else {
      uni.$emit('isTop', false);
    }
  },
  created() {
    // this.listHeight();
    // this.pagePadding = (api.navHeight().navPaddingTop +
    // 	api.navHeight().navHeight + (api.navHeight().headerPadding * 2))
  }
}
</script>

<style lang="scss">
//@import './components/done.scss';
</style>