Layout.vue 4.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<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>
姜雷 committed
11
      <slot name="title"></slot>
12 13 14
    </div>

    <div class="body-container">
姜雷 committed
15
      <slot name="nav"></slot>
16
      <div class="main-container">
姜雷 committed
17
        <tags-views></tags-views>
姜雷 committed
18 19 20 21 22 23 24 25
        <section class="app-main">
          <transition
            name="fade"
            mode="out-in"
          >
            <slot></slot>
          </transition>
        </section>
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
      </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);
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    .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;
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    }
  }
  .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全局样式
姜雷 committed
101 102 103 104
    .app-main {
      width: calc(100vw - #{$sideBar-width});
      height: calc(100vh - #{$topBar-height} - 30px);
    }
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
    .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;
      }
    }
  }
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
  // 底部分页
  .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;
  }
156 157 158 159
}
@media screen and (min-width: $bigScreenWidth) {
  $sideBar-width: 132px;
  $topBar-height: 72px;
160
  $footer-height: 48px;
161 162 163
  .app-wrapper {
    .topTitle {
      height: $topBar-height; // background-image: linear-gradient(90deg, #6895fe, #2362f6);
164 165 166 167
      .com-logo {
        width: 138px;
        height: 44px;
      }
168
    }
169 170
    .body-container {
      height: calc(100vh - #{$topBar-height});
171
    }
172 173
    .main-container {
      height: calc(100vh - #{$topBar-height});
姜雷 committed
174 175 176 177
      .app-main {
        width: calc(100vw - #{$sideBar-width});
        height: calc(100vh - #{$topBar-height} - 30px);
      }
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
      .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;
    }
200 201 202
  }
}
</style>