|
|
|
|
@ -916,34 +916,32 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
if (jsonStatus.workMode === "moistureTest") {
|
|
|
|
|
if ("success" === jsonStatus.testStatus) {
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
// 到达第几个step
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
let timerIdSuccess = this.state.timerIdSuccess;
|
|
|
|
|
let timerIdSchedule = this.state.timerIdSchedule;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 代表5秒以后最后拿到的结果
|
|
|
|
|
if (waterStepList[waterStepIndex].finish) {
|
|
|
|
|
// 获取等级
|
|
|
|
|
waterStepList[waterStepIndex].forehead =
|
|
|
|
|
jsonStatus.waterLevel;
|
|
|
|
|
// 检测完成
|
|
|
|
|
if (waterStepIndex === 2) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isRuningTest: 4,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 启动检测
|
|
|
|
|
this.setState({
|
|
|
|
|
isRuningTest: 1,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearTimeout(timerIdSuccess);
|
|
|
|
|
clearTimeout(timerIdSchedule);
|
|
|
|
|
console.log("成功拿到", jsonStatus, waterStepIndex);
|
|
|
|
|
// 一共有3条数据
|
|
|
|
|
let num = waterStepIndex;
|
|
|
|
|
if (waterStepIndex < 2) {
|
|
|
|
|
num = waterStepIndex + 1;
|
|
|
|
|
this.waterTestNext(num);
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
timerIdSuccess: null,
|
|
|
|
|
timerIdSchedule: null,
|
|
|
|
|
waterStepIndex: num,
|
|
|
|
|
waterStepList,
|
|
|
|
|
});
|
|
|
|
|
@ -951,11 +949,9 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
} else {
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
let timerIdSuccess = this.state.timerIdSuccess;
|
|
|
|
|
let timerIdSchedule = this.state.timerIdSchedule;
|
|
|
|
|
// 5秒后获取的结果
|
|
|
|
|
if (waterStepList[waterStepIndex].finish) {
|
|
|
|
|
clearTimeout(timerIdSuccess);
|
|
|
|
|
clearTimeout(timerIdSchedule);
|
|
|
|
|
// 获取失败后,把进度条清理0
|
|
|
|
|
waterStepList[waterStepIndex].schedule = 0;
|
|
|
|
|
waterStepList[waterStepIndex].finish = false;
|
|
|
|
|
this.setState({
|
|
|
|
|
@ -1599,8 +1595,40 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
executePromises = async () => {
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
let that =this
|
|
|
|
|
await new Promise<void>((resolve) => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
waterStepList[waterStepIndex].schedule = 100;
|
|
|
|
|
that.setState({
|
|
|
|
|
|
|
|
|
|
waterStepList,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
resolve();
|
|
|
|
|
}, 3000);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
return new Promise<void>((resolve) => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
waterStepList[waterStepIndex].finish = true;
|
|
|
|
|
that.setState({
|
|
|
|
|
waterStepList,
|
|
|
|
|
});
|
|
|
|
|
resolve();
|
|
|
|
|
}, 2000);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检测并控制工作状态
|
|
|
|
|
handleWorkStatus = (isBtnClick: boolean, workStatus) => {
|
|
|
|
|
handleWorkStatus = async (isBtnClick: boolean, workStatus) => {
|
|
|
|
|
const { DeviceConnectStatus, ActiveModeItem } = this.state;
|
|
|
|
|
let newWorkStatus =
|
|
|
|
|
workStatus ||
|
|
|
|
|
@ -1626,30 +1654,16 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
if (ActiveModeItem.modeType === "moistureTest") {
|
|
|
|
|
let that = this;
|
|
|
|
|
sendParams.testStatus = "standby"; // 切换为准备
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
let timerIdSchedule = this.state.timerIdSchedule;
|
|
|
|
|
let timerIdSuccess = this.state.timerIdSuccess;
|
|
|
|
|
if (isBtnClick) {
|
|
|
|
|
timerIdSchedule = setTimeout(function () {
|
|
|
|
|
waterStepList[waterStepIndex].schedule = 100;
|
|
|
|
|
|
|
|
|
|
// 3秒定时器,逻辑3秒把进度条弄成100,再加2秒获取最后结果
|
|
|
|
|
|
|
|
|
|
timerIdSuccess = setTimeout(function () {
|
|
|
|
|
waterStepList[waterStepIndex].finish = true;
|
|
|
|
|
that.setState({
|
|
|
|
|
waterStepList,
|
|
|
|
|
});
|
|
|
|
|
}, 2000);
|
|
|
|
|
that.setState({
|
|
|
|
|
waterStepList,
|
|
|
|
|
timerIdSuccess,
|
|
|
|
|
});
|
|
|
|
|
}, 3000);
|
|
|
|
|
if (isBtnClick) {
|
|
|
|
|
that.setState({
|
|
|
|
|
isRuningTest: 2,
|
|
|
|
|
timerIdSchedule,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
// 水分测试启动
|
|
|
|
|
this.executePromises()
|
|
|
|
|
|
|
|
|
|
sendParams.testStatus = "start"; // 点击开始再开始
|
|
|
|
|
console.log("点击开始", isBtnClick);
|
|
|
|
|
}
|
|
|
|
|
@ -2106,12 +2120,7 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
return nursingData;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
nursingData: JSON.stringify({
|
|
|
|
|
workMode: nowFR200NursingHistory.workMode,
|
|
|
|
|
}),
|
|
|
|
|
showFace: true,
|
|
|
|
|
};
|
|
|
|
|
return { nursingData: JSON.stringify({ workMode: nowFR200NursingHistory.workMode, }), showFace: true }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 计算挡位
|
|
|
|
|
@ -2660,7 +2669,7 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
showFullscreenBtn={false}
|
|
|
|
|
onLoadedMetaData={this.GetVideosTime}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<button onClick={this.executePromises}>点击按钮</button>
|
|
|
|
|
{errorTips && (
|
|
|
|
|
<Block>
|
|
|
|
|
<View className="msg-tips">
|
|
|
|
|
|