优化设备控制界面,增加设备名称显示,调整按钮样式
This commit is contained in:
@@ -134,10 +134,7 @@ Page({
|
||||
addDialogSelectedGroupIndex: 0,
|
||||
},
|
||||
|
||||
// 动态计算日志区域高度(像素)
|
||||
// 在页面显示或切换到日志 Tab 时调用,计算公式:高度 = 窗口高度 - 日志卡片顶部
|
||||
// 若计算结果过小则使用最小值保障可见性
|
||||
|
||||
|
||||
|
||||
// 中间层:在执行测试按键动作前检查连接状态
|
||||
maybeOnTestKeyTap(e) {
|
||||
|
||||
@@ -128,10 +128,15 @@ if (Nres.Status==200) {
|
||||
code:options.HotelCode
|
||||
}).then(res =>{
|
||||
if (res.IsSuccess==true) {
|
||||
|
||||
|
||||
for (let index = 0; index < res.Result.length; index++) {
|
||||
const element = res.Result[index];
|
||||
if (element.ID == options.roomtypeid) {
|
||||
for (let Nindex = 0; Nindex < element.Modals.length; Nindex++) {
|
||||
element.Modals[Nindex].addrindex=this.Getloopnumber( element.Modals[Nindex].ModalAddress)
|
||||
}
|
||||
|
||||
|
||||
this.setData({
|
||||
roomtypeInfo:res.Result,
|
||||
roomtypeInfoNodeinfo:element.Modals
|
||||
@@ -139,6 +144,7 @@ if (Nres.Status==200) {
|
||||
break
|
||||
}
|
||||
}
|
||||
console.log("roomtypeInfoNodeinfo")
|
||||
console.log(this.data.roomtypeInfoNodeinfo)
|
||||
this.LoopDebugging(null)
|
||||
}
|
||||
@@ -198,6 +204,29 @@ if (Nres.Status==200) {
|
||||
|
||||
},
|
||||
|
||||
// 根据回路地址字符串解析回路号。
|
||||
// 逻辑:
|
||||
// 1) 若输入为空或长度小于9,返回0
|
||||
// 2) 取字符串最后3位;若不为 "000",尝试 parseInt 后返回结果(失败返回0)
|
||||
// 3) 若最后3位为 "000",则取倒数第4~6位(即 slice(-6,-3))尝试 parseInt 返回(失败返回0)
|
||||
Getloopnumber(loopaddr) {
|
||||
try {
|
||||
const s = (loopaddr || '') + ''
|
||||
if (!s || s.length < 9) return 0
|
||||
const tail3 = s.slice(-3)
|
||||
if (tail3 !== '000') {
|
||||
const v = parseInt(tail3, 10)
|
||||
return isNaN(v) ? 0 : v
|
||||
}
|
||||
const mid3 = s.slice(-6, -3)
|
||||
const v2 = parseInt(mid3, 10)
|
||||
return isNaN(v2) ? 0 : v2
|
||||
} catch (e) {
|
||||
return 0
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
@@ -94,10 +94,10 @@
|
||||
<!-- <view style="text-align: left;font-weight: bold">设置设备开关状态:</view> -->
|
||||
<view class="Ncu-bar bg-white flex-sub" wx:for="{{row[1].length/4 }}" wx:for-index="colIndex" >
|
||||
<view class="Ncu-bar bg-white" wx:if="{{colIndex*4<row[1].length}}">
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4<row[1].length}}" style="background-color: {{row[1][colIndex*4][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][colIndex*4][1] }}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+1][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+1<row[1].length}}" style="background-color: {{row[1][colIndex*4+1][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+1][1] }}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+2][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+2<row[1].length}}" style="background-color: {{row[1][colIndex*4+2][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+2][1] }}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+3][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+3<row[1].length}}" style="background-color: {{row[1][colIndex*4+3][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+3][1] }}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4<row[1].length}}" style="background-color: {{row[1][colIndex*4][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][colIndex*4][3]}}_{{row[1][colIndex*4][1]}}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+1][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+1<row[1].length}}" style="background-color: {{row[1][colIndex*4+1][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+1][3] }}_{{row[1][colIndex*4+1][1] }}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+2][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+2<row[1].length}}" style="background-color: {{row[1][colIndex*4+2][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+2][3] }}_{{row[1][colIndex*4+2][1] }}</button>
|
||||
<button id="1" class="cu-btn round1 margin-3 vlg" data-value="1" data-index="{{row[1][colIndex*4+3][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+3<row[1].length}}" style="background-color: {{row[1][colIndex*4+3][2][0][2]===0 ? '#E6E6E6':'#39b54a'}};">{{row[1][colIndex*4+3][3] }}_{{row[1][colIndex*4+3][1] }}</button>
|
||||
<!-- <button class="cu-btn round margin-3 nlg" data-index="{{row[1][colIndex*5+4][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*4+4<row[1].length}}">{{row[1][colIndex*4+4][1] }}</button> -->
|
||||
<!-- <button class="cu-btn round margin-3 nlg" data-index="{{row[1][colIndex*6+5][0]}}" bindtap="SetDeviceSwitchStatus" wx:if="{{colIndex*6+5<row[1].length}}">{{row[1][colIndex*6+5][1] }}</button> -->
|
||||
</view>
|
||||
@@ -109,7 +109,7 @@
|
||||
<!-- <view style="text-align: left;font-weight: bold">设置调光亮度:</view> -->
|
||||
<view class="bg-white" wx:for="{{row[1].length}}" wx:for-index="DimIndex" >
|
||||
<view class="Ncu-bar bg-white">
|
||||
<view class="flex-twice">{{row[1][DimIndex][1]}}</view>
|
||||
<view class="flex-twice">{{row[1][DimIndex][3]}}_{{row[1][DimIndex][1]}}</view>
|
||||
<slider id="23" data-index="{{row[1][DimIndex][0]}}" class="flex-eight" min="10" max="90" step="1" value="{{row[1][DimIndex][2][0][2]}}" bindchange="SetDeviceSwitchStatusslider" ></slider>
|
||||
<view class="flex-sub">{{row[1][DimIndex][2][0][2]}}</view>
|
||||
</view>
|
||||
@@ -126,7 +126,7 @@
|
||||
<view class=" bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex" >
|
||||
<view class="Ncu-bar bg-white">
|
||||
<view class=" flex-twice margin-3 " >
|
||||
<button id="52" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][1]}}</button>
|
||||
<button id="52" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][3]}}_{{row[1][coloIndex][1]}}</button>
|
||||
</view>
|
||||
<view class=" flex-xis Ncubar1 solid-left " >
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
<view class="bg-white" wx:for="{{row[1].length}}" wx:for-index="coloIndex">
|
||||
<view class="Ncu-bar bg-white">
|
||||
|
||||
<view class="flex-treble" style="font-weight: bold">{{row[1][coloIndex][1]}}</view>
|
||||
<view class="flex-treble" style="font-weight: bold">{{row[1][coloIndex][3]}}_{{row[1][coloIndex][1]}}</view>
|
||||
<view class="Ncubar1 bg-white flex-eight">
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
<view class="Ncu-bar bg-white">
|
||||
<view class=" flex-twice margin-xs " >
|
||||
<!-- <button class="cu-btn round1 Elg">{{row[1][coloIndex][1]}}</button> -->
|
||||
<button id="7" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][1]}}</button>
|
||||
<button id="7" data-type="1" data-value="1" data-index="{{row[1][coloIndex][0]}}" class="cu-btn round1 Elg" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][0][2]===0 ? '#E6E6E6 ':'#39b54a'}};" >{{row[1][coloIndex][3]}}_{{row[1][coloIndex][1]}}</button>
|
||||
</view>
|
||||
<view class=" flex-8 Ncubar1 solid-left " >
|
||||
<button id="7" data-type="2" data-value="1" data-index="{{row[1][coloIndex][0]}}" class=" cu-btn round1 clg margin-3" bindtap="SetDeviceSwitchStatus" style="background-color: {{row[1][coloIndex][2][1][2]===4 ? '#E6E6E6 ':row[1][coloIndex][2][1][2]===3 ? '#1cbbb4':row[1][coloIndex][2][1][2]===2 ? '#e54d42':'#0081ff'}};" >{{row[1][coloIndex][2][1][2]===4 ? '自动':row[1][coloIndex][2][1][2]===3 ? '送风':row[1][coloIndex][2][1][2]===2 ? '制热':'制冷'}}</button>
|
||||
|
||||
Reference in New Issue
Block a user