<template>
  <div>
    <lucency-header :lang="lang" :page-key="pageKey"></lucency-header>
    <item-banner :title="'支持中心'" :sub-title="'需要我们为您提供些什么内容呢?'"></item-banner>
    <div class="conBox">
      <q-tab :headers="qTabs">
        <template v-slot:question>
          <support ></support>
        </template>
        <template v-slot:download>
         <downloads :downloads="downloadsType"></downloads>
        </template>
      </q-tab>
    </div>
    <default-footer :lang="lang"></default-footer>
    <site-bar wechat-src="/image/wechat.jpg"></site-bar>
  </div>
</template>

<script>
import lucencyHeader from "~/components/header/lucencyHeader";
import langMap from "@/map/langMap";
export default {
  name: "index",
  props:['uLang'],
  components: { lucencyHeader },
  data(){
    return {
      lang: this.uLang?this.uLang:langMap.lang.cn,
      pageKey: 'support',
      qTabs: [
        {
          text: '技术支持',
          content: '技术支持',
          key: 'question'
        },
        {
          text: '下载中心',
          content: '下载相关技术资料',
          key: 'download'
        },
      ],
      downloadsType: [
        {
          title: "G8100",
          key: 1,
          subItems: [
            {
              icon: "doc",
              title: "4G低功耗模块G8100B硬件手册",
              url: "https://gpscore.net/",
              add_time: "1486538906"
            },
            {
              icon: "pdf",
              title: "4G低功耗模块G8100B硬件手册",
              url: "https://gpscore.net/",
              add_time: "1486538906"
            },
            {
              icon: "img",
              title: "4G低功耗模块G8100B硬件手册",
              url: "https://gpscore.net/",
              add_time: "1486538906"
            }
          ]
        },
        {
          title: "枪机摄像头",
          key: 2,
          subItems: [
            {
              icon: "doc",
              title: "4G低功耗模块G8100B硬件手册",
              url: "https://gpscore.net/",
              add_time: "1486538906"
            },
            {
              icon: "pdf",
              title: "4G低功耗模块G8100B硬件手册",
              url: "https://gpscore.net/",
              add_time: "1486538906"
            },
            {
              icon: "img",
              title: "4G低功耗模块G8100B硬件手册",
              url: "https://gpscore.net/",
              add_time: "1486538906"
            }
          ]
        }
      ]
    }
  },
  mounted() {
    this.$root.$on('changeLang',this.switchLang);
    // todo 从后台获取下载列表数据
  },
  methods:{
    switchLang(nextLang){
      if(nextLang){
        this.lang = nextLang;
      }else{
        if(this.lang === langMap.lang.cn){
          this.lang = langMap.lang.en
        }else{
          this.lang = langMap.lang.cn
        }
      }
    }
  },
}
</script>

<style scoped>

</style>
