add:1.蓝牙断开连接错误重连弹窗。2.运行中动态切换设备模式控制逻辑

master
blak-kong 2 years ago
parent 18eaff89e6
commit 0459a45ab4

@ -34,7 +34,7 @@ import {
getTimeCode, getTimeCode,
isNeedToUpdate, isNeedToUpdate,
} from "@/utils/util"; } from "@/utils/util";
const log = require("@/utils/log"); // const log = require("@/utils/log");
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
import { bleCommandSamples } from "./test"; import { bleCommandSamples } from "./test";
@ -129,7 +129,15 @@ class ConnectionBluetoot extends Component<any, any> {
async onLoad() {} async onLoad() {}
componentDidMount() { componentDidMount() {
// 只有非断开状态的弹窗才自动连接蓝牙
if (!this.props.isDisconnect) {
this.connection(); this.connection();
} else {
// 断开状态弹窗:自动设置为错误模式
this.setState({
error: true,
});
}
} }
componentWillUnmount() {} componentWillUnmount() {}
@ -993,6 +1001,15 @@ class ConnectionBluetoot extends Component<any, any> {
onReconnect = () => { onReconnect = () => {
console.log("onReconnect"); console.log("onReconnect");
// 重置信息并重连
this.setState({
error: false,
searchError: false,
errorText: "",
});
setTimeout(() => {
this.connection();
});
// this.props.confirm("confirm"); // this.props.confirm("confirm");
}; };
@ -1006,7 +1023,7 @@ class ConnectionBluetoot extends Component<any, any> {
render() { render() {
let { name, isConnection, connectionSuccess, error } = this.state; let { name, isConnection, connectionSuccess, error } = this.state;
let { deviceInfo } = this.props; let { deviceInfo, isDisconnect } = this.props;
return ( return (
<Block> <Block>
<DeviceConnectPopup <DeviceConnectPopup

@ -13,12 +13,12 @@
// } // }
.site-close { .site-close {
position: absolute; position: absolute;
right: 36rpx; right: 16rpx;
top: 36rpx; top: 16rpx;
color: #fff; color: #000;
font-size: 36rpx; font-size: 36rpx;
z-index: 100009; z-index: 100009;
background-color: #ababab; background-color: transparent;
border-radius: 50%; border-radius: 50%;
padding: 8rpx; padding: 8rpx;
box-sizing: border-box; box-sizing: border-box;
@ -64,7 +64,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
width: 100%; width: 84%;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
// column-gap: 30rpx; // column-gap: 30rpx;
@ -76,6 +76,7 @@
width: 36rpx; width: 36rpx;
min-width: 36rpx; min-width: 36rpx;
height: 36rpx; height: 36rpx;
margin-right: 36rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;

@ -178,12 +178,13 @@ export default class DeviceConnectPopup 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-btn"
style="background-color: #fff;color: #000"
onClick={this.onClose}
>
</Button> </Button>
<Button className="common-popup-btn2" onClick={this.onConfirm}>
</Button>
</View> </View>
</View> </View>
)} )}
@ -201,7 +202,8 @@ export default class DeviceConnectPopup extends Component<any, any> {
<View className="error-block"> <View className="error-block">
<View className="tip1"></View> <View className="tip1"></View>
<View className="tip2"> <View className="tip2">
{data.bluetoothConnectFailContent} {data.bluetoothConnectFailContent ||
"请重启设备后点击重新连接"}
</View> </View>
</View> </View>
</View> </View>

@ -18,12 +18,12 @@
// } // }
.site-close { .site-close {
position: absolute; position: absolute;
right: 36rpx; right: 16rpx;
top: 36rpx; top: 16rpx;
color: #fff; color: #000;
font-size: 36rpx; font-size: 36rpx;
z-index: 100009; z-index: 100009;
background-color: #ababab; background-color: transparent;
border-radius: 50%; border-radius: 50%;
padding: 8rpx; padding: 8rpx;
box-sizing: border-box; box-sizing: border-box;

@ -24,6 +24,7 @@ import { go } from "../../utils/traoAPI";
/** props /** props
* isLarge * isLarge
* isShow * isShow
* isFirstEntry
* data * data
* title * title
* confirmButtonText * confirmButtonText
@ -59,6 +60,9 @@ export default class PopupStepTips extends Component<any, any> {
let { isLocal } = this.state; let { isLocal } = this.state;
this.props.close({ isLocal }); this.props.close({ isLocal });
}; };
onConfirm = () => {
this.props.close({ isLocal: true });
};
onClickStop = (e) => { onClickStop = (e) => {
e.stopPropagation(); e.stopPropagation();
@ -94,8 +98,15 @@ export default class PopupStepTips extends Component<any, any> {
}; };
render() { render() {
let { isShow, data, isLarge, title, content, confirmButtonText } = let {
this.props; isShow,
data,
isLarge,
isFirstEntry,
title,
content,
confirmButtonText,
} = this.props;
let { current, isLocal } = this.state; let { current, isLocal } = this.state;
return ( return (
@ -123,7 +134,7 @@ export default class PopupStepTips extends Component<any, any> {
"margin-samll": isLarge, "margin-samll": isLarge,
})} })}
> >
{data.length > 0 ? data[current].openTitle : "暂无数据"} {data.length > 0 ? data[current].openTitle : "使用教程"}
</View> </View>
{/* {title && ( {/* {title && (
<View <View
@ -164,9 +175,15 @@ export default class PopupStepTips extends Component<any, any> {
<View> <View>
{data.length === 1 && ( {data.length === 1 && (
<View className="popup-btn-one"> <View className="popup-btn-one">
{isFirstEntry ? (
<Button className="popup-btn" onClick={this.onConfirm}>
{confirmButtonText}
</Button>
) : (
<Button className="popup-btn" onClick={this.onClose}> <Button className="popup-btn" onClick={this.onClose}>
{confirmButtonText} {confirmButtonText}
</Button> </Button>
)}
</View> </View>
)} )}
{data.length > 1 && current === 0 && ( {data.length > 1 && current === 0 && (
@ -191,6 +208,7 @@ export default class PopupStepTips extends Component<any, any> {
)} )}
</View> </View>
{!isFirstEntry && (
<View className="setp-footer-btn" onClick={this.onChangeLocal}> <View className="setp-footer-btn" onClick={this.onChangeLocal}>
{isLocal ? ( {isLocal ? (
<Image <Image
@ -206,6 +224,7 @@ export default class PopupStepTips extends Component<any, any> {
<Text className="text"></Text> <Text className="text"></Text>
</View> </View>
)}
</View> </View>
</Popup> </Popup>
</Block> </Block>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -156,16 +156,14 @@ class Index extends Component<any, any> {
} }
} }
if (Taro.getStorageSync("skip")) { if (Taro.getStorageSync("skip")) {
this.setState({ showEquipment: true }) this.setState({ showEquipment: true });
Taro.removeStorageSync('skip'); Taro.removeStorageSync("skip");
} }
} }
componentDidMount() { componentDidMount() {}
} componentWillUnmount() {}
componentWillUnmount() { }
componentDidShow() { componentDidShow() {
const tabbar = Taro.getTabBar<CustomTabBar>(this.$instance.page); const tabbar = Taro.getTabBar<CustomTabBar>(this.$instance.page);
@ -174,7 +172,7 @@ class Index extends Component<any, any> {
this.showInit(); this.showInit();
} }
componentDidHide() { } componentDidHide() {}
showInit() { showInit() {
// 判断是否登录 // 判断是否登录
@ -224,7 +222,7 @@ class Index extends Component<any, any> {
this.isSancQrcodeEnter(); this.isSancQrcodeEnter();
} }
}, },
fail: () => { }, fail: () => {},
complete: () => { complete: () => {
// 授权完成运行页面初始化 // 授权完成运行页面初始化
}, },
@ -382,7 +380,7 @@ class Index extends Component<any, any> {
this.setState({ isShowSiteSwiper: false }); this.setState({ isShowSiteSwiper: false });
}; };
bannerSwiperchange() { } bannerSwiperchange() {}
gobanner(item) { gobanner(item) {
// 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间', // 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间',
@ -655,27 +653,15 @@ class Index extends Component<any, any> {
// return; // return;
} }
onUnloginConfirm() { onUnloginConfirm() {
this.setState({ showEquipment: false }) this.setState({ showEquipment: false });
} }
onUnloginClose() { onUnloginClose() {
this.setState({ showEquipment: false }) this.setState({ showEquipment: false });
} }
//连接完成时数据的回调 //连接完成时数据的回调
offlineChange = async (e) => { offlineChange = async (e) => {
console.log("offlineChange", e); console.log("offlineChange", e);
// log.info( this.pairingChange("offlineChange");
// commandMap.versionInfoHome,
// `offlineChange::e::${JSON.stringify(e)}`
// );
//offlineDataList 离线数据
//versioninfo 版本号
let { offlineDataList, versionInfo } = e.detail;
this.setState({
versionInfo,
});
let offlinelist: any = [];
console.log(offlinelist);
}; };
connectionOpen = async () => { connectionOpen = async () => {
@ -801,20 +787,20 @@ class Index extends Component<any, any> {
<PopupAlert <PopupAlert
isShow={isNotRegister} isShow={isNotRegister}
isClose isClose
title='提示' title="提示"
content='暂未授权注册,请点击注册' content="暂未授权注册,请点击注册"
confirmButtonText='确定' confirmButtonText="确定"
textAlgin='center' textAlgin="center"
type='1' type="1"
close={this.closeAlert} close={this.closeAlert}
confirm={this.closeAlert} confirm={this.closeAlert}
/> />
<PopupAlert <PopupAlert
isShow={isDev} isShow={isDev}
title='提示' title="提示"
content='页面正在开发中' content="页面正在开发中"
confirmButtonText='确定' confirmButtonText="确定"
textAlgin='center' textAlgin="center"
close={this.closeDev} close={this.closeDev}
confirm={this.closeDev} confirm={this.closeDev}
/> />
@ -834,25 +820,25 @@ class Index extends Component<any, any> {
/> />
<PopupAlert <PopupAlert
isShow={isBindingError} isShow={isBindingError}
title='提示' title="提示"
content={ content={
<Block> <Block>
<View></View> <View></View>
<View></View> <View></View>
</Block> </Block>
} }
confirmButtonText='知道了' confirmButtonText="知道了"
textAlgin='center' textAlgin="center"
isClose={false} isClose={false}
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm} confirm={this.onBindErrorConfirm}
/> />
<PopupAlert <PopupAlert
isShow={isBeforeBinding} isShow={isBeforeBinding}
title='提示' title="提示"
content='您选择的仪器有误,请重新确认选择' content="您选择的仪器有误,请重新确认选择"
confirmButtonText='知道了' confirmButtonText="知道了"
textAlgin='center' textAlgin="center"
isClose={false} isClose={false}
close={this.onBeforeBindClose} close={this.onBeforeBindClose}
confirm={this.onBeforeBindConfirm} confirm={this.onBeforeBindConfirm}
@ -860,16 +846,16 @@ class Index extends Component<any, any> {
<PopupAlert <PopupAlert
isShow={showEquipment} isShow={showEquipment}
title='提示' title="提示"
content={ content={
<Block> <Block>
<View className='mb10'></View> <View className="mb10"></View>
<View className='mb10'>uniquie14231</View> <View className="mb10">uniquie14231</View>
<View className='mb10'></View> <View className="mb10"></View>
</Block> </Block>
} }
confirmButtonText='知道了' confirmButtonText="知道了"
textAlgin='center' textAlgin="center"
isClose={false} isClose={false}
close={this.onUnloginClose.bind(this)} close={this.onUnloginClose.bind(this)}
confirm={this.onUnloginConfirm.bind(this)} confirm={this.onUnloginConfirm.bind(this)}
@ -883,9 +869,9 @@ class Index extends Component<any, any> {
<PopupSiteSwiper <PopupSiteSwiper
isShow={isShowSiteSwiper} isShow={isShowSiteSwiper}
siteData={sitePopupList} siteData={sitePopupList}
size='middle' size="middle"
confirmButtonText='确定' confirmButtonText="确定"
textAlgin='center' textAlgin="center"
close={this.closeSiteSwiper} close={this.closeSiteSwiper}
confirm={this.closeSiteSwiper} confirm={this.closeSiteSwiper}
/> />
@ -948,29 +934,29 @@ class Index extends Component<any, any> {
leftSlot={ leftSlot={
<Block> <Block>
<View <View
className='message' className="message"
onClick={this.gourl} onClick={this.gourl}
data-url='/pages/message/message' data-url="/pages/message/message"
> >
<Image <Image
className='message-img' className="message-img"
src={require("../../img/index/message.png")} src={require("../../img/index/message.png")}
mode='aspectFill' mode="aspectFill"
/> />
{messagecount ? <View className='tip' /> : ""} {messagecount ? <View className="tip" /> : ""}
</View> </View>
</Block> </Block>
} }
/> />
<View className='index'> <View className="index">
<View className='date-title' onClick={this.toNursingRecords}> <View className="date-title" onClick={this.toNursingRecords}>
<Text className='text'></Text> <Text className="text"></Text>
<Image <Image
src={require("../../img/index/right.png")} src={require("../../img/index/right.png")}
style='width: 20rpx;height: 20rpx;' style="width: 20rpx;height: 20rpx;"
/> />
</View> </View>
<View className='bg-while'> <View className="bg-while">
<AtCalendar <AtCalendar
hideArrow hideArrow
isSwiper={false} isSwiper={false}
@ -982,41 +968,41 @@ class Index extends Component<any, any> {
/> />
</View> </View>
</View> </View>
<View className='infobox5'> <View className="infobox5">
{instrumentList.length > 0 && ( {instrumentList.length > 0 && (
<Block> <Block>
<View className='nurse_plan_box flex aitems sb'> <View className="nurse_plan_box flex aitems sb">
<View className='title'></View> <View className="title"></View>
<View <View
className='txt_box flex jcenter aitems' className="txt_box flex jcenter aitems"
data-url='/pages/instrument/instrument' data-url="/pages/instrument/instrument"
onClick={this.gourl} onClick={this.gourl}
> >
<Image <Image
className='right_icon' className="right_icon"
src={require("../../img/black-add.png")} src={require("../../img/black-add.png")}
mode='aspectFill' mode="aspectFill"
/> />
<View className='txt'></View> <View className="txt"></View>
</View> </View>
</View> </View>
<View style='overflow-x: auto;'> <View style="overflow-x: auto;">
<View className='device_list flex'> <View className="device_list flex">
{instrumentList.map((item, index) => { {instrumentList.map((item, index) => {
if (item.status === 0) { if (item.status === 0) {
return ( return (
<View <View
key={"instrumentList" + index} key={"instrumentList" + index}
className='device_item' className="device_item"
onClick={this.goNursing.bind(this, item)} onClick={this.goNursing.bind(this, item)}
> >
<Image <Image
className='banner_img' className="banner_img"
src={item.banner} src={item.banner}
mode='aspectFill' mode="aspectFill"
/> />
<View className='device_name ellipsis1'> <View className="device_name ellipsis1">
{item.name} {item.name}
</View> </View>
</View> </View>
@ -1029,32 +1015,32 @@ class Index extends Component<any, any> {
)} )}
{instrumentList.length === 0 && ( {instrumentList.length === 0 && (
<Block> <Block>
<View className='nurse_plan_box flex aitems sb'> <View className="nurse_plan_box flex aitems sb">
<View className='title'></View> <View className="title"></View>
</View> </View>
<View className='add_device flex jcenter aitems bg-while'> <View className="add_device flex jcenter aitems bg-while">
<View className='add_device_btn'> <View className="add_device_btn">
<View className='txt_box flex jcenter aitems'> <View className="txt_box flex jcenter aitems">
<View <View
className='at-icon at-icon-add' className="at-icon at-icon-add"
style='color: #fff;font-size: 30rpx;' style="color: #fff;font-size: 30rpx;"
></View> ></View>
<View className='txt' onClick={this.addNewDevice}> <View className="txt" onClick={this.addNewDevice}>
</View> </View>
</View> </View>
</View> </View>
<View className='tips'></View> <View className="tips"></View>
</View> </View>
</Block> </Block>
)} )}
</View> </View>
<View style='margin: 20px'> <View style="margin: 20px">
<View onClick={this.goIot}></View> <View onClick={this.goIot}></View>
</View> </View>
<View className='infobox3'> <View className="infobox3">
<Swiper <Swiper
autoplay autoplay
onAnimationFinish={this.bannerSwiperchange.bind(this)} onAnimationFinish={this.bannerSwiperchange.bind(this)}
@ -1066,13 +1052,13 @@ class Index extends Component<any, any> {
key={"banner_" + index} key={"banner_" + index}
onClick={this.gobanner.bind(this, item)} onClick={this.gobanner.bind(this, item)}
> >
<Image style='width:100%;height:100%' src={item.fileUrl} /> <Image style="width:100%;height:100%" src={item.fileUrl} />
</SwiperItem> </SwiperItem>
); );
})} })}
</Swiper> </Swiper>
</View> </View>
<View style='height:200rpx'></View> <View style="height:200rpx"></View>
</Block> </Block>
); );
} }

@ -11,6 +11,7 @@ interface Props {
onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件 onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件
onEmitSwitchChange: Function; onEmitSwitchChange: Function;
onEmitEndPlan: Function; onEmitEndPlan: Function;
onEmitErrorTips: Function; // 不可点击,提示错误
} }
function Index({ function Index({
isCanClick, isCanClick,
@ -19,6 +20,7 @@ function Index({
onEmitStartNurse, onEmitStartNurse,
onEmitSwitchChange, onEmitSwitchChange,
onEmitEndPlan, onEmitEndPlan,
onEmitErrorTips,
}: Props) { }: Props) {
const onStartNurse = () => { const onStartNurse = () => {
onEmitStartNurse(); onEmitStartNurse();
@ -32,6 +34,10 @@ function Index({
onEmitEndPlan(); onEmitEndPlan();
}; };
const onErrorTips = () => {
onEmitErrorTips();
};
return ( return (
<Block> <Block>
<View className="footer"> <View className="footer">
@ -50,6 +56,7 @@ function Index({
)} )}
{isShowNurse && ( {isShowNurse && (
<View className="switch-btn-box"> <View className="switch-btn-box">
{isCanClick && (
<View className="btn-item border-right" onClick={onSwitchChange}> <View className="btn-item border-right" onClick={onSwitchChange}>
{isStopNurse ? ( {isStopNurse ? (
<Block> <Block>
@ -58,7 +65,7 @@ function Index({
src={require("../../../../img/iot/start_nurse.png")} src={require("../../../../img/iot/start_nurse.png")}
mode="aspectFill" mode="aspectFill"
/> />
<Text className="btn-text"></Text> <Text className="btn-text"></Text>
</Block> </Block>
) : ( ) : (
<Block> <Block>
@ -71,6 +78,36 @@ function Index({
</Block> </Block>
)} )}
</View> </View>
)}
{!isCanClick && (
<View className="btn-item border-right" onClick={onErrorTips}>
{isStopNurse ? (
<Block>
<Image
className="btn-icon"
style="color: #ccc"
src={require("../../../../img/iot/start_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text" style="color: #ccc">
</Text>
</Block>
) : (
<Block>
<Image
className="btn-icon"
style="color: #ccc"
src={require("../../../../img/iot/pause_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text" style="color: #ccc">
</Text>
</Block>
)}
</View>
)}
<View className="btn-item" onClick={onEndPlan}> <View className="btn-item" onClick={onEndPlan}>
<Image <Image

@ -24,6 +24,7 @@ import PopupStepTips from "@/components/popup/popup-step-tips";
import PopupConfirm from "@/components/popup/popup-confirm"; import PopupConfirm from "@/components/popup/popup-confirm";
import PopupAlert from "@/components/popup/popup-alert"; import PopupAlert from "@/components/popup/popup-alert";
import PopupStatus from "@/components/popup/popup-status"; import PopupStatus from "@/components/popup/popup-status";
import ConnectionBluetoot from "@/components/bluetoot/connection";
/* 公共组件 END */ /* 公共组件 END */
/* 本页组件 */ /* 本页组件 */
@ -50,7 +51,14 @@ import {
deviceCommandSamples, deviceCommandSamples,
bleCommandSamples, bleCommandSamples,
} from "@/components/bluetoot/connection/test"; } from "@/components/bluetoot/connection/test";
import { s_to_s, s_to_m, minSecToS, s_to_ms, sleep } from "@/utils/util"; import {
s_to_s,
s_to_m,
minSecToS,
s_to_ms,
s_to_hms,
sleep,
} from "@/utils/util";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
@ -147,10 +155,11 @@ class IotCarePlan extends Component<any, any> {
hadShowBreakTips: false, // 是否展示过支架断开提示 hadShowBreakTips: false, // 是否展示过支架断开提示
popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗 popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗
isConnectShow: false, // 是否弹出连蓝牙弹窗:在蓝牙断开时弹出
/** 连接设备 End */ /** 连接设备 End */
/** 护理过程 */ /** 护理过程 */
isCanClick: false, // 是否可以点击开始按钮 isCanClick: false, // 是否可以点击开始按钮/启动暂停
isStandStatus: false, // 当前模式是否舱体/支架模式 isStandStatus: false, // 当前模式是否舱体/支架模式
isShowStepTips: false, // 是否显示介绍步骤弹窗 isShowStepTips: false, // 是否显示介绍步骤弹窗
isConnectionBlutoot: true, // 是否已连接蓝牙 isConnectionBlutoot: true, // 是否已连接蓝牙
@ -184,8 +193,6 @@ class IotCarePlan extends Component<any, any> {
countdown: 3, countdown: 3,
// 是否结束护理 // 是否结束护理
isEndCarePlan: false, isEndCarePlan: false,
// 最后执行步骤位置
endPlace: "",
currentTime: "01:00", currentTime: "01:00",
// 护理时间不够 // 护理时间不够
@ -195,10 +202,13 @@ class IotCarePlan extends Component<any, any> {
errorTipsText: "", // 护理模式切换错误提示 errorTipsText: "", // 护理模式切换错误提示
isShowNursingSuccess: false, // 护理成功弹窗 isShowNursingSuccess: false, // 护理成功弹窗
isShowTipsSave: false, // 切换模式时,提示是否保存部分护理记录
}; };
} }
// 不涉及渲染的页面变量 // 不涉及渲染的页面变量
jsonStatus: any = {}; // 同步设备返回数据,用于结束
tempModeCurrent: any = {}; // 临时保存的当前模式
elapsedTime: any = 0; // 设备已运行时间 elapsedTime: any = 0; // 设备已运行时间
workStatus: any = ""; // 工作状态 workStatus: any = ""; // 工作状态
WL200NursingHistory: any = null; // 护理缓存历史 WL200NursingHistory: any = null; // 护理缓存历史
@ -232,6 +242,7 @@ class IotCarePlan extends Component<any, any> {
} }
componentDidHide() { componentDidHide() {
console.log("Hide");
// 页面隐藏后,下次显示需要重新检查记录 // 页面隐藏后,下次显示需要重新检查记录
this.hadCheckReport = false; this.hadCheckReport = false;
} }
@ -249,9 +260,9 @@ class IotCarePlan extends Component<any, any> {
console.log("info"); console.log("info");
// 如果不存在设备模式值,则判断为首次进入,弹窗提示 // 如果不存在设备模式值,则判断为首次进入,弹窗提示
let isFirstEntry = getStorageSync("isFirstEntry_" + info.model); let isFirstEntry = getStorageSync("isFirstEntry_" + info.id);
if (!isFirstEntry) { if (!isFirstEntry) {
// this.setState({ isShowStepTips: true }); this.setState({ isShowStepTips: true });
} }
} }
@ -296,18 +307,15 @@ class IotCarePlan extends Component<any, any> {
console.log("offBLECharacteristicValueChange", res); console.log("offBLECharacteristicValueChange", res);
}); });
clearTimeout(loadingTipsTimer); clearTimeout(loadingTipsTimer);
// 断开蓝牙关闭倒计时
this.setState({
isShowCountdown: false,
});
console.log(commandMap.WL200Command, "监听到蓝牙断开, 打开断开提示"); console.log(commandMap.WL200Command, "监听到蓝牙断开, 打开断开提示");
this.workStatus = ""; this.workStatus = "";
// 显示蓝牙断开弹窗 // 显示蓝牙断开弹窗
// this.setState({ this.setState({
// workStatus: "", isConnectShow: true, // 打开蓝牙链接弹窗
// currentShowDialog: "connection_break", isConnectionBlutoot: false, // 断开蓝牙
// }); isShowCountdown: false, // 关闭倒计时,防止倒计时还在运行
});
}; };
GetModeList = async (id) => { GetModeList = async (id) => {
@ -362,12 +370,21 @@ class IotCarePlan extends Component<any, any> {
} }
/** 选中护理模式 */ /** 选中护理模式 */
modeCurrentFun = async (data) => { modeCurrentFun = async (data, isNotCheck = false) => {
let { isStandStatus } = this.state; // 是否跳过护理检查
if (!isNotCheck) {
this.tempModeCurrent = data;
let isReturn = this.modeRuningChange();
if (isReturn) return;
}
let { isStandStatus, isShowNurse } = this.state;
// 舱体模式无法对应的时候,置灰开始按钮 // 舱体模式无法对应的时候,置灰开始按钮
let isCabinMode = data.isCabinMode === 1; let isCabinMode = isStandStatus
? data.isCabinMode === 1
: data.isCabinMode === 0;
if (isStandStatus === isCabinMode) { if (isStandStatus === isCabinMode) {
this.setState({ isCanClick: true }); this.setState({ isCanClick: true }); // 是否舱体一致时,可以点击
} else { } else {
this.setState({ isCanClick: false }); this.setState({ isCanClick: false });
} }
@ -402,7 +419,46 @@ class IotCarePlan extends Component<any, any> {
this.setCustomMaskData(); this.setCustomMaskData();
} }
}); });
// 如果是正在运行中切换,则直接准备运行
if (isShowNurse) {
this.onStartNurse();
setTimeout(() => {
this.onNursingTap();
}, 500);
}
}; };
/** 设备运行中切换模式 */
modeRuningChange() {
// 运行中切换模式逻辑
if (
this.workStatus === MODE_WORKING_ENUM.PAUSE ||
this.workStatus === MODE_WORKING_ENUM.WORKING
) {
const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData;
const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds;
let { ActiveModeItem } = this.state;
if (!ActiveModeItem || totalTime === 0) {
return false;
}
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = minSecToS(currentScene.modeTimeStr); // 场景最小护理时间
if (
sceneTime <= totalTime &&
this.state.step == 2 &&
this.state.facialMaskConnectStatus == 1
) {
// 提示切换护理模式
this.hanldeChangeNurseFun();
return true;
}
}
return false;
}
/** 切换护理模式 */ /** 切换护理模式 */
switchModeCurrentFun = async (data) => { switchModeCurrentFun = async (data) => {
this.setState({ this.setState({
@ -488,17 +544,22 @@ class IotCarePlan extends Component<any, any> {
// } // }
let { isStandStatus, ActiveModeItem } = this.state; let { isStandStatus, ActiveModeItem } = this.state;
let isCabinMode = ActiveModeItem.isCabinMode === 1; let isCabinMode = isStandStatus
? ActiveModeItem.isCabinMode === 1
: ActiveModeItem.isCabinMode === 0;
if (isStandStatus && isCabinMode) { if (isStandStatus && isCabinMode) {
this.stepNext(); this.stepNext();
return; return;
} }
this.onEmitErrorTips();
};
/** 不可切换光照提示 */
onEmitErrorTips = async () => {
let { isStandStatus, ActiveModeItem } = this.state;
if (isStandStatus) { if (isStandStatus) {
if (ActiveModeItem.isCabinMode === 0) { if (ActiveModeItem.isCabinMode === 0) {
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体"); this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
}
} else { } else {
if (ActiveModeItem.isCabinMode === 1) {
this.showTips( this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源" "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
); );
@ -523,7 +584,7 @@ class IotCarePlan extends Component<any, any> {
closeStepTips = (data) => { closeStepTips = (data) => {
if (data.isLocal) { if (data.isLocal) {
setStorageSync("isFirstEntry_" + this.state.ActiveModeItem.model, true); // 关闭首次进入弹窗 setStorageSync("isFirstEntry_" + this.state.currentDevice.id, true); // 关闭首次进入弹窗
} }
this.setState({ isShowStepTips: false }); this.setState({ isShowStepTips: false });
}; };
@ -554,6 +615,11 @@ class IotCarePlan extends Component<any, any> {
isStandStatus: true, isStandStatus: true,
isCanClick: this.state.isCabinMode === 1, isCanClick: this.state.isCabinMode === 1,
}); });
} else {
this.setState({
isStandStatus: false,
isCanClick: this.state.isCabinMode !== 1,
});
} }
break; break;
default: default:
@ -570,7 +636,9 @@ class IotCarePlan extends Component<any, any> {
console.log("支架是否链接", isStandDevice); console.log("支架是否链接", isStandDevice);
this.setState({ this.setState({
isStandStatus: isStandDevice, isStandStatus: isStandDevice,
isCanClick: this.state.isCabinMode === 1, isCanClick: isStandDevice
? this.state.isCabinMode === 1
: this.state.isCabinMode !== 1,
}); });
// 连上面罩后, 获取仪器记录, 与缓存信息对比 // 连上面罩后, 获取仪器记录, 与缓存信息对比
@ -783,8 +851,6 @@ class IotCarePlan extends Component<any, any> {
console.log("场景时间 sceneTime", sceneTime); console.log("场景时间 sceneTime", sceneTime);
console.log("当前显示时间 currentTime", currentTime); console.log("当前显示时间 currentTime", currentTime);
console.log("设备运行时间 totalTime", totalTime); console.log("设备运行时间 totalTime", totalTime);
console.log(" this.state.step", this.state.step);
console.log("sceneTime > totalTime", sceneTime > totalTime);
// 更新界面倒计时 // 更新界面倒计时
this.resetTimer(); this.resetTimer();
@ -802,13 +868,8 @@ class IotCarePlan extends Component<any, any> {
} else { } else {
this.setState({ this.setState({
currentTime: "00:00", currentTime: "00:00",
endPlace: "report",
}); });
this.judgementWorkStatus( this.judgementWorkStatus(MODE_WORKING_ENUM.END, jsonStatus.workMode);
MODE_WORKING_ENUM.END,
jsonStatus.workMode,
jsonStatus
);
} }
}, },
}; };
@ -835,7 +896,7 @@ class IotCarePlan extends Component<any, any> {
* *
* params * params
*/ */
judgementWorkStatus(nWorkStatus, nWorkMode, jsonStatus) { judgementWorkStatus(nWorkStatus, nWorkMode) {
const { step, isStandStatus, workMode, ActiveModeItem, ModeList } = const { step, isStandStatus, workMode, ActiveModeItem, ModeList } =
this.state; this.state;
const opts: any = {}; const opts: any = {};
@ -956,10 +1017,7 @@ class IotCarePlan extends Component<any, any> {
// 仪器自动上报完成, 直接上报并跳转报告页 // 仪器自动上报完成, 直接上报并跳转报告页
clearInterval(currentTimeTimer); clearInterval(currentTimeTimer);
const isEnough = this.checkNurseTime(); const isEnough = this.checkNurseTime();
if (isEnough && !this.state.endPlace) { if (isEnough) {
this.setState({
endPlace: "report",
});
this.saveNurseReport(true, "endnursing"); this.saveNurseReport(true, "endnursing");
} }
} else { } else {
@ -1034,7 +1092,6 @@ class IotCarePlan extends Component<any, any> {
clearInterval(currentTimeTimer); clearInterval(currentTimeTimer);
this.setState({ this.setState({
currentTime: "00:00", currentTime: "00:00",
endPlace: "report",
ModeStepIndex: 0, ModeStepIndex: 0,
}); });
this.saveNurseReport(true, "setTimer"); // 保存护理计划,并且结束 this.saveNurseReport(true, "setTimer"); // 保存护理计划,并且结束
@ -1168,11 +1225,9 @@ class IotCarePlan extends Component<any, any> {
this.handleWorkStatus(true, MODE_WORKING_ENUM.WORKING); this.handleWorkStatus(true, MODE_WORKING_ENUM.WORKING);
} }
// 结束护理 // 结束护理
endNurseFun() { endNurseFun() {
this.handleWorkStatus(false, "end"); this.handleWorkStatus(false, "end");
console.log("this.checkNurseTime()", this.checkNurseTime());
if (this.checkNurseTime()) { if (this.checkNurseTime()) {
this.PostNursingLogClock(); this.PostNursingLogClock();
} else { } else {
@ -1185,6 +1240,19 @@ class IotCarePlan extends Component<any, any> {
} }
} }
// 手动切换护理
hanldeChangeNurseFun() {
// 满足时间条件,提示是否保存部分护理记录
if (this.checkNurseTime()) {
// 打开提示保存护理弹窗
this.setState({
isShowTipsSave: true,
});
} else {
// 不满足条件,直接切换
}
}
/** 检查时间是否达标仪器最低护理时间 */ /** 检查时间是否达标仪器最低护理时间 */
checkNurseTime() { checkNurseTime() {
const { currentDevice, ActiveModeItem } = this.state; const { currentDevice, ActiveModeItem } = this.state;
@ -1315,12 +1383,18 @@ class IotCarePlan extends Component<any, any> {
return; return;
} }
// 小程序时间和设备时间,谁大用谁
let timeValue =
totalSeconds > this.elapsedTime
? s_to_hms(totalSeconds)
: s_to_hms(this.elapsedTime);
let params = { let params = {
instrumentId: currentDevice.id, instrumentId: currentDevice.id,
instrumentName: currentDevice.name, instrumentName: currentDevice.name,
modeId: ActiveModeItem.id, modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName, modeName: ActiveModeItem.modeName,
nursingTime: s_to_ms(this.elapsedTime), nursingTime: timeValue,
}; };
let res: any = await this.PostNursingLogClock(params); let res: any = await this.PostNursingLogClock(params);
console.log("res", res); console.log("res", res);
@ -1332,7 +1406,7 @@ class IotCarePlan extends Component<any, any> {
instrumentName: currentDevice.name, instrumentName: currentDevice.name,
modeId: ActiveModeItem.id, modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName, modeName: ActiveModeItem.modeName,
nursingTime: "01:00", nursingTime: "00:01:00",
}; };
let res: any = await this.PostNursingLogClock(params); let res: any = await this.PostNursingLogClock(params);
console.log("res", res); console.log("res", res);
@ -1378,7 +1452,7 @@ class IotCarePlan extends Component<any, any> {
}; };
/** 提交护理记录 */ /** 提交护理记录 */
PostNursingLogClock = async (data: any = null) => { PostNursingLogClock = async (data: any = null, isJump = true) => {
let { currentDevice, ActiveModeItem } = this.state; let { currentDevice, ActiveModeItem } = this.state;
let params = {}; let params = {};
@ -1390,7 +1464,7 @@ class IotCarePlan extends Component<any, any> {
instrumentName: currentDevice.name, instrumentName: currentDevice.name,
modeId: ActiveModeItem.id, modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName, modeName: ActiveModeItem.modeName,
nursingTime: s_to_ms(this.elapsedTime), nursingTime: s_to_hms(this.elapsedTime),
}; };
} }
@ -1398,13 +1472,18 @@ class IotCarePlan extends Component<any, any> {
console.log("PostNursingLogClock", res); console.log("PostNursingLogClock", res);
if (res.data.code === 200) { if (res.data.code === 200) {
if (!isJump) {
this.setState({ this.setState({
isShowNursingSuccess: true, isShowNursingSuccess: true,
}); });
}
if (isJump) {
setTimeout(() => { setTimeout(() => {
this.goFaceReport(); this.goFaceReport();
}, 1000); }, 1000);
} }
}
}; };
/*** 护理记录 END ***/ /*** 护理记录 END ***/
@ -1598,12 +1677,38 @@ class IotCarePlan extends Component<any, any> {
go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); go("/pages/face_report/face_report?id=" + this.state.currentDevice.id);
}; };
// 完成配对
pairingChange = () => {
this.setState({
isConnectShow: false,
});
};
connectionClose = () => {
this.setState({
isConnectShow: false,
});
};
// 手动护理模式切换:提示是否保存护理
closeTipsSave = () => {
this.setState({
isShowTipsSave: false,
});
this.modeCurrentFun(this.tempModeCurrent, false);
};
confirmTipsSave = async () => {
this.setState({
isShowTipsSave: false,
});
this.PostNursingLogClock(null, false);
this.modeCurrentFun(this.tempModeCurrent, false);
};
render() { render() {
let { let {
name, name,
title, title,
isShowUpdateVersionTip, isConnectShow,
isShowVersionUpgrading,
isShowStepTips, isShowStepTips,
isCanClick, isCanClick,
isShowNurse, isShowNurse,
@ -1618,7 +1723,6 @@ class IotCarePlan extends Component<any, any> {
activeModeID, activeModeID,
isShowCountdown, isShowCountdown,
countdown, countdown,
ModeStepIndex,
Electricity, Electricity,
matrixElectricity, matrixElectricity,
errorTips, errorTips,
@ -1629,6 +1733,9 @@ class IotCarePlan extends Component<any, any> {
errorTipsText, errorTipsText,
isNotEnoughTime, isNotEnoughTime,
isShowNursingSuccess, isShowNursingSuccess,
currentDevice,
isConnectionBlutoot,
isShowTipsSave,
} = this.state; } = this.state;
return ( return (
<Block> <Block>
@ -1677,9 +1784,9 @@ class IotCarePlan extends Component<any, any> {
{ActiveModeItem.openSourceData && ( {ActiveModeItem.openSourceData && (
<PopupStepTips <PopupStepTips
isShow={isShowStepTips} isShow={isShowStepTips}
isLarge={true} isLarge
title={"" + "准备中"} isFirstEntry
confirmButtonText="开始护理" confirmButtonText="知道了"
data={ActiveModeItem.openSourceData} data={ActiveModeItem.openSourceData}
close={this.closeStepTips} close={this.closeStepTips}
/> />
@ -1709,6 +1816,25 @@ class IotCarePlan extends Component<any, any> {
confirm={this.closeErrorTipsText} confirm={this.closeErrorTipsText}
/> />
<PopupAlert
isShow={isShowTipsSave}
isClose
zIndex={10020}
myClassName="level-up"
title="提示"
content={
<Block>
<View></View>
<View></View>
</Block>
}
cancelButtonText="取消"
confirmButtonText="确认"
textAlgin="center"
close={this.closeTipsSave}
confirm={this.confirmTipsSave}
/>
<PopupStatus <PopupStatus
isShow={isShowNursingSuccess} isShow={isShowNursingSuccess}
isClose isClose
@ -1721,6 +1847,17 @@ class IotCarePlan extends Component<any, any> {
/*不需要做处理*/ /*不需要做处理*/
}} }}
/> />
{isConnectShow && (
<ConnectionBluetoot
deviceInfo={currentDevice}
close={this.connectionClose}
isDisconnect={!isConnectionBlutoot}
offlineChange={() => {}}
pairingChange={this.pairingChange}
upgradeFun={() => {}}
/>
)}
</View> </View>
<View> <View>
@ -1806,6 +1943,7 @@ class IotCarePlan extends Component<any, any> {
onEmitStartNurse={this.onStartNurse} onEmitStartNurse={this.onStartNurse}
onEmitSwitchChange={this.onSwitchChange} onEmitSwitchChange={this.onSwitchChange}
onEmitEndPlan={this.onEndPlan} onEmitEndPlan={this.onEndPlan}
onEmitErrorTips={this.onEmitErrorTips}
/> />
</View> </View>
</Block> </Block>

Loading…
Cancel
Save