Blame view

HHECS.Web/src/layout/index.vue 2.53 KB
胡菁 authored
1
2
<template>
  <div :class="classObj" class="app-wrapper">
3
4
5
6
7
    <div
      v-if="device === 'mobile' && sidebar.opened"
      class="drawer-bg"
      @click="handleClickOutside"
    />
胡菁 authored
8
9
    <sidebar class="sidebar-container" />
    <div class="main-container">
10
      <div :class="{ 'fixed-header': fixedHeader }">
胡菁 authored
11
        <navbar />
12
        <tags-view />
胡菁 authored
13
14
      </div>
      <app-main />
15
16
17
      <div :class="{ 'fixed-footer': fixedFooter }">
        <copyright />
      </div>
胡菁 authored
18
19
20
21
22
    </div>
  </div>
</template>

<script>
胡菁 authored
23
24
25
26
import { AppMain, Navbar, Sidebar, TagsView, Copyright } from "./components";
import ResizeMixin from "./mixin/ResizeHandler";
import { getDictDetails } from "@/api/common";
import Vue from "vue";
胡菁 authored
27
28

export default {
胡菁 authored
29
  name: "Layout",
胡菁 authored
30
31
32
  components: {
    Navbar,
    Sidebar,
胡菁 authored
33
    AppMain,
34
    TagsView,
胡菁 authored
35
    Copyright,
胡菁 authored
36
37
38
39
  },
  mixins: [ResizeMixin],
  computed: {
    sidebar() {
胡菁 authored
40
      return this.$store.state.app.sidebar;
胡菁 authored
41
42
    },
    device() {
胡菁 authored
43
      return this.$store.state.app.device;
胡菁 authored
44
45
    },
    fixedHeader() {
胡菁 authored
46
      return this.$store.state.settings.fixedHeader;
胡菁 authored
47
    },
weijuan55650@qq.com authored
48
    fixedFooter() {
胡菁 authored
49
      return this.$store.state.settings.fixedFooter;
weijuan55650@qq.com authored
50
    },
胡菁 authored
51
52
53
54
55
    classObj() {
      return {
        hideSidebar: !this.sidebar.opened,
        openSidebar: this.sidebar.opened,
        withoutAnimation: this.sidebar.withoutAnimation,
胡菁 authored
56
57
58
        mobile: this.device === "mobile",
      };
    },
胡菁 authored
59
  },
胡菁 authored
60
61
62
63
64
  created() {
    getDictDetails({ code: "AlarmCodes" }).then((res) => {
      Vue.prototype.$dict = res.data;
    });
  },
胡菁 authored
65
  mounted() {},
胡菁 authored
66
67
  methods: {
    handleClickOutside() {
胡菁 authored
68
69
70
71
      this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
    },
  },
};
胡菁 authored
72
73
74
</script>

<style lang="scss" scoped>
75
76
@import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss";
胡菁 authored
77
78
79
80
81
82
83
.app-wrapper {
  @include clearfix;
  position: relative;
  height: 100%;
  width: 100%;
  &.mobile.openSidebar {
胡菁 authored
84
85
86
    position: fixed;
    top: 0;
  }
胡菁 authored
87
  //   overflow: scroll;
88
89
90
91
92
93
94
95
96
97
}
.drawer-bg {
  background: #000;
  opacity: 0.3;
  width: 100%;
  top: 0;
  height: 100%;
  position: absolute;
  z-index: 999;
}
胡菁 authored
98
99
100
101
102
103
104
105
106
.fixed-header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9;
  width: calc(100% - #{$sideBarWidth});
  transition: width 0.28s;
}
胡菁 authored
107
108
109
110
111
112
113
114
.hideSidebar .fixed-header {
  width: calc(100% - 54px);
}

.mobile .fixed-header {
  width: 100%;
}
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

.fixed-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1000;
  width: calc(100% - #{$sideBarWidth});
  transition: width 0.28s;
}

.hideSidebar .fixed-footer {
  width: calc(100% - 54px);
}

.mobile .fixed-footer {
  width: 100%;
}
胡菁 authored
132
</style>