bonus-ui/src/views/home/components/ProvincialChart.vue

232 lines
4.3 KiB
Vue
Raw Normal View History

2026-01-22 09:24:00 +08:00
<template>
2026-01-25 15:31:18 +08:00
<div class="viewport">
<div class="screen" :style="screenStyle">
<div class="app-container">
<div style="height: 90px"></div>
<div class="top">
<div class="top-1">
<Top1 />
</div>
<div class="top-2">
<Top2 />
</div>
<div class="top-3">
<Top3 />
</div>
</div>
2026-01-22 09:24:00 +08:00
2026-01-25 15:31:18 +08:00
<div class="center">
<div class="center-1">
<Center1 />
</div>
<div class="center-2">
<Center2 />
</div>
2026-01-22 09:24:00 +08:00
</div>
2026-01-25 15:31:18 +08:00
<div class="bottom">
<div class="bottom-1">
<div class="bottom-1-1">
<Bottom11 />
</div>
<div class="bottom-1-2">
<Bottom12 />
</div>
</div>
<div class="bottom-2">
<Bottom2 />
</div>
2026-01-22 09:24:00 +08:00
</div>
</div>
</div>
</div>
</template>
<script>
2026-01-22 09:31:15 +08:00
import Top1 from './provincial/Top1'
2026-01-22 15:56:24 +08:00
import Top2 from './provincial/Top2'
2026-01-22 09:31:15 +08:00
import Top3 from './provincial/Top3'
import Center1 from './provincial/Center1'
import Center2 from './provincial/Center2'
import Bottom11 from './provincial/Bottom1-1'
import Bottom12 from './provincial/Bottom1-2'
import Bottom2 from './provincial/Bottom2'
2026-01-22 09:24:00 +08:00
export default {
name: 'provincialChart',
components: {
Top1,
2026-01-22 15:56:24 +08:00
Top2,
2026-01-22 09:24:00 +08:00
Top3,
Center1,
Center2,
Bottom11,
Bottom12,
Bottom2,
},
data() {
2026-01-25 15:31:18 +08:00
return {
scale: 1,
offsetX: 0,
offsetY: 0,
}
},
computed: {
screenStyle() {
return {
width: '1920px',
height: '1080px',
transform: `translate(${this.offsetX}px, ${this.offsetY}px) scale(${this.scale})`,
transformOrigin: '0 0',
}
},
},
mounted() {
this.calcScale()
window.addEventListener('resize', this.calcScale)
},
beforeDestroy() {
window.removeEventListener('resize', this.calcScale)
},
methods: {
calcScale() {
const baseW = 1920
const baseH = 1080
const vw = document.documentElement.clientWidth
const vh = document.documentElement.clientHeight
const scale = Math.min(vw / baseW, vh / baseH)
const realW = baseW * scale
const realH = baseH * scale
// ✅ 横向:仍然居中
this.offsetX = (vw - realW) / 2 / scale
// ✅ 纵向:贴顶(不再居中)
this.offsetY = 0
this.scale = scale
},
2026-01-22 09:24:00 +08:00
},
}
</script>
<style lang="scss" scoped>
2026-01-25 15:31:18 +08:00
/* 外层视口:锁满屏 */
.viewport {
position: fixed;
inset: 0;
overflow: hidden;
background: #e1ebf7; /* 大屏底色 */
}
/* 被缩放的 1920×1080 画布 */
.screen {
position: absolute;
top: 0;
left: 0;
}
2026-01-22 18:32:51 +08:00
.app-container {
2026-01-25 15:31:18 +08:00
width: 1920px;
height: 1080px;
2026-01-22 09:24:00 +08:00
background: #e1ebf7;
}
2026-01-25 15:31:18 +08:00
2026-01-22 09:24:00 +08:00
.top {
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
.top-1,
.top-2,
.top-3 {
padding: 24px;
background: rgba(255, 255, 255, 0.91);
border-radius: 5px;
}
.top-1,
.top-3 {
width: 480px;
height: 518px;
}
.top-2 {
flex: 1;
margin: 0 15px;
height: 518px;
2026-01-22 15:56:24 +08:00
background-image: url('~@/assets/images/map-img.png');
background-size: 100% 100%;
2026-01-22 09:24:00 +08:00
}
}
.center {
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
.center-1,
.center-2 {
2026-01-25 15:31:18 +08:00
width: 928px;
2026-01-22 09:24:00 +08:00
height: 390px;
padding: 24px;
background: rgba(255, 255, 255, 0.91);
border-radius: 5px;
}
.center-1 {
margin-right: 7.5px;
}
.center-2 {
margin-left: 7.5px;
}
}
.bottom {
display: flex;
align-items: center;
justify-content: space-between;
.bottom-1 {
2026-01-25 15:31:18 +08:00
width: 928px;
2026-01-22 09:24:00 +08:00
height: 350px;
display: flex;
align-items: center;
justify-content: space-between;
.bottom-1-1,
.bottom-1-2 {
padding: 24px;
width: 50%;
height: 350px;
background: rgba(255, 255, 255, 0.91);
border-radius: 5px;
}
.bottom-1-1 {
margin-right: 7.5px;
}
.bottom-1-2 {
margin-left: 7.5px;
}
}
.bottom-2 {
2026-01-25 15:31:18 +08:00
width: 928px;
2026-01-22 09:24:00 +08:00
height: 350px;
padding: 24px;
background: rgba(255, 255, 255, 0.91);
border-radius: 5px;
}
.bottom-1 {
margin-right: 7.5px;
}
.bottom-2 {
margin-left: 7.5px;
}
}
</style>