Blame view

src/App.vue 2.44 KB
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
  	name: "app",
  	mounted() {
  
  	},
ef16e57e   LH_PC   fix:前端版本迭代
16
17
18
  	methods: {
  		_reSize() {
  
f45b3c05   LH_PC   云平台新UI界面
19
  			const $app = this.$refs.app;
6bca489d   LH_PC   云平台二期UI
20
  
ef16e57e   LH_PC   fix:前端版本迭代
21
  			const standardScale = "100%" / "100%";
6bca489d   LH_PC   云平台二期UI
22
  
ef16e57e   LH_PC   fix:前端版本迭代
23
  			const docHeight = document.body.clientHeight;
6bca489d   LH_PC   云平台二期UI
24
  
ef16e57e   LH_PC   fix:前端版本迭代
25
26
27
28
  			const docWidth = document.body.clientWidth; 
   
  			if (docWidth < 1700) { 
  				const currentScale = docHeight / docWidth;
6bca489d   LH_PC   云平台二期UI
29
  
ef16e57e   LH_PC   fix:前端版本迭代
30
31
32
33
  				let [scale, translate] = [0, 0];
  				if (currentScale < standardScale) {
  					// 以高度计算
  					scale = docHeight / 1080;
6bca489d   LH_PC   云平台二期UI
34
  
ef16e57e   LH_PC   fix:前端版本迭代
35
  					const shouleWidth = 1920 * scale;
6bca489d   LH_PC   云平台二期UI
36
  
ef16e57e   LH_PC   fix:前端版本迭代
37
  					const offsetWidth = docWidth - shouleWidth;
6bca489d   LH_PC   云平台二期UI
38
  
ef16e57e   LH_PC   fix:前端版本迭代
39
40
  					translate =
  						offsetWidth > 0 ? `translate(${offsetWidth / 2}px, 0)` : "";
f45b3c05   LH_PC   云平台新UI界面
41
  
ef16e57e   LH_PC   fix:前端版本迭代
42
43
44
  				} else {
  					// 以宽度计算
  					scale = docWidth / 1920;
6bca489d   LH_PC   云平台二期UI
45
  
ef16e57e   LH_PC   fix:前端版本迭代
46
  					const shouleHeight = 1080 * scale;
6bca489d   LH_PC   云平台二期UI
47
  
ef16e57e   LH_PC   fix:前端版本迭代
48
  					const offsetHeight = docHeight - shouleHeight;
6bca489d   LH_PC   云平台二期UI
49
  
ef16e57e   LH_PC   fix:前端版本迭代
50
51
52
  					translate =
  						offsetHeight > 0 ? `translate(0, ${offsetHeight / 2}px)` : "";
  				}
6bca489d   LH_PC   云平台二期UI
53
  
ef16e57e   LH_PC   fix:前端版本迭代
54
  				if (docHeight <= 700) {
6bca489d   LH_PC   云平台二期UI
55
  
ef16e57e   LH_PC   fix:前端版本迭代
56
  					$app.style.cssText = `
6bca489d   LH_PC   云平台二期UI
57
58
59
  								transform: scale(${scale}) ${translate};
  								transform-origin: top left;
  								min-width: 1920px;
ef16e57e   LH_PC   fix:前端版本迭代
60
61
62
63
64
65
  								min-height: 885px; 
            					`;
  				}
  				else if (docHeight <= 780) {
  
  					$app.style.cssText = `
6bca489d   LH_PC   云平台二期UI
66
67
68
  								transform: scale(${scale}) ${translate};
  								transform-origin: top left;
  								min-width: 1920px;
ef16e57e   LH_PC   fix:前端版本迭代
69
70
71
72
73
  								min-height:910px; 
            					`;
  				}
  				else {
  					$app.style.cssText = `
6bca489d   LH_PC   云平台二期UI
74
75
76
  								transform: scale(${scale}) ${translate};
  								transform-origin: top left;
  								min-width: 1920px;
ef16e57e   LH_PC   fix:前端版本迭代
77
78
79
  								min-height:1045px; 
            					`;
  				}
f45b3c05   LH_PC   云平台新UI界面
80
  
ef16e57e   LH_PC   fix:前端版本迭代
81
82
83
84
85
86
87
  			} else {
  				$app.style.cssText = '';
  			}
  		},
  	},
  	created() {
  		let that = this;
f45b3c05   LH_PC   云平台新UI界面
88
  
ef16e57e   LH_PC   fix:前端版本迭代
89
  		this.$nextTick(() => {
f45b3c05   LH_PC   云平台新UI界面
90
  			if (document.createEvent) {
ef16e57e   LH_PC   fix:前端版本迭代
91
  				that._reSize();
f45b3c05   LH_PC   云平台新UI界面
92
  			} else if (document.createEventObject) {
ef16e57e   LH_PC   fix:前端版本迭代
93
  				that._reSize();
f45b3c05   LH_PC   云平台新UI界面
94
95
96
  			}
  		});
  	}
a0ea7efe   梁保满   init
97
98
99
100
101
102
103
104
  }
  
  </script>
  
  <style lang="scss">
  body {
  	margin: 0px;
  	padding: 0px;
ef16e57e   LH_PC   fix:前端版本迭代
105
  	font-family: Microsoft YaHei, Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, SimSun, sans-serif;
a0ea7efe   梁保满   init
106
107
108
109
110
111
112
113
114
  	-webkit-font-smoothing: antialiased;
  }
  
  #app {
  	position: absolute;
  	top: 0px;
  	bottom: 0px;
  	width: 100%;
  }
f45b3c05   LH_PC   云平台新UI界面
115
116
117
  
  a {
  	color: #56a9ff;
a0ea7efe   梁保满   init
118
  }
f45b3c05   LH_PC   云平台新UI界面
119
  
a0ea7efe   梁保满   init
120
121
122
123
124
125
126
127
128
  .fade-enter-active,
  .fade-leave-active {
  	transition: all .2s ease;
  }
  
  .fade-enter,
  .fade-leave-active {
  	opacity: 0;
  }
f45b3c05   LH_PC   云平台新UI界面
129
  
a0ea7efe   梁保满   init
130
  #nprogress .bar {
f45b3c05   LH_PC   云平台新UI界面
131
132
  	height: 3px !important;
  	background: #56a9ff !important; //自定义颜色
a0ea7efe   梁保满   init
133
134
  }
  </style>