<template>
  <view class="template-year 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">
          小脑虎，新年快乐
        </view>
        <view class="justify-content-item tn-margin" style="font-size: 50rpx;">
          <text class="tn-icon-zodiac-hu"></text>
        </view>
      </view>
    </view>
    
    
    <swiper class="card-swiper tn-margin tn-shadow-purplered" :current="cardCur" :circular="true" vertical="true"
      :autoplay="true" duration="500" interval="5000" @change="cardSwiper"  style="margin-top: 30rpx;"> 
      <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>
      </swiper-item>
    </swiper>
    <view class="indication">
        <block v-for="(item,index) in swiperList" :key="index">
            <view class="spot tn-text-center tn-padding-top-sm tn-shadow-blur" :class="cardCur==index?'active':''" @tap.stop="handleSwiperClick(index)">
              <text class="tn-text-bold">{{item.text}}</text>
            </view>
        </block>
    </view>
    
    <!-- banner start-->
    <view class="tn-flex tn-flex-wrap tn-padding-xs tn-margin-top-xl">
      <view class=" " style="width: 100%;">
        <view class="image-pic tn-shadow-blur" style="background-image:url('https://resource.tuniaokj.com/images/capsule-banner/banner-cap.png')">
           <view class="image-capsule">
           </view>
         </view>  
      </view>  
    </view>
    <!-- banner end-->
    
    
    <view class="tn-margin-top">
      <view class="nav_title--wrap">
        <view class="nav_title tn-cool-bg-color-1">
          <text class="tn-icon-lucky-money tn-padding-right-sm"></text>
          新 / 年 / 快 / 乐
          <text class="tn-icon-lucky-money tn-padding-left-sm"></text>
        </view>
      </view>
    </view>
    
    <!-- 图文 -->
    <!-- 比例 start-->
    <view class="tn-flex tn-flex-wrap tn-margin-sm">
      <block v-for="(item, index) in content" :key="index">
        <view class="" style="width: 50%;">
          <view class="tn-blogger-content__wrap">
            <view class="image-pic" :style="'background-image:url(' + item.mainImage + ')'">
              <view class="image-year">
              </view>
            </view> 
            
            <view class="tn-blogger-content__label tn-text-justify tn-padding-sm">
              <text class="tn-blogger-content__label__desc">{{ item.desc }}</text>  
            </view>
            
            <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-left-sm tn-padding-right-sm tn-padding-bottom-sm">
              <!-- <view class="justify-content-item tn-flex tn-flex-col-center">
                <view>
                  <view class="tn-color-gray">
                    <text class="tn-blogger-content__count-icon tn-icon-flower"></text> 
                    <text class="tn-padding-right-sm">{{ item.collectionCount }}</text>
                    <text class="tn-blogger-content__count-icon tn-icon-message"></text>
                    <text class="tn-padding-right-sm">{{ item.commentCount }}</text>
                    <text class="tn-blogger-content__count-icon tn-icon-like"></text>
                    <text class="">{{ item.likeCount }}</text>
                  </view>
                </view>
              </view> -->
              <view class="justify-content-item tn-text-center">
                <view v-for="(label_item,label_index) in item.label" :key="label_index" class="tn-blogger-content__label__item tn-float-left tn-margin-right tn-bg-gray--light tn-round tn-text-sm tn-text-bold">
                  <text class="tn-blogger-content__label__item--prefix">#</text> {{ label_item }}
                </view>
              </view>
            </view>
            
            
          </view>
        </view>
      </block>
    </view>
    <!-- 比例 end-->
    
    
    <!-- 底部tabbar start-->
    <view class="tabbar footerfixed">
      <view class="action">
        <view class="bar-icon">
          <view class="tn-icon-home-vertical-fill tn-color-purplered">
          </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-icon">
          <view class="tn-icon-discover tn-color-gray--dark">
          </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-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-image-text tn-color-gray--dark">
          </view>
          <!-- <image class="" src='https://resource.tuniaokj.com/images/tabbar/case_tn.png'></image> -->
        </view>
        <view class="tn-color-gray">灯谜</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <view class="tn-icon-my 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>
    <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: 'TemplateYear',
    mixins: [template_page_mixin],
    components: { NavIndexButton },
    data(){
      return {
        cardCur: 0,
        swiperList: [{
          id: 0,
          type: 'image',
          name: '一起愉快的玩耍叭',
          text: '恭 · 跨年',
          url: 'https://resource.tuniaokj.com/images/shop/banner2.jpg',
        }, {
          id: 1,
          type: 'image',
          name: '如果你也有不错的作品',
          text: '喜 · 祝福',
          url: 'https://resource.tuniaokj.com/images/swiper/ad1.jpg',
        }, {
          id: 2,
          type: 'image',
          name: '用最少的代码做最骚的效果',
          text: '发 · 红包',
          url: 'https://resource.tuniaokj.com/images/swiper/ad2.jpg',
        }, {
          id: 3,
          type: 'image',
          name: '商业合作请联系作者',
          text: '财 · 红庆',
          url: 'https://resource.tuniaokj.com/images/swiper/ad3.jpg',
        }, {
          id: 4,
          type: 'image',
          name: '我们都是好孩子',
          text: '虎 · 生威',
          url: 'https://resource.tuniaokj.com/images/swiper/ad4.jpg',
        }],
        content: [
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/prototype2.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 999,
            commentCount: 999,
            likeCount: 999
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/prototype1.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/computer2.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/phonecase1.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/phonecase2.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '我们都是好孩子',
            mainImage: 'https://resource.tuniaokj.com/images/shop/watch1.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/sticker.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          },
          {
            userAvatar: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg',
            userName: '可我会像',
            date: '2021年12月20日',
            label: ['开源','创意'],
            desc: '免费开源可商用组件',
            mainImage: 'https://resource.tuniaokj.com/images/shop/card.jpg',
            viewUser: {
              latestUserAvatar: [
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_1.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_2.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_3.jpeg'},
                {src: 'https://resource.tuniaokj.com/images/blogger/avatar_4.jpeg'},
              ],
              viewUserCount: 129
            },
            collectionCount: 265,
            commentCount: 22,
            likeCount: 62
          }
        ]
      }
    },
    methods: {
      // cardSwiper
      cardSwiper(e) {
        this.cardCur = e.detail.current
      },
      // swiper点击事件
      handleSwiperClick(index) {
        this.cardCur = index
      },
    }
  }
</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: 10rpx 0;
        margin: 0 30rpx;
        border-radius: 60rpx 60rpx 0 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: 650rpx !important;
        width: 500rpx;
        border-radius: 20rpx;
        overflow: hidden;
      }
    
      .card-swiper swiper-item {
        height: 650rpx;
        width: 500rpx;
        box-sizing: border-box;
        padding: 0rpx;
        border-radius: 20rpx;
        overflow: hidden;
      }
    
      .card-swiper swiper-item .swiper-item {
        width: 100%;
        display: block;
        height: 100%;
        border-radius: 0rpx;
        transform: scale(1);
        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;
      }
    
      .image-banner{
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .image-banner image{
        width: 100%;
        height: 100%;
      }
      /* 轮播指示点 start*/
      .indication{
        z-index: 9999;
        width: 100%;
        height: 36rpx;
        position: absolute;
        display:inline-block;
        flex-direction:row;
        align-items:center;
        justify-content:center;
      }
      
      .spot{
        color: #E83A30;
        background-color: #FAD5E8;
        opacity: 1;
        width: 160rpx;
        height: 80rpx;
        border-radius: 20rpx;
        margin: 20rpx -30rpx !important;
        left: 590rpx;
        right: 0;
        top: -700rpx;
        position: relative;
      }
      
      .spot.active{
        color: #FFFFFF;
        opacity: 1;
        background-color: #E83A30;
      }
      /* 标题 start */
      .nav_title {
        -webkit-background-clip: text;
        color: transparent;
        
        &--wrap {
          position: relative;
          display: flex;
          height: 120rpx;
          font-size: 46rpx;
          align-items: center;
          justify-content: center;
          font-weight: bold;
          background-image: url(https://resource.tuniaokj.com/images/title_bg/title44.png);
          background-size: cover;
        }
      }
      /* 标题 end */
      
      /* 文章内容 start*/
      .tn-blogger-content {
        &__wrap {
          box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.12);
          border-radius: 20rpx;
          margin: 15rpx;
        }
        
        &__info {
          &__btn {
            margin-right: -12rpx;
            opacity: 0.5;
          }
        }
        
        &__label {
          &__item {
            line-height: 45rpx;
            padding: 0 20rpx;
            margin: 5rpx 18rpx 0 0;
            
            &--prefix {
              color: #82B2FF;
              padding-right: 10rpx;
            }
          }
          
          &__desc {
            line-height: 35rpx;
          }
        }
        
        &__main-image {
          border-radius: 16rpx 16rpx 0 0;
          
          &--1 {
            max-width: 690rpx;
            min-width: 690rpx;
            max-height: 400rpx;
            min-height: 400rpx;
          }
          
          &--2 {
            max-width: 260rpx;
            max-height: 260rpx;
          }
          
          &--3 {
            height: 212rpx;
            width: 100%;
          }
        }
        
        &__count-icon {
          font-size: 30rpx;
          padding-right: 5rpx;
        }
      }
      
      .image-year{
        padding: 150rpx 0rpx;
        font-size: 16rpx;
        font-weight: 300;
        position: relative;
      }
      .image-capsule{
        padding: 100rpx 0rpx;
        font-size: 40rpx;
        font-weight: 300;
        position: relative;
      }
      .image-pic{
        background-size: cover;
        background-repeat:no-repeat;
        // background-attachment:fixed;
        background-position:top;
        border-radius: 20rpx 20rpx 0 0;
      }

      /* 文章内容 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;
        // line-height: 50rpx;
      }
      
      .tabbar .action .bar-icon image {
      	width: 50rpx;
      	height: 50rpx;
      	display: inline-block;
      }
      
      .tabbar .action .bar-circle {
        position: relative;
        display: block;
        margin: -60rpx auto 20rpx;
        text-align: center;
        font-size: 52rpx;
        line-height: 90rpx;
      	background-color: #E72F8C;
        width: 90rpx !important;
        height: 90rpx !important;
        overflow: hidden;
        border-radius: 50%;
        box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(231, 47, 140, 0.5);
      }
      
      .tabbar .action .bar-circle image {
        width: 60rpx;
      	height: 60rpx;
      	display: inline-block;
        margin: 15rpx auto 15rpx;
      }
      

</style>
