layout.vue 5.37 KB
Newer Older
Z's avatar
Z committed
1 2 3 4 5 6 7 8 9 10 11 12 13
<template>
  <div
    class="d2-layout-header-aside-group"
    :style="styleLayoutMainGroup"
    :class="{grayMode: grayActive}"
  >
    <!-- 半透明遮罩 -->
    <div class="d2-layout-header-aside-mask"></div>
    <!-- 主体内容 -->
    <div class="d2-layout-header-aside-content" flex="dir:top">
      <!-- 顶栏 -->
      <div
        class="d2-theme-header"
xulili's avatar
xulili committed
14
        :style="{   opacity: this.searchActive ? 0.5 : 1 }"
Z's avatar
Z committed
15 16 17
        flex-box="0"
        flex
      >
18 19 20
        <!-- <img class="zlogos" :src="`/image/logo.png`" /> -->
        <img class="zlogos" :src="`/image/logoNew.png`" />

Z's avatar
Z committed
21 22 23 24
        <d2-menu-header class="header-menus" flex-box="1" />
        <!-- 顶栏右侧 -->
        <div class="d2-header-right" flex-box="0">
          <!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" -->
xulili's avatar
xulili committed
25 26
         <!--<d2-header-search @click="handleSearchClick" />-->
          <!--<d2-header-log />-->
Z's avatar
Z committed
27
          <d2-header-fullscreen />
xulili's avatar
xulili committed
28 29 30 31
          <!--<d2-header-theme />-->
          <!--<d2-header-size />-->
          <!--<d2-header-locales />-->
          <!--<d2-header-color />-->
Z's avatar
Z committed
32 33 34 35
          <d2-header-user />
        </div>
      </div>
      <!-- 下面 主体 -->
xulili's avatar
xulili committed
36
      <div class="d2-theme-container" flex-box="1" flex flex="dir:top">
Z's avatar
Z committed
37 38 39 40 41 42 43 44 45 46 47
        <!-- 主体 侧边栏 -->
        <!-- <div
          flex-box="0"
          ref="aside"
          class="d2-theme-container-aside"
          :style="{
            width: asideCollapse ? asideWidthCollapse : asideWidth,
            opacity: this.searchActive ? 0.5 : 1
          }">
          <d2-menu-side/>
        </div>-->
xulili's avatar
xulili committed
48 49
        <!--通知栏-->
        <d2-header-alarm-notify ></d2-header-alarm-notify>
Z's avatar
Z committed
50
        <!-- 主体 -->
xulili's avatar
xulili committed
51
        <div class="d2-theme-container-main">
Z's avatar
Z committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
          <!-- 搜索 -->
          <!-- <transition name="fade-scale">
            <div v-if="searchActive" class="d2-theme-container-main-layer" flex>
              <d2-panel-search ref="panelSearch" @close="searchPanelClose" />
            </div>
          </transition>-->
          <!-- 内容 -->
          <transition name="fade-scale">
            <div v-if="!searchActive" class="d2-theme-container-main-layer" flex="dir:top">
              <!-- tab -->
              <!-- <div class="d2-theme-container-main-header" flex-box="0">
                <d2-tabs/>
              </div>-->
              <!-- 页面 -->
              <div
                class="d2-theme-container-main-body"
                flex-box="1"
xulili's avatar
xulili committed
69
                style="margin: 16px 0px 16px 0px;"
Z's avatar
Z committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
              >
                <transition :name="transitionActive ? 'fade-transverse' : ''">
                  <keep-alive :include="keepAlive">
                    <router-view />
                  </keep-alive>
                </transition>
              </div>
            </div>
          </transition>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import d2MenuSide from './components/menu-side'
import d2MenuHeader from './components/menu-header'
import d2Tabs from './components/tabs'
import d2HeaderFullscreen from './components/header-fullscreen'
import d2HeaderLocales from './components/header-locales'
import d2HeaderSearch from './components/header-search'
import d2HeaderSize from './components/header-size'
import d2HeaderTheme from './components/header-theme'
import d2HeaderUser from './components/header-user'
import d2HeaderLog from './components/header-log'
import d2HeaderColor from './components/header-color'
xulili's avatar
xulili committed
97
import d2HeaderAlarmNotify from './components/header-alarm-notify'
Z's avatar
Z committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
import { mapState, mapGetters, mapActions } from 'vuex'
import mixinSearch from './mixins/search'
export default {
  name: 'd2-layout-header-aside',
  mixins: [mixinSearch],
  components: {
    d2MenuSide,
    d2MenuHeader,
    d2Tabs,
    d2HeaderFullscreen,
    d2HeaderLocales,
    d2HeaderSearch,
    d2HeaderSize,
    d2HeaderTheme,
    d2HeaderUser,
    d2HeaderLog,
xulili's avatar
xulili committed
114 115
    d2HeaderColor,
    d2HeaderAlarmNotify
Z's avatar
Z committed
116 117 118 119 120 121 122 123 124 125 126 127 128 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 156 157 158 159 160 161 162 163 164 165
  },
  data () {
    return {
      // [侧边栏宽度] 正常状态
      asideWidth: '200px',
      // [侧边栏宽度] 折叠状态
      asideWidthCollapse: '65px'
    }
  },
  computed: {
    ...mapState('d2admin', {
      keepAlive: state => state.page.keepAlive,
      grayActive: state => state.gray.active,
      transitionActive: state => state.transition.active,
      asideCollapse: state => state.menu.asideCollapse
    }),
    ...mapGetters('d2admin', {
      themeActiveSetting: 'theme/activeSetting'
    }),
    /**
     * @description 最外层容器的背景图片样式
     */
    styleLayoutMainGroup () {
      return {
        ...(this.themeActiveSetting.backgroundImage
          ? {
            backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`
          }
          : {})
      }
    }
  },
  methods: {
    ...mapActions('d2admin/menu', ['asideCollapseToggle']),
    /**
     * 接收点击切换侧边栏的按钮
     */
    handleToggleAside () {
      this.asideCollapseToggle()
    }
  }
}
</script>

<style lang="scss">
// 注册主题
@import "~@/assets/style/theme/register.scss";
</style>
<style lang="scss" scoped>
.zlogos {
166 167 168
  // height: 60px;
  height: 25px;
  width: 125px;
Z's avatar
Z committed
169
  padding-left: 20px;
170
  padding-top: 16px;
Z's avatar
Z committed
171
  object-fit: cover;
172
  // border: 2px solid red;
Z's avatar
Z committed
173 174 175 176 177 178 179 180 181 182 183
}
.d2-theme-header{
  background-color: #4E59C7;
  // background-color: red;
}
.header-menus{
  color: #E8E9FF !important;
  // background-color: red;

}
</style>