refactor(screen): 将驾驶舱组件转换为使用混入的响应式SCSS

用视口单位(vw, vh)和字体大小函数(fs)替换硬编码的像素值,以提高跨设备的响应性。从LESS切换到SCSS预处理器,并在所有驾驶舱组件中添加共享混入的导入。
This commit is contained in:
Zzc 2025-10-31 20:08:49 +08:00
parent f055d2feb4
commit bfbbbfd228
7 changed files with 163 additions and 149 deletions

View File

@ -35,11 +35,13 @@ const stats = ref([
])
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.block-event {
background: url(../assets/img/block-panel-bg.png) no-repeat;
background-size: 100% 100%;
padding: 20px 30px;
padding: vw(20) vw(30);
flex: 1;
display: flex;
flex-direction: column;
@ -47,18 +49,18 @@ const stats = ref([
.panel-header {
position: relative;
width: 293px;
height: 49px;
width: vw(293);
height: vh(49);
background: url(../assets/img/common-panel-header-bg.png) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
padding-left: 24px;
margin-bottom: 40px;
padding-left: vw(24);
margin-bottom: vh(40);
.title {
color: rgba(255, 255, 255, 1);
font-size: 22px;
font-size: fs(22);
font-family: SourceHanSansCN-Medium, sans-serif;
font-weight: 500;
}
@ -67,7 +69,7 @@ const stats = ref([
.stats-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 40px 20px;
gap: vh(40) vw(20);
flex: 1;
align-content: flex-start;
}
@ -75,11 +77,11 @@ const stats = ref([
.stat-card {
display: flex;
align-items: center;
gap: 10px;
gap: vw(10);
.stat-icon {
width: 53px;
height: 84px;
width: vw(53);
height: vh(84);
flex-shrink: 0;
}
@ -88,40 +90,40 @@ const stats = ref([
position: relative;
.stat-title {
height: 28px;
height: vh(28);
background: url(../assets/img/block-stat-title-bg.png) no-repeat;
background-size: 100% 100%;
color: rgba(255, 255, 255, 1);
font-size: 15px;
font-size: fs(15);
font-family: SourceHanSansCN-Bold, sans-serif;
font-weight: 700;
display: flex;
align-items: center;
padding-left: 10px;
margin-bottom: 10px;
padding-left: vw(10);
margin-bottom: vh(10);
}
.stat-value {
color: rgba(255, 255, 255, 1);
font-size: 42px;
font-size: fs(42);
font-family: SourceHanSansCN-Bold, sans-serif;
font-weight: 700;
line-height: 1;
padding-left: 10px;
padding-left: vw(10);
}
.stat-unit {
position: absolute;
top: 50px;
right: 20px;
top: vh(50);
right: vw(20);
color: rgba(255, 255, 255, 1);
font-size: 15px;
font-size: fs(15);
}
.stat-decoration {
width: 154px;
height: 29px;
margin-top: 5px;
width: vw(154);
height: vh(29);
margin-top: vh(5);
}
}
}

View File

@ -28,7 +28,9 @@ import BlockEvent from './BlockEvent.vue'
import YearStatistics from './YearStatistics.vue'
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.cockpit-layout {
width: 100vw;
height: 100vh;
@ -42,9 +44,9 @@ import YearStatistics from './YearStatistics.vue'
.cockpit-main {
flex: 1;
display: grid;
grid-template-columns: 580px 1fr 580px;
gap: 20px;
padding: 20px;
grid-template-columns: vw(580) 1fr vw(580);
gap: vw(20);
padding: vw(20);
padding-top: 0;
}
@ -52,7 +54,7 @@ import YearStatistics from './YearStatistics.vue'
.right-panel {
display: flex;
flex-direction: column;
gap: 20px;
gap: vw(20);
}
.center-panel {

View File

@ -98,11 +98,13 @@ const resources = ref([
])
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.emergency-resources {
background: url(../assets/img/emergency-panel-bg.png) no-repeat;
background-size: 100% 100%;
padding: 20px 30px;
padding: vw(20) vw(30);
flex: 1;
display: flex;
flex-direction: column;
@ -110,18 +112,18 @@ const resources = ref([
.panel-header {
position: relative;
width: 293px;
height: 49px;
width: vw(293);
height: vh(49);
background: url(../assets/img/common-panel-header-bg.png) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
padding-left: 24px;
margin-bottom: 30px;
padding-left: vw(24);
margin-bottom: vh(30);
.title {
color: rgba(255, 255, 255, 1);
font-size: 22px;
font-size: fs(22);
font-family: SourceHanSansCN-Medium, sans-serif;
font-weight: 500;
}
@ -133,7 +135,7 @@ const resources = ref([
flex-direction: column;
.table-header {
height: 35px;
height: vh(35);
background: url(../assets/img/emergency-table-header-bg.png) no-repeat;
background-size: 100% 100%;
display: grid;
@ -141,20 +143,20 @@ const resources = ref([
align-items: center;
text-align: center;
color: rgba(255, 255, 255, 1);
font-size: 16px;
font-size: fs(16);
font-family: SourceHanSansCN-Medium, sans-serif;
font-weight: 500;
margin-bottom: 5px;
margin-bottom: vh(5);
}
.table-row {
height: 35px;
height: vh(35);
display: grid;
grid-template-columns: 35px 1fr 1fr 1fr 1fr;
grid-template-columns: vw(35) 1fr 1fr 1fr 1fr;
align-items: center;
gap: 10px;
gap: vw(10);
color: rgba(255, 255, 255, 1);
font-size: 14px;
font-size: fs(14);
font-family: PingFangSC-Medium, sans-serif;
font-weight: 500;
@ -169,14 +171,14 @@ const resources = ref([
}
.row-number {
width: 35px;
height: 35px;
width: vw(35);
height: vh(35);
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(28, 161, 255, 0.44);
color: rgba(255, 255, 255, 1);
font-size: 14px;
font-size: fs(14);
font-family: FZZYJW--GB1-0, sans-serif;
}
@ -192,7 +194,7 @@ const resources = ref([
text-align: center;
font-family: PingFangSC-Semibold, sans-serif;
font-weight: 600;
font-size: 14px;
font-size: fs(14);
&.green {
color: rgba(17, 187, 119, 1);
@ -211,11 +213,11 @@ const resources = ref([
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
gap: vw(5);
.alert-icon {
width: 10px;
height: 10px;
width: vw(10);
height: vh(10);
}
}
}

View File

@ -109,7 +109,9 @@ const markers = ref([
])
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.map-center {
width: 100%;
height: 100%;
@ -120,23 +122,23 @@ const markers = ref([
.top-buttons {
position: absolute;
top: 20px;
top: vh(20);
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
gap: vw(10);
z-index: 10;
}
.func-button {
width: 60px;
height: 60px;
border: 0.5px solid rgba(60, 174, 255, 1);
width: vw(60);
height: vh(60);
border: vw(0.5) solid rgba(60, 174, 255, 1);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 5px;
gap: vh(5);
cursor: pointer;
transition: all 0.3s;
@ -153,13 +155,13 @@ const markers = ref([
}
.button-icon {
width: 28px;
height: 23px;
width: vw(28);
height: vh(23);
}
span {
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-size: fs(12);
font-family: SourceHanSansCN-Regular, sans-serif;
}
}
@ -170,8 +172,8 @@ const markers = ref([
.marker {
position: absolute;
width: 44px;
height: 44px;
width: vw(44);
height: vh(44);
cursor: pointer;
transition: transform 0.3s;
@ -188,27 +190,27 @@ const markers = ref([
.bottom-menu {
position: absolute;
bottom: 20px;
bottom: vh(20);
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 30px;
gap: vw(30);
align-items: flex-end;
}
.menu-left {
.menu-text {
color: rgba(255, 255, 255, 1);
font-size: 14px;
line-height: 39px;
font-size: fs(14);
line-height: vh(39);
white-space: nowrap;
}
}
.menu-center {
position: relative;
width: 350px;
height: 156px;
width: vw(350);
height: vh(156);
.center-menu-bg {
width: 100%;
@ -221,7 +223,7 @@ const markers = ref([
.center-menu-content {
position: relative;
z-index: 1;
padding: 15px 34px;
padding: vw(15) vw(34);
height: 100%;
display: flex;
flex-direction: column;
@ -230,11 +232,11 @@ const markers = ref([
display: flex;
justify-content: space-between;
margin-top: auto;
margin-bottom: 5px;
margin-bottom: vh(5);
span {
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-size: fs(12);
font-family: Helvetica, "Microsoft YaHei", Arial, sans-serif;
cursor: pointer;
@ -253,31 +255,31 @@ const markers = ref([
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
gap: vh(5);
cursor: pointer;
transition: transform 0.3s;
&:hover {
transform: translateY(-5px);
transform: translateY(vh(-5));
}
&.highlighted {
background: url(../assets/img/map-menu-item-highlight-bg.png) no-repeat;
background-size: contain;
padding: 10px;
padding: vw(10);
}
img {
width: 32px;
height: 32px;
width: vw(32);
height: vh(32);
}
span {
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-size: fs(12);
font-family: Helvetica, "Microsoft YaHei", Arial, sans-serif;
text-align: center;
line-height: 14px;
line-height: vh(14);
}
}
}

View File

@ -10,9 +10,11 @@
<script setup>
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.page-header {
height: 137px;
height: vh(137);
background: url(../assets/img/header-bg.png) no-repeat;
background-size: 100% 100%;
display: flex;
@ -24,7 +26,7 @@
.header-bg {
background-image: url(../assets/img/header-title-bg.png);
width: 100%;
height: 107px;
height: vh(107);
display: flex;
align-items: center;
justify-content: center;
@ -33,8 +35,8 @@
.title {
color: rgba(255, 255, 255, 1);
font-size: 51px;
letter-spacing: 2.32px;
font-size: fs(51);
letter-spacing: vw(2.32);
font-family: FZLTDHJW--GB1-0, sans-serif;
white-space: nowrap;
margin: 0;
@ -43,15 +45,15 @@
.app-button {
position: absolute;
right: 40px;
right: vw(40);
top: 50%;
transform: translateY(-50%);
width: 165px;
height: 44px;
width: vw(165);
height: vh(44);
background: url(../assets/img/header-btn-app-bg.png) no-repeat;
background-size: 100% 100%;
color: rgba(255, 255, 255, 1);
font-size: 16px;
font-size: fs(16);
font-family: SourceHanSansCN-Regular, sans-serif;
border: none;
cursor: pointer;

View File

@ -115,11 +115,13 @@ const districts = ref([
])
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.weather-warning {
background: url(../assets/img/weather-panel-bg.png) no-repeat;
background-size: 100% 100%;
padding: 20px 30px;
padding: vw(20) vw(30);
flex: 1;
display: flex;
flex-direction: column;
@ -127,18 +129,18 @@ const districts = ref([
.panel-header {
position: relative;
width: 293px;
height: 49px;
width: vw(293);
height: vh(49);
background: url(../assets/img/common-panel-header-bg.png) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
padding-left: 24px;
margin-bottom: 20px;
padding-left: vw(24);
margin-bottom: vh(20);
.title {
color: rgba(255, 255, 255, 1);
font-size: 22px;
font-size: fs(22);
font-family: SourceHanSansCN-Medium, sans-serif;
font-weight: 500;
}
@ -147,16 +149,16 @@ const districts = ref([
.warning-levels {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin: 0 30px;
padding: 0 27px;
gap: vw(20);
margin: 0 vw(30);
padding: 0 vw(27);
}
.warning-level-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
gap: vh(10);
//
.badge-container {
@ -169,8 +171,8 @@ const districts = ref([
//
.level-badge {
position: relative;
width: 80px;
height: 90px;
width: vw(80);
height: vh(90);
display: flex;
align-items: center;
justify-content: center;
@ -185,7 +187,7 @@ const districts = ref([
.level-count {
position: relative;
font-size: 32px;
font-size: fs(32);
font-family: DISPLAYFREETFB, sans-serif;
font-weight: normal;
z-index: 1;
@ -195,9 +197,9 @@ const districts = ref([
//
.glow-base {
width: 72px;
height: 65px;
margin-top: -10px;
width: vw(72);
height: vh(65);
margin-top: vh(-10);
z-index: 1;
//
@ -207,7 +209,7 @@ const districts = ref([
background-position:
center 0px, //
center 10px; //
center vh(10); //
background-size:
100% auto, //
@ -219,35 +221,35 @@ const districts = ref([
//
.level-name {
color: rgba(255, 255, 255, 1);
font-size: 14px;
font-size: fs(14);
font-family: SourceHanSansCN-Bold, sans-serif;
font-weight: 700;
text-align: center;
margin-top: 4px;
margin-top: vh(4);
}
}
.altitude-section {
margin: 20px 0;
margin: vh(20) 0;
.altitude-header {
width: 100%;
height: 38px;
height: vh(38);
background: url(../assets/img/weather-altitude-bar-bg.png) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
gap: 10px;
padding: 0 10px;
gap: vw(10);
padding: 0 vw(10);
.altitude-icon {
width: 39px;
height: 35px;
width: vw(39);
height: vh(35);
}
span {
color: rgba(255, 255, 255, 1);
font-size: 16px;
font-size: fs(16);
font-family: PingFangSC-Semibold, sans-serif;
font-weight: 600;
}
@ -260,7 +262,7 @@ const districts = ref([
flex-direction: column;
.table-header {
height: 35px;
height: vh(35);
background: url(../assets/img/weather-table-header-bg.png) no-repeat;
background-size: 100% 100%;
display: grid;
@ -268,21 +270,21 @@ const districts = ref([
align-items: center;
text-align: center;
color: rgba(255, 255, 255, 1);
font-size: 14px;
font-size: fs(14);
font-family: SourceHanSansCN-Medium, sans-serif;
font-weight: 500;
margin-bottom: 5px;
margin-bottom: vh(5);
}
.table-row {
height: 35px;
height: vh(35);
display: grid;
grid-template-columns: 9px 1fr 1fr 1fr;
grid-template-columns: vw(9) 1fr 1fr 1fr;
align-items: center;
gap: 10px;
padding: 0 10px;
gap: vw(10);
padding: 0 vw(10);
color: rgba(255, 255, 255, 1);
font-size: 14px;
font-size: fs(14);
font-family: PingFangSC-Medium, sans-serif;
font-weight: 500;
@ -297,9 +299,9 @@ const districts = ref([
}
.row-indicator {
width: 9px;
height: 33px;
border-radius: 1px;
width: vw(9);
height: vh(33);
border-radius: vw(1);
}
.district-name {

View File

@ -50,11 +50,13 @@ const xAxisYears = ref([
])
</script>
<style scoped lang="less">
<style scoped lang="scss">
@import '@/styles/mixins.scss';
.year-statistics {
background: url(../assets/img/statistics-panel-bg.png) no-repeat;
background-size: 100% 100%;
padding: 20px 30px;
padding: vw(20) vw(30);
flex: 1;
display: flex;
flex-direction: column;
@ -62,18 +64,18 @@ const xAxisYears = ref([
.panel-header {
position: relative;
width: 293px;
height: 49px;
width: vw(293);
height: vh(49);
background: url(../assets/img/common-panel-header-bg.png) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
padding-left: 24px;
margin-bottom: 25px;
padding-left: vw(24);
margin-bottom: vh(25);
.title {
color: rgba(255, 255, 255, 1);
font-size: 22px;
font-size: fs(22);
font-family: SourceHanSansCN-Medium, sans-serif;
font-weight: 500;
}
@ -82,18 +84,18 @@ const xAxisYears = ref([
.chart-header {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 10px;
padding-left: 10px;
gap: vw(15);
margin-bottom: vh(10);
padding-left: vw(10);
.y-axis-label {
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-size: fs(12);
}
.chart-title {
color: rgba(255, 255, 255, 1);
font-size: 16px;
font-size: fs(16);
font-family: PingFangSC-Semibold, sans-serif;
font-weight: 600;
margin-left: auto;
@ -101,17 +103,17 @@ const xAxisYears = ref([
.legend {
display: flex;
gap: 15px;
gap: vw(15);
.legend-item {
display: flex;
align-items: center;
gap: 5px;
gap: vw(5);
.legend-color {
width: 9px;
height: 9px;
border-radius: 4px;
width: vw(9);
height: vh(9);
border-radius: vw(4);
&.blue {
background-color: rgba(0, 143, 255, 1);
@ -124,7 +126,7 @@ const xAxisYears = ref([
span {
color: rgba(255, 255, 255, 1);
font-size: 10px;
font-size: fs(10);
}
}
}
@ -133,18 +135,18 @@ const xAxisYears = ref([
.chart-container {
flex: 1;
display: flex;
gap: 10px;
margin-bottom: 10px;
gap: vw(10);
margin-bottom: vh(10);
.y-axis {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 5px 0;
padding: vh(5) 0;
span {
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-size: fs(12);
font-family: HelveticaNeue, sans-serif;
text-align: right;
}
@ -157,7 +159,7 @@ const xAxisYears = ref([
display: flex;
align-items: center;
justify-content: center;
padding: 15px;
padding: vw(15);
.chart-image {
width: 100%;
@ -170,11 +172,11 @@ const xAxisYears = ref([
.x-axis {
display: flex;
justify-content: space-around;
padding: 0 40px 0 60px;
padding: 0 vw(40) 0 vw(60);
span {
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-size: fs(12);
text-align: center;
}
}