charles
2024-04-29 c7f3fd5215399b37d0511b3bd555150ff1b13507
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
<template>
  <div class="dashboard-layout">
    <div class="left">
      <div class="header-block padding-4">
        <slot name="leftBlock1"></slot>
      </div>
      <div class="double-height-block padding-4">
        <div class="card scroll-card">
          <el-scrollbar always class="scroller">
            <slot name="leftBlock2"></slot>
          </el-scrollbar>
        </div>
      </div>
    </div>
    <div class="middle">
      <div class="header-block padding-4">
        <slot name="middleBlock1"></slot>
      </div>
      <div class="top-block padding-4">
        <div class="card">
          <slot name="middleBlock2"></slot>
        </div>
      </div>
      <div class="bottom-block">
        <div class="bottom-block-item padding-4">
          <div class="card">
            <slot name="middleBlock3"></slot>
          </div>
        </div>
        <div class="bottom-block-item padding-4">
          <div class="card">
            <slot name="middleBlock4"></slot>
          </div>
        </div>
      </div>
    </div>
    <div class="right">
      <div class="header-block padding-4">
        <slot name="rightBlock1"></slot>
      </div>
      <div class="top-block padding-4">
        <div class="card">
          <slot name="rightBlock2"></slot>
        </div>
      </div>
      <div class="bottom-block padding-4">
        <div class="card">
          <slot name="rightBlock3"></slot>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script setup lang="ts"></script>
 
<style scoped lang="scss">
// 两侧区域宽
$sideWidth: 25%;
// 中间主区域宽
$mainWidth: 50%;
// 整体内边距
$layoutPadding: 12px;
// 头部布局块高度
$headerBlockHeight: 80px;
// 基础布局块高度
$baseBlockHeight: calc((100vh - 2 * $layoutPadding - $headerBlockHeight) / 2);
// 双倍高布局块高度
$doubleBlockHeight: calc($baseBlockHeight * 2);
// 上边固定高
$topBlocHeight: 400px;
// 下边高度
$bottomBlockHeight: calc(100vh - 2 * $layoutPadding - $headerBlockHeight - $topBlocHeight);
.dashboard-layout {
  background-image: url('/header-bg.png');
  background-position-x: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100vh;
  width: 100vw;
  padding: $layoutPadding;
  &.debug {
    & > div {
      border: 1px solid red;
      & > div {
        border: 1px solid red;
      }
    }
  }
}
 
.left,
.right {
  width: $sideWidth;
}
 
.middle {
  width: $mainWidth;
}
.left,
.right,
.middle {
  height: 100%;
}
.padding-4 {
  padding: 6px;
}
 
.base-block {
  height: $baseBlockHeight;
  flex: 1;
}
.top-block {
  height: $topBlocHeight;
  flex: 0;
}
.bottom-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: $bottomBlockHeight;
}
.bottom-block-item {
  height: $bottomBlockHeight;
  flex: 1;
}
.header-block {
  height: $headerBlockHeight;
}
.double-height-block {
  height: $doubleBlockHeight;
}
 
.card {
  width: 100%;
  height: 100%;
  background-color: #153e94;
  border-radius: 6px;
  padding: 10px 10px;
}
.scroll-card {
  padding: 0;
}
.scroller {
  padding: 10px 10px;
}
</style>