自动化页面简写

feasure
lld 2026-02-26 17:57:04 +08:00
parent adc5a2e41f
commit c3b30deadb
2 changed files with 12 additions and 27 deletions

View File

@ -7,34 +7,17 @@
</template> </template>
<view> <view>
<!-- 优化度卡片循环渲染 --> <!-- 优化湿度卡片循环渲染 -->
<view class="uni-flex_control uni-row"> <view class="uni-flex_control uni-row" v-for="data in dataType" :key="data.name">
<view <view
class="text uni-flex_control_one uni-view" :class="['text', `uni-flex_control_${data.name}`,'uni-view']"
v-for="item in sensorCards.temp" v-for="item in sensorCards[data.name]"
:key="item.key" :key="item.key"
@click="openDataModal(item)" @click="openDataModal(item)"
> >
<text class="data" :style="fontStyle"> <text class="data" :style="fontStyle">
{{ liveData[item.key] }} {{ liveData[item.key] }}
<text v-if="isEffectiveValue(liveData[item.key])" class="tempStyle"></text> <text v-if="isEffectiveValue(liveData[item.key])" class="dataStyle">{{data.unit}}</text>
</text>
<text class="data" v-if="dtu_remark[item.key]">{{ dtu_remark[item.key] }}</text>
<text class="data" v-else>{{ item.label }}</text>
</view>
</view>
<!-- 优化湿度卡片循环渲染 -->
<view class="uni-flex_control uni-row">
<view
class="text uni-flex_control_two uni-view"
v-for="item in sensorCards.humi"
:key="item.key"
@click="openDataModal(item)"
>
<text class="data" :style="fontStyle">
{{ liveData[item.key] }}
<text v-if="isEffectiveValue(liveData[item.key])" class="humiStyle"> %RH</text>
</text> </text>
<text class="data" v-if="dtu_remark[item.key]">{{ dtu_remark[item.key] }}</text> <text class="data" v-if="dtu_remark[item.key]">{{ dtu_remark[item.key] }}</text>
<text class="data" v-else>{{ item.label }}</text> <text class="data" v-else>{{ item.label }}</text>
@ -201,6 +184,7 @@ export default {
// //
if (newVal) { if (newVal) {
this.imei = this.value this.imei = this.value
console.info(this.liveData)
} }
} }
} }
@ -253,7 +237,7 @@ export default {
imei: '', imei: '',
// 湿1234湿1234 // 湿1234湿1234
sensorCard:{}, sensorCard:{},
dataType: ["temp", "humi"] dataType: [{name:"temp", unit: "℃"}, {name:"humi", unit: "%RH"}]
}; };
}, },
@ -638,7 +622,7 @@ export default {
box-shadow: 0 2rpx 8rpx #bfbec1 box-shadow: 0 2rpx 8rpx #bfbec1
} }
.tempStyle, .humiStyle { .dataStyle {
display: inline-block; display: inline-block;
font-size: 12px; font-size: 12px;
} }

View File

@ -25,15 +25,16 @@ form {
flex-direction: column; flex-direction: column;
} }
.uni-flex_control_one { .uni-flex_control_temp {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: radial-gradient(circle at bottom right, #faf1f1 40%, #F8FCFE 100%); background: radial-gradient(circle at bottom right, #faf1f1 40%, #F8FCFE 100%);
} }
.uni-flex_control_two { .uni-flex_control_humi {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: radial-gradient(circle at top left, #E8F4F8 40%, #F8FCFE 100%); background: radial-gradient(circle at top left, #E8F4F8 40%,
#F8FCFE 100%);
} }
.uni-flex-item { .uni-flex-item {