a0ea7efe
梁保满
init
|
1
|
<template>
|
f45b3c05
LH_PC
云平台新UI界面
|
2
3
4
5
6
|
<div id="app" ref="app">
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
</div>
|
a0ea7efe
梁保满
init
|
7
8
9
|
</template>
<script>
|
f45b3c05
LH_PC
云平台新UI界面
|
10
|
import _ from "lodash";
|
a0ea7efe
梁保满
init
|
11
|
export default {
|
f45b3c05
LH_PC
云平台新UI界面
|
12
13
14
15
16
17
18
19
20
|
name: "app",
mounted() {
},
created() {
this.$nextTick(() => {
const $app = this.$refs.app;
// 设置 屏幕 百分比 尺寸 适配
const standardScale = "100%" / "100%";
|
f45b3c05
LH_PC
云平台新UI界面
|
21
22
23
|
window.addEventListener(
"resize",
_.debounce(function () {
|
6bca489d
LH_PC
云平台二期UI
|
24
|
|
f45b3c05
LH_PC
云平台新UI界面
|
25
|
const docHeight = document.body.clientHeight;
|
6bca489d
LH_PC
云平台二期UI
|
26
|
|
f45b3c05
LH_PC
云平台新UI界面
|
27
|
const docWidth = document.body.clientWidth;
|
6bca489d
LH_PC
云平台二期UI
|
28
|
|
f45b3c05
LH_PC
云平台新UI界面
|
29
|
if (docWidth < 1700) {
|
6bca489d
LH_PC
云平台二期UI
|
30
|
|
f45b3c05
LH_PC
云平台新UI界面
|
31
|
const currentScale = docHeight / docWidth;
|
6bca489d
LH_PC
云平台二期UI
|
32
|
|
f45b3c05
LH_PC
云平台新UI界面
|
33
|
let [scale, translate] = [0, 0];
|
6bca489d
LH_PC
云平台二期UI
|
34
|
|
f45b3c05
LH_PC
云平台新UI界面
|
35
36
37
|
if (currentScale < standardScale) {
// 以高度计算
scale = docHeight / 1080;
|
6bca489d
LH_PC
云平台二期UI
|
38
|
|
f45b3c05
LH_PC
云平台新UI界面
|
39
40
41
|
const shouleWidth = 1920 * scale;
const offsetWidth = docWidth - shouleWidth;
|
6bca489d
LH_PC
云平台二期UI
|
42
|
|
f45b3c05
LH_PC
云平台新UI界面
|
43
44
|
translate =
offsetWidth > 0 ? `translate(${offsetWidth / 2}px, 0)` : "";
|
6bca489d
LH_PC
云平台二期UI
|
45
|
|
f45b3c05
LH_PC
云平台新UI界面
|
46
47
48
|
} else {
// 以宽度计算
scale = docWidth / 1920;
|
6bca489d
LH_PC
云平台二期UI
|
49
|
|
f45b3c05
LH_PC
云平台新UI界面
|
50
|
const shouleHeight = 1080 * scale;
|
6bca489d
LH_PC
云平台二期UI
|
51
|
|
f45b3c05
LH_PC
云平台新UI界面
|
52
|
const offsetHeight = docHeight - shouleHeight;
|
6bca489d
LH_PC
云平台二期UI
|
53
|
|
f45b3c05
LH_PC
云平台新UI界面
|
54
55
|
translate =
offsetHeight > 0 ? `translate(0, ${offsetHeight / 2}px)` : "";
|
6bca489d
LH_PC
云平台二期UI
|
56
57
|
}
|
f45b3c05
LH_PC
云平台新UI界面
|
58
|
if (docHeight <= 700) {
|
6bca489d
LH_PC
云平台二期UI
|
59
|
|
f45b3c05
LH_PC
云平台新UI界面
|
60
|
$app.style.cssText = `
|
6bca489d
LH_PC
云平台二期UI
|
61
62
63
64
65
|
transform: scale(${scale}) ${translate};
transform-origin: top left;
min-width: 1920px;
min-height: 850px;
`;
|
f45b3c05
LH_PC
云平台新UI界面
|
66
67
|
}
else if (docHeight <= 750) {
|
6bca489d
LH_PC
云平台二期UI
|
68
|
|
f45b3c05
LH_PC
云平台新UI界面
|
69
|
$app.style.cssText = `
|
6bca489d
LH_PC
云平台二期UI
|
70
71
72
73
74
|
transform: scale(${scale}) ${translate};
transform-origin: top left;
min-width: 1920px;
min-height:920px;
`;
|
f45b3c05
LH_PC
云平台新UI界面
|
75
76
77
|
}
else {
$app.style.cssText = `
|
6bca489d
LH_PC
云平台二期UI
|
78
79
80
81
82
|
transform: scale(${scale}) ${translate};
transform-origin: top left;
min-width: 1920px;
min-height:1080px;
`;
|
f45b3c05
LH_PC
云平台新UI界面
|
83
84
85
86
87
|
}
} else {
$app.style.cssText = '';
}
|
f45b3c05
LH_PC
云平台新UI界面
|
88
89
90
91
92
93
94
95
96
97
98
99
100
|
}),
300
);
if (document.createEvent) {
var event = document.createEvent("HTMLEvents");
event.initEvent("resize", true, true);
window.dispatchEvent(event);
} else if (document.createEventObject) {
window.fireEvent("onresize");
}
});
}
|
a0ea7efe
梁保满
init
|
101
102
103
104
105
106
107
108
|
}
</script>
<style lang="scss">
body {
margin: 0px;
padding: 0px;
|
6bca489d
LH_PC
云平台二期UI
|
109
|
font-family: Microsoft YaHei, Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, SimSun, sans-serif;
|
a0ea7efe
梁保满
init
|
110
111
112
113
114
115
116
117
118
|
-webkit-font-smoothing: antialiased;
}
#app {
position: absolute;
top: 0px;
bottom: 0px;
width: 100%;
}
|
f45b3c05
LH_PC
云平台新UI界面
|
119
120
121
|
a {
color: #56a9ff;
|
a0ea7efe
梁保满
init
|
122
|
}
|
f45b3c05
LH_PC
云平台新UI界面
|
123
|
|
a0ea7efe
梁保满
init
|
124
125
126
127
128
129
130
131
132
|
.fade-enter-active,
.fade-leave-active {
transition: all .2s ease;
}
.fade-enter,
.fade-leave-active {
opacity: 0;
}
|
f45b3c05
LH_PC
云平台新UI界面
|
133
|
|
a0ea7efe
梁保满
init
|
134
|
#nprogress .bar {
|
f45b3c05
LH_PC
云平台新UI界面
|
135
136
|
height: 3px !important;
background: #56a9ff !important; //自定义颜色
|
a0ea7efe
梁保满
init
|
137
138
|
}
</style>
|