<template>
  <div class="wind-site">
    <div class="page-common-body">
      <div class="page-common-body-router">
        <router-view />
      </div>
      <div class="page-common-body-menu">
        <div class="page-common-body-menu-box">
          <div class="page-common-body-menu-border left top"></div>
          <div class="page-common-body-menu-border left bottom"></div>
          <div class="page-common-body-menu-border right top"></div>
          <div class="page-common-body-menu-border right bottom"></div>
          <div class="page-common-body-menu-item" v-for="(menuData, index) of menuDatas" :key="index" @click="clickMenu(index)" :class="{ active: activeIndex == index }">
            <router-link :to="menuData.path">
              <span class="svg-icon" :class="activeIndex == index ? 'svg-icon-yellow' : 'svg-icon-green'">
                <SvgIcon :svgid="menuData.icon"></SvgIcon>
              </span>
            </router-link>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import SvgIcon from "@com/coms/icon/svg-icon.vue";
export default {
  // 名称
  name: "WindSite",
  // 使用组件
  components: {
    SvgIcon,
  },
  // 数据
  data() {
    return {
      activeIndex: 0,
      menuDatas: [
        {
          icon: "svg-agc",
          path: "/windsite/home",
        },
        {
          icon: "svg-matrix",
          path: "/windsite/draughtfanlist",
        },
        {
          icon: "svg-agc",
          path: "/windsite/matrix",
        },
        {
          icon: "svg-agc",
          path: "/windsite/lightmatrix",
        },
        {
          icon: "svg-intranet-involvement",
          path: "/windsite/box",
        },
        {
          icon: "svg-easy-compass",
          path: "/windsite/home",
        },
        {
          icon: "svg-easy-compass",
          path: "/windsite/home",
        },
      ],
    };
  },
  // 函数
  methods: {
    clickMenu: function(index) {
      this.activeIndex = index;
    },
  },
  // 生命周期钩子
  beforeCreate() {
    // 创建前
  },
  created() {
    // 创建后
  },
  beforeMount() {
    // 渲染前
  },
  mounted() {
    // 渲染后
  },
  beforeUpdate() {
    // 数据更新前
  },
  updated() {
    // 数据更新后
  },
};
</script>

<style lang="less" scoped>
.wind-site {
  .page-common-body {
    display: flex;
    flex-direction: row;
    margin-top: 8px;

    .page-common-body-router {
      overflow: auto;
      height: calc(100vh - 7.037vh);
      flex: 1 0 auto;
    }

    .page-common-body-menu {
      width: 7.407vh;
      padding: 0 1.481vh 1.481vh 1.481vh;

      .page-common-body-menu-box {
        border: 1px solid @gray;
        background-color: fade(@gray, 30%);
        padding: 24px 2px;
        position: relative;

        .page-common-body-menu-border {
          position: absolute;
          width: 4px;
          height: 4px;
          background-color: @write;
          border-radius: 50%;

          &.left {
            left: -2px;
          }

          &.right {
            right: -2px;
          }

          &.top {
            top: -2px;
          }

          &.bottom {
            bottom: -2px;
          }
        }

        .page-common-body-menu-item {
          border: 1px solid fade(@green, 40%);
          width: 3.889vh;
          height: 3.889vh;
          border-radius: 3px;
          margin-top: 0.741vh;
          display: flex;
          align-items: center;
          justify-content: center;
          cursor: pointer;

          a {
            line-height: 0;
          }

          &:first-child {
            margin-top: 0;
          }

          &.active {
            border-color: fade(@yellow, 40%);
            position: relative;

            &::after {
              content: "";
              width: calc(100% - 4px);
              height: calc(100% - 4px);
              position: absolute;
              border: 1px solid @yellow;
              box-shadow: 0 0 4px @yellow;
              top: 1px;
              left: 1px;
            }
          }
        }
      }
    }
  }
}
</style>
