<template>
  <div>
    <menu-modal></menu-modal>
    <div class="main-container">
      <vehicle-banner
        :list = "bannerList"
        :looptime="looptime"
        :width="width"
        :height="height"
        :background="background"
        :color="color"
        :fontSize="fontSize"
        @prev="prev"
        @next="next"
        @change="changeBanner"
        @click="bannerClick"
        class="mb-50">
      </vehicle-banner>
      <div class="wrap" style="background: #f1f1f1;">
        <div class="bread-menu" style="margin-top: 20px;padding: 0">
          <nuxt-link to="/">首页></nuxt-link>
          <span>房车租赁</span>
        </div>
        <div class="total-div">
          共{{totalCount}}款车型
        </div>
        <ul class="campsiteDetail clearfix">
          <li v-for="item in dataDetail" :key="item.id" class="vehicle-item">
            <nuxt-link :to="item.link" class="flex-aic">
              <img class="v-img-cover" :src="item.coverPic" alt="房车租赁" />
              <div style="margin-left: 20px;width: 750px;">
                <h2 style="font-size: 18px;margin:10px 0">{{ item.name }}</h2>
                <div class="vehicle-desc">{{item.intro}}</div>
                <div class="flex-aic">
                  <span class="flex-aic config" v-for="(iitem,iindex) in item.uccnCataList" :key="iitem.id">
                    <img style="margin-right: 5px;" v-if="iindex==0" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZG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K/wb+QFFebIpWVTcDGLmBjI6hIMJAmKgQ1Rs5n4Y2ZO67zBh52bm/m3dnZ3UIcx14etpyeaLVabi6AU6hDFcbQhwuIwjCcpfMKtiJE9hi6UHMJ0IORvhtawH37iN1lCknkBq6gSeBrRrUVhjYcwYEVK5rtdCVyAj8med1ozfTfxXWVt6iIiSb+OezCVD3ZhyG4ynbgXf42fMADnFFV+68iNTbSdsrCVVLSgZQ1LsGK4iLleVaorsZa24At+ZvGn1tPeYnjr+o0PK3u7Nok3Rq/pHGkvITQWEfsqUfOjmEgkUP5q2zrXv9ryksI9XVPLs3KL/Asf4DAU2prDeUleuRubKB7MtWpvME3fMJXxn0KlJcQirTntkQqVPAIE9dkxqERKShupLyFkN6OrxvbgbV5AP+mqUo6ivPtm8v/reX6+v9jRS8n+xVgAORemfNTP4ZNAAAAAElFTkSuQmCC"/>
                    {{iitem.name}}
                  </span>
                  <span class="more-set">+更多配置</span>
                </div>
              </div>
              <nuxt-link :to="item.link" class="flex-aic">
                <button class="buttonDetails">租车详情<img style="position: absolute;" src="../assets/images/r.png"/></button>
              </nuxt-link>
            </nuxt-link>
          </li>
        </ul>
        <div class="right">
          <nuxt-child :key="$route.params.id" />
        </div>
      </div>
    </div>
    <footer-modal></footer-modal>
  </div>
</template>

<script>
  import axios from '../plugins/axios'

  import menuModal from "../components/menu";
  import footerModal from "../components/footer";
  import vehicleBanner from "../components/vehicleBanner"
  export default {
    transition: "bounce",
    components: {
      menuModal,
      footerModal,
      vehicleBanner
    },
    data() {
      return {
        totalCount: "",
        dataDetail: [],
        bannerList: [],//车型banner列表
        listQuery: {
          type: "",
          pageNo: 1,
          pageSize: 6
        },
        store: "",
        curId: 0,
        items1: {},
        curId1: 0,
        looptime: 4000, // 循环时间
        width: 400,
        height:200,
        background: 'red',
        color: '#fff',
        fontSize: '70px',
      };
    },
    created() {
      this.getAll();
      this.getBanner();
    },
    mounted() {
      window.addEventListener("scroll", this.scrollHandle); // 绑定页面的滚动事件
    },
    methods: {
      // 点击下一页回调
      prev () {
      },
      // 点击下一页回调
      next () {
      },
      // 鼠标移入状态点回调
      changeBanner () {
      },
      bannerClick () {
      },
      /**
       * 获取车型列表页banner
       */
      async getBanner(){
        //车型banner 0：首页，1：旅游 2：营地 3：房车 4：活动 5：新闻 6：关于欣新
        let tempBannerData = await axios.get( '/api/app/banner/app/unauth/findBannerlist?type=3&platform=1');
        let banner = tempBannerData.data.data;
        this.bannerList = banner;
      },
      chooseSelect(e) {
        console.log(e.target.value);
        this.listQuery.type = e.target.value;
        this.getAll();
      },
      async getAll() {
        let {
          data: { data }
        } = await axios.get(`/api/uccn/vehicleModel/app/unauth/findVehicleModelPage?page=1&limit=100`);
        this.totalCount = data.totalCount;
        data.data.map(function(item){
          item.link = encodeURI('/vehicleList/' + item.id+'?name='+item.name);
          item.link = encodeURI(item.link);
          item.pictureList = item.picture.split(",");
          item.coverPic = item.coverPic?item.coverPic: item.pictureList.length>0?item.pictureList[0]:'';
        });
        this.dataDetail = data.data;
        // this.dataDetail = this.dataDetail.push(data.data);
      },
      mounted() {
        window.addEventListener('scroll', this.scrollHandle);  // 绑定页面的滚动事件
      },
      scrollHandle: function(e) {
        //变量scrollTop是滚动条滚动时，距离顶部的距离
        var scrollTop = document.documentElement.scrollTop||document.body.scrollTop;
        //变量windowHeight是可视区的高度
        var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
        //变量scrollHeight是滚动条的总高度
        var scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;
        //滚动条到底部的条件
        if(scrollTop+windowHeight+0.7>scrollHeight){
          //写后台加载数据的函数
//          	      console.log("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight);
          // this.listQuery.pageNo++;
          // this.getAll();

        }
      }
    },
    head () {
      return {
        title: "欣新房车租赁|房车出租|房车服务|租用房车|出租房车|房车租赁APP"
      }
    }
  };
</script>

<style scoped>
  .clearfix:after {
    /*伪元素是行内元素 正常浏览器清除浮动方法*/
    content: "";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
  }
  .clearfix {
    *zoom: 1; /*ie6清除浮动的方式 *号只有IE6-IE7执行，其他浏览器不执行*/
  }
 .more-set:hover{
   border:1px solid #1bbb9f;
   color: #1bbb9f;
 }
  .more-set{
    border: 1px solid #999;
    padding: 3px 10px;
    color: #999;
    font-size: 12px;
    cursor: pointer;
  }
  .banner {
    /* background-color: #fff; */
    text-align: center;
  }
  .v-img-cover{
    width: 190px;
    height:122px;
  }

  .banner h2 {
    font-size: 20px;
    font-weight: 700;
    padding-top: 40px;
  }

  .banner h3 {
    font-size: 16px;
    padding-top: 20px;
    font-weight: 400;
    padding-bottom: 40px;
  }

  .campsiteDetail {
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .campsiteDetail li {
    list-style: none;
    display: flex;
  }

  .toDetail {
    font-size: 16px;
  }

  .buttonDetails {
    width: 116px;
    height: 34px;
    border-width: 0px;
    background: #1bbb9f;
    cursor: pointer;
    outline: none;
    font-family: Microsoft YaHei;
    color: white;
    font-size: 14px;
    padding-right: 15px;
  }
</style>
