<script setup>
import { ref } from 'vue'
const goDetail = (info) => {
  console.log(info)
  window.open(info.url, '_blank');
}
const navsData = ref([
  {
    typeName: '私有部署',
    urlList: [
      {
        logo: '/logos/drone.png',
        title: 'drone',
        desc: 'CI/CD自动化部署工具',
        url: 'https://drone.chuckchen.top',
        detail: null  // markdown
      },
      {
        logo: '/logos/gogs.png',
        title: 'gogs',
        desc: 'gogs私有代码管理仓库',
        url: 'https://gogs.chuckchen.top',
        detail: null  // markdown
      },
      {
        logo: '/logos/yapi.png',
        title: 'yapi',
        desc: 'api接口管理中心',
        url: 'https://yapi.chuckchen.top',
        detail: null  // markdown
      },
      {
        logo: '/logos/registry-web.png',
        title: 'registry-web',
        desc: 'docker私有镜像仓库web管理',
        url: 'https://registry-web.chuckchen.top',
        detail: null  // markdown
      },
      {
        logo: '/logos/bookstack.png',
        title: 'bookstack',
        desc: '私有图书馆、知识库',
        url: 'https://bookstack.chuckchen.top',
        detail: null  // markdown
      },
      {
        logo: '/logos/verdaccio.svg',
        title: 'verdaccio',
        desc: '私有npm仓库',
        url: 'https://verdaccio.chuckchen.top',
        detail: null  // markdown
      },
    ]
  },
  {
    typeName: '必备网站',
    urlList: [
      {
        logo: '/logos/github.png',
        title: 'Github',
        desc: '全球最大的代码托管平台',
        url: 'https://github.com',
        detail: null  // markdown
      },
    ]
  }
])
</script>

<template>
  <div class="container">
    <div class="left">
      <div class="logo">分类菜单</div>
      <div class="navs">
        <div class="nav-item" v-for="item in navsData" :key="item.typeName">{{ item.typeName }}</div>
      </div>
    </div>
    <div class="right">
      <div class="r-top">
        <span style="color: #ba0a0a;">CHUCK</span>办公网址导航
      </div>
      <div class="r-bottom">
        <div class="content">
          <div v-for="item in navsData" :key="item.typeName">
            <div class="item-title">{{ item.typeName }}</div>
            <div class="url-list">
              <div class="list-item" v-for="info in item.urlList" :key="info.title" @click="goDetail(info)">
                <img :src="info.logo">
                <div class="info">
                  <h3>{{ info.title }}</h3>
                  <p>{{ info.desc }}</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style>
  * {
    margin: 0;
    padding:0;
  }
  body,html {
    background: #f9f9f9;
  }
</style>
<style scoped>
  @media (max-width: 600px) {
    .left {
      display: none;
    }
    .right {
      margin-left: unset !important;
    }
    .list-item{
      width: 100% !important;
    }
  }
  .left{
    position: fixed;
    width: 300px;
    height: 100vh;
    background-color: #2c2e2f;
    box-sizing: border-box;
    color: #979898;
  }
  .logo{
    line-height: 80px;
    box-sizing: border-box;
    border-bottom: 1px solid #313437;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
  }
  .navs{

  }
  .navs .nav-item{
    text-align: center;
    line-height: 50px;
    border-bottom: 1px solid #313437;
    transition: all .3s;
    cursor: pointer;
  }
  .navs .nav-item:hover,.navs .nav-item.active{
    color:white;
  }
  .right{
    margin-left: 300px;
    height: 100vh;
    overflow: hidden;
  }
  .r-top{
    position: fixed;
    width: 100%;
    height: 80px;
    background: white;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 20px;
    font-size: 18px;
    font-weight: bold;
  }
  .r-bottom{
    height: calc(100vh - 80px);
    width: 100%;
    overflow-y: auto;
    margin-top:80px;
    padding: 20px;
    box-sizing: border-box;
  }
  .r-bottom .content{
    height: 200px;
  }
  .url-list{
    display: flex;
    flex-wrap: wrap;
  }
  .item-title{
    margin-top: 20px;
    margin-bottom: 20px;
  }
  .list-item{
    width: 24%; 
    background:white;
    border:1px solid #e4ecf3;
    transition: all .3s;
    cursor: pointer;
    border-radius: 4px;
    padding:20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    margin: 10px 0;
    color: #333;
  }
  .list-item:not(:nth-child(4n)) {
    margin-right: calc(4% / 3);
  }
  .list-item:hover{
    box-shadow: 0 10px 10px rgba(0,0,0,.1);
  }
  .list-item h3{
    font-size: 16px;
  }
  .list-item img{
    width: 10%;
    margin-right: 10px;
  }
  .list-item p{
    color:#979898;
    font-size:12px;
    margin-top: 5px;
  }
</style>
