唐润平:UI显示面板开发起步版

This commit is contained in:
trp
2023-12-08 16:12:55 +08:00
parent 3edbf7312f
commit e20b7c1002
34 changed files with 1202 additions and 4 deletions

View File

@@ -0,0 +1,99 @@
<template>
<div id="wind-pressure">
<div class="name">风压</div>
<div class="list">
<wind-pressure-item v-for="item in wpList" :wp="item" />
</div>
</div>
</template>
<script setup>
import WindPressureItem from "./childComps/WindPressureItem.vue";
const wpList = [
{
windPId: 1, //编号
max: 120, //最大值
value: 40, //测量值
point: 60, //阈值
},
{
windPId: 1, //编号
max: 120, //最大值
value: 66, //测量值
point: 60, //阈值
},
{
windPId: 2, //编号
max: 120, //最大值
value: 70, //测量值
point: 50, //阈值
},
{
windPId: 3, //编号
max: 120, //最大值
value: 90, //测量值
point: 60, //阈值
},
{
windPId: 4, //编号
max: 120, //最大值
value: 40, //测量值
point: 30, //阈值
},
{
windPId: 5, //编号
max: 120, //最大值
value: 30, //测量值
point: 50, //阈值
},
{
windPId: 6, //编号
max: 120, //最大值
value: 20, //测量值
point: 30, //阈值
},
{
windPId: 7, //编号
max: 120, //最大值
value: 20, //测量值
point: 30, //阈值
},
{
windPId: 8, //编号
max: 120, //最大值
value: 120, //测量值
point: 80, //阈值
},
{
windPId: 9, //编号
max: 120, //最大值
value: 99, //测量值
point: 70, //阈值
},
];
</script>
<style lang="scss" scoped>
#wind-pressure {
width: 830px;
height: 779px;
position: absolute;
top: 185px;
right: 68px;
background-image: url(../../../assets/images/windPressure/bg.png);
background-position: center center;
background-size: 100%;
background-repeat: no-repeat;
padding-top: 22px;
.name {
width: 64px;
height: 42px;
font-size: 32px;
font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold;
color: #38cafb;
line-height: 42px;
margin-left: 62px;
}
}
</style>

View File

@@ -0,0 +1,121 @@
<template>
<div id="wind-pressure-item">
<div class="label">
<img src="../../../../assets/images/windPressure/icon.png" alt="" /><span
>{{ params.wp.windPId }}号风压</span
>
</div>
<div class="container" ref="length">
<div class="value" ref="value"></div>
<div id="point" ref="point"></div>
</div>
<div class="value-num" :class="{ warning: isWaring }">
{{ params.wp.value }}Pa
</div>
</div>
</template>
<script setup>
import { reactive, onMounted, watch, defineProps, computed } from "vue";
const params = defineProps({
wp: Object,
});
// const info = {
// windPId: 0, //编号
// max: 120, //最大值
// value: 40, //测量值
// point: 60, //阈值
// };
// const wp = reactive(info);
const length = ref(null);
const value = ref(null);
const point = ref(null);
onMounted(handleOnMounted);
function handleOnMounted() {
// const = length.value.offsetWidth);
setValue();
}
watch(
() => params.wp.value,
(value) => {
setValue();
}
);
function setValue() {
let width = (params.wp.value * length.value.offsetWidth) / params.wp.max;
value.value.style.width = `${width}px`;
let flag = (params.wp.point * length.value.offsetWidth) / params.wp.max;
point.value.style.left = `${flag}px`;
if (width >= flag) {
value.value.style.background = "#F53839";
} else {
value.value.style.background = "#60DDDE";
}
}
let isWaring = computed(() => {
return params.wp.value >= params.wp.point;
});
</script>
<style lang="scss" scoped>
#wind-pressure-item {
display: flex;
align-items: center;
width: 100%;
padding: 20px 0px 14px 33px;
.label {
display: flex;
align-items: center;
img {
height: 26px;
width: 26px;
}
span {
width: 101px;
height: 37px;
font-size: 28px;
font-family: MicrosoftYaHei;
color: #d6f1fa;
line-height: 37px;
margin: 0px 20px 0px 14px;
}
}
.container {
width: 500px;
height: 24px;
border-radius: 12px;
border: 1px solid #0f82af;
position: relative;
.value {
height: inherit;
width: 0px;
background: #60ddde;
border-radius: 10px;
transition: width 0.5s linear 0s;
}
#point {
position: absolute;
height: inherit;
width: 10px;
background: #60ddde;
top: 0px;
left: 1px;
}
}
.value-num {
height: 37px;
font-size: 28px;
font-family: MicrosoftYaHei;
color: #d6f1fa;
line-height: 37px;
margin-left: 20px;
}
.warning {
color: #f53839;
font-size: 28px;
font-weight: bold;
font-family: MicrosoftYaHei;
}
}
</style>