hejianhao
2025-04-29 1041fcce14e7195357be9d37a33f81a32900cb41
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
67
68
69
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<template>
  <div style="height: 100%;">
    <!-- 判断是否在空白页打开 -->
    <template v-if="!isOneself">
      <div class="app-wrapper">
        <div class="left" :style="{ width: isFold ? '0px' : '298px' }">
          <!-- 系统标题 -->
          <div v-if="!isFold" class="system-title">
            <div class="image">
              <img src="../assets/logo.jpg" alt="" srcset="" />
            </div>
            <div class="title">实验室流程</div>
          </div>
          <!-- 左侧菜单 -->
          <div v-if="!isFold" class="sidebar-container">
            <ElMenu />
          </div>
          <div v-if="!isFold" class="sidebar-left-bg"></div>
          <div v-if="!isFold" class="sidebar-bottom-bg"></div>
        </div>
        <!-- 右侧展示内容 -->
        <div class="main-container" :style="{ width: isFold ? '100%' : 'calc(100% - 298px)' }">
          <HeaderNav class="header-main" />
          <AppContent class="app-main" />
        </div>
      </div>
    </template>
    <!-- 如果在空白页打开则不显示框架 -->
    <template v-else>
      <AppContent />
    </template>
  </div>
</template>
 
<script>
import ElMenu from './components/ElMenu/index.vue'
import HeaderNav from './components/HeaderNav.vue'
import AppContent from './components/AppContent.vue'
import { mapState } from 'vuex'
export default {
  data() {
    return {
      // 默认页面在框架内显示
      isOneself: false,
      // 获取当前页面名称
      nowRouteName: '',
    }
  },
  computed: {
    ...mapState(['isFold'])
  },
  components: {
    ElMenu,
    HeaderNav,
    AppContent,
  },
  mounted() {
    // 设置标题
    this.setNowRouteName(this.$route)
    // 初始化加载一次判断是否在空白页打开
    this.isOneself = this.$route.meta.oneself
  },
  methods: {
    // 获取当前页面标题
    setNowRouteName(route) {
      this.nowRouteName = route.meta.title
    },
  },
  watch: {
    // 监听route变化
    $route: function (newVal) {
      this.setNowRouteName(newVal)
      // 判断页面是否在空白页打开
      this.isOneself = newVal.meta.oneself
    },
  },
}
</script>
 
<style lang="less" scoped>
.app-wrapper {
  height: 100%;
  width: 100%;
  display: flex;
  background-image: url('../assets/public/layoutsBG.png');
  background-size: cover;
  background-position: center;
 
  .left {
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: white;
    transition: width 0.3s ease-in-out;
 
    // 系统标题
    .system-title {
      overflow: hidden;
      white-space: nowrap;
      display: flex;
      flex-direction: column;
      align-items: center;
      background-color: white;
      height: 240px;
      box-sizing: border-box;
 
      .image {
        margin-top: 40px;
        width: 100px;
        height: 100px;
 
        img {
          width: 100%;
          height: 100%;
          border-radius: 50%;
        }
      }
 
      .title {
        margin-top: 7px;
        font-weight: bold;
        line-height: 43px;
        font-size: 25px;
      }
    }
 
    // 左侧菜单
    .sidebar-container {
      z-index: 2;
      padding: 0 19px;
      overflow-y: auto;
      flex: 1;
 
      ::v-deep .el-menu {
        border-right: unset !important;
      }
    }
 
    .sidebar-left-bg {
      z-index: 1;
      position: absolute;
      top: 338px;
      left: 0;
      width: 183px;
      height: 316px;
      background: #FFFCE5;
      opacity: 0.56;
      filter: blur(76.141290103688px);
    }
 
    .sidebar-bottom-bg {
      z-index: 1;
      position: absolute;
      bottom: 0;
      left: 0;
      width: 129px;
      height: 289px;
      background: #66FFFF;
      opacity: 0.4;
      filter: blur(76.141290103688px);
    }
  }
 
  .main-container {
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-in-out;
 
    .header-main {
      height: 70px;
    }
 
    .app-main {
      flex: 1;
      overflow: auto;
      border-radius: 10px;
      padding: 10px 21px 0 21px;
    }
  }
 
}
 
::v-deep .el-menu {
  background-color: transparent !important;
}
</style>