fix: 消息页面bug修复。主页新增控制开关定时,溶解氧和温度显示红色标识逻辑。
This commit is contained in:
@@ -99,6 +99,8 @@
|
|||||||
:class="
|
:class="
|
||||||
!item.up
|
!item.up
|
||||||
? ''
|
? ''
|
||||||
|
: (item.oxyWarnLower && Number(item.valueDissolvedOxygen) < Number(item.oxyWarnLower))
|
||||||
|
? 'c_E22323'
|
||||||
: alarmJudgeCode(item.warnCodeInfo?.warnCode, 7)
|
: alarmJudgeCode(item.warnCodeInfo?.warnCode, 7)
|
||||||
? 'c_E22323'
|
? 'c_E22323'
|
||||||
: ''
|
: ''
|
||||||
@@ -126,6 +128,9 @@
|
|||||||
:class="
|
:class="
|
||||||
!item.up
|
!item.up
|
||||||
? ''
|
? ''
|
||||||
|
: (item.tempWarnUpper && Number(item.valueTemperature) > Number(item.tempWarnUpper)) ||
|
||||||
|
(item.tempWarnLower && Number(item.valueTemperature) < Number(item.tempWarnLower))
|
||||||
|
? 'c_E22323'
|
||||||
: alarmJudgeCode(item.warnCodeInfo?.warnCode, 9) ||
|
: alarmJudgeCode(item.warnCodeInfo?.warnCode, 9) ||
|
||||||
alarmJudgeCode(item.warnCodeInfo?.warnCode, 8)
|
alarmJudgeCode(item.warnCodeInfo?.warnCode, 8)
|
||||||
? 'c_E22323'
|
? 'c_E22323'
|
||||||
@@ -820,6 +825,8 @@ const keepNightOpen = ref(false);
|
|||||||
const openSetNameSwitch = ref(false);
|
const openSetNameSwitch = ref(false);
|
||||||
const switchName = ref<string>('');
|
const switchName = ref<string>('');
|
||||||
const switchId = ref<number>();
|
const switchId = ref<number>();
|
||||||
|
// 定时刷新定时器
|
||||||
|
const refreshTimer = ref<any>(null);
|
||||||
/** -----------------method start----------------- */
|
/** -----------------method start----------------- */
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
const sysInfo = Taro.getSystemInfoSync();
|
const sysInfo = Taro.getSystemInfoSync();
|
||||||
@@ -836,6 +843,9 @@ Taro.useDidShow(() => {
|
|||||||
visControl.value = false;
|
visControl.value = false;
|
||||||
getDeviceList();
|
getDeviceList();
|
||||||
getNowDate();
|
getNowDate();
|
||||||
|
|
||||||
|
// 启动定时刷新,每10秒刷新一次开关状态
|
||||||
|
startRefreshTimer();
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const sysInfo = Taro.getSystemInfoSync();
|
const sysInfo = Taro.getSystemInfoSync();
|
||||||
@@ -853,7 +863,35 @@ onMounted(() => {
|
|||||||
|
|
||||||
getDeviceList();
|
getDeviceList();
|
||||||
getNowDate();
|
getNowDate();
|
||||||
|
|
||||||
|
// 启动定时刷新,每10秒刷新一次开关状态
|
||||||
|
startRefreshTimer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 页面隐藏时停止定时刷新
|
||||||
|
Taro.useDidHide(() => {
|
||||||
|
stopRefreshTimer();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 启动定时刷新
|
||||||
|
function startRefreshTimer() {
|
||||||
|
// 先清除已有的定时器
|
||||||
|
stopRefreshTimer();
|
||||||
|
// 每10秒刷新一次
|
||||||
|
refreshTimer.value = setInterval(() => {
|
||||||
|
if (controlList.value.length > 0) {
|
||||||
|
getDeviceList();
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停止定时刷新
|
||||||
|
function stopRefreshTimer() {
|
||||||
|
if (refreshTimer.value) {
|
||||||
|
clearInterval(refreshTimer.value);
|
||||||
|
refreshTimer.value = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
emit("getPondInfo", pondDeviceRes.value);
|
emit("getPondInfo", pondDeviceRes.value);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -284,11 +284,19 @@ let currentLoadingPage = 0;
|
|||||||
let isInitialized = false;
|
let isInitialized = false;
|
||||||
|
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
// 只在首次显示时加载数据
|
// 每次显示页面时都刷新数据,确保数据一致性
|
||||||
if (!isInitialized) {
|
// 重置分页参数
|
||||||
selectVal.value = 0;
|
warnParams.value.pageNum = 1;
|
||||||
|
switchParams.value.pageNum = 1;
|
||||||
|
payParams.value.pageNum = 1;
|
||||||
|
|
||||||
|
// 根据当前选中的标签刷新对应数据
|
||||||
|
if (selectVal.value === 0) {
|
||||||
getWarnMsg();
|
getWarnMsg();
|
||||||
isInitialized = true;
|
} else if (selectVal.value === 1) {
|
||||||
|
getSwitchMsg();
|
||||||
|
} else if (selectVal.value === 2) {
|
||||||
|
getPayMsg();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 头部组件刷新
|
// 头部组件刷新
|
||||||
|
|||||||
Reference in New Issue
Block a user