临时提交

master
blak-kong 2 years ago
parent a7da7f1ade
commit 4db65b4d05

@ -421,7 +421,9 @@ class Index extends Component<any, any> {
Taro.setStorageSync("mobile", data.data.mobile); Taro.setStorageSync("mobile", data.data.mobile);
this.props.tokenRefresh(data.data); this.props.tokenRefresh(data.data);
this.initPageData(); setTimeout(() => {
this.initPageData();
}, 300);
} else { } else {
msg("请求失败,尝试重新请求"); msg("请求失败,尝试重新请求");
this.WCUserLogin(); this.WCUserLogin();

@ -615,26 +615,31 @@ class IotCarePlan extends Component<any, any> {
); );
this.setState({ this.setState({
Electricity: jsonStatus.battery, Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery,
workStatus: jsonStatus.workStatus,
workMode: jsonStatus?.workMode,
});
this.setState({
fr200Electricity: jsonStatus.battery, fr200Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery, matrixElectricity: jsonStatus.matrixBattery,
workStatus: jsonStatus.workStatus, workStatus: jsonStatus.workStatus,
workMode: jsonStatus?.workMode, workMode: jsonStatus?.workMode,
}); });
// this.setState({
// fr200Electricity: jsonStatus.battery,
// matrixElectricity: jsonStatus.matrixBattery,
// workStatus: jsonStatus.workStatus,
// workMode: jsonStatus?.workMode,
// });
// 判断是否在step == 2(护理中) // 判断是否在step == 2(护理中)
if ( if (
this.state.step == 2 && this.state.step == 2 &&
jsonStatus.workStatus !== MODE_WORKING_ENUM.END jsonStatus.workStatus !== MODE_WORKING_ENUM.END
) { ) {
this.updateDeviceSyncData({ this.updateDeviceSyncData(
totalWorkingMinutes: jsonStatus.totalWorkingMinutes, {
totalWorkingSeconds: jsonStatus.totalWorkingSeconds, totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
}); totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
},
jsonStatus
);
} }
if (jsonStatus.workMode && this.state.step == 2) { if (jsonStatus.workMode && this.state.step == 2) {
const { ActiveModeItem } = this.state; const { ActiveModeItem } = this.state;
const item = ActiveModeItem; const item = ActiveModeItem;
@ -647,16 +652,13 @@ class IotCarePlan extends Component<any, any> {
}); });
} }
} }
// // 我忘记了为啥要这样传参... 埋坑了...
this.judgementWorkStatus( // 根据工作状态:执行逻辑
jsonStatus.workStatus,
jsonStatus.workMode, // if (jsonStatus.workMode && this.state.step == 2) {
jsonStatus // // this.judgementModel(jsonStatus.workMode);
); // // that.data.startSettingCountDown = false;
if (jsonStatus.workMode && this.state.step == 2) { // }
// this.judgementModel(jsonStatus.workMode);
// that.data.startSettingCountDown = false;
}
break; break;
//设备信息查询返回 //设备信息查询返回
case "InfoQuery": case "InfoQuery":
@ -816,19 +818,19 @@ class IotCarePlan extends Component<any, any> {
} }
//待完善,以后同步设备数据到小程序的事件,在这个事件里判断是否需要更新页面(是否需要触发setData) //待完善,以后同步设备数据到小程序的事件,在这个事件里判断是否需要更新页面(是否需要触发setData)
updateDeviceSyncData = (newData) => { updateDeviceSyncData = (newData, jsonStatus) => {
DeviceSyncData = { DeviceSyncData = {
...DeviceSyncData, ...DeviceSyncData,
...newData, ...newData,
}; };
if (newData.hasOwnProperty("totalWorkingSeconds")) { if (newData.hasOwnProperty("totalWorkingSeconds")) {
this.renderDeviceStatus.renderWorkTime(); this.renderDeviceStatus.renderWorkTime(jsonStatus);
} }
}; };
// 渲染页面时间状态 // 页面同步护理剩余时间
renderDeviceStatus = { renderDeviceStatus = {
renderWorkTime: () => { renderWorkTime: (jsonStatus) => {
const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData; const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData;
const { ActiveModeItem, currentTime } = this.state; const { ActiveModeItem, currentTime } = this.state;
const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds; const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds;
@ -840,7 +842,7 @@ class IotCarePlan extends Component<any, any> {
const timeRemaining = sceneTime - hourMinSecToS(currentTime); // 小程序上已运行的总秒数 const timeRemaining = sceneTime - hourMinSecToS(currentTime); // 小程序上已运行的总秒数
if ( if (
Math.abs(timeRemaining - totalTime) >= 2 && Math.abs(timeRemaining - totalTime) >= 0 &&
this.state.step == 2 && this.state.step == 2 &&
this.state.facialMaskConnectStatus == 1 this.state.facialMaskConnectStatus == 1
) { ) {
@ -853,6 +855,14 @@ class IotCarePlan extends Component<any, any> {
ActiveModeItem, ActiveModeItem,
}); });
} }
if (Math.abs(timeRemaining - totalTime) < 0) {
this.judgementWorkStatus(
MODE_WORKING_ENUM.END,
jsonStatus.workMode,
jsonStatus
);
}
}, },
}; };
@ -891,9 +901,8 @@ class IotCarePlan extends Component<any, any> {
// ActiveModeItem // ActiveModeItem
let nowModeItem; let nowModeItem;
if (nWorkMode) { if (nWorkMode) {
const nowModeType = WORK_MODE_TYPE[nWorkMode];
nowModeItem = ModeList.find((item) => { nowModeItem = ModeList.find((item) => {
return item.model_type == nowModeType; return item.modeType === nWorkMode;
}); });
} }
opts.workStatus = nWorkStatus; opts.workStatus = nWorkStatus;
@ -908,7 +917,7 @@ class IotCarePlan extends Component<any, any> {
isShowCountdown: false, isShowCountdown: false,
}); });
if (nowModeItem?.isStandMode && step == 2) { if (nowModeItem?.isStandMode && step == 2) {
opts.currentTime = nowModeItem.time; opts.currentTime = nowModeItem.modeTime;
} else if (!nowModeItem?.isStandMode && step == 2) { } else if (!nowModeItem?.isStandMode && step == 2) {
// fix: 启动非支架模式倒计时时连上支架仪器的状态变为standby // fix: 启动非支架模式倒计时时连上支架仪器的状态变为standby
opts.step = 1; opts.step = 1;
@ -943,7 +952,7 @@ class IotCarePlan extends Component<any, any> {
}); });
} }
if (nowModeItem) { if (nowModeItem) {
opts.currentTime = nowModeItem.time; opts.currentTime = nowModeItem.modeTime;
} }
// startSettingCountDown 用于标记打开了倒计时loading // startSettingCountDown 用于标记打开了倒计时loading
if (!this.state.isShowCountdown) { if (!this.state.isShowCountdown) {
@ -999,7 +1008,7 @@ class IotCarePlan extends Component<any, any> {
currentTime: s_to_hms(timeRemaining), currentTime: s_to_hms(timeRemaining),
}); });
} }
this.endnursing(null, true); this.endnursing(true);
// this.rmWL200NursingHistory(this.state.WL200NursingHistory); // this.rmWL200NursingHistory(this.state.WL200NursingHistory);
}, },
}; };
@ -1048,7 +1057,7 @@ class IotCarePlan extends Component<any, any> {
* *
* param isAuto * param isAuto
*/ */
endnursing(e, isAuto) { endnursing = (isAuto) => {
if (isAuto == true) { if (isAuto == true) {
// 仪器自动上报完成, 直接上报并跳转报告页 // 仪器自动上报完成, 直接上报并跳转报告页
clearInterval(timer); clearInterval(timer);
@ -1062,16 +1071,9 @@ class IotCarePlan extends Component<any, any> {
// this.handleTimeCheck(that.endNurseFun) // this.handleTimeCheck(that.endNurseFun)
} else { } else {
// 手动点击结束, 弹出弹窗, 看看是否需要结束 // 手动点击结束, 弹出弹窗, 看看是否需要结束
this.setState({ this.onEndPlan();
popupType: "endPopup",
});
/*showModal({
t2: "是否结束护理?",
}).then(async () => {
this.handleTimeCheck(that.endNurseFun)
});*/
} }
} };
// 设置自定义模式数据 // 设置自定义模式数据
setCustomModeData() { setCustomModeData() {
@ -1436,6 +1438,7 @@ class IotCarePlan extends Component<any, any> {
Electricity, Electricity,
errorTips, errorTips,
isEndCarePlan, isEndCarePlan,
currentTime,
} = this.state; } = this.state;
return ( return (
<Block> <Block>
@ -1505,7 +1508,7 @@ class IotCarePlan extends Component<any, any> {
className="msg-tips-img" className="msg-tips-img"
src={require("../../img/tips.png")} src={require("../../img/tips.png")}
/> />
<View className="msg-tips-content">{{ errorTips }}</View> <View className="msg-tips-content">{errorTips}</View>
</View> </View>
</Block> </Block>
)} )}
@ -1513,27 +1516,17 @@ class IotCarePlan extends Component<any, any> {
<View className="iot-device"> <View className="iot-device">
<View className="item border-right"> <View className="item border-right">
<Text>10:00</Text> <Text>{currentTime}</Text>
</View> </View>
<View className="item"> <View className="item">
<Text>WE200</Text> <Text>WE200</Text>
<View className="value flex aitems"> <View className="value flex aitems">
{Electricity === 5 && ( {Electricity >= 4 && (
<Block>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
</Block>
)}
{Electricity === 4 && (
<Block> <Block>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 3 && ( {Electricity === 3 && (
@ -1542,7 +1535,6 @@ class IotCarePlan extends Component<any, any> {
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 2 && ( {Electricity === 2 && (
@ -1551,7 +1543,6 @@ class IotCarePlan extends Component<any, any> {
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 1 && ( {Electricity === 1 && (
@ -1560,7 +1551,6 @@ class IotCarePlan extends Component<any, any> {
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 0 && ( {Electricity === 0 && (
@ -1569,7 +1559,6 @@ class IotCarePlan extends Component<any, any> {
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
</View> </View>

Loading…
Cancel
Save