<template>
  <div id="proginn-footer">
    <div id="friend-links">
      <div class="links">
        <a href="/">
          <img class="logo" src="https://www.proginn.com/Public/image/common/logo_new.png">
        </a>
        <div class="items">
          <div class="item-box" v-for="(link, index) of links" :key="index">
            <span class="name">{{link.name}}</span>
            <div class="item">
              <div class="list" :class="{expand: link.expand}">
                <a v-for="(item, ii) of link.data" :key="ii" :href="item.url" target="_blank">{{item.name}}</a>
              </div>
              <span
                class="more"
                style="display: inline;"
                @click="clickMore(link, index)"
              >{{link.expand ? '收起' : '更多'}}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="footer" id="footer">
      <div class="footer-container">
        <div class="footer-links">
          <a class="item" href="/index/app" rel="nofollow">APP下载</a>
          <a class="item" href="http://support.proginn.com/" rel="nofollow">帮助</a>
          <a class="item" href="/about" rel="nofollow">关于我们</a>
          <a class="item" href="/about/mediareports" rel="nofollow">媒体报道</a>
          <a class="item" href="https://inn.proginn.com/sites/" rel="nofollow">合作伙伴</a>
          <a class="item" href="/about/suggestion" rel="nofollow">意见反馈</a>
          <span style="color: rgb(204, 204, 204);" class="ui item">© 程序员客栈</span>
        </div>
        <div class="safe">
          <a href="http://www.miibeian.gov.cn" target="_blank" rel="nofollow">浙ICP备15029175号</a>
          <div>
            <a
              style="display: flex;"
              target="_blank"
              href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=33011002011566"
              rel="nofollow"
            >
              <img
                width="20"
                height="20"
                src="https://www.proginn.com/Public/image/common/badge.png"
              >
              <span
                style="height:20px;line-height:20px;margin: 0px 0px 0px 5px;"
              >浙公网安备 33011002011566号</span>
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isCity: false,
      isBusiness: false,
      isDirection: false,
      isRecommend: false,
      links: [],
    }
  },
  mounted() {
    this.getLinks()
  },
  methods: {
    clickMore(link, index) {
      link.expand = !link.expand
      this.$set(this.links, index, link)
    },
    async getLinks() {
      let res = await this.$post('/api/public_config/get_seo_footer_links')
      if(res) {
        this.links = res.data.links
      }
    }
  }
}
</script>

<style scoped>
#proginn-footer {
  width: 100%;
}
#friend-links,
#footer {
  display: flex;
  justify-content: center;
  background: white;
}
#friend-links {
  padding: 50px 0 40px;
}
.links,
.footer-container {
  display: flex;
  justify-content: space-between;
  width: 1000px;
  font-size: 12px;
  color: #4a4a4a;
}
.logo {
  width: 115px;
  height: 38px;
  margin-top: 10px;
}
.items {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 840px;
}
.item {
  display: flex;
}
.name {
  line-height: 30px;
  font-weight: 800;
}
.list {
  --height: 30px;
  flex: 1;
  height: var(--height);
  line-height: var(--height);
  overflow: hidden;
}
.list a {
  display: inline-block;
  margin: 0 15px 0 0;
}
.expand {
  height: auto;
}
.footer-container a,
.list a {
  color: #4a4a4a;
}
.footer-container {
  display: flex;
  align-items: center;
  border-top: 1px solid #ddd;
  padding: 20px 0 10px;
}
.footer-links {
  display: flex;
  align-items: center;
}
.footer-container a {
  margin: 0 30px 0 0;
}
.safe {
  text-align: right;
}
.safe a {
  margin: 0;
}
.more {
  line-height: 30px;
  cursor: pointer;
}
.more:hover {
  color: #1782d9;
}
</style>
