qsj 2 years ago
commit cf920fd2c8

@ -128,24 +128,24 @@ class IotCarePlanFR200 extends Component<any, any> {
name: "额头",
finish: false,
schedule: 0,
color:'#c2e5f3',
forehead:0
color: "#c2e5f3",
forehead: 0,
},
{
value: "Step2",
name: "左脸颊",
finish: false,
schedule: 0,
color:'#c2e5f3',
forehead:0
color: "#c2e5f3",
forehead: 0,
},
{
value: "Step3",
name: "右脸颊",
finish: false,
schedule: 0,
color:'#c2e5f3',
forehead:0
color: "#c2e5f3",
forehead: 0,
},
],
stepIndex: 0,
@ -198,7 +198,8 @@ class IotCarePlanFR200 extends Component<any, any> {
countdown: 3,
// 是否结束护理
isEndCarePlan: false,
currentTime: "01:00",
currentTime: "10:00", // 倒计时时间WR200以视频为准
currentVideoTime: "10:00", // 当前视频时间
// 护理时间不够
isNotEnoughTime: false,
@ -413,18 +414,15 @@ class IotCarePlanFR200 extends Component<any, any> {
});
if (this.state.activeModeID != "") {
this.state.ModeList.map((item) => {
if (item.id === this.state.activeModeID) {
this.setState({
ActiveModeItem: item,
});
}
});
}
let res1 = res.data.data.find((e) => e.id == this.state.activeModeID);
setTimeout(() => {
this.modeCurrentFun(res1);
}, 100);
} else {
setTimeout(() => {
this.modeCurrentFun(res.data.data[0]);
}, 100);
}
} else {
this.setState({ ModeList: [] });
}
@ -477,14 +475,12 @@ class IotCarePlanFR200 extends Component<any, any> {
}
// 如果按钮不可点击则报错,内部自带检查底部按钮函数
this.onEmitErrorTips();
// this.onEmitErrorTips();
if (!isNotCheck) {
let isReturn = this.modeRuningChange();
if (isReturn) return;
}
let currentTime = data.modeTimeStr;
// 根据模式,动态设置底部按钮样式
let currentWorkModeType = 1;
if (data.modeType === "moistureTest") {
@ -502,7 +498,6 @@ class IotCarePlanFR200 extends Component<any, any> {
ModeID: "mode_" + data.id,
ModeStepIndex: 0,
ModeType: this.ModeTypeArray[data.modeClass],
currentTime,
currentWorkModeType,
});
@ -630,18 +625,18 @@ class IotCarePlanFR200 extends Component<any, any> {
};
/** 完成护理,跳转到水分 */
onsuccess = async () => {
let stepList= this.state.stepList
let stepList = this.state.stepList;
this.setState({
isShowNursingSuccess:true
})
isShowNursingSuccess: true,
});
// return;
let { currentDevice, ActiveModeItem } = this.state;
let params = {};
let nursingData = {
nursingData: JSON.stringify({
GearData:[...stepList]
})
}
GearData: [...stepList],
}),
};
params = {
instrumentId: currentDevice.id,
instrumentName: currentDevice.name,
@ -650,13 +645,18 @@ class IotCarePlanFR200 extends Component<any, any> {
nursingTime: s_to_hms(this.elapsedTime),
};
params = { ...params, ...nursingData };
let res: any = await InstrumentInfo.apiNursingLog.addLog(JSON.stringify(params));
let res: any = await InstrumentInfo.apiNursingLog.addLog(
JSON.stringify(params)
);
setTimeout(() => {
this.setState({
isShowNursingSuccess: false,
})
go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${nursingData}&date=${s_to_hms(this.elapsedTime)}&modeId=${ActiveModeItem.id}`);
});
go(
`/recoding/pages/moisture_test_report/moisture_test_report?data=${nursingData}&date=${s_to_hms(
this.elapsedTime
)}&modeId=${ActiveModeItem.id}`
);
}, 2000);
};
@ -683,9 +683,11 @@ class IotCarePlanFR200 extends Component<any, any> {
if (isStopNurse) {
// 开始光照逻辑
this.onNursingTap();
this.switchVideoPlay(); // 开始
} else {
// 暂停光照逻辑
this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE);
this.switchVideoPause(); // 暂停
}
this.setState({
isStopNurse: !isStopNurse,
@ -788,7 +790,6 @@ class IotCarePlanFR200 extends Component<any, any> {
//设备的运行中状态
console.log("设备状态同步 运行中状态", jsonStatus.workMode);
// 脸部模式
if (jsonStatus.workMode === "face") {
// impedance
@ -805,48 +806,51 @@ class IotCarePlanFR200 extends Component<any, any> {
break;
}
if (jsonStatus.workMode === "moistureTest") {
if('success' === jsonStatus.testStatus){
let stepList =this.state.stepList
let stepIndex =this.state.stepIndex
let timerIdSuccess =this.state.timerIdSuccess
let timerIdSchedule =this.state.timerIdSchedule
if ("success" === jsonStatus.testStatus) {
let stepList = this.state.stepList;
let stepIndex = this.state.stepIndex;
let timerIdSuccess = this.state.timerIdSuccess;
let timerIdSchedule = this.state.timerIdSchedule;
if (stepList[stepIndex].finish) {
stepList[stepIndex].forehead =jsonStatus.waterLevel
stepList[stepIndex].forehead = jsonStatus.waterLevel;
if (stepIndex === 2) {
this.setState({
isRuningTest:4
isRuningTest: 4,
});
} else {
this.setState({
isRuningTest:1
isRuningTest: 1,
});
}
clearTimeout(timerIdSuccess);
clearTimeout(timerIdSchedule);
console.log('成功拿到',jsonStatus,stepIndex);
let num =stepIndex
console.log("成功拿到", jsonStatus, stepIndex);
let num = stepIndex;
if (stepIndex < 2) {
num =stepIndex+1
num = stepIndex + 1;
}
this.setState({
timerIdSuccess:null,timerIdSchedule:null,stepIndex:num,stepList
timerIdSuccess: null,
timerIdSchedule: null,
stepIndex: num,
stepList,
});
}
} else {
let stepList =this.state.stepList
let stepIndex =this.state.stepIndex
let timerIdSuccess =this.state.timerIdSuccess
let timerIdSchedule =this.state.timerIdSchedule
let stepList = this.state.stepList;
let stepIndex = this.state.stepIndex;
let timerIdSuccess = this.state.timerIdSuccess;
let timerIdSchedule = this.state.timerIdSchedule;
if (stepList[stepIndex].finish) {
clearTimeout(timerIdSuccess);
clearTimeout(timerIdSchedule);
stepList[stepIndex].schedule=0
stepList[stepIndex].finish=false
stepList[stepIndex].schedule = 0;
stepList[stepIndex].finish = false;
this.setState({
stepList,isRuningTest:3
stepList,
isRuningTest: 3,
});
}
}
@ -1039,10 +1043,9 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log("仪器上报的已经运行的总秒数", totalTime);
console.log("时间校准频率默认5秒一次", TIME_CALIBRATION_FREQUENCY);
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = ActiveModeItem?.breakTimeStr
? minSecToS(ActiveModeItem.breakTimeStr)
: minSecToS(currentScene.modeTimeStr); // 场景时间
: minSecToS(this.state.currentVideoTime); // 场景时间
console.log("场景时间 sceneTime", sceneTime);
console.log("当前显示时间 currentTime", currentTime);
@ -1319,40 +1322,43 @@ class IotCarePlanFR200 extends Component<any, any> {
workMode: ActiveModeItem.modeType, // 使用模式
workStatus: newWorkStatus,
};
console.log(ActiveModeItem,'查看工作状态');
console.log(ActiveModeItem, "查看工作状态");
// 水分测试需要特殊处理
// 水分测试准备 水分测试工作 水分测试启动
if (ActiveModeItem.modeType === "moistureTest") {
sendParams.testStatus = "standby"; // 切换为准备
let stepList =this.state.stepList
let stepIndex =this.state.stepIndex
let timerIdSchedule =this.state.timerIdSchedule
let timerIdSuccess =this.state.timerIdSuccess
let stepList = this.state.stepList;
let stepIndex = this.state.stepIndex;
let timerIdSchedule = this.state.timerIdSchedule;
let timerIdSuccess = this.state.timerIdSuccess;
if (isBtnClick) {
timerIdSchedule = setTimeout(function () {
stepList[stepIndex].schedule=100
stepList[stepIndex].schedule = 100;
timerIdSuccess = setTimeout(function () {
stepList[stepIndex].finish=true
stepList[stepIndex].finish = true;
this.setState({
stepList,
});
}, 2000);
this.setState({
stepList,timerIdSuccess
stepList,
timerIdSuccess,
});
}, 3000);
this.setState({
isRuningTest: 2,
timerIdSchedule
timerIdSchedule,
});
// 水分测试启动
sendParams.testStatus = "start"; // 点击开始再开始
console.log('点击开始',isBtnClick);
console.log("点击开始", isBtnClick);
}
}
if (ActiveModeItem.modeType === "maskPenetration") {
sendParams.gear = 10; // 点击开始再开始
}
console.log("准备发送自定义或工作指令", ActiveModeItem, sendParams);
@ -1722,7 +1728,6 @@ class IotCarePlanFR200 extends Component<any, any> {
Taro.removeStorageSync("FR200NursingHistory");
};
// 脸部one
todoPromise = async () => {
const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
@ -1922,27 +1927,6 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log("组合时间ModeStepTimeArray", ModeStepTimeArray);
}
/* 组合模式 */
/** 获取自定义组合模式数组 */
getCustomModesArray = () => {
const { ModeList, ActiveModeItem } = this.state;
const combineIds = ActiveModeItem.combineData.map(
(item) => item.combineModeId
);
let modesArray = ModeList.filter((item) =>
combineIds.includes(item.id)
).map((item) => {
let totalWorkingMinutes = parseInt(item.modeTimeStr.split(":")[0]); // 仅分钟数
let totalWorkingSeconds = parseInt(item.modeTimeStr.split(":")[1]); // 仅秒数
return {
workMode: item.modeType,
totalWorkingMinutes,
totalWorkingSeconds,
};
});
return modesArray;
};
// 护理的错误提示
showTips(ctx) {
if (!ctx) return;
@ -2129,6 +2113,28 @@ class IotCarePlanFR200 extends Component<any, any> {
this.setState({ isModeLock: false });
};
// 获取并设置视频时间
GetVideosTime = (event) => {
if (event?.detail?.duration) {
let duration = Math.floor(event?.detail?.duration);
let currentTime = s_to_ms(duration);
this.setState({ currentTime });
}
};
switchVideoPlay = () => {
setTimeout(() => {
let videoRef = Taro.createVideoContext("myVideo", this);
videoRef.play();
}, 100);
};
switchVideoPause = () => {
setTimeout(() => {
let videoRef = Taro.createVideoContext("myVideo", this);
videoRef.pause();
}, 100);
};
render() {
let {
title,
@ -2142,7 +2148,6 @@ class IotCarePlanFR200 extends Component<any, any> {
ModeList,
ModeType,
ModeStepIndex,
currentServiceData,
ActiveModeItem,
currentWorkModeType,
isSwitchActiveMode,
@ -2165,7 +2170,6 @@ class IotCarePlanFR200 extends Component<any, any> {
isShowTipsSave,
isFirstTipShow,
nurseInfo,
isShowReReadRecordSave,
isRuningTest,
isShowHistoryMsg,
isModeLock,
@ -2334,7 +2338,6 @@ class IotCarePlanFR200 extends Component<any, any> {
<View className="iot-main">
<View className="banner-box">
<View>
{!isShowNurse && (
<Video
className="video-or-image"
src={ActiveModeItem.modeVideo}
@ -2343,24 +2346,9 @@ class IotCarePlanFR200 extends Component<any, any> {
objectFit="cover"
enablePlayGesture
showFullscreenBtn={false}
onLoadedMetaData={this.GetVideosTime}
/>
)}
{isShowNurse && (
<Block>
{isStopNurse ? (
<Image
className="video-or-image"
src={currentServiceData.stopSource}
/>
) : (
<Image
className="video-or-image"
src={currentServiceData.startSource}
/>
)}
</Block>
)}
{errorTips && (
<Block>
<View className="msg-tips">
@ -2404,12 +2392,12 @@ class IotCarePlanFR200 extends Component<any, any> {
/>
)}
{(ActiveModeItem.modeType === "face" ||
{/* {(ActiveModeItem.modeType === "face" ||
ActiveModeItem.modeType === "eyes") && (
<Block>
<Echarts></Echarts>
</Block>
)}
)} */}
{/* <View style="display:none;">
<Echarts></Echarts>
</View> */}

Loading…
Cancel
Save