<template>
  <view class="template-moon 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">
        <!-- 图标logo -->
        <view class="custom-nav__back">
          <view class="logo-pic tn-shadow-blur" style="background-image:url('https://resource.tuniaokj.com/images/logo/logo2.png')">
            <view class="logo-image">
            </view>
          </view> 
          <!-- <view class="tn-icon-left"></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-left tn-color-gray--dark tn-bg-gray--light">
            <view class="custom-nav__search__icon tn-icon-search"></view>
            <view class="custom-nav__search__text tn-padding-left-xs">好想搜点什么</view>
          </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">
          Hi，北北欢迎你吖
        </view>
        <view class="tn-margin" style="font-size: 50rpx;">
          <text class="tn-icon-menu-more"></text>
        </view>
      </view>
    </view>

    <swiper class="card-swiper tn-margin-top-lg" :circular="true"
      :autoplay="true" duration="500" interval="5000" previous-margin="60rpx" next-margin="60rpx" @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 tn-color-white">{{item.name}}</view>
          <view class="tn-text-sm tn-text-bold tn-color-white 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>
    
    <!-- 底部tabbar start-->
    <view class="tabbar footerfixed">
      <view class="action">
        <view class="bar-icon">
          <view class="tn-icon-level">
          </view>
          <!-- <image class="" src='https://resource.tuniaokj.com/images/tabbar/home_tnnew.png'></image> -->
        </view>
        <view class="tn-color-black">首页</view>
      </view>
      <view class="action">
        <view class="bar-circle tn-shadow-blur">
          <view class="tn-icon-camera-fill tn-color-white">
          </view>
          <!-- <image class="" src='https://resource.tuniaokj.com/images/tabbar/information_tn.png'></image> -->
        </view>
        <!-- <view class="tn-color-gray">发布</view> -->
      </view>
      <view class="action">
        <view class="bar-icon">
          <view class="tn-icon-signpost tn-color-gray--dark">
          </view>
          <!-- <image class="" src='https://resource.tuniaokj.com/images/tabbar/my_tn.png'></image> -->
        </view>
        <view class="tn-color-gray">导向</view>
      </view>
    </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: 'TemplateMoon',
    mixins: [template_page_mixin],
    components: { NavIndexButton },
    data(){
      return {
          cardCur: 0,
          swiperList: [{
            id: 0,
            type: 'image',
            name: '图鸟UI 她来了',
            text: '开启全新的探索之旅',
            url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
          }, {
            id: 1,
            type: 'image',
            name: '欢迎加入东东们',
            text: '如果你也有不错的作品',
            url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
          }, {
            id: 2,
            type: 'image',
            name: '一起玩转scss',
            text: '用最少的代码做最骚的效果',
            url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
          }, {
            id: 3,
            type: 'image',
            name: '微信号 tnkewo',
            text: '商业合作请联系作者',
            url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
          }, {
            id: 4,
            type: 'image',
            name: '努力成为大佬',
            text: '一起加油吖',
            url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
          }],
        }
      },
      methods: {
        // cardSwiper
        cardSwiper(e) {
          this.cardCur = e.detail.current
        },
      }
  }
</script>

<style lang="scss" scoped>
  @import '@/static/css/templatePage/custom_nav_bar.scss';
  
  
  /* 自定义导航栏内容 start */
  .custom-nav {
    height: 100%;
    
    &__back {
      margin: auto 5rpx;
      font-size: 40rpx;
      margin-right: 10rpx;
      margin-left: 30rpx;
      flex-basis: 5%;
    }
    
    &__search {
      flex-basis: 60%;
      width: 100%;
      height: 100%;
      
      &__box {
        width: 100%;
        height: 70%;
        padding: 15rpx 0;
        margin: 0 30rpx;
        border-radius: 60rpx;
        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: 67vh !important;
    }
    
    .card-swiper swiper-item {
      width: 630rpx !important;
      // left: 60rpx;
      box-sizing: border-box;
      padding: 0rpx 0rpx 90rpx 0rpx;
      overflow: initial;
    }
    
    .card-swiper swiper-item .swiper-item {
      width: 100%;
      display: block;
      height: 100%;
      border-radius: 10rpx;
      transform: scale(0.9);
      transition: all 0.2s ease-in 0s;
      overflow: hidden;
    }
    
    .card-swiper swiper-item.cur .swiper-item {
      transform: none;
      transition: all 0.2s ease-in 0s;
    }
    
    .card-swiper swiper-item .swiper-item-text {
      margin-top: -180rpx;
      width: 100%;
      display: block;
      height: 50%;
      border-radius: 10rpx;
      transform: translate(0rpx, -40rpx) scale(0.7, 0.7);
      transition: all 0.6s ease 0s;
      overflow: hidden;
    }
      
    .card-swiper swiper-item.cur .swiper-item-text {
      margin-top: -150rpx;
      width: 100%;
      transform: translate(0rpx, 0rpx) scale(0.9, 0.9);
      transition: all 0.6s ease 0s;
    }
    
    .image-banner{
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0rpx 30rpx 60rpx 0rpx rgba(116,10,250, 0.08);
    }
    .image-banner image{
      width: 100%;
      height: 100%;
    }
  
  /* 轮播指示点 start*/
  .indication{
    z-index: 99;
    width: 100%;
    height: 36rpx;
    position: absolute;
    display:flex;
    margin-top: -50rpx;
    flex-direction:row;
    align-items:center;
    justify-content:center;
  }
  
  .spot{
    background-color: #3165CC;
    opacity: 0.4;
    width: 15rpx;
    height: 15rpx;
    border-radius: 20rpx;
    margin: 0 8rpx !important;
    position: relative;
  }
  
  .spot.active{
    opacity: 1;
    width: 35rpx;
    background-color: #3165CC;
  }
  
  /* 底部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;
    // line-height: 50rpx;
  }
  
  .tabbar .action .bar-icon image {
  	width: 50rpx;
  	height: 50rpx;
  	display: inline-block;
  }
  
  .tabbar .action .bar-circle {
    position: relative;
    display: block;
    margin: -30rpx auto 20rpx;
    text-align: center;
    font-size: 52rpx;
    line-height: 90rpx;
  	background-color: #01BEFF;
    width: 90rpx !important;
    height: 90rpx !important;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(1, 190, 255, 0.5);
  }
  
  .tabbar .action .bar-circle image {
    width: 60rpx;
  	height: 60rpx;
  	display: inline-block;
    margin: 15rpx auto 15rpx;
  }
  
</style>
