<template>
  <view class="template-plan tn-safe-area-inset-bottom">
    <!-- 顶部自定义导航 -->
    <!-- <tn-nav-bar fixed alpha customBack>
      <view slot="back" class='tn-custom-nav-bar__back'
        @click="goBack">
        <text class='icon tn-icon-left'></text>
        <text class='icon tn-icon-home-capsule-fill'></text>
      </view>
    </tn-nav-bar> -->
    
    <!-- 顶部自定义导航 -->
    <tn-nav-bar fixed :isBack="false" :bottomShadow="false" backgroundColor="#FFFFFF">
      <view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
        <!-- 按钮 -->
        <view class="custom-nav__back">
          <view class="tn-icon-menu-more" style="font-size: 50rpx;"></view>
        </view>
        <!-- 字 -->
        <view class="custom-nav__search tn-flex tn-flex-col-center tn-flex-row-center ">
          <view class="custom-nav__search__box tn-flex tn-flex-col-center tn-flex-row-center">
            <text class="tn-text-bold tn-text-xxl">北北小目标</text>
          </view>
        </view>
      </view>
    </tn-nav-bar>
    
     
    <view class="tn-margin-top-sm" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
      <view class="tn-flex tn-flex-row-between">
        <view class="justify-content-item tn-margin tn-text-bold tn-text-xxl">
          未进行（5）
        </view>
        <view class="tn-margin" style="font-size: 50rpx;">
          <text class="tn-icon-send"></text>
        </view>
      </view>
    </view>
    
    <swiper class="card-swiper tn-margin-top-sm" :circular="true"
      :autoplay="true" duration="500" interval="5000" @change="cardSwiper"> 
      <swiper-item v-for="(item,index) in swiperList" :key="index" :class="cardCur==index?'cur':''">
        <view class="swiper-item image-banner">
          <image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
        </view>
        <view class="swiper-item-text">
          <view class="tn-text-xxl tn-text-bold">{{item.name}}</view>
          <view class="tn-text-sm tn-text-bold tn-padding-top-xs">{{item.text}}</view>
        </view>
      </swiper-item>
    </swiper>
    <view class="indication">
        <block v-for="(item,index) in swiperList" :key="index">
            <view class="spot" :class="cardCur==index?'active':''"></view>
        </block>
    </view>
    
    <view class="" style="margin-top: -30rpx;">
      <view class="tn-flex tn-flex-row-between">
        <view class="justify-content-item tn-margin tn-text-bold tn-text-xxl">
          今日目标
        </view>
        <view class="tn-margin" style="font-size: 50rpx;">
          <text class="tn-icon-edit-form"></text>
        </view>
      </view>
    </view>
    
    <view class="tn-margin-left tn-text-sm tn-color-gray" style="margin-top: -25rpx;">
      <text>这是今日目标，请干巴爹吖</text>
    </view>
    
    <view class="">
      <view class="tn-plan-content tn-margin tn-text-justify">
        <view v-for="(item,index) in planList" :key="index" class="tn-plan-content__item tn-margin-right tn-round tn-text-sm tn-text-bold" :class="[`tn-bg-${item.color}--light tn-color-${item.color}`]">
          <text class="tn-plan-content__item--prefix">#</text> {{item.name}}
        </view>
      </view>
    </view>
    
    <view class="tn-clear-float tn-padding-top-lg">
      <view class="tn-flex tn-flex-row-between">
        <view class="justify-content-item tn-margin tn-text-bold tn-text-xxl">
          历史记录
        </view>
        <!-- <view class="tn-margin" style="font-size: 50rpx;">
          <text class="tn-icon-right"></text>
        </view> -->
      </view>
    </view>
    
    <view class="tn-margin-left tn-text-sm tn-color-gray" style="margin-top: -25rpx;">
      <text>完成的目标，当然要记录啦</text>
    </view>
    
    <view class="tn-margin-top-lg" style="margin-bottom: 50rpx">
      <view class="tn-plan-content2 tn-margin tn-text-justify">
        <view v-for="(item,index) in planList2" :key="index" class="tn-plan-content2__item tn-margin-right tn-round tn-text-sm tn-text-bold tn-bg-gray--light tn-color-black">
          <text class="tn-plan-content2__item--prefix">#</text> {{item.name}}
          <text class="tn-float-right">{{item.time}}</text>
        </view>
      </view>
    </view>
    
    <view class="" style="height: 10rpx;">
    </view>
    
    <!-- 底部tabbar start-->
    <view class="tabbar footerfixed">
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-home-smile">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/a1.png'></image>
        </view>
        <view class="tn-color-black">首页</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-discover">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/k2.png'></image>
        </view>
        <view class="tn-color-gray">圈子</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-image-text">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/i2.png'></image>
        </view>
        <view class="tn-color-gray">案例</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-my">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/d2.png'></image>
        </view>
        <view class="tn-color-gray">我的</view>
      </view>
    </view>
    <view class="tn-padding-xl"></view>

    <!-- 回到首页悬浮按钮-->
    <nav-index-button></nav-index-button>
    
  </view>
</template>

<script>
  import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
  import NavIndexButton from '@/libs/components/nav-index-button.vue'
  export default {
    name: 'TemplatePlan',
    mixins: [template_page_mixin],
    components: { NavIndexButton },
    data(){
      return {
        cardCur: 0,
        swiperList: [{
          id: 0,
          type: 'image',
          name: '看书20分钟',
          text: '静下心看《读者》',
          url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
        }, {
          id: 1,
          type: 'image',
          name: '创新一个轮播',
          text: '在图鸟UI新增创意轮播',
          url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
        }, {
          id: 2,
          type: 'image',
          name: '坚持早起',
          text: '早上9点前起床',
          url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
        }, {
          id: 3,
          type: 'image',
          name: '和群友吹水',
          text: '技术的友情永不过时',
          url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
        }, {
          id: 4,
          type: 'image',
          name: '散步找创意',
          text: '每天散步30分钟',
          url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
        }],
        planList: [{
          name: '看书',
          color: 'red',
          time: '2021-12-13 06:20',
        }, {
          name: '早起',
          color: 'cyan',
          time: '8:37',
        }, {
          name: '做30个深蹲',
          color: 'blue',
        }, {
          name: '散步',
          color: 'green',
        }, {
          name: '写新的轮播效果',
          color: 'orange',
        }, {
          name: '吃早餐',
          color: 'purplered',
        }, {
          name: '陪猫猫玩',
          color: 'purple',
        }, {
          name: '睡午觉',
          color: 'brown',
        }, {
          name: '干饭饭',
          color: 'yellowgreen',
        }, {
          name: '蔡猪北',
          color: 'grey',
        }],
        planList2: [{
          name: '陪猫猫玩',
          time: '2021-12-13 22:45',
        },{
          name: '写新的轮播效果',
          time: '2021-12-13 20:20',
        }, {
          name: '散步',
          time: '2021-12-13 18:11',
        }, {
          name: '睡午觉',
          time: '2021-12-13 13:42',
        }, {
          name: '干饭饭',
          time: '2021-12-13 12:14',
        }, {
          name: '看书',
          time: '2021-12-13 10:21',
        }, {
          name: '吃早餐',
          time: '2021-12-13 08:56',
        }, {
          name: '做30个深蹲',
          time: '2021-12-13 08:40',
        }, {
          name: '早起',
          time: '2021-12-13 08:22',
        }, {
          name: '蔡北北测试',
          time: '2021-12-12 22:06',
        }],
      }
    },
    methods: {
      // cardSwiper
      cardSwiper(e) {
        this.cardCur = e.detail.current
      },
    }
  }
</script>

<style lang="scss" scoped>
  @import '@/static/css/templatePage/custom_nav_bar.scss';
  .template-plan{
  }
  /* 自定义导航栏内容 start */
  .custom-nav {
    height: 100%;
    
    &__back {
      margin: auto 5rpx;
      font-size: 40rpx;
      margin-right: 10rpx;
      margin-left: 30rpx;
      flex-basis: 5%;
    }
    
    &__search {
      flex-basis: 70%;
      width: 100%;
      height: 100%;
      
      &__box {
        width: 100%;
        height: 70%;
        padding: 15rpx 0;
        margin: 0 30rpx;
        border-radius: 10rpx;
        font-size: 24rpx;
      }
      
      &__icon {
        padding-right: 10rpx;
        margin-left: 20rpx;
        font-size: 30rpx;
      }
      
      &__text {
        color: #AAAAAA;
      }
    }
  }
  .logo-image{
    width: 65rpx;
    height: 65rpx;
    position: relative;
  }
  .logo-pic{
    background-size: cover;
    background-repeat:no-repeat;
    // background-attachment:fixed;
    background-position:top;
    border-radius: 50%;
  }
  /* 自定义导航栏内容 end */
  /* 轮播 start*/
  .card-swiper {
    height: 570rpx !important;
  }
  
  .card-swiper swiper-item {
    width: 450rpx !important;
    left: 30rpx;
    box-sizing: border-box;
    padding: 0rpx 0rpx 80rpx 0rpx;
    overflow: initial;
  }
  
  .card-swiper swiper-item .swiper-item {
    width: 100%;
    display: block;
    height: 100%;
    border-radius: 10rpx;
    transform: scale(0.7) translate(0rpx,-104rpx);
    transition: all 0.3s ease-in 0s;
    overflow: hidden;
  }
  
  .card-swiper swiper-item.cur .swiper-item {
    transform: none;
    transition: all 0.3s ease-in 0s;
  }
  
  .card-swiper swiper-item .swiper-item-text {
    margin-top: -120rpx;
    width: 100%;
    display: block;
    height: 50%;
    border-radius: 10rpx;
    transform: translate(20rpx, -30rpx) scale(0.7, 0.7);
    transition: all 0.4s ease 0s;
    overflow: hidden;
    color: #000000;
  }
    
  .card-swiper swiper-item.cur .swiper-item-text {
    margin-top: -150rpx;
    padding-left: 30rpx;
    width: 100%;
    transform: translate(-20rpx, 20rpx) scale(0.9, 0.9);
    transition: all 0.4s ease 0s;
    color: #FFFFFF;
    text-shadow: 0rpx 10rpx 20rpx rgba(0,0,0,0.1);
  }
  
  .image-banner{
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0rpx 30rpx 60rpx 0rpx rgba(116,10,250, 0.15);
    // border: 1rpx solid red;
  }
  .image-banner image{
    width: 100%;
    height: 100%;
  }
  /* 轮播指示点 start*/
  .indication{
    z-index: 9999;
    width: 100%;
    height: 36rpx;
    position: absolute;
    display:flex;
    flex-direction:row;
    align-items:center;
    justify-content:center;
  }
  
  .spot{
    background-color: #000;
    opacity: 0.4;
    width: 10rpx;
    height: 10rpx;
    border-radius: 20rpx;
    margin: 0 8rpx !important;
    right: -270rpx;
    top: -100rpx;
    position: relative;
  }
  
  .spot.active{
    opacity: 1;
    width: 10rpx;
    background-color: #000;
  }
  
  /* 计划内容 start*/
  .tn-plan-content {
    &__item {
      display: inline-block;
      line-height: 45rpx;
      padding: 10rpx 30rpx;
      margin: 20rpx 20rpx 5rpx 0rpx;
      
      &--prefix {
        padding-right: 10rpx;
      }  
    }
  }
  .tn-plan-content2 {
    &__item {
      line-height: 45rpx;
      padding: 15rpx 30rpx;
      margin: 30rpx 0rpx 10rpx 0rpx;
      
      &--prefix {
        padding-right: 10rpx;
      }  
    }
  }
  /* 计划内容 end*/
  
  /* 底部tabbar start*/
  .footerfixed{
   position: fixed;
   width: 100%;
   bottom: 0;
   z-index: 999;
   background-color: #FFFFFF;
   box-shadow: 0rpx 0rpx 30rpx 0rpx rgba(0, 0, 0, 0.07);
  }
  
  .tabbar {
    display: flex;
    align-items: center;
    min-height: 110rpx;
    justify-content: space-between;
  	padding: 0;
  	height: calc(110rpx + env(safe-area-inset-bottom) / 2);
  	padding-bottom: calc(env(safe-area-inset-bottom) / 2);
  }
  
  .tabbar .action {
  	font-size: 22rpx;
  	position: relative;
  	flex: 1;
  	text-align: center;
  	padding: 0;
  	display: block;
  	height: auto;
  	line-height: 1;
  	margin: 0;
  	overflow: initial;
  }
  
  .tabbar .action .bar-icon {
  	width: 100rpx;
  	position: relative;
  	display: block;
  	height: auto;
  	margin: 0 auto 10rpx;
  	text-align: center;
  	font-size: 42rpx;
  }
  
  .tabbar .action .bar-icon image {
  	width: 50rpx;
  	height: 50rpx;
  	display: inline-block;
  }
</style>
