<template>
  <div class="temp-layout">
    <div class="banner">
      <div class="container">
        <h1>{{$t('service.title')}}</h1>
        <ul>
          <li :class="{'is-active': $route.path === item.path}" v-for="item in listItem" :key="item.name" @click="$router.push(item.path)">{{ item.name }}</li>
        </ul>
      </div>
    </div>
    <div class="oper-btn" v-if="$route.params.id === 'use'">
      <a :href="`${$cdn}pdf/${language==='en'?'4DKanKan Pro Product Manual':'四维看看说明书_1.0'}.pdf`" target="_blank">
        <img :src="`${$cdn}images/use-download.png`" alt="">
      </a>
    </div>
    <component class="fix-layout" :is="active.cp" :data='active'/>
  </div>
</template>

<script>
import lselect from '@/components/lselect'
import {mapState} from 'vuex'
import iuse from './use'
import iapp from './app'
import ibefore from './before'
import iqa from './qa'
import iclause from './clause'
import iproduct from './product'
import data from './config'
import mVideo from '../video'

export default {
  computed: {
    ...mapState({
      split: state => state.ui.navDivision,
      language: state => state.language.current
    })
  },
  data () {
    return {
      active: '',
      listItem: [
        {
          name: this.$t('service.app'),
          path: '/service/app/pro'
        },
        {
          name: this.$t('service.use'),
          path: '/service/use/pro'
        },
        {
          name: this.$t('service.clause'),
          path: '/service/clause/pro'
        },
        {
          name: this.$t('service.mVideo'),
          path: '/service/mVideo/all'
        }
      ]
    }
  },
  methods: {
  },
  watch: {
    '$route.params': {
      immediate: true,
      handler: function (newVal) {
        if (newVal.active && newVal.active !== 'all') {
          this.active = data[newVal.id][newVal.active]
        } else {
          this.active = {
            cp: newVal.id
          }
        }
      }
    }
  },
  components: {lselect, ibefore, iuse, iapp, iproduct, iclause, iqa, mVideo},
  mounted () {
  }
}
</script>

<style lang="scss" scoped>
.temp-layout{
  overflow: hidden;
  position: relative;
  .oper-btn{
    position: absolute;
    right: 50px;
    top: 50px;
  }
}
.banner {
  width: 100%;
  height: 290px;
  background: url(~@/assets/images/refactor/appDownload/banner.jpg) no-repeat center center;
  h1 {
    font-size: 40px;
    font-weight: normal;
    padding-top: 107px;
    line-height: 50px;
    margin-bottom: 30px;
  }
  ul {
    display: flex;
  }
  li {
    padding: 0 30px;
    font-size: 16px;
    color: #909090;
    cursor: pointer;
    font-weight: bold;
    &:first-child {
      padding-left: 0;
    }
    &.is-active, &:hover {
      color: #202020;
    }
  }
}
  @media screen and (max-width: 1600px) {
  // .fix-layout{
  //   margin-right: auto!important;
  //   max-width: 900px!important;
  // }
}
</style>
