blak-kong 2 years ago
parent 8d3e804844
commit 625d36d025

@ -12,7 +12,7 @@ Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN
#### 安装教程 #### 安装教程
1. 电脑需要安装 node16.18.0 以上版本 1. 电脑需要安装 node ,开发版本为 16.18.0
2. 下载项目依赖 2. 下载项目依赖

@ -116,14 +116,15 @@ class ConnectionBluetoot extends Component<any, any> {
offlineDataList: [], //离线数据 offlineDataList: [], //离线数据
prefix: "12CAA", // WL200蓝牙搜索前缀 prefix: "12CAA", // WL200蓝牙搜索前缀
// WL200匹配 // WL200匹配
tranType: [ tranType: [
"WE100", // 发箍 "WE100", // 发箍
"WE200", // 发箍 "WE200", // 发箍
"WL200", // 发箍 "WL200", // 面罩
"12CAA", // 面罩前缀名 "12CAA", // 面罩前缀名
], ],
currentDeviceType: "WE200", // 现在的设备类型: WE200 WL200
}; };
} }
@ -450,6 +451,7 @@ class ConnectionBluetoot extends Component<any, any> {
if (deviceInfo.model == "WL200") { if (deviceInfo.model == "WL200") {
if (this.isWL200()) { if (this.isWL200()) {
this.setState({ currentDeviceType: "WL200" });
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus( jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
value.value value.value
); );
@ -458,6 +460,7 @@ class ConnectionBluetoot extends Component<any, any> {
bleCommandSamples.querySubDevice as any bleCommandSamples.querySubDevice as any
); );
} else { } else {
this.setState({ currentDeviceType: "WE200" });
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
querySubDeviceArrayBuffer = querySubDeviceArrayBuffer =
deviceToolKitInstanceM01.toBleCommand( deviceToolKitInstanceM01.toBleCommand(
@ -465,6 +468,7 @@ class ConnectionBluetoot extends Component<any, any> {
); );
} }
} else if (deviceInfo.model == "M01") { } else if (deviceInfo.model == "M01") {
this.setState({ currentDeviceType: "M01" });
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand( querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any bleCommandSamples.querySubDevice as any
@ -505,6 +509,7 @@ class ConnectionBluetoot extends Component<any, any> {
if (jsonStatus.connectMessage?.connectType == "CONNECTED") { if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
switch (jsonStatus.connectMessage?.deviceName) { switch (jsonStatus.connectMessage?.deviceName) {
case OtaDeviceTypeEnum.WE100: case OtaDeviceTypeEnum.WE100:
console.log("手环连上了 value => ", jsonStatus);
case OtaDeviceTypeEnum.FACIALMASK: case OtaDeviceTypeEnum.FACIALMASK:
console.log("面膜连上了 value => ", jsonStatus); console.log("面膜连上了 value => ", jsonStatus);
this.detectVersionUpdate(); this.detectVersionUpdate();
@ -1022,7 +1027,8 @@ class ConnectionBluetoot extends Component<any, any> {
}; };
render() { render() {
let { isConnection, connectionSuccess, error } = this.state; let { isConnection, connectionSuccess, error, currentDeviceType } =
this.state;
let { deviceInfo, isDisconnect } = this.props; let { deviceInfo, isDisconnect } = this.props;
return ( return (
<Block> <Block>
@ -1032,6 +1038,7 @@ class ConnectionBluetoot extends Component<any, any> {
reconnect={this.onReconnect} reconnect={this.onReconnect}
data={deviceInfo} data={deviceInfo}
isShow={true} isShow={true}
currentDeviceType={currentDeviceType}
connectionSuccess={connectionSuccess} connectionSuccess={connectionSuccess}
isConnection={isConnection} isConnection={isConnection}
error={error} error={error}

@ -83,6 +83,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
// connectionStatus, // connectionStatus,
isConnection, isConnection,
connectionSuccess, connectionSuccess,
currentDeviceType,
error, error,
} = this.props; } = this.props;
@ -120,22 +121,9 @@ export default class DeviceConnectPopup extends Component<any, any> {
/> />
)} )}
<View className="block"> {currentDeviceType === "WE200" && (
{isConnection ? (
<Block>
<View className="icon">
<Image
className="images"
src={require("../../../img/selected_success.png")}
mode="aspectFill"
/>
</View>
<View className="tip">
{data.bluetoothConnectingContent}
</View>
</Block>
) : (
<Block> <Block>
<View>
<View className="icon"> <View className="icon">
<Image <Image
className="images" className="images"
@ -146,11 +134,11 @@ export default class DeviceConnectPopup extends Component<any, any> {
<View className="tip success"> <View className="tip success">
{data.bluetoothConnectingContent} {data.bluetoothConnectingContent}
</View> </View>
</View>
</Block> </Block>
)} )}
</View> <View className="block">
{/* <View className="block2"> {currentDeviceType === "WL200" && isConnection ? (
{connectionSuccess ? (
<Block> <Block>
<View className="icon"> <View className="icon">
<Image <Image
@ -159,7 +147,9 @@ export default class DeviceConnectPopup extends Component<any, any> {
mode="aspectFill" mode="aspectFill"
/> />
</View> </View>
<View className="tip"></View> <View className="tip">
{data.bluetoothConnectingContent}
</View>
</Block> </Block>
) : ( ) : (
<Block> <Block>
@ -171,11 +161,11 @@ export default class DeviceConnectPopup extends Component<any, any> {
/> />
</View> </View>
<View className="tip success"> <View className="tip success">
{data.bluetoothConnectingContent}
</View> </View>
</Block> </Block>
)} )}
</View> */} </View>
</View> </View>
<View className="common-popup-btns"> <View className="common-popup-btns">
<Button <Button

@ -35,7 +35,6 @@ import {
// 通过设备类型判断给 deviceToolKitInstance 赋值 // 通过设备类型判断给 deviceToolKitInstance 赋值
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import InstrumentTypeEnum from "../InstrumentTypeEnum";
import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum"; import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum";
// 临时替代 // 临时替代
@ -79,10 +78,17 @@ class UpdateIotWL200 extends Component<any, any> {
countDown: 7, countDown: 7,
}; };
async onLoad() {} async onLoad() {
if (this.$checkTimer) clearInterval(this.$checkTimer);
}
componentDidMount() { componentDidMount() {
console.log("componentDidMount");
this.initData(); this.initData();
} }
componentDidHide() {
console.log("componentDidHide");
this.errorFun();
}
isWL200() { isWL200() {
let currentDevicesName = getStorageSync("currentDevicesName"); let currentDevicesName = getStorageSync("currentDevicesName");
@ -256,9 +262,17 @@ class UpdateIotWL200 extends Component<any, any> {
}); });
// log.info('ota失败日志', '发送日志OTAQuit失败', err); // log.info('ota失败日志', '发送日志OTAQuit失败', err);
console.info("ota失败日志", "发送日志OTAQuit失败", err); console.info("ota失败日志", "发送日志OTAQuit失败", err);
// this.showError(errorMap[errorString] || tipMap[errorString] || '发生错误') if (err.errCode === 10000) {
let isDisconnect = getStorageSync("isDisconnectUpdate");
if (isDisconnect) {
if (this.$checkTimer) clearInterval(this.$checkTimer);
}
}
} }
}); });
setTimeout(() => {
this.errorFun();
}, 1000);
} }
/** /**
@ -375,8 +389,8 @@ class UpdateIotWL200 extends Component<any, any> {
const jsonStatus: any = deviceToolKitInstance.toJsonStatus(value.value); const jsonStatus: any = deviceToolKitInstance.toJsonStatus(value.value);
log.info("OTA页面设备响应数据打印==》", JSON.stringify(jsonStatus)); log.info("OTA页面设备响应数据打印==》", JSON.stringify(jsonStatus));
console.info("onBLECharacteristicValueChange json => ", jsonStatus); console.info("onBLECharacteristicValueChange json => ", jsonStatus);
this.$otaDataGroup.currentPackageNo = jsonStatus.currentPackageNo;
this.$otaDataGroup.currentPackageNo = jsonStatus.currentPackageNo;
this.$otaDataGroup.countDown = 7; this.$otaDataGroup.countDown = 7;
this.parseData(jsonStatus); this.parseData(jsonStatus);
}); });
@ -405,6 +419,7 @@ class UpdateIotWL200 extends Component<any, any> {
//升级销毁页面时关闭小程序蓝牙 //升级销毁页面时关闭小程序蓝牙
onUnload() { onUnload() {
console.log("onUnload");
if (this.$checkTimer) clearInterval(this.$checkTimer); if (this.$checkTimer) clearInterval(this.$checkTimer);
Taro.closeBluetoothAdapter(); Taro.closeBluetoothAdapter();
} }
@ -419,6 +434,7 @@ class UpdateIotWL200 extends Component<any, any> {
// 错误关闭回调 // 错误关闭回调
errorFun = () => { errorFun = () => {
this.resetOta();
this.props.errorFun(); this.props.errorFun();
}; };
// 升级完成回调 // 升级完成回调

@ -46,11 +46,20 @@ export default class PopupConfirm extends Component<any, any> {
componentDidHide() {} componentDidHide() {}
async initData() {} async initData() {}
// 关闭
onClose = () => { onClose = () => {
this.props.close(); this.props.close();
}; };
// 取消
onCancel = () => {
// 旧代码共用了取消和关闭回调,临时适配兼容:有取消用取消,没取消用关闭
if (this.props.cancel) {
this.props.cancel();
} else {
this.onClose();
}
};
// 确认
onConfirm = () => { onConfirm = () => {
this.props.confirm(); this.props.confirm();
}; };
@ -115,7 +124,7 @@ export default class PopupConfirm extends Component<any, any> {
</View> </View>
</View> </View>
<View className="common-popup-btns"> <View className="common-popup-btns">
<Button className="common-popup-btn2" onClick={this.onClose}> <Button className="common-popup-btn2" onClick={this.onCancel}>
{cancelButtonText} {cancelButtonText}
</Button> </Button>
<Button className="common-popup-btn2" onClick={this.onConfirm}> <Button className="common-popup-btn2" onClick={this.onConfirm}>

@ -156,6 +156,7 @@ export default class PopupSiteSwiper extends Component<any, any> {
className="cover" className="cover"
src={item.fileUrl} src={item.fileUrl}
mode="aspectFit" mode="aspectFit"
lazyLoad
></Image> ></Image>
</View> </View>
</SwiperItem> </SwiperItem>

@ -1,5 +1,10 @@
.step-popup-content-box { .step-popup-content-box {
margin: 0; margin: 0;
.absolutely-img {
width: 100%;
height: 600rpx;
background-color: #eee;
}
} }
.step-absolutely { .step-absolutely {
width: 600rpx; width: 600rpx;
@ -13,9 +18,7 @@
height: 600rpx; height: 600rpx;
border-radius: 30rpx; border-radius: 30rpx;
} }
// .van-popup {
// background-color: transparent;
// }
.site-close { .site-close {
position: absolute; position: absolute;
right: 16rpx; right: 16rpx;

@ -151,16 +151,12 @@ export default class PopupStepTips extends Component<any, any> {
return ( return (
current === index && ( current === index && (
<View className="absolutely" key={"swiper_" + index}> <View className="absolutely" key={"swiper_" + index}>
<View <View className="absolutely-img">
style={{
width: "100%",
height: "600rpx",
}}
>
<Image <Image
className="cover" className="cover"
src={item.openSourceUrl} src={item.openSourceUrl}
mode="aspectFit" mode="aspectFit"
lazyLoad
></Image> ></Image>
</View> </View>
<View className="tips-message">{item.openContent}</View> <View className="tips-message">{item.openContent}</View>

@ -70,8 +70,13 @@ export default class Index extends Component {
// } // }
console.log("url", url); console.log("url", url);
this.setSelected(index); this.setSelected(index);
if (url === "pages/index/index") {
Taro.reLaunch({ url: "/" + url });
} else {
Taro.switchTab({ url: "/" + url }); Taro.switchTab({ url: "/" + url });
} }
}
setSelected(idx: number) { setSelected(idx: number) {
this.setState({ this.setState({

@ -183,7 +183,11 @@ class Index extends Component<any, any> {
} }
} }
componentDidHide() {} componentDidHide() {
this.wl200UpgradeErrorFun();
Taro.closeBluetoothAdapter();
setStorageSync("isDisconnectUpdate", true); // 已断开更新
}
showInit = async () => { showInit = async () => {
// 判断是否登录 // 判断是否登录
@ -557,20 +561,21 @@ class Index extends Component<any, any> {
} }
// 0已绑定 1未绑定 2已解绑 // 0已绑定 1未绑定 2已解绑
if (instrumentInfo.bindingStatus === 0) { if (instrumentInfo.bindingStatus === 0) {
setTimeout(() => {
this.isBindingSerial();
}, 100);
let isBind = this.state.instrumentList.find( let isBind = this.state.instrumentList.find(
(item) => item.id === instrumentInfo.id (item) => item.id === instrumentInfo.id
); );
if (isBind) { if (isBind) {
// 选择仪器有误
this.setState({ this.setState({
isBeforeBindingError: true, isBeforeBindingError: true,
BeforeBindingErrorText: "序列号已被其他用户绑定", BeforeBindingErrorText: "序列号已绑定",
}); });
} else { } else {
// 选择仪器有误
this.setState({ this.setState({
isBeforeBindingError: true, isBeforeBindingError: true,
BeforeBindingErrorText: "序列号已绑定", BeforeBindingErrorText: "序列号已被其他用户绑定",
}); });
} }
@ -638,9 +643,11 @@ class Index extends Component<any, any> {
if (obj) { if (obj) {
setStorageSync("instrument_detail", obj); setStorageSync("instrument_detail", obj);
} }
setTimeout(() => { setTimeout(() => {
go("/pages/instrument/intro??customBack=true&id=" + instrumentInfo.id); // 绑定成功后,先查询设备介绍页,有数据则跳转,没数据则刷新已绑定数据
}, 2000); this.getInstrumentIntroInfo(instrumentInfo.id);
}, 1000);
return; return;
} else if (data.code === 202) { } else if (data.code === 202) {
// 换绑操作 // 换绑操作
@ -653,6 +660,21 @@ class Index extends Component<any, any> {
} }
}; };
/** 获取设备介绍页信息 */
getInstrumentIntroInfo = async (id) => {
let res = await InstrumentInfo.instructionInfo({
instrumentId: id,
});
if (res.data.code === 200) {
console.log("res.data.data", res.data.data);
if (res.data.data.length > 0) {
go("/pages/instrument/intro??customBack=true&id=" + id);
} else {
this.bindingInstrumentList();
}
}
};
// 换绑仪器 // 换绑仪器
exchangeBinding = async () => { exchangeBinding = async () => {
Taro.showLoading({ Taro.showLoading({
@ -700,7 +722,6 @@ class Index extends Component<any, any> {
this.setState({ connectInstrument: item }); this.setState({ connectInstrument: item });
setTimeout(() => this.bindBlockLeft()); setTimeout(() => this.bindBlockLeft());
} else { } else {
// todo
this.openCommonError([ this.openCommonError([
"该仪器暂时无法进行在线护理,", "该仪器暂时无法进行在线护理,",
"请联系微信小助理", "请联系微信小助理",
@ -796,6 +817,7 @@ class Index extends Component<any, any> {
isShowUpdateVersionTip: false, isShowUpdateVersionTip: false,
isShowVersionUpgrading: true, isShowVersionUpgrading: true,
}); });
Taro.removeStorageSync("isDisconnectUpdate");
}; };
// 完成升级 // 完成升级
@ -829,6 +851,7 @@ class Index extends Component<any, any> {
this.setState({ this.setState({
isShowVersionUpgrading: false, isShowVersionUpgrading: false,
}); });
msg("升级失败");
}; };
// 关闭升级完成公告 // 关闭升级完成公告
onVersionUpgradFinish = () => { onVersionUpgradFinish = () => {

@ -37,6 +37,7 @@ export default class Instrument extends Component<any, any> {
this.state = { this.state = {
name: "instrument", name: "instrument",
isBindingError: false, isBindingError: false,
isBindingError203: false,
isBindingCheckError: false, isBindingCheckError: false,
style: "font-size: 28rpx; color: #ccc;", style: "font-size: 28rpx; color: #ccc;",
succeedShow: false, succeedShow: false,
@ -373,6 +374,13 @@ export default class Instrument extends Component<any, any> {
this.onBindErrorClose(); this.onBindErrorClose();
go("/pages/consultant/consultant"); go("/pages/consultant/consultant");
}; };
onBindErrorClose203 = () => {
this.setState({ isBindingError203: false });
};
onBindErrorConfirm203 = () => {
this.onBindErrorClose203();
go("/pages/consultant/consultant");
};
onBindCheckErrorClose = () => { onBindCheckErrorClose = () => {
this.setState({ isBindingCheckError: false }); this.setState({ isBindingCheckError: false });
@ -404,6 +412,7 @@ export default class Instrument extends Component<any, any> {
render() { render() {
let { let {
isBindingError, isBindingError,
isBindingError203,
isBindingCheckError, isBindingCheckError,
channelInfo, channelInfo,
inputType, inputType,
@ -451,6 +460,15 @@ export default class Instrument extends Component<any, any> {
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm} confirm={this.onBindErrorConfirm}
></PopupAlert> ></PopupAlert>
<PopupAlert
isShow={isBindingError203}
title="提示"
content="序列码已被别人绑定,请联系微信助手"
confirmButtonText="知道了"
textAlgin="center"
close={this.onBindErrorClose203}
confirm={this.onBindErrorConfirm203}
></PopupAlert>
<PopupAlert <PopupAlert
isShow={isBindingCheckError} isShow={isBindingCheckError}
title="提示" title="提示"

@ -9,6 +9,7 @@ import {
Video, Video,
Swiper, Swiper,
SwiperItem, SwiperItem,
RichText,
} from "@tarojs/components"; } from "@tarojs/components";
/** 自定义组件 **/ /** 自定义组件 **/
@ -99,18 +100,6 @@ class Intro extends Component<any, any> {
} }
}; };
/** 跳转至打卡页或护理页 */
toNursing = () => {
const { instrument } = this.state;
console.log("instrument", instrument);
if (instrument.type === 1) {
go("/pages/instrumentClickinUpload/index");
} else {
go("/pages/iotCarePlan/iotCarePlan");
}
};
toHomePage = () => { toHomePage = () => {
const url = "/pages/index/index"; const url = "/pages/index/index";
Taro.switchTab({ Taro.switchTab({
@ -128,10 +117,10 @@ class Intro extends Component<any, any> {
}; };
// 跳转仪器介绍页 // 跳转仪器介绍页
goNursing = (item) => { goNursing = () => {
if (item.status === 0) { let { instrument } = this.state;
setStorageSync("instrument_detail", item); if (instrument.status === 0) {
this.setState({ connectInstrument: item }); this.setState({ connectInstrument: instrument });
setTimeout(() => this.bindBlockLeft()); setTimeout(() => this.bindBlockLeft());
} else { } else {
// todo // todo
@ -160,11 +149,6 @@ class Intro extends Component<any, any> {
/** 蓝牙逻辑 */ /** 蓝牙逻辑 */
bindBlockLeft() { bindBlockLeft() {
if (!this.state.isRegisterBoolean) {
//未注册授权
this.alertRegister();
return false;
}
if (this.state.connectInstrument.type === 1) { if (this.state.connectInstrument.type === 1) {
//非IOT //非IOT
setTimeout(() => { setTimeout(() => {
@ -205,12 +189,16 @@ class Intro extends Component<any, any> {
console.log("===epairingChange===》", e); console.log("===epairingChange===》", e);
go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
setTimeout(() => {
this.connectionClose(); this.connectionClose();
}, 100);
}; };
async goIot() { async goIot() {
go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
// return; setTimeout(() => {
this.connectionClose();
}, 100);
} }
//连接完成时数据的回调 //连接完成时数据的回调
@ -312,12 +300,23 @@ class Intro extends Component<any, any> {
this.setState({ this.setState({
isShowReConnectDeviceRecordWL200: false, isShowReConnectDeviceRecordWL200: false,
}); });
// this.goNursing()
}; };
render() { render() {
let { current, introList, instrument } = this.state; let {
current,
introList,
instrument,
isCommonError,
commonErrorText,
isShowReConnectDeviceRecordWL200,
isConnectShow,
connectInstrument,
isShowUpdateVersionTip,
isShowVersionUpgrading,
isShowVersionUpgradFinish,
versionUpgradFinishNodes,
} = this.state;
return ( return (
<Block> <Block>
<Navbar <Navbar
@ -464,7 +463,7 @@ class Intro extends Component<any, any> {
</View> </View>
<View className="footer flex aitems jcenter"> <View className="footer flex aitems jcenter">
<View className="btn" onClick={this.toNursing}> <View className="btn" onClick={this.goNursing}>
</View> </View>
<View className="btn text" onClick={this.toHomePage}> <View className="btn text" onClick={this.toHomePage}>

@ -174,12 +174,7 @@ export default class InstrumentManage extends Component<any, any> {
></Image> ></Image>
<View className="bind_status"></View> <View className="bind_status"></View>
<View className="intro"> <View className="intro">
<View <View className="tips"></View>
className="tips"
onClick={this.goIntro.bind(this, item)}
>
</View>
<View className="right"> <View className="right">
<Image <Image
src={require("../../img/index/right.png")} src={require("../../img/index/right.png")}

@ -1,6 +1,7 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import dayjs from "dayjs"; import dayjs from "dayjs";
import classnames from "classnames"; import classnames from "classnames";
import { debounce } from "lodash";
// eslint-disable-next-line import/no-named-as-default // eslint-disable-next-line import/no-named-as-default
import React, { import React, {
Component, Component,
@ -457,9 +458,12 @@ class IotCarePlan extends Component<any, any> {
// 如果是正在运行中切换,则直接准备运行 // 如果是正在运行中切换,则直接准备运行
if (isShowNurse) { if (isShowNurse) {
this.onStartNurse(); if (!this.footerIsDisabled()) {
this.stepNext(); // 如果切换模式,则不执行开始逻辑
return;
}
setTimeout(() => { setTimeout(() => {
this.onNursingTap(); this.onNursingTap("switch");
}, 800); }, 800);
} }
}; };
@ -608,7 +612,7 @@ class IotCarePlan extends Component<any, any> {
// 1.如果没有持久化不再提示,每次进入都会弹窗提示 // 1.如果没有持久化不再提示,每次进入都会弹窗提示
if (!isFirstEntryModeNot) { if (!isFirstEntryModeNot) {
// 2.必须要有数据才弹窗 // 2.必须要有数据才弹窗
if (this.state.ActiveModeItem.openSourceData) { if (this.state.ActiveModeItem.openSourceData.length > 0) {
this.setState({ isShowStepTips: true }); this.setState({ isShowStepTips: true });
} }
} }
@ -777,13 +781,14 @@ class IotCarePlan extends Component<any, any> {
// 判断设备主动上报的关机事件 // 判断设备主动上报的关机事件
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) { if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
this.rmWL200NursingHistory(this.WL200NursingHistory, true); // 判断id是否一致, 一致的话则生成护理报表, 并提示
// 判断护理时间,如果不足,则提示不足 if (jsonStatus.id == this.WL200NursingHistory.id) {
if (!this.isCheckNurseTime()) { debounce(
this.setState({ isNotEnoughTime: true }); this.checkInstrumentRecord.bind(this, jsonStatus),
} else { 500
this.endNurseFun(); );
} }
return; return;
} }
@ -917,6 +922,17 @@ class IotCarePlan extends Component<any, any> {
}); });
}; };
/**监听关机事件*/
onEndDevice = () => {
this.rmWL200NursingHistory(this.WL200NursingHistory, true);
// 判断护理时间,如果不足,则提示不足
if (!this.isCheckNurseTime()) {
this.setState({ isNotEnoughTime: true });
} else {
this.endNurseFun();
}
};
/** 同步设备运行信息:运行时间 */ /** 同步设备运行信息:运行时间 */
updateDeviceSyncData = (newData, jsonStatus) => { updateDeviceSyncData = (newData, jsonStatus) => {
DeviceSyncData = { DeviceSyncData = {
@ -1260,9 +1276,10 @@ class IotCarePlan extends Component<any, any> {
}; };
/** /**
* * @name
* @params type switch
*/ */
onNursingTap() { onNursingTap(type = "") {
// 如果已禁止运行,则停止执行后续逻辑 // 如果已禁止运行,则停止执行后续逻辑
if (this.state.isFooterBtnDisabled) return; if (this.state.isFooterBtnDisabled) return;
// 防止多次点击 // 防止多次点击
@ -1321,9 +1338,11 @@ class IotCarePlan extends Component<any, any> {
return; return;
} }
// 仅在切换模式的时候,弹窗倒计时.
if (type === "switch") {
let downNum = CountDownTime[ActiveModeItem.modeType] || 3; let downNum = CountDownTime[ActiveModeItem.modeType] || 3;
console.log("downNum", downNum);
this.showCountdownFun(downNum, () => {}); // 倒计时弹窗 this.showCountdownFun(downNum, () => {}); // 倒计时弹窗
}
// 开始执行护理 // 开始执行护理
this.workStatus = MODE_WORKING_ENUM.WORKING; // 不管当前什么状态,直接设为工作状态 this.workStatus = MODE_WORKING_ENUM.WORKING; // 不管当前什么状态,直接设为工作状态
@ -1398,6 +1417,7 @@ class IotCarePlan extends Component<any, any> {
* *
* */ * */
checkInstrumentRecord = async (jsonStatus: any) => { checkInstrumentRecord = async (jsonStatus: any) => {
console.log("检查护理记录");
let { currentDevice, ActiveModeItem, ModeList } = this.state; let { currentDevice, ActiveModeItem, ModeList } = this.state;
if (jsonStatus) { if (jsonStatus) {
} }
@ -1437,7 +1457,6 @@ class IotCarePlan extends Component<any, any> {
return; return;
} }
let sceneTime = minSecToS(ActiveModeItem.modeTimeStr);
// 4.判断设备状态-未运行/已完成/待机 // 4.判断设备状态-未运行/已完成/待机
if ( if (
workStatus == MODE_WORKING_ENUM.STANDBY || workStatus == MODE_WORKING_ENUM.STANDBY ||
@ -1458,8 +1477,8 @@ class IotCarePlan extends Component<any, any> {
let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间 let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间
if (totalSeconds < nursingTime) { if (totalSeconds < nursingTime) {
console.log("护理时间不足,弹出提示"); // 护理时间不足
// todo this.setState({ isNotEnoughTime: true });
this.rmWL200NursingHistory(WL200NursingHistory); this.rmWL200NursingHistory(WL200NursingHistory);
return; return;
} }
@ -1561,8 +1580,10 @@ class IotCarePlan extends Component<any, any> {
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory"); const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
if (nowWL200NursingHistory.id == WL200NursingHistory.id) { if (nowWL200NursingHistory.id == WL200NursingHistory.id) {
Taro.removeStorageSync("WL200NursingHistory"); Taro.removeStorageSync("WL200NursingHistory");
this.WL200NursingHistory.id = "";
} else if (hard) { } else if (hard) {
Taro.removeStorageSync("WL200NursingHistory"); Taro.removeStorageSync("WL200NursingHistory");
this.WL200NursingHistory.id = "";
} }
}; };
@ -1810,18 +1831,25 @@ class IotCarePlan extends Component<any, any> {
}; };
// 手动护理模式切换:提示是否保存护理 // 手动护理模式切换:提示是否保存护理
/**仅关闭*/
closeTipsSave = () => { closeTipsSave = () => {
this.setState({ this.setState({
isShowTipsSave: false, isShowTipsSave: false,
}); });
this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验
}; };
/**关闭+切换*/
cancelTipsSave = () => {
this.setState({
isShowTipsSave: false,
});
this.modeCurrentFun(this.tempModeCurrent, true); // 不提交护理记录,也不进行校验
};
/**关闭+提交+切换*/
confirmTipsSave = async () => { confirmTipsSave = async () => {
this.setState({ this.setState({
isShowTipsSave: false, isShowTipsSave: false,
}); });
// isShowTipsSave this.PostNursingLogClock(null, false); // 先提交护理记录
this.PostNursingLogClock(null, false);
this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验 this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验
}; };
@ -1876,9 +1904,13 @@ class IotCarePlan extends Component<any, any> {
} }
} }
// 仅在值变化时更新state
if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
this.setState({ this.setState({
isFooterBtnDisabled: isFooterBtnDisabled, isFooterBtnDisabled: isFooterBtnDisabled,
}); });
}
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断 return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
}; };
@ -2030,6 +2062,7 @@ class IotCarePlan extends Component<any, any> {
confirmButtonText="确认" confirmButtonText="确认"
textAlgin="center" textAlgin="center"
close={this.closeTipsSave} close={this.closeTipsSave}
cancel={this.cancelTipsSave}
confirm={this.confirmTipsSave} confirm={this.confirmTipsSave}
/> />
@ -2066,6 +2099,7 @@ class IotCarePlan extends Component<any, any> {
<Video <Video
className="video-or-image" className="video-or-image"
src={ActiveModeItem.modeVideo} src={ActiveModeItem.modeVideo}
loop
/> />
)} )}

@ -139,7 +139,12 @@ export const AjaxUploadFile = (params, formData) => {
}); });
return false; return false;
} }
if (o.code !== 200 && o.code !== 204 && o.code !== 205) { if (
o.code !== 200 &&
o.code !== 203 &&
o.code !== 204 &&
o.code !== 205
) {
let msg = let msg =
typeof o.msg == "string" ? o.msg : "系统异常,请联系管理人员"; typeof o.msg == "string" ? o.msg : "系统异常,请联系管理人员";
Taro.showModal({ Taro.showModal({

Loading…
Cancel
Save