<!--
 * @Author: your name
 * @Date: 2021-01-09 20:19:.gitignore
 * @LastEditTime: 2021-01-13 17:21:02
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /java-pc/src/components/FooterBottom.vue
-->
<template>
  <div>
    <div class="footer_service_wrap" v-if="ImgBG">
      <div class="footer_service">
        <a>
          <img :src="ImgBG"  alt />
        </a>
      </div>
    </div>
    <div class="footer_link">
      <div class="link_box" v-if="navList.data.length > 0">
        <div class="link_wrap" v-for="(
            { categoryName, categoryId, articleList }, index
          ) in navList.data" :key="index">
          <p @click="toarticle(categoryId)">{{ categoryName }}</p>
          <li v-for="({ title, cateId, articleId }, index) in articleList" :key="index">
            <!-- <router-link :to="{
              path: '/article',
              query: { cateId: cateId, articleId: articleId },
            }" replace> -->
              <a style="cursor:pointer" @click="getContent(articleId)">{{ title }}</a>
            <!-- </router-link> -->
          </li>
        </div>
      </div>
      <div class="bottom_box">
        <div class="footer_bottom">
          <ul class="footer_list">
            <li v-for="({ linkName, linkUrl }, index) in helpList.data" :key="index">
              <a :href="linkUrl" target="_blank">
                {{ linkName }}
              </a>
            </li>
          </ul>
          <p class="copy_right">
            {{ CopyrightData.data[1] }} {{ L["版权所有"] }}
            <a style="text-decoration: underline;color:#333;" href="https://beian.miit.gov.cn/" target="_blank">{{ CopyrightData.data[0] }}</a>
          </p>
          <p class="author">
            {{ CopyrightData.data[2] }} {{ L["提供技术支持"] }}
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
const L = getCurLanguage();
const ImgBG = ref('')
const router = useRouter()
//获取底部合作案例-联系我们等帮助部分的链接list
const helpList = reactive({ data: [] });
const getInitDataList = async () => {
  const { data: res } = await useFetch(
    apiUrl + "/v3/cms/front/friendLink/list"
  );
  if (res._rawValue.state == 200) {
    helpList.data = res._rawValue.data;
  }
};
getInitDataList();

//获取产品列表-新手说明等部分的链接list
const navList = reactive({ data: [] });
const getInitData = async () => {
  const { data: res } = await useFetch(
    apiUrl + "/v3/cms/front/article/helpList",
    {
      params: {
        cateSize: 6,
        articleSize: 5,
      },
    }
  );
  if (res._rawValue.state == 200) {
    navList.data = res._rawValue.data;
  }
};

getInitData();

//跳转判断
const getContent = (articleId) => {
  const params = {
    articleId: articleId,
  };
  get("v3/cms/front/article/articleDetail", params).then((res) => {
    if (res.state === 200) {
      if (res.data.outUrl) {
        window.open(res.data.outUrl,'_blank');
        return
      }else{
        router.push({ path: "/article", query: { articleId: articleId }});
      }
    }
  });
}

//获取版权，技术支持信息
const CopyrightData = reactive({ data: [] });
const getCopyrightData = async () => {
  const { data: res } = await useFetch(
    apiUrl +
    "v3/system/front/setting/getSettings?names=basic_site_icp,basic_site_copyright,basic_site_technical_support,pc_home_bottom_adv"
  );
  if (res._rawValue.state == 200) {
    CopyrightData.data = res._rawValue.data;
    ImgBG.value = res._rawValue.data[3]
  }
};

getCopyrightData();
</script>

<style lang="scss" scoped>
@import "@/assets/style/theme.scss";

.footer_link {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  background: #eaeaea;
  background: rgb(176 221 204 / 37%);
  .link_box {
    border-top: 1px dashed #f2f2f2;
    padding-top: 50px;
    width: 1210px;
    margin: 0 auto 50px;
    display: flex;
    position: relative;
    flex-direction: row;
    justify-content: space-between;

    .link_wrap {
      text-align: left;

      p {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 20px;
        color: #333333;
      }

      li {
        line-height: 25px;

        a {
          color: #333333;

          &:hover {
            color: $colorMain;
          }
        }
      }
    }

    .link_wrap:nth-child(1) {
      /*width: 295px;*/
      /*text-align: left;*/
    }

    .link_wrap:nth-child(2) {
      /*width: 270px;*/
    }

    .link_wrap:nth-child(3) {
      /*width: 280px;*/
    }

    .link_wrap:nth-child(4) {
      /*width: 280px;*/
    }

    .link_wrap:nth-child(5) {
      /*width: 280px;*/
    }
  }

  .bottom_box,
  .bottom_box_none {
    position: relative;
    width: 100%;
    overflow: hidden;
    height: 130px;
  }

  .bottom_box_none {
    width: 100%;
    height: 87px;
    background-color: #333333;
  }
}
</style>

<style lang="scss" scoped>
.footer_bottom {
  background: rgba(176, 221, 204, 0.37);
  position: absolute;
  width: 100%;
  overflow: hidden;
  bottom: 0;
  color: #333;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 12px;
  padding-top: 12px;

  .footer_list {
    width: 1200px;
    margin: 15px auto;
    display: flex;
    margin-bottom: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: center;

    li {
      box-sizing: border-box;
      padding: 0 7px;
      border-right: 1px solid rgba(255, 255, 255, 0.4);
      color: #333;
      line-height: 19px;
      cursor: pointer;

      a {
        color: #333;
      }
    }
  }

  li:last-child {
    border-right: none;
  }

  .copy_right {
    letter-spacing: 1px;
    margin-bottom: 10px;
  }
}

.footer_service_wrap {
  width: 100%;
  height: 100%;

  .footer_service {
    width: 100%;
    height: 50px;
    overflow: hidden;

    a {
      display: inline-block;
      width: 100%;
      height: 100%;

      // overflow: hidden;
      img {
        width: 1920px;
        height: 100%;
        margin-left: -960px;
        left: 50%;
        position: relative;
        overflow: hidden;
        display: block;
      }
    }
  }
}
</style>
