<!-- @format -->

<template>
  <a-config-provider :locale="locale">
    <router-view />
  </a-config-provider>
</template>

<script lang="ts">
  import { defineComponent, watch, ref } from 'vue';
  import zhCN from 'ant-design-vue/es/locale/zh_CN';
  import { useRouter } from 'vue-router';
  import Cookies from 'js-cookie';
  import { message } from 'ant-design-vue';
  export default defineComponent({
    name: 'App',

    setup() {
      const router = useRouter();
      router.beforeEach((to, from) => {
        if (Cookies.get('nervsid') === undefined && to.fullPath !== '/login') {
          if (from.name !== undefined) {
            message.warn('登陆信息已过期，请重新登录!', 1);
          }
          router.push('/login');
        }
      });

      const cachedViews = ['Status'];

      // watch(
      //   () => router.currentRoute.value,
      //   (e) => {
      //     // if (Cookies.get('nervsid') === undefined && e.fullPath !== '/login') {
      //     //   message.warn('登陆信息已过期，请重新登录!', 1);
      //     //   router.push('/login');
      //     // }
      //     // } else {
      //     //   if (Cookies.get('nervsid') !== undefined && e === '/login') {
      //     //     let url = window.sessionStorage.getItem('url');
      //     //     url === null ? window.sessionStorage.setItem('url', '/doorway/visitor/audit') : '';
      //     //     router.push(url === null ? '/doorway' : url);
      //     //   }
      //     // }
      //   }
      // );
      return {
        cachedViews,
        locale: zhCN,
      };
    },
  });
</script>

<style lang="less" scoped>
  #app {
    width: 100%;
    height: 100%;
  }
  :deep(.nsHeader_action) {
    .action {
      cursor: pointer;
      &:hover {
        background-color: @primary-color;
      }
    }
  }

  /***顶部菜单和侧边菜单样式修改 */
  :deep(.ns-left-menu) {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99;
    height: calc(100% - 40px);
    background-image: url(/asset/image/side.png);
    background-size: cover;
    padding-top: 48px;
    .ant-layout-sider-children {
      background-color: transparent;
      .ant-menu-root {
        background-color: transparent;
      }
      .ant-menu {
        color: rgba(255, 255, 255, 0.9);
      }
      .ant-menu-item a {
        color: rgba(255, 255, 255, 0.9);
      }
      .ant-menu-submenu-expand-icon,
      .ant-menu-submenu-arrow {
        color: rgba(255, 255, 255, 0.9);
      }
      .ant-menu-sub.ant-menu-inline {
        background-color: #001027;
      }
    }
  }
  :deep(.ns-header-menu) {
    background-size: 100% 100%;
    .ant-menu-root {
      background-color: transparent;
    }
    .ant-menu.ant-menu-dark .ant-menu-item:hover {
      background: @primary-color !important;
    }
    .ant-menu.ant-menu-dark .ant-menu-item-selected {
      background: @primary-color !important;
    }
  }
  :deep(.ns-left-menu-trigger) {
    background: rgba(0, 0, 0, 0.1) !important;
  }
  :deep(.ant-menu-inline .ant-menu-item-selected) {
    &::after {
      position: absolute;
      border: unset !important;
      content: '';
    }
    &::before {
      background: transparent;
    }
  }
  /********* 菜单选中符号修改 */
  :deep(.ant-menu-sub .ant-menu-item-selected::after) {
    position: absolute;
    width: 2px;
    height: 14px;
    background: #fff;
    border: unset;
    top: 14px;
    left: 20px;
    right: 0;
    bottom: 0;
    content: '';
  }
  :deep(.ant-menu-submenu .ant-menu-submenu .ant-menu-sub .ant-menu-item-selected::after) {
    position: absolute;
    width: 2px;
    height: 14px;
    background: #fff;
    border: unset;
    top: 14px;
    left: 40px;
    right: 0;
    bottom: 0;
    content: '';
  }
  /********* 一级菜单选中效果 */
  :deep(.firstMenuItem-selected) {
    background: @primary-color!important;
    border-radius: 4px;
  }
  :deep(.ns-left-menu .ant-layout-sider-children .ant-menu-submenu-arrow) {
    color: rgba(255, 255, 255, 0.5);
  }
  :deep(.ant-layout-sider-children) {
    overflow-x: hidden;
  }
  :deep(.ns-left-menu .firstMenuItem-selected .ant-menu-title-content) {
    background: unset !important;
  }
  :deep(.ns-left-menu .ant-menu-item-selected .ant-menu-title-content) {
    color: #fff !important;
    background: @primary-color;
    border-radius: 2px;
    height: 40px;
    line-height: 40px;
    a {
      color: #ffffff !important;
    }
  }
  :deep(.ant-menu-light.ant-menu-horizontal > .ant-menu-item:hover) {
    background: @primary-color;
  }
  :deep(.ant-menu-inline .ant-menu-submenu-title) {
    color: rgba(255, 255, 255, 0.9) !important;
  }
  :deep(.ns-left-menu .ant-layout-sider-children .ant-menu-sub.ant-menu-inline) {
    position: relative;
    &::before {
      display: flex;
      width: 2px;
      height: calc(100% - 40px);
      position: absolute;
      top: 20px;
      left: 20px;
      content: '';
      background-color: rgba(255, 255, 255, 0.2);
    }
  }
  :deep(.link-btn) {
    color: @primary-color !important;
  }
  :deep(.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected) {
    color: @primary-color !important;
  }
  :deep(.ant-table-footer .ns-icon) {
    color: @primary-color !important;
  }
  //*************************含tab的 list列表样式 */
  :deep(.tabListTable) {
    .ns-table-title {
      text-align: left;
      height: 46px;
      line-height: 46px;
      font-size: 18px;
      font-weight: bold;
      user-select: text;
      padding-left: 16px;
      background: #fff;
      width: calc(100% + 32px);
      margin-left: -16px;
    }
    .tabs-list {
      overflow: visible !important;
    }
    .ant-tabs-nav {
      width: calc(100% + 32px);
      margin-left: -16px !important;
      background: #fff;
      border-top: 1px solid #e5ebf0;
    }
    .ant-tabs-nav-list {
      margin-left: 0px;
    }
    .ant-tabs-nav-wrap {
      padding: 0 16px;
      height: 46px;
    }
    .customContent {
      border-top: 16px solid #e5ebf0;
    }
  }

  //*********************详情页返回修改 */
  :deep(.nsDetailView) {
    min-height: 100%;
    height: 100%;
    .ns-detail-content {
      padding: 0px 24px;
      border-top: 16px solid #e5ebf0;
    }

    .ant-descriptions-item-label {
      color: rgba(0, 0, 0, 0.5);
      font-family: PingFang SC;
      font-size: 14px;
    }
    .ant-descriptions-item-content {
      color: rgba(0, 0, 0, 0.95);
      font-family: PingFang SC;
      font-size: 14px;
    }
    .ns-table .ns-table-main {
      border: unset;
    }
    .ant-descriptions-title {
      &::after {
        content: '';
        width: 75px;
        height: 7px;
        display: block;
        background: linear-gradient(90deg, @primary-color 0%, #fff 82.67%);
        margin-left: 2px;
        margin-top: -2px;
      }
    }

    .ant-descriptions-row > th,
    .ant-descriptions-row > td {
      padding-bottom: 8px;
    }
    .ns-page-header {
      margin-bottom: 0 !important;
      padding-top: 7px !important;
      padding-bottom: 7px !important;
      width: calc(100% + 32px);
      margin-left: -16px;
      .title {
        cursor: pointer;
        font-size: 18px !important;
        display: flex;
        align-items: center;
      }
    }
    .ant-descriptions-header {
      margin: 16px 0 16px 0 !important;

      .ant-descriptions-title {
        line-height: 16px;
        font-size: 16px;
      }
    }
  }
</style>
<style lang="less">
  // 列表弹框样式修改
  .listTableModal .ant-modal-title {
    font-weight: 600;
  }
  .listTableModal .ant-modal-body {
    padding: 16px !important;
    .ant-tabs-nav-wrap {
      padding: 0px;
    }
    .ns-list-table {
      border-left: 16px solid #e5ebf0;
      border-right: 16px solid #e5ebf0;
      border-bottom: 16px solid #e5ebf0;
    }
  }
  :deep(.ant-menu-submenu-title) {
    color: #ffffff !important;
  }
  //************************修改顶部菜单弹框样式
  .ant-menu-submenu-placement-bottomLeft {
    .ant-menu-submenu {
      background: rgb(3 24 53) !important;
    }

    .ant-menu-sub {
      background: rgb(3 24 53) !important;
    }
    .ant-menu-title-content {
      color: #fff !important;
      .ns-icon {
        margin-right: 7px;
        transform: translateY(2px);
      }
    }
    .ant-menu-submenu-arrow {
      color: #fff !important;
    }
  }
</style>
