|
|
|
|
@ -22,10 +22,7 @@ import {
|
|
|
|
|
Button,
|
|
|
|
|
} from "@tarojs/components";
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
notifyBLECharacteristicValueChange,
|
|
|
|
|
sendCommand,
|
|
|
|
|
} from "@/utils/bluetoothWXAPI";
|
|
|
|
|
import { sendCommand } from "@/utils/bluetoothWXAPI";
|
|
|
|
|
import {
|
|
|
|
|
deviceCommandSamples,
|
|
|
|
|
bleCommandSamples,
|
|
|
|
|
@ -69,6 +66,8 @@ import Gears from "./components/Gears";
|
|
|
|
|
|
|
|
|
|
import "./FR200.less";
|
|
|
|
|
|
|
|
|
|
import BluetoothContainer from "./components/Bluetoot/FR200";
|
|
|
|
|
|
|
|
|
|
const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200");
|
|
|
|
|
let deviceToolKitInstance = deviceToolKitInstanceFR200;
|
|
|
|
|
|
|
|
|
|
@ -344,9 +343,10 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
color: "#750010",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
bluetoothContainer: any = null;
|
|
|
|
|
isFullScreen: boolean = false;
|
|
|
|
|
// 不涉及渲染的页面变量
|
|
|
|
|
isRuning: any = true; // 设备默认运行中:fr200贴脸就会自动开始工作
|
|
|
|
|
@ -469,9 +469,16 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
|
|
|
|
|
// 监听蓝牙连接状态改变
|
|
|
|
|
Taro.onBLEConnectionStateChange(this.listener);
|
|
|
|
|
await this.notifyBLECharacteristicValueChange();
|
|
|
|
|
this.bluetoothContainer = new BluetoothContainer(
|
|
|
|
|
this.props.bluetoothInfo,
|
|
|
|
|
deviceToolKitInstance,
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
this.bluetoothContainer.notifyBLECharacteristicValueChange();
|
|
|
|
|
|
|
|
|
|
// this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
listener = (res) => {
|
|
|
|
|
console.log("listener res", res);
|
|
|
|
|
@ -585,7 +592,8 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
currentWorkModeType = 3;
|
|
|
|
|
} else if (
|
|
|
|
|
data.modeType === "maskPenetration" ||
|
|
|
|
|
data.modeType === "essence"
|
|
|
|
|
data.modeType === "essence" ||
|
|
|
|
|
data.modeType === "led"
|
|
|
|
|
) {
|
|
|
|
|
currentWorkModeType = 2;
|
|
|
|
|
}
|
|
|
|
|
@ -821,10 +829,13 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
gears,
|
|
|
|
|
eDate,
|
|
|
|
|
};
|
|
|
|
|
setStorageSync("moistureEachtsData", JSON.stringify(echartsData));
|
|
|
|
|
let report = true;
|
|
|
|
|
// go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${allData.nursingData}&date=${allData.createTime}&modeId=${allData.modeId}&id=${allData.instrumentId}&echartsData=${JSON.stringify(echartsData)}`);
|
|
|
|
|
go(
|
|
|
|
|
`/recoding/pages/moisture_test_report/moisture_test_report?data=${nursingData}&date=${formattedDate}&modeId=${ActiveModeItemId}&id=${currentDeviceId}&echartsData=${JSON.stringify(
|
|
|
|
|
echartsData
|
|
|
|
|
)}`
|
|
|
|
|
)}&report=${report}`
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -845,42 +856,47 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
let stop = 0;
|
|
|
|
|
let time = setInterval(function () {
|
|
|
|
|
stop++;
|
|
|
|
|
let series = JSON.parse(JSON.stringify(that.state.series))
|
|
|
|
|
let num = Math.floor(Math.random() * 9)
|
|
|
|
|
let count = 0
|
|
|
|
|
series.map(item => {
|
|
|
|
|
if (item.type === 'line') {
|
|
|
|
|
item.data.splice(0, 1)
|
|
|
|
|
item.data.push(num)
|
|
|
|
|
}
|
|
|
|
|
if (item.type === 'bar') {
|
|
|
|
|
count++
|
|
|
|
|
item.data.splice(0, 1)
|
|
|
|
|
let series = JSON.parse(JSON.stringify(that.state.series));
|
|
|
|
|
let num = Math.floor(Math.random() * 9);
|
|
|
|
|
let count = 0;
|
|
|
|
|
series.map((item) => {
|
|
|
|
|
if (item.type === "line") {
|
|
|
|
|
item.data.splice(0, 1);
|
|
|
|
|
item.data.push(num);
|
|
|
|
|
}
|
|
|
|
|
if (item.type === "bar") {
|
|
|
|
|
count++;
|
|
|
|
|
item.data.splice(0, 1);
|
|
|
|
|
if (count <= num) {
|
|
|
|
|
item.data.push(1)
|
|
|
|
|
item.data.push(1);
|
|
|
|
|
} else {
|
|
|
|
|
item.data.push(0)
|
|
|
|
|
item.data.push(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 更新图表数据
|
|
|
|
|
that.setState({ series })
|
|
|
|
|
that.setState({ series });
|
|
|
|
|
if (stop >= 20) {
|
|
|
|
|
clearInterval(time);
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
full() {
|
|
|
|
|
this.setState({ isFullScreen: !this.state.isFullScreen });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 切换光照 */
|
|
|
|
|
onSwitchChange = async () => {
|
|
|
|
|
// todo
|
|
|
|
|
let { isStopNurse } = this.state;
|
|
|
|
|
let { isStopNurse, ActiveModeItem } = this.state;
|
|
|
|
|
|
|
|
|
|
console.log("切换光照,", ActiveModeItem);
|
|
|
|
|
if (ActiveModeItem.modeType === "led") {
|
|
|
|
|
this.onSwitchChangeLED();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isStopNurse) {
|
|
|
|
|
// 开始光照逻辑
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
@ -894,6 +910,37 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
isStopNurse: !isStopNurse,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
/** LED切换模式 */
|
|
|
|
|
onSwitchChangeLED = () => {
|
|
|
|
|
let { isStopNurse } = this.state;
|
|
|
|
|
if (isStopNurse) {
|
|
|
|
|
// 开始光照逻辑
|
|
|
|
|
this.onNursingTap();
|
|
|
|
|
this.switchVideoPlay(); // 开始
|
|
|
|
|
} else {
|
|
|
|
|
// 暂停光照逻辑
|
|
|
|
|
let sendParams: any = {
|
|
|
|
|
...deviceCommandSamples.pause,
|
|
|
|
|
workMode: "led", // 使用模式
|
|
|
|
|
workStatus: "standby",
|
|
|
|
|
};
|
|
|
|
|
const pauseArrayBuffer = deviceToolKitInstance.toBleCommand(
|
|
|
|
|
sendParams as any
|
|
|
|
|
);
|
|
|
|
|
sendCommand({
|
|
|
|
|
value: pauseArrayBuffer,
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.workStatus = "pause";
|
|
|
|
|
this.resetTimer();
|
|
|
|
|
console.info(`发送暂停指令成功 参数为 =>`, sendParams);
|
|
|
|
|
});
|
|
|
|
|
// this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE);
|
|
|
|
|
this.switchVideoPause(); // 暂停
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
isStopNurse: !isStopNurse,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @name 每次进入设备运行页,打开首个模式的介绍弹窗
|
|
|
|
|
@ -933,275 +980,6 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 蓝牙特征更改
|
|
|
|
|
notifyBLECharacteristicValueChange = () => {
|
|
|
|
|
console.log("notifyBLECharacteristicValueChange deviceInfo 参数为=>");
|
|
|
|
|
const bluetoothInfo = this.props.bluetoothInfo;
|
|
|
|
|
notifyBLECharacteristicValueChange({
|
|
|
|
|
deviceId: bluetoothInfo.deviceId,
|
|
|
|
|
servicesuuid: bluetoothInfo.servicesuuid,
|
|
|
|
|
characteristicsuuid1: bluetoothInfo.characteristicsuuid1,
|
|
|
|
|
characteristicsuuid0: bluetoothInfo.characteristicsuuid0,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
Taro.onBLECharacteristicValueChange((value) => {
|
|
|
|
|
const jsonStatus: any = deviceToolKitInstance.toJsonStatus(value.value);
|
|
|
|
|
console.log(
|
|
|
|
|
"onBLECharacteristicValueChange jsonStatus => ",
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
if (!jsonStatus || jsonStatus == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.workStatus = jsonStatus.workStatus; // 记录工作状态
|
|
|
|
|
// end 和 endWork 都是护理结束, endWork不关机, end 关机, 对小程序而言处理流程都一样
|
|
|
|
|
if (jsonStatus.workStatus && jsonStatus.workStatus == "endWork") {
|
|
|
|
|
jsonStatus.workStatus = "end";
|
|
|
|
|
console.log(jsonStatus.workStatus, "护理结束");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (jsonStatus?.commandType) {
|
|
|
|
|
//设备配对和连接的返回
|
|
|
|
|
case "BleMatch":
|
|
|
|
|
// 蓝牙相关指令
|
|
|
|
|
this.switchBLEMatch(jsonStatus);
|
|
|
|
|
break;
|
|
|
|
|
//设备状态同步
|
|
|
|
|
case "DeviceStatusSync":
|
|
|
|
|
if (jsonStatus.battery) {
|
|
|
|
|
// 防止抖动
|
|
|
|
|
this.setState({
|
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (jsonStatus.workStatus) {
|
|
|
|
|
case "standby":
|
|
|
|
|
//设备的待机状态 可能workMode字段为空
|
|
|
|
|
console.log("设备状态同步 待机状态", jsonStatus);
|
|
|
|
|
if (this.BaseModeType.includes(jsonStatus.workMode)) {
|
|
|
|
|
this.openTips("检测到您的设备没有紧贴肌肤,请紧贴肌肤");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "pause":
|
|
|
|
|
//设备的暂停状态
|
|
|
|
|
console.log("设备状态同步 暂停状态", jsonStatus);
|
|
|
|
|
if (this.BaseModeType.includes(jsonStatus.workMode)) {
|
|
|
|
|
this.openTips(
|
|
|
|
|
"检测到您的设备没有紧贴肌肤,请紧贴肌肤后重新尝试"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "working":
|
|
|
|
|
//设备的运行中状态
|
|
|
|
|
console.log("设备状态同步 工作中状态", jsonStatus.workMode);
|
|
|
|
|
|
|
|
|
|
// 脸部模式
|
|
|
|
|
if (this.BaseModeType.includes(jsonStatus.workMode)) {
|
|
|
|
|
this.closeTips();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (jsonStatus.workMode === "moistureTest") {
|
|
|
|
|
if ("success" === jsonStatus.testStatus) {
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
// 到达第几个step
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
|
|
|
|
|
// 代表5秒以后最后拿到的结果
|
|
|
|
|
if (waterStepList[waterStepIndex].finish) {
|
|
|
|
|
// 获取等级
|
|
|
|
|
waterStepList[waterStepIndex].forehead =
|
|
|
|
|
jsonStatus.waterLevel;
|
|
|
|
|
// 检测完成
|
|
|
|
|
if (waterStepIndex === 2) {
|
|
|
|
|
this.setState({
|
|
|
|
|
isRuningTest: 4,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 启动检测
|
|
|
|
|
this.setState({
|
|
|
|
|
isRuningTest: 1,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 一共有3条数据
|
|
|
|
|
let num = waterStepIndex;
|
|
|
|
|
if (waterStepIndex < 2) {
|
|
|
|
|
num = waterStepIndex + 1;
|
|
|
|
|
this.waterTestNext(num);
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
waterStepIndex: num,
|
|
|
|
|
waterStepList,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
// 5秒后获取的结果
|
|
|
|
|
if (waterStepList[waterStepIndex].finish) {
|
|
|
|
|
// 获取失败后,把进度条清理0
|
|
|
|
|
waterStepList[waterStepIndex].schedule = 0;
|
|
|
|
|
waterStepList[waterStepIndex].finish = false;
|
|
|
|
|
this.setState({
|
|
|
|
|
waterStepList,
|
|
|
|
|
isRuningTest: 3,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 水分测试
|
|
|
|
|
// testStatus:success
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("设备运行中?", this.isRuning);
|
|
|
|
|
if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) {
|
|
|
|
|
if (this.state.workMode !== jsonStatus?.workMode) {
|
|
|
|
|
this.setState({
|
|
|
|
|
workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断设备是否在运行中(护理中)
|
|
|
|
|
// 仅当设备模式与小程序是否一致,才允许更改设备运行时间
|
|
|
|
|
if (this.isRuning) {
|
|
|
|
|
if (
|
|
|
|
|
this.state.DeviceConnectStatus === 1 &&
|
|
|
|
|
jsonStatus.workStatus !== MODE_WORKING_ENUM.END
|
|
|
|
|
) {
|
|
|
|
|
// 水分测试手动检测时间,不自动计算倒计时
|
|
|
|
|
if (jsonStatus?.workMode !== "moistureTest")
|
|
|
|
|
this.updateDeviceSyncData(
|
|
|
|
|
{
|
|
|
|
|
totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
|
|
|
|
|
totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
|
|
|
|
|
},
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
//设备对控制指令的响应
|
|
|
|
|
case "DeviceControl":
|
|
|
|
|
console.log("设备控制响应", jsonStatus);
|
|
|
|
|
if (jsonStatus.responseStatus == "OK") {
|
|
|
|
|
console.log("发送控制指令成功");
|
|
|
|
|
this.workJsonStatus = jsonStatus;
|
|
|
|
|
this.workStatus = jsonStatus.workStatus;
|
|
|
|
|
|
|
|
|
|
setTimeout(() => console.log("this.workStatus", this.workStatus));
|
|
|
|
|
if (jsonStatus.battery) {
|
|
|
|
|
this.setState({
|
|
|
|
|
Electricity: jsonStatus.battery,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断设备主动上报的关机事件
|
|
|
|
|
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
|
|
|
|
|
// 判断id是否一致, 一致的话则生成护理报表, 并提示
|
|
|
|
|
if (jsonStatus.id == this.FR200NursingHistory.id) {
|
|
|
|
|
debounce(
|
|
|
|
|
this.checkInstrumentRecord.bind(this, jsonStatus),
|
|
|
|
|
500
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) {
|
|
|
|
|
this.setState({
|
|
|
|
|
workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 判断是否在isRuning(护理中)
|
|
|
|
|
// 仅当设备模式与小程序是否一致,才允许更改设备运行时间
|
|
|
|
|
if (
|
|
|
|
|
this.state.DeviceConnectStatus === 1 &&
|
|
|
|
|
this.isRuning &&
|
|
|
|
|
jsonStatus.workStatus !== MODE_WORKING_ENUM.END
|
|
|
|
|
) {
|
|
|
|
|
this.updateDeviceSyncData(
|
|
|
|
|
{
|
|
|
|
|
totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
|
|
|
|
|
totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
|
|
|
|
|
},
|
|
|
|
|
jsonStatus
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
jsonStatus.workMode === MODE_WORKING_ENUM.WORKING &&
|
|
|
|
|
this.isRuning
|
|
|
|
|
) {
|
|
|
|
|
const { ActiveModeItem } = this.state;
|
|
|
|
|
const item = ActiveModeItem;
|
|
|
|
|
if (jsonStatus.workMode !== item.modeType) {
|
|
|
|
|
clearTimeout(loadingTipsTimer);
|
|
|
|
|
this.setState({
|
|
|
|
|
isShowCountdown: false,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
// 设备对信息查询指令的响应
|
|
|
|
|
case "InfoQuery":
|
|
|
|
|
console.log("设备对信息查询指令的响应 InfoQuery", jsonStatus);
|
|
|
|
|
switch (jsonStatus.infoQueryType) {
|
|
|
|
|
// 离线记录
|
|
|
|
|
case "offlineClockInInfo":
|
|
|
|
|
console.log("离线记录", jsonStatus);
|
|
|
|
|
break;
|
|
|
|
|
// 版本信息
|
|
|
|
|
case "versionInfo":
|
|
|
|
|
console.log("版本信息", jsonStatus);
|
|
|
|
|
break;
|
|
|
|
|
// 时间同步
|
|
|
|
|
case "timeSync":
|
|
|
|
|
console.log("时间同步", jsonStatus);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 延迟600毫秒获取附属设备状态
|
|
|
|
|
*/
|
|
|
|
|
const querySubDeviceArrayBuffer = deviceToolKitInstance.toBleCommand({
|
|
|
|
|
...bleCommandSamples.querySubDevice,
|
|
|
|
|
queryType: "WL200",
|
|
|
|
|
} as any);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log("发送查询附属设备指令 querySubDeviceArrayBuffer");
|
|
|
|
|
sendCommand({
|
|
|
|
|
value: querySubDeviceArrayBuffer,
|
|
|
|
|
});
|
|
|
|
|
}, 600);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 延迟500毫秒获取设备电量
|
|
|
|
|
*/
|
|
|
|
|
const queryDeviceArrayBuffer = deviceToolKitInstance.toBleCommand(
|
|
|
|
|
bleCommandSamples.queryDeviceStatus as any
|
|
|
|
|
);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log("发送查询设备电量指令");
|
|
|
|
|
sendCommand({
|
|
|
|
|
value: queryDeviceArrayBuffer,
|
|
|
|
|
});
|
|
|
|
|
}, 500);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**监听关机事件*/
|
|
|
|
|
onEndDevice = () => {
|
|
|
|
|
this.rmFR200NursingHistory(this.FR200NursingHistory, true);
|
|
|
|
|
@ -1230,15 +1008,15 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData;
|
|
|
|
|
let { ActiveModeItem, currentTime } = this.state;
|
|
|
|
|
const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds;
|
|
|
|
|
console.log("仪器上报的已经运行的总秒数", totalTime);
|
|
|
|
|
console.log("时间校准频率,默认5秒一次", TIME_CALIBRATION_FREQUENCY);
|
|
|
|
|
// console.log("仪器上报的已经运行的总秒数", totalTime);
|
|
|
|
|
// console.log("时间校准频率,默认5秒一次", TIME_CALIBRATION_FREQUENCY);
|
|
|
|
|
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
|
|
|
|
|
let sceneTime = ActiveModeItem?.breakTimeStr
|
|
|
|
|
? minSecToS(ActiveModeItem.breakTimeStr)
|
|
|
|
|
: minSecToS(this.state.currentVideoTime); // 场景时间
|
|
|
|
|
|
|
|
|
|
console.log("场景时间 sceneTime", sceneTime);
|
|
|
|
|
console.log("当前显示时间 currentTime", currentTime);
|
|
|
|
|
// console.log("场景时间 sceneTime", sceneTime);
|
|
|
|
|
// console.log("当前显示时间 currentTime", currentTime);
|
|
|
|
|
console.log("设备运行时间 totalTime", totalTime);
|
|
|
|
|
|
|
|
|
|
// 更新界面倒计时
|
|
|
|
|
@ -1689,12 +1467,11 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
executePromises = async () => {
|
|
|
|
|
let waterStepList = this.state.waterStepList;
|
|
|
|
|
let waterStepIndex = this.state.waterStepIndex;
|
|
|
|
|
let that = this
|
|
|
|
|
let that = this;
|
|
|
|
|
await new Promise<void>((resolve) => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
waterStepList[waterStepIndex].schedule = 100;
|
|
|
|
|
that.setState({
|
|
|
|
|
|
|
|
|
|
waterStepList,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -1711,34 +1488,20 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
}, 2000);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检测并控制工作状态
|
|
|
|
|
handleWorkStatus = async (isBtnClick: boolean, workStatus) => {
|
|
|
|
|
const { DeviceConnectStatus, ActiveModeItem } = this.state;
|
|
|
|
|
let newWorkStatus =
|
|
|
|
|
workStatus ||
|
|
|
|
|
(this.workStatus == MODE_WORKING_ENUM.WORKING ? "pause" : "working");
|
|
|
|
|
// if (isBtnClick && newWorkStatus == "working") {
|
|
|
|
|
// // todo FR200 不判断舱体,判断肌肤
|
|
|
|
|
// if (!ActiveModeItem.isCabinMode && DeviceConnectStatus != 1) {
|
|
|
|
|
// console.log("DeviceConnectStatus", DeviceConnectStatus);
|
|
|
|
|
// this.showTips("检测到您的设备没有紧贴肌肤,请紧贴肌肤后点击重新检测");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
let sendParams: any = {
|
|
|
|
|
...deviceCommandSamples.pause,
|
|
|
|
|
workMode: ActiveModeItem.modeType, // 使用模式
|
|
|
|
|
workStatus: newWorkStatus,
|
|
|
|
|
};
|
|
|
|
|
console.log(ActiveModeItem, "查看工作状态");
|
|
|
|
|
|
|
|
|
|
// 水分测试需要特殊处理
|
|
|
|
|
// 水分测试准备 水分测试工作 水分测试启动
|
|
|
|
|
@ -1747,20 +1510,22 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
sendParams.testStatus = "standby"; // 切换为准备
|
|
|
|
|
|
|
|
|
|
// 3秒定时器,逻辑3秒把进度条弄成100,再加2秒获取最后结果
|
|
|
|
|
|
|
|
|
|
if (isBtnClick) {
|
|
|
|
|
that.setState({
|
|
|
|
|
isRuningTest: 2,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
this.executePromises()
|
|
|
|
|
this.executePromises();
|
|
|
|
|
|
|
|
|
|
sendParams.testStatus = "start"; // 点击开始再开始
|
|
|
|
|
console.log("点击开始", isBtnClick);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ActiveModeItem.modeType === "maskPenetration") {
|
|
|
|
|
// 面膜促渗和精华促渗
|
|
|
|
|
if (
|
|
|
|
|
ActiveModeItem.modeType === "maskPenetration" ||
|
|
|
|
|
ActiveModeItem.modeType === "essence"
|
|
|
|
|
) {
|
|
|
|
|
sendParams.gear = this.state.currentGear; // 点击开始再开始
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1798,7 +1563,7 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
});
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
const { ActiveModeItem, DeviceConnectStatus } = this.state;
|
|
|
|
|
const { DeviceConnectStatus } = this.state;
|
|
|
|
|
|
|
|
|
|
if (DeviceConnectStatus != 1) {
|
|
|
|
|
console.log("DeviceConnectStatus 开始处", DeviceConnectStatus);
|
|
|
|
|
@ -1806,12 +1571,6 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 仅在切换模式的时候,弹窗倒计时.
|
|
|
|
|
// if (type === "switch") {
|
|
|
|
|
// let downNum = CountDownTime[ActiveModeItem.modeType] || 3;
|
|
|
|
|
// this.showCountdownFun(downNum, () => {}); // 倒计时弹窗
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 开始执行护理
|
|
|
|
|
this.workStatus = MODE_WORKING_ENUM.WORKING; // 不管当前什么状态,直接设为工作状态
|
|
|
|
|
this.handleWorkStatus(true, MODE_WORKING_ENUM.WORKING);
|
|
|
|
|
@ -1821,12 +1580,12 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 结束护理
|
|
|
|
|
endNurseFun() {
|
|
|
|
|
this.handleWorkStatus(false, "end");
|
|
|
|
|
async endNurseFun() {
|
|
|
|
|
if (this.isCheckNurseTime()) {
|
|
|
|
|
this.PostNursingLogClock();
|
|
|
|
|
await this.PostNursingLogClock();
|
|
|
|
|
this.handleWorkStatus(false, "end");
|
|
|
|
|
} else {
|
|
|
|
|
// 时间不满足,回到主页
|
|
|
|
|
// 时间不满足,直接提交回到主页
|
|
|
|
|
this.handleWorkStatus(false, "end");
|
|
|
|
|
this.setState({
|
|
|
|
|
isEndCarePlan: false,
|
|
|
|
|
@ -1950,10 +1709,6 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("workStatus", workStatus);
|
|
|
|
|
console.log("jsonStatus", jsonStatus, this.workJsonStatus);
|
|
|
|
|
console.log("currentTime", FR200NursingHistory.currentTime);
|
|
|
|
|
|
|
|
|
|
let historyElapsedTime =
|
|
|
|
|
minSecToS(currentVideoTime) - minSecToS(FR200NursingHistory.currentTime);
|
|
|
|
|
|
|
|
|
|
@ -2093,7 +1848,6 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
params.modeName = this.state.ActiveModeItem.modeName;
|
|
|
|
|
|
|
|
|
|
console.log(jsonStatus, 555555555555);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
params.jsonStatus = jsonStatus;
|
|
|
|
|
@ -2103,7 +1857,7 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Taro.setStorageSync("FR200NursingHistory", params);
|
|
|
|
|
console.log("更新updateFR200NursingHistory");
|
|
|
|
|
// console.log("更新updateFR200NursingHistory");
|
|
|
|
|
|
|
|
|
|
// 基础模式可在这里调用函数更新图标Echarts
|
|
|
|
|
// 最新一条数据jsonStatus
|
|
|
|
|
@ -2214,7 +1968,12 @@ 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,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 计算挡位
|
|
|
|
|
@ -2590,7 +2349,7 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
isShowReReadRecordConnect,
|
|
|
|
|
currentServiceData,
|
|
|
|
|
series,
|
|
|
|
|
isFullScreen
|
|
|
|
|
isFullScreen,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
@ -2601,7 +2360,8 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
isCustomBack
|
|
|
|
|
customBack={this.customBack}
|
|
|
|
|
/>
|
|
|
|
|
{!isFullScreen && <View>
|
|
|
|
|
{!isFullScreen && (
|
|
|
|
|
<View>
|
|
|
|
|
<View catchMove>
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isModeLock}
|
|
|
|
|
@ -2663,85 +2423,6 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
confirm={this.confirmModeSwitchBtn}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
{ActiveModeItem.openSourceData.length > 0 && (
|
|
|
|
|
<PopupStepTips
|
|
|
|
|
isShow={isShowStepTips}
|
|
|
|
|
isLarge
|
|
|
|
|
isFirstEntry={false}
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
data={ActiveModeItem.openSourceData}
|
|
|
|
|
close={this.closeStepTips}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isNotEnoughTime}
|
|
|
|
|
isClose
|
|
|
|
|
title="提示"
|
|
|
|
|
content="您的本次护理时间不足,请重新护理"
|
|
|
|
|
confirmButtonText="确认"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.closeNotEnoughTime}
|
|
|
|
|
confirm={this.closeNotEnoughTime}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupAlert
|
|
|
|
|
isShow={isShowErrorTipsText}
|
|
|
|
|
isClose
|
|
|
|
|
zIndex={10020}
|
|
|
|
|
myClassName="level-up"
|
|
|
|
|
title="提示"
|
|
|
|
|
content={errorTipsText}
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.closeErrorTipsText}
|
|
|
|
|
confirm={this.closeErrorTipsText}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupConfirm
|
|
|
|
|
isShow={isShowTipsSave}
|
|
|
|
|
isClose
|
|
|
|
|
zIndex={10020}
|
|
|
|
|
myClassName="level-up"
|
|
|
|
|
title="提示"
|
|
|
|
|
content={
|
|
|
|
|
<Block>
|
|
|
|
|
<View>当前模式已护理部分时间</View>
|
|
|
|
|
<View>是否保存护理记录</View>
|
|
|
|
|
</Block>
|
|
|
|
|
}
|
|
|
|
|
cancelButtonText="取消"
|
|
|
|
|
confirmButtonText="确认"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={this.closeTipsSave}
|
|
|
|
|
cancel={this.cancelTipsSave}
|
|
|
|
|
confirm={this.confirmTipsSave}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PopupStatus
|
|
|
|
|
isShow={isShowNursingSuccess}
|
|
|
|
|
isClose
|
|
|
|
|
title="您已结束本次护理"
|
|
|
|
|
type="success"
|
|
|
|
|
content="正在上传护理记录……"
|
|
|
|
|
confirmButtonText="知道了"
|
|
|
|
|
textAlgin="center"
|
|
|
|
|
close={() => {
|
|
|
|
|
/*不需要做处理*/
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
{isConnectShow && (
|
|
|
|
|
<ConnectionBluetoot
|
|
|
|
|
deviceInfo={currentDevice}
|
|
|
|
|
close={this.connectionClose}
|
|
|
|
|
isDisconnect={!isConnectionBlutoot}
|
|
|
|
|
offlineChange={() => { }}
|
|
|
|
|
pairingChange={this.pairingChange}
|
|
|
|
|
upgradeFun={() => { }}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<Popup
|
|
|
|
|
show={isShowHistoryMsg}
|
|
|
|
|
className="custom-popup"
|
|
|
|
|
@ -2814,13 +2495,16 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
{/* <button onClick={this.updata.bind(this)}>添加数据 </button> */}
|
|
|
|
|
|
|
|
|
|
<View className={classnames({ show: showEcharts })}>
|
|
|
|
|
<Echarts series={series} full={this.full.bind(this)}></Echarts>
|
|
|
|
|
|
|
|
|
|
<EchartsFullScean series={series} full={this.full}></EchartsFullScean>
|
|
|
|
|
|
|
|
|
|
<Echarts
|
|
|
|
|
series={series}
|
|
|
|
|
full={this.full.bind(this)}
|
|
|
|
|
></Echarts>
|
|
|
|
|
|
|
|
|
|
<EchartsFullScean
|
|
|
|
|
series={series}
|
|
|
|
|
full={this.full}
|
|
|
|
|
></EchartsFullScean>
|
|
|
|
|
</View>
|
|
|
|
|
{/* {(ActiveModeItem.modeType === "face" ||
|
|
|
|
|
ActiveModeItem.modeType === "eyes") && <Echarts></Echarts>} */}
|
|
|
|
|
|
|
|
|
|
{(ActiveModeItem.modeType === "maskPenetration" ||
|
|
|
|
|
ActiveModeItem.modeType === "essence") && (
|
|
|
|
|
@ -2840,7 +2524,7 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{/* <Footer
|
|
|
|
|
<Footer
|
|
|
|
|
currentWorkModeType={currentWorkModeType}
|
|
|
|
|
isRuningTest={isRuningTest}
|
|
|
|
|
isStopNurse={isStopNurse}
|
|
|
|
|
@ -2848,19 +2532,20 @@ class IotCarePlanFR200 extends Component<any, any> {
|
|
|
|
|
onEmitSwitchChange={this.onSwitchChange}
|
|
|
|
|
onEmitEndPlan={this.onEndPlan}
|
|
|
|
|
onsuccess={this.onsuccess}
|
|
|
|
|
/> */}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
isFullScreen && <View>
|
|
|
|
|
)}
|
|
|
|
|
{isFullScreen && (
|
|
|
|
|
<View>
|
|
|
|
|
<button onClick={this.updata.bind(this)}>模拟数据更新 </button>
|
|
|
|
|
|
|
|
|
|
<EchartsFullScean series={series} full={this.full}></EchartsFullScean>
|
|
|
|
|
<EchartsFullScean
|
|
|
|
|
series={series}
|
|
|
|
|
full={this.full}
|
|
|
|
|
></EchartsFullScean>
|
|
|
|
|
</View>
|
|
|
|
|
}
|
|
|
|
|
)}
|
|
|
|
|
</Block>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|