<template>
  <div class="app-wrapper">
    <div class="topTitle">
      <div class="com-logo">
        <img
          src="../../assets/images/logo.png"
          alt="logo"
        />
      </div>
      <h1 class="com-title">后台管理系统</h1>
      <slot name="title"></slot>
    </div>

    <div class="body-container">
      <slot name="nav"></slot>
      <div class="main-container">
        <tags-views></tags-views>
        <section class="app-main">
          <transition
            name="fade"
            mode="out-in"
          >
            <slot></slot>
          </transition>
        </section>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "app-layout",
  computed: {
    sidebar() {
      return this.$store.state.app.sidebar;
    }
  }
};
</script>

<style lang="scss">
@import "../../assets/styles/variables.scss";
html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.app-wrapper {
  position: relative;
  height: 100%;
  width: 100%;
  min-width: 1280px;
  background-image: radial-gradient(
    ellipse farthest-corner at 0px 0px,
    #6895fe 0%,
    #2362f6 100%
  );
  .topTitle {
    display: flex;
    align-items: center;
    transition: height 0.28s;
    height: $topBar-height; // background-image: linear-gradient(90deg, #6895fe, #2362f6);
    .com-logo {
      width: 80px;
      height: 30px;
      display: flex;
      justify-content: center;
      align-items: center;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .com-title {
      flex: 1;
      height: 24px;
      line-height: 24px;
      font-size: 14px;
      font-weight: normal;
      color: #fff;
      text-indent: 6px;
    }
  }
  .body-container {
    display: flex;
    height: calc(100vh - #{$topBar-height});
  }
  // 主体区域
  .main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - #{$topBar-height});
    transition: margin-left 0.28s;
    background-color: #eee;
    // main-container全局样式
    .app-main {
      width: calc(100vw - #{$sideBar-width});
      height: calc(100vh - #{$topBar-height} - 30px);
    }
    .main-wrap {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      position: relative;
      .main-wrap-inner {
        height: calc(100% - #{$footer-height});
        display: flex;
        flex-direction: column;
        &.noFooter {
          height: 100%;
          .table-wrap {
            margin-bottom: 0;
          }
        }
      }
      .table-wrap {
        flex: 1;
        overflow: auto;
        margin: 12px 12px 22px;
      }
    }
  }
  // 底部分页
  .footer-wrap {
    width: 100%;
    height: $footer-height;
    line-height: $footer-height;
    background-color: #fff;
    display: flex;
    justify-content: flex-end;
    .md-pagination {
      font-size: 12px;
      padding: 0;
      padding-right: 12px;
      .md-pager li {
        line-height: $footer-height;
      }
    }
    .footer-info {
      text-indent: 20px;
      flex: 1;
      color: #666;
      font-size: 12px;
    }
  }
  .el-pagination span:not([class*="suffix"]),
  .el-pagination button {
    font-size: 12px;
  }
}
@media screen and (min-width: $bigScreenWidth) {
  $sideBar-width: 132px;
  $topBar-height: 72px;
  $footer-height: 48px;
  .app-wrapper {
    .topTitle {
      height: $topBar-height; // background-image: linear-gradient(90deg, #6895fe, #2362f6);
      .com-logo {
        width: 138px;
        height: 44px;
      }
    }
    .body-container {
      height: calc(100vh - #{$topBar-height});
    }
    .main-container {
      height: calc(100vh - #{$topBar-height});
      .app-main {
        width: calc(100vw - #{$sideBar-width});
        height: calc(100vh - #{$topBar-height} - 30px);
      }
      .main-wrap {
        .main-wrap-inner {
          height: calc(100% - #{$footer-height});
        }
      }
    }
    .footer-wrap {
      height: $footer-height;
      line-height: $footer-height;
      .md-pagination {
        .md-pager li {
          line-height: $footer-height;
        }
      }
      .footer-info {
        font-size: 14px;
      }
    }
    .el-pagination span:not([class*="suffix"]),
    .el-pagination button {
      font-size: 14px;
    }
  }
}
</style>
