gear挡位调节,写到一半

master
blak-kong 2 years ago
parent c28719bbe7
commit d15b1e53e5

@ -168,7 +168,8 @@ class IotCarePlanFR200 extends Component<any, any> {
countdown: 3, countdown: 3,
// 是否结束护理 // 是否结束护理
isEndCarePlan: false, isEndCarePlan: false,
currentTime: "01:00", currentTime: "10:00", // 倒计时时间WR200以视频为准
currentVideoTime: "10:00", // 当前视频时间
// 护理时间不够 // 护理时间不够
isNotEnoughTime: false, isNotEnoughTime: false,
@ -383,18 +384,15 @@ class IotCarePlanFR200 extends Component<any, any> {
}); });
if (this.state.activeModeID != "") { if (this.state.activeModeID != "") {
this.state.ModeList.map((item) => { let res1 = res.data.data.find((e) => e.id == this.state.activeModeID);
if (item.id === this.state.activeModeID) { setTimeout(() => {
this.setState({ this.modeCurrentFun(res1);
ActiveModeItem: item, }, 100);
}); } else {
} setTimeout(() => {
}); this.modeCurrentFun(res.data.data[0]);
}, 100);
} }
let res1 = res.data.data.find((e) => e.id == this.state.activeModeID);
setTimeout(() => {
this.modeCurrentFun(res1);
}, 100);
} else { } else {
this.setState({ ModeList: [] }); this.setState({ ModeList: [] });
} }
@ -447,14 +445,12 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
// 如果按钮不可点击则报错,内部自带检查底部按钮函数 // 如果按钮不可点击则报错,内部自带检查底部按钮函数
this.onEmitErrorTips(); // this.onEmitErrorTips();
if (!isNotCheck) { if (!isNotCheck) {
let isReturn = this.modeRuningChange(); let isReturn = this.modeRuningChange();
if (isReturn) return; if (isReturn) return;
} }
let currentTime = data.modeTimeStr;
// 根据模式,动态设置底部按钮样式 // 根据模式,动态设置底部按钮样式
let currentWorkModeType = 1; let currentWorkModeType = 1;
if (data.modeType === "moistureTest") { if (data.modeType === "moistureTest") {
@ -472,7 +468,6 @@ class IotCarePlanFR200 extends Component<any, any> {
ModeID: "mode_" + data.id, ModeID: "mode_" + data.id,
ModeStepIndex: 0, ModeStepIndex: 0,
ModeType: this.ModeTypeArray[data.modeClass], ModeType: this.ModeTypeArray[data.modeClass],
currentTime,
currentWorkModeType, currentWorkModeType,
}); });
@ -621,9 +616,11 @@ class IotCarePlanFR200 extends Component<any, any> {
if (isStopNurse) { if (isStopNurse) {
// 开始光照逻辑 // 开始光照逻辑
this.onNursingTap(); this.onNursingTap();
this.switchVideoPlay(); // 开始
} else { } else {
// 暂停光照逻辑 // 暂停光照逻辑
this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE); this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE);
this.switchVideoPause(); // 暂停
} }
this.setState({ this.setState({
isStopNurse: !isStopNurse, isStopNurse: !isStopNurse,
@ -930,10 +927,9 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log("仪器上报的已经运行的总秒数", totalTime); console.log("仪器上报的已经运行的总秒数", totalTime);
console.log("时间校准频率默认5秒一次", TIME_CALIBRATION_FREQUENCY); console.log("时间校准频率默认5秒一次", TIME_CALIBRATION_FREQUENCY);
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准 //对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = ActiveModeItem?.breakTimeStr let sceneTime = ActiveModeItem?.breakTimeStr
? minSecToS(ActiveModeItem.breakTimeStr) ? minSecToS(ActiveModeItem.breakTimeStr)
: minSecToS(currentScene.modeTimeStr); // 场景时间 : minSecToS(this.state.currentVideoTime); // 场景时间
console.log("场景时间 sceneTime", sceneTime); console.log("场景时间 sceneTime", sceneTime);
console.log("当前显示时间 currentTime", currentTime); console.log("当前显示时间 currentTime", currentTime);
@ -1221,6 +1217,10 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
} }
if (ActiveModeItem.modeType === "maskPenetration") {
sendParams.gear = 10; // 点击开始再开始
}
console.log("准备发送自定义或工作指令", ActiveModeItem, sendParams); console.log("准备发送自定义或工作指令", ActiveModeItem, sendParams);
const pauseArrayBuffer = deviceToolKitInstance.toBleCommand( const pauseArrayBuffer = deviceToolKitInstance.toBleCommand(
sendParams as any sendParams as any
@ -1808,27 +1808,6 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log("组合时间ModeStepTimeArray", ModeStepTimeArray); 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) { showTips(ctx) {
if (!ctx) return; if (!ctx) return;
@ -2015,6 +1994,28 @@ class IotCarePlanFR200 extends Component<any, any> {
this.setState({ isModeLock: false }); 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() { render() {
let { let {
title, title,
@ -2026,7 +2027,6 @@ class IotCarePlanFR200 extends Component<any, any> {
ModeList, ModeList,
ModeType, ModeType,
ModeStepIndex, ModeStepIndex,
currentServiceData,
ActiveModeItem, ActiveModeItem,
currentWorkModeType, currentWorkModeType,
isSwitchActiveMode, isSwitchActiveMode,
@ -2049,7 +2049,6 @@ class IotCarePlanFR200 extends Component<any, any> {
isShowTipsSave, isShowTipsSave,
isFirstTipShow, isFirstTipShow,
nurseInfo, nurseInfo,
isShowReReadRecordSave,
isRuningTest, isRuningTest,
isShowHistoryMsg, isShowHistoryMsg,
isModeLock, isModeLock,
@ -2218,33 +2217,17 @@ class IotCarePlanFR200 extends Component<any, any> {
<View className="iot-main"> <View className="iot-main">
<View className="banner-box"> <View className="banner-box">
<View> <View>
{!isShowNurse && ( <Video
<Video className="video-or-image"
className="video-or-image" src={ActiveModeItem.modeVideo}
src={ActiveModeItem.modeVideo} loop
loop id="myVideo"
id="myVideo" objectFit="cover"
objectFit="cover" enablePlayGesture
enablePlayGesture showFullscreenBtn={false}
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 && ( {errorTips && (
<Block> <Block>
<View className="msg-tips"> <View className="msg-tips">
@ -2288,12 +2271,12 @@ class IotCarePlanFR200 extends Component<any, any> {
/> />
)} )}
{(ActiveModeItem.modeType === "face" || {/* {(ActiveModeItem.modeType === "face" ||
ActiveModeItem.modeType === "eyes") && ( ActiveModeItem.modeType === "eyes") && (
<Block> <Block>
<Echarts></Echarts> <Echarts></Echarts>
</Block> </Block>
)} )} */}
{/* <View style="display:none;"> {/* <View style="display:none;">
<Echarts></Echarts> <Echarts></Echarts>
</View> */} </View> */}

Loading…
Cancel
Save