<template>
  <div class="doc_container">
    <side-nav-bar
      title="开发文档管理"
      imgSrc="tool_ic_kaifawendang"
      :nav-list="navList"
      :title-path="navList[0] && navList[0].path"
      style="width: 200px;"
    ></side-nav-bar>
    <div class="main_container">
      <router-view />
    </div>
  </div>
</template>

<script>
import sideNavBar from "@/components/side-nav-bar";

export default {
  components: {
    sideNavBar,
  },
  data: () => ({
    navList: [],
  }),
  methods: {
    initNavList() {
      this.$api.general.getNowMenu({ teamName: "APAAS3" }).then((response) => {
        if (response.data.success == 1) {
          let arr = response.data.data[0].Child;

          for (let i = 0; i < arr.length; i++) {
            let first = arr[i];

            if (first.visit_url == "/technical_support") {
              for (let j = 0; j < first.Child.length; j++) {
                let second = first.Child[j];

                if (second.visit_url == "/technical_support/doc_manage") {
                  this.navList = second.Child.map((item) => ({
                    name: item.menu_name,
                    path: item.visit_url,
                  }));
                  break;
                }
              }
              break;
            }
          }
        }
      });
    },
  },
  mounted() {
    this.initNavList();
  },
};
</script>

<style scoped>
.doc_container {
  height: calc(100vh - 58px);
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
}
.side_nav_bar {
  width: 180px;
  flex-shrink: 0;
}
.main_container {
  width: calc(100% - 180px);
  flex-grow: 1;
  flex-shrink: 1;
  background-color: #f6f7fb;
  overflow: auto;
}
</style>
