设备模式对接

master
blak-kong 2 years ago
parent 3350094fd6
commit b9563350a5

@ -145,8 +145,9 @@
transition-property: all; transition-property: all;
transition-duration: 0.5s; transition-duration: 0.5s;
width: 24rpx; width: 24rpx;
height: 100%; height: 20rpx;
margin: 0 auto; margin: 0 auto;
padding-top: 10rpx;
} }
.arrow-rotate { .arrow-rotate {

@ -1,7 +1,15 @@
import classnames from "classnames"; import classnames from "classnames";
import { Component } from "react"; import { Component } from "react";
import { Block, View, Image, Text, Button, PageMeta } from "@tarojs/components"; import {
Block,
View,
Image,
Text,
Button,
PageMeta,
ScrollView,
} from "@tarojs/components";
import { Popup } from "@antmjs/vantui"; import { Popup } from "@antmjs/vantui";
@ -64,6 +72,10 @@ export default class PopupAlert extends Component<any, any> {
e.stopPropagation(); e.stopPropagation();
}; };
onTouchMove = () => {
return true;
};
render() { render() {
let { let {
title, title,
@ -101,6 +113,7 @@ export default class PopupAlert extends Component<any, any> {
className={classnames("common-box", { className={classnames("common-box", {
"common-large": isLarge, "common-large": isLarge,
})} })}
catchMove
> >
{title && ( {title && (
<View <View
@ -112,7 +125,8 @@ export default class PopupAlert extends Component<any, any> {
</View> </View>
)} )}
<View className="common-popup-content-box"> <View className="common-popup-content-box">
<View <ScrollView
scrollY
className={classnames("common-popup-content", { className={classnames("common-popup-content", {
"text-left": textAlgin === "left", "text-left": textAlgin === "left",
"text-right": textAlgin === "right", "text-right": textAlgin === "right",
@ -120,7 +134,7 @@ export default class PopupAlert extends Component<any, any> {
})} })}
> >
{content} {content}
</View> </ScrollView>
</View> </View>
{type === "3" && ( {type === "3" && (

@ -47,7 +47,6 @@ export default class PopupClock extends Component<any, any> {
onConfirm = () => { onConfirm = () => {
let { type } = this.props; let { type } = this.props;
this.props.confirm(); this.props.confirm();
}; };
@ -75,7 +74,7 @@ export default class PopupClock extends Component<any, any> {
show={isShow} show={isShow}
closeOnClickOverlay={false} closeOnClickOverlay={false}
round round
overlayStyle='width: 100vw;padding: 0;' overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop} onClick={this.onClickStop}
> >
{/* <View {/* <View
@ -84,7 +83,7 @@ export default class PopupClock extends Component<any, any> {
></View> */} ></View> */}
{isClose && ( {isClose && (
<View <View
className='at-icon at-icon-close common-close' className="at-icon at-icon-close common-close"
onClick={this.onClose} onClick={this.onClose}
></View> ></View>
)} )}
@ -92,6 +91,7 @@ export default class PopupClock extends Component<any, any> {
className={classnames("common-box", { className={classnames("common-box", {
"common-large": isLarge, "common-large": isLarge,
})} })}
catchMove
> >
{title && ( {title && (
<View <View
@ -102,7 +102,7 @@ export default class PopupClock extends Component<any, any> {
{title} {title}
</View> </View>
)} )}
<View className='common-popup-content-box'> <View className="common-popup-content-box">
<View <View
className={classnames("common-popup-content", { className={classnames("common-popup-content", {
"text-left": textAlgin === "left", "text-left": textAlgin === "left",
@ -115,18 +115,18 @@ export default class PopupClock extends Component<any, any> {
</View> </View>
{type === "3" && ( {type === "3" && (
<View className='type3btn' onClick={this.onConfirm}> <View className="type3btn" onClick={this.onConfirm}>
<Image <Image
className='checked' className="checked"
src={require("../../img/welcome/checked.png")} src={require("../../img/welcome/checked.png")}
></Image> ></Image>
<Text className='text'></Text> <Text className="text"></Text>
</View> </View>
)} )}
{type !== "3" && ( {type !== "3" && (
<View className='alert-popup-btns'> <View className="alert-popup-btns">
<Button className='alert-popup-btn' onClick={this.onConfirm}> <Button className="alert-popup-btn" onClick={this.onConfirm}>
{confirmButtonText} {confirmButtonText}
</Button> </Button>
</View> </View>

@ -11,7 +11,6 @@ import "./popup.less";
* isLarge * isLarge
* isShow * isShow
* isClose * isClose
* type 1
* title * title
* content * content
* cancelButtonText * cancelButtonText
@ -70,7 +69,6 @@ export default class PopupConfirm extends Component<any, any> {
isShow, isShow,
isClose, isClose,
isLarge, isLarge,
type,
} = this.props; } = this.props;
return ( return (
<Block> <Block>
@ -94,6 +92,7 @@ export default class PopupConfirm extends Component<any, any> {
className={classnames("common-box", { className={classnames("common-box", {
"common-large": isLarge, "common-large": isLarge,
})} })}
catchMove
> >
{title && ( {title && (
<View <View

@ -63,7 +63,7 @@ export default class PopupCountdown extends Component<any, any> {
onClick={this.onClose} onClick={this.onClose}
></View> ></View>
)} )}
<View className={classnames("common-box", "countdown-box")}> <View className={classnames("common-box", "countdown-box")} catchMove>
<View <View
className={classnames("common-popup-title", "countdown-title")} className={classnames("common-popup-title", "countdown-title")}
> >

@ -85,6 +85,7 @@ export default class PopupDrawer extends Component<any, any> {
"common-big-large" "common-big-large"
)} )}
style="margin: auto;" style="margin: auto;"
catchMove
> >
<View <View
className={classnames("common-popup-title", "drawer-popup-title")} className={classnames("common-popup-title", "drawer-popup-title")}

@ -115,7 +115,7 @@ export default class PopupPrivacy extends Component<any, any> {
></View> ></View>
)} )}
<View className={classnames("common-box", "common-large")}> <View className={classnames("common-box", "common-large")} catchMove>
<View className="common-popup-title"></View> <View className="common-popup-title"></View>
<View className="common-popup-content-box"> <View className="common-popup-content-box">
<View className="common-popup-content"> <View className="common-popup-content">

@ -781,80 +781,82 @@ class Index extends Component<any, any> {
return ( return (
<Block> <Block>
<PopupAlert <View catchMove>
isShow={isNotRegister} <PopupAlert
isClose={true} isShow={isNotRegister}
title="提示" isClose={true}
content="暂未授权注册,请点击注册" title="提示"
confirmButtonText="确定" content="暂未授权注册,请点击注册"
textAlgin="center" confirmButtonText="确定"
type="1" textAlgin="center"
close={this.closeAlert} type="1"
confirm={this.closeAlert} close={this.closeAlert}
/> confirm={this.closeAlert}
<PopupAlert />
isShow={isDev} <PopupAlert
title="提示" isShow={isDev}
content="页面正在开发中" title="提示"
confirmButtonText="确定" content="页面正在开发中"
textAlgin="center" confirmButtonText="确定"
close={this.closeDev} textAlgin="center"
confirm={this.closeDev} close={this.closeDev}
/> confirm={this.closeDev}
<PopupPrivacy />
isShow={isShowPrivacyPopup} <PopupPrivacy
closePrivacy={this.closePrivacy} isShow={isShowPrivacyPopup}
/> closePrivacy={this.closePrivacy}
/>
<PopupBinding <PopupBinding
type={instrumentInfo.bindingStatus} type={instrumentInfo.bindingStatus}
isShow={isVisibleBinding} isShow={isVisibleBinding}
isRegisterBoolean={isRegisterBoolean} isRegisterBoolean={isRegisterBoolean}
isExchangeBinding={isExchangeBinding} isExchangeBinding={isExchangeBinding}
data={instrumentInfo} data={instrumentInfo}
close={this.closeBinding} close={this.closeBinding}
confirm={this.confirmBinding} confirm={this.confirmBinding}
/> />
<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>
<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}
></PopupAlert> ></PopupAlert>
{/* <PopupPrivacyTest {/* <PopupPrivacyTest
closePrivacy={this.closePrivacy.bind(this)} closePrivacy={this.closePrivacy.bind(this)}
initData={this.initData.bind(this)} initData={this.initData.bind(this)}
></PopupPrivacyTest> */} ></PopupPrivacyTest> */}
<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}
/> />
</View>
{isConnectShow && ( {isConnectShow && (
<ConnectionBluetoot <ConnectionBluetoot

@ -359,51 +359,53 @@ class IntegralList extends Component<any, any> {
} = this.state; } = this.state;
return ( return (
<Block> <Block>
<PopupAlert <View catchMove>
myClassName="integral" <PopupAlert
isLarge={true} myClassName="integral"
isClose={true} isLarge={true}
isShow={isIntegral} isClose={true}
title="积分规则" isShow={isIntegral}
content={<RichText nodes={nodes} />} title="积分规则"
confirmButtonText="我知道了" content={<RichText nodes={nodes} />}
textAlgin="center" confirmButtonText="我知道了"
close={this.integralPopupClose} textAlgin="center"
confirm={this.integralPopupClose} close={this.integralPopupClose}
/> confirm={this.integralPopupClose}
<PopupAlert />
myClassName="officialAccount" <PopupAlert
isLarge={true} myClassName="officialAccount"
isClose={true} isLarge={true}
isShow={isOfficialAccount} isClose={true}
title="过期积分提醒" isShow={isOfficialAccount}
type="3" title="过期积分提醒"
content={ type="3"
// <View style={{ height: "700rpx" }}> // 删除测试阶段标签后需改回700rpx content={
<View style={{ height: "750rpx" }}> // <View style={{ height: "700rpx" }}> // 删除测试阶段标签后需改回700rpx
<Image <View style={{ height: "750rpx" }}>
style={{ <Image
width: "100%", style={{
height: "600rpx", width: "100%",
// backgroundColor: "#666", height: "600rpx",
}} // backgroundColor: "#666",
showMenuByLongpress={true} // 长按识别二维码 }}
src={require("../../img/qrcode-test.jpg")} showMenuByLongpress={true} // 长按识别二维码
mode="aspectFit" src={require("../../img/qrcode-test.jpg")}
/> mode="aspectFit"
<View style={{ marginTop: "20rpx" }}> />
<View style={{ marginTop: "20rpx" }}>
</View>
<View style={{ marginTop: "10rpx", color: "#666" }}> </View>
(广) <View style={{ marginTop: "10rpx", color: "#666" }}>
(广)
</View>
</View> </View>
</View> }
} confirmButtonText="我知道了"
confirmButtonText="我知道了" textAlgin="center"
textAlgin="center" close={this.officialPopupClose}
close={this.officialPopupClose} confirm={this.officialPopupConfirm}
confirm={this.officialPopupConfirm} />
/> </View>
<Navbar titleSlot="我的积分" isBack={true} /> <Navbar titleSlot="我的积分" isBack={true} />

@ -49,25 +49,25 @@ function Index({
</Block> </Block>
)} )}
{isShowNurse && ( {isShowNurse && (
<View className="switch-btn-box" onClick={onSwitchChange}> <View className="switch-btn-box">
<View className="btn-item border-right"> <View className="btn-item border-right" onClick={onSwitchChange}>
{isStopNurse ? ( {isStopNurse ? (
<Block> <Block>
<Image <Image
className="btn-icon" className="btn-icon"
src={require("../../../../img/iot/pause_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>
<Image <Image
className="btn-icon" className="btn-icon"
src={require("../../../../img/iot/start_nurse.png")} src={require("../../../../img/iot/pause_nurse.png")}
mode="aspectFill" mode="aspectFill"
/> />
<Text className="btn-text"></Text> <Text className="btn-text"></Text>
</Block> </Block>
)} )}
</View> </View>

@ -105,6 +105,7 @@ function Index({
</View> </View>
); );
})} })}
<View style="width:120rpx;min-width:120rpx;height:40rpx;display:flex"></View>
</View> </View>
</ScrollView> </ScrollView>
)} )}

@ -21,6 +21,7 @@ import { connect } from "react-redux";
import Navbar from "@/components/navbar/navbar"; import Navbar from "@/components/navbar/navbar";
import PopupCountdown from "@/components/popup/popup-countdown"; import PopupCountdown from "@/components/popup/popup-countdown";
import PopupStepTips from "@/components/popup/popup-step-tips"; import PopupStepTips from "@/components/popup/popup-step-tips";
import PopupConfirm from "@/components/popup/popup-confirm";
/* 公共组件 END */ /* 公共组件 END */
/* 本页组件 */ /* 本页组件 */
@ -56,12 +57,13 @@ import commandMap from "@/utils/commandMap";
const deviceToolKitInstanceWE100 = new DeviceToolKitWE100("WE100", "M01"); const deviceToolKitInstanceWE100 = new DeviceToolKitWE100("WE100", "M01");
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200"); const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200");
let CountdownTimer: any = null;
let timer: any = null; let timer: any = null;
let checkVersionTimeout: any = null; let checkVersionTimeout: any = null;
let showTipsTimer: any = null; let showTipsTimer: any = null;
let loadingTipsTimer: any = null; // 蓝牙连接提示 let loadingTipsTimer: any = null; // 蓝牙连接提示
let switchModeStatus = "free"; // 用于标记是否在切换模式中, free: 空闲, switching: 切换中 let switchModeStatus = "free"; // 用于标记是否在切换模式中, free: 空闲, switching: 切换中
//时间校准频率,每多少秒校准一次 // 设备运行时间校准频率,每多少秒校准一次
const TIME_CALIBRATION_FREQUENCY = 5; const TIME_CALIBRATION_FREQUENCY = 5;
// 模式类型 // 模式类型
@ -127,8 +129,8 @@ const WORK_MODE_TYPE = {
}; };
const MODE_WORKING_ENUM = { const MODE_WORKING_ENUM = {
STANDBY: "standby", STANDBY: "standby", // 待命
WORKING: "working", WORKING: "working", // 工作
PAUSE: "pause", PAUSE: "pause",
END: "end", END: "end",
}; };
@ -161,7 +163,7 @@ class IotCarePlan extends Component<any, any> {
super(props); super(props);
this.state = { this.state = {
name: "iotCarePlan", name: "iotCarePlan",
title: "美容仪名字", title: "美容仪名字", // 页面标题
instrument: "WE200", instrument: "WE200",
/** 连接设备 */ /** 连接设备 */
@ -170,10 +172,12 @@ class IotCarePlan extends Component<any, any> {
basicModeList: [], //模式列表 basicModeList: [], //模式列表
modelActiveIndex: 0, //模式下标 modelActiveIndex: 0, //模式下标
sliderProgress: 22, sliderProgress: 22,
isStandStatus: false, //支架开启状态(支架就是舱体) isStandStatus: false, // 支架开启状态(支架就是舱体)
workStatus: "", //工作状态 facialMaskConnectStatus: 0, // 面膜?暂时认为是面罩连接状态 0未连接 1已连接
Electricity: 0, //fr200电量 workStatus: "", // 工作状态
matrixElectricity: 0, //matrix电量 Electricity: 0, // WL200电量
matrixElectricity: 0, // matrix电量
workMode: "", //当前模式 workMode: "", //当前模式
showCombinationModeDialog: false, // 组合模式弹窗 showCombinationModeDialog: false, // 组合模式弹窗
combinationModeList: [], // 可选的组合模式列表 combinationModeList: [], // 可选的组合模式列表
@ -183,22 +187,17 @@ class IotCarePlan extends Component<any, any> {
originCombinationModeInfo: {}, // 原始组合模式缓存的信息 originCombinationModeInfo: {}, // 原始组合模式缓存的信息
isCurrentModeCombination: false, // 当前模式是否是组合模式 isCurrentModeCombination: false, // 当前模式是否是组合模式
isSendModeCombination: false, // 当前是否在发送组合模式 isSendModeCombination: false, // 当前是否在发送组合模式
gear: { gear: 1 }, gear: { gear: 1 },
currentShowDialog: "", currentShowDialog: "",
// countdown: 3, // 倒计时 // countdown: 3, // 倒计时
step: 1, // 1:选择模式并播放视频, 2:护理中 step: 1, // 1:选择模式并播放视频, 2:护理中
facialMaskConnectStatus: 0, // 面膜连接状态 isCheckedMaskVersion: false, // 是否检查过固件版本了
checkedMaskVersion: false, //是否检查过固件版本了 isAskedOta: false, // 询问过用户是否需要OTA
askedOta: false, //询问过用户是否需要OTA
showVideoPlayBtn: true, // 视频播放按钮 showVideoPlayBtn: true, // 视频播放按钮
duration: 0, // 视频总时长 duration: 0, // 视频总时长
hadShowBreakTips: false, // 是否展示过支架断开提示 hadShowBreakTips: false, // 是否展示过支架断开提示
popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗 popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗
safeAreaBottom: 0,
video_guide: "", // 指导视频
wl200CustomMode: [], // wl200所有的自定义模式
joinModeId: 0,
todayMode: 0, // 今日场景id
customModeData: { customModeData: {
hadCustom: false, hadCustom: false,
hadSetCustom: false, // 是否设置过 -- 代码逻辑使用 hadSetCustom: false, // 是否设置过 -- 代码逻辑使用
@ -207,8 +206,6 @@ class IotCarePlan extends Component<any, any> {
/** 连接设备 End */ /** 连接设备 End */
// isMuted: false, // 视频是否静音
isMusicPlay: false, // 声音播放状态
isShowStepTips: false, // 是否显示介绍步骤弹窗 isShowStepTips: false, // 是否显示介绍步骤弹窗
isConnectionBlutoot: false, // 是否已连接蓝牙 isConnectionBlutoot: false, // 是否已连接蓝牙
isShowNurse: false, // 是否开始并显示护理 isShowNurse: false, // 是否开始并显示护理
@ -225,11 +222,10 @@ class IotCarePlan extends Component<any, any> {
// 倒计时 // 倒计时
isShowCountdown: false, // 倒计时弹窗 isShowCountdown: false, // 倒计时弹窗
countdown: 6, countdown: 3,
// startSettingCountDown: false, // 是否开始倒计时
// 音乐 // 是否结束护理
// innerAudioContext: null, isEndCarePlan: false,
// 最后执行步骤位置 // 最后执行步骤位置
endPlace: "", endPlace: "",
@ -271,8 +267,17 @@ class IotCarePlan extends Component<any, any> {
} }
} }
// 开发者工具
const platform = Taro.getSystemInfoSync().platform;
//开发者工具
if (platform !== "devtools") {
// 初始化蓝牙
this.init();
}
// 初始化蓝牙 // 初始化蓝牙
this.init(); // this.init();
} }
async init() { async init() {
@ -293,7 +298,7 @@ class IotCarePlan extends Component<any, any> {
Taro.onBLEConnectionStateChange(this.listener); Taro.onBLEConnectionStateChange(this.listener);
await this.notifyBLECharacteristicValueChange(); await this.notifyBLECharacteristicValueChange();
this.handleWorkStatus(null, MODE_WORKING_ENUM.STANDBY); this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
} }
listener = (res) => { listener = (res) => {
console.log("listener res", res); console.log("listener res", res);
@ -335,11 +340,6 @@ class IotCarePlan extends Component<any, any> {
} }
}; };
changeMusicStatus = () => {
let { isMusicPlay } = this.state;
this.setState({ isMusicPlay: !isMusicPlay });
};
/** 开始护理按钮:点击开始,页面进行到下一步 */ /** 开始护理按钮:点击开始,页面进行到下一步 */
onStartNurse = async () => { onStartNurse = async () => {
this.stepNext(); this.stepNext();
@ -355,17 +355,47 @@ class IotCarePlan extends Component<any, any> {
onSwitchChange = async () => { onSwitchChange = async () => {
// todo // todo
let { isStopNurse } = this.state; let { isStopNurse } = this.state;
let switchStatus = !isStopNurse; if (isStopNurse) {
if (switchStatus) {
// 开始光照逻辑 // 开始光照逻辑
this.showCountdownFun(3, () => {});
this.handleWorkStatus(false, MODE_WORKING_ENUM.WORKING);
} else { } else {
// 暂停光照逻辑 // 暂停光照逻辑
this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE);
} }
this.setState({ isStopNurse: switchStatus }); this.setState({
}; isStopNurse: !isStopNurse,
onEndPlan = async () => { });
// todo
}; };
/**
*
* param
* callback
*/
showCountdownFun(count = 3, callback: any = null) {
this.setState({
countdown: count,
});
setTimeout(() => {
clearInterval(CountdownTimer);
this.setState({
isShowCountdown: true,
});
CountdownTimer = setInterval(() => {
if (this.state.countdown === 0) {
clearInterval(CountdownTimer);
this.setState({
isShowCountdown: false,
});
if (callback) callback();
} else {
this.setState({
countdown: this.state.countdown - 1,
});
}
}, 1000);
}, 0);
}
modeCurrentFun = async (data) => { modeCurrentFun = async (data) => {
console.log("modeCurrentFun", data); console.log("modeCurrentFun", data);
@ -376,8 +406,15 @@ class IotCarePlan extends Component<any, any> {
// //0未定义全部 1面罩模式 2舱体模式 3医美术后 // //0未定义全部 1面罩模式 2舱体模式 3医美术后
let modeArray = ["all", "visor", "cabin", "yimeish"]; let modeArray = ["all", "visor", "cabin", "yimeish"];
let modeClass = this.state.ActiveModeItem.modeClass; let modeClass = this.state.ActiveModeItem.modeClass;
this.setState({ ModeType: modeArray[modeClass] }); this.setState({
this.setState({ isShowNurse: true }); ModeType: modeArray[modeClass],
isShowNurse: true,
isStopNurse: true,
isStandStatus: this.state.ActiveModeItem.isCabinMode === 1,
workStatus: "pause",
});
this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
}; };
closeStepTips = (data) => { closeStepTips = (data) => {
@ -393,12 +430,12 @@ class IotCarePlan extends Component<any, any> {
// 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。 // 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。
case "SendMatchCode": case "SendMatchCode":
if (jsonStatus.matchedSuccess) { if (jsonStatus.matchedSuccess) {
// msg('配对成功') console.log("设备配对成功");
console.log("配对成功");
// log.info(commandMap.WL200Command, "配对成功"); // log.info(commandMap.WL200Command, "配对成功");
} }
break; break;
//附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了
// 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了
case "BleStatusSync": case "BleStatusSync":
switch (jsonStatus.connectMessage?.deviceName) { switch (jsonStatus.connectMessage?.deviceName) {
case "WL200": case "WL200":
@ -409,50 +446,57 @@ class IotCarePlan extends Component<any, any> {
!this.state.customModeData.setCustomSuc && !this.state.customModeData.setCustomSuc &&
!this.state.customModeData.hadSetCustom !this.state.customModeData.hadSetCustom
) { ) {
// this.setCustomMaskData(); this.setCustomMaskData();
}
// 附属设备连接成功,如何区分是哪个设备?
this.setState({
facialMaskConnectStatus: 1, // 面罩已连接
});
deviceToolKitInstance = deviceToolKitInstanceWL200;
console.log(
"检查版本isCheckedMaskVersion",
this.state.isCheckedMaskVersion
);
if (!this.state.isCheckedMaskVersion) {
this.checkVersion();
} }
// that.setData({
// facialMaskConnectStatus: 1,
// });
// this.deviceToolKitInstance = deviceToolKitInstanceWL200;
// console.log(
// "checkedMaskVersion",
// this.data.checkedMaskVersion
// );
// if (!this.data.checkedMaskVersion) {
// this.checkVersion();
// }
} else { } else {
// WL200连接失败
// deviceToolKitInstance = deviceToolKitInstanceWE100; // deviceToolKitInstance = deviceToolKitInstanceWE100;
// // TODO 护理中(step==2)时, 如果断开, 可能需要暂停 // // TODO 护理中(step==2)时, 如果断开, 可能需要暂停
// that.setData({ this.setState({
// facialMaskConnectStatus: 0, facialMaskConnectStatus: 0,
// }); });
} }
break; break;
// 是否附属设备是否连接支架
case "Stand": case "Stand":
// that.setData({ if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
// isStandStatus: this.setState({
// jsonStatus.connectMessage?.connectType == "CONNECTED", isStandStatus: true,
// }); });
}
break; break;
default: default:
break; break;
} }
break; break;
//小程序主动问主机,现在链接了哪些附属设备,这时候主机给小程序的回复消息 //小程序主动问主机,现在链接了哪些附属设备,这时候主机给小程序的回复消息
case "QueryMatchStatus": case "QueryMatchStatus":
const isStandDevice = const isStandDevice =
jsonStatus?.subDeviceList?.includes("Stand") || false; jsonStatus?.subDeviceList?.includes("Stand") || false;
const isConnectedMask = const isConnectedMask =
jsonStatus?.subDeviceList?.includes("WL200") || false; jsonStatus?.subDeviceList?.includes("WL200") || false;
deviceToolKitInstance = isConnectedMask deviceToolKitInstance = isConnectedMask
? deviceToolKitInstanceWL200 ? deviceToolKitInstanceWL200
: deviceToolKitInstanceWE100; : deviceToolKitInstanceWE100;
console.log(isConnectedMask, "更改成功deviceToolKitInstance");
if (!this.state.checkedMaskVersion && isConnectedMask) { console.log("连接and更改成功 deviceToolKitInstance", isConnectedMask);
this.checkVersion(); if (!this.state.isCheckedMaskVersion && isConnectedMask) {
this.checkVersion(); // 检查版本
} }
console.log("支架是否链接", isStandDevice); console.log("支架是否链接", isStandDevice);
console.log("面罩是否链接", isConnectedMask); console.log("面罩是否链接", isConnectedMask);
@ -469,7 +513,7 @@ class IotCarePlan extends Component<any, any> {
// that.standVideoContext.seek(0); // that.standVideoContext.seek(0);
// // that.showTips('检测到支架未连接成功,请确认面罩开机后与支架连接,并接通支架电源'); // // that.showTips('检测到支架未连接成功,请确认面罩开机后与支架连接,并接通支架电源');
// that.showTips( // that.showTips(
// `检测到${that.data.deviceChineseName.WL200Stand}未连接成功,请确认面罩开机后与${that.data.deviceChineseName.WL200Stand}连接,并接通${that.data.deviceChineseName.WL200Stand}电源` // `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源`
// ); // );
// 连上面罩后, 设置自定义模式 -- 不在这里设置自定义模式 // 连上面罩后, 设置自定义模式 -- 不在这里设置自定义模式
@ -548,25 +592,26 @@ class IotCarePlan extends Component<any, any> {
) { ) {
// 发送启动指令 // 发送启动指令
this.startCombinationMode(); this.startCombinationMode();
const totalTime = this.state.combinationList.reduce(
(total, item) => { // const totalTime = this.state.combinationList.reduce(
return total + minSecToS(item.time); // (total, item) => {
}, // return total + minSecToS(item.time);
0 // },
); // 0
// );
// 设备启动后小程序操作 // 设备启动后小程序操作
this.setState({ // this.setState({
showCombinationModeDialog: false, // showCombinationModeDialog: false,
combinationModeInfo: { // combinationModeInfo: {
time: s_to_hs(totalTime), // time: s_to_hs(totalTime),
seconds: totalTime, // seconds: totalTime,
}, // },
modelActiveIndex: -1, // modelActiveIndex: -1,
currentTime: s_to_hs(totalTime), // currentTime: s_to_hs(totalTime),
isCurrentModeCombination: true, // isCurrentModeCombination: true,
isSendModeCombination: false, // isSendModeCombination: false,
}); // });
setTimeout(() => { setTimeout(() => {
console.log("currentTime", this.state.currentTime); console.log("currentTime", this.state.currentTime);
}); });
@ -723,7 +768,7 @@ class IotCarePlan extends Component<any, any> {
checkVersion = () => { checkVersion = () => {
this.sendCheckVersion(); this.sendCheckVersion();
this.setState({ this.setState({
checkedMaskVersion: true, isCheckedMaskVersion: true,
}); });
if (checkVersionTimeout) clearTimeout(checkVersionTimeout); if (checkVersionTimeout) clearTimeout(checkVersionTimeout);
checkVersionTimeout = setTimeout(() => { checkVersionTimeout = setTimeout(() => {
@ -758,7 +803,7 @@ class IotCarePlan extends Component<any, any> {
); );
if (isNeedToUpdateBl) { if (isNeedToUpdateBl) {
this.setState({ this.setState({
askedOta: true, isAskedOta: true,
// currentShowDialog: 'offlineDialog', // currentShowDialog: 'offlineDialog',
}); });
// this.confirmOta(); // this.confirmOta();
@ -791,18 +836,17 @@ class IotCarePlan extends Component<any, any> {
} }
}; };
// 待完善以后更新页面状态的方法在这里执行setData // 渲染页面时间状态
renderDeviceStatus = { renderDeviceStatus = {
renderWorkTime() { renderWorkTime: () => {
// const that = this;
const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData; const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData;
const { ActiveModeItem, currentTime } = this.state; const { ActiveModeItem, currentTime } = this.state;
const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds; const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds;
console.log("仪器上报的已经运行的总秒数", totalTime); console.log("仪器上报的已经运行的总秒数", totalTime);
// console.log('时间校准频率默认5秒一次',TIME_CALIBRATION_FREQUENCY) console.log("时间校准频率默认5秒一次", TIME_CALIBRATION_FREQUENCY);
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准 //对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
const currentScene = ActiveModeItem; // 获取当前的场景 const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = minSecToS(currentScene.time); // 场景时间 let sceneTime = minSecToS(currentScene.modeTime); // 场景时间
const timeRemaining = sceneTime - minSecToS(currentTime); // 小程序上已运行的总秒数 const timeRemaining = sceneTime - minSecToS(currentTime); // 小程序上已运行的总秒数
if ( if (
@ -840,7 +884,10 @@ class IotCarePlan extends Component<any, any> {
} }
} }
// 设备上报不同状态 /**
*
* params
*/
judgementWorkStatus(nWorkStatus, nWorkMode, jsonStatus) { judgementWorkStatus(nWorkStatus, nWorkMode, jsonStatus) {
const { const {
workStatus, workStatus,
@ -852,7 +899,6 @@ class IotCarePlan extends Component<any, any> {
} = this.state; } = this.state;
const opts: any = {}; const opts: any = {};
// ActiveModeItem // ActiveModeItem
const modeItem = ActiveModeItem;
let nowModeItem; let nowModeItem;
if (nWorkMode) { if (nWorkMode) {
const nowModeType = WORK_MODE_TYPE[nWorkMode]; const nowModeType = WORK_MODE_TYPE[nWorkMode];
@ -890,18 +936,13 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
hadShowBreakTips: false, hadShowBreakTips: false,
}); });
if (step != 2 && !modeItem.isStandMode) { if (step != 2 && !ActiveModeItem.isCabinMode) {
opts.step = 2; opts.step = 2;
this.setState({ this.setState({
title: "正在护理", title: "正在护理",
isStopNurse: false, isStopNurse: false,
}); });
// Taro.setNavigationBarTitle({ } else if (step != 2 && ActiveModeItem.isCabinMode) {
// title: "正在护理",
// });
// 处理音乐
this.musicStatusChange();
} else if (step != 2 && modeItem.isStandMode) {
opts.step = 2; opts.step = 2;
// this.setState({ // this.setState({
// title: "正在护理", // title: "正在护理",
@ -932,13 +973,7 @@ class IotCarePlan extends Component<any, any> {
title: "正在护理", title: "正在护理",
isStopNurse: false, isStopNurse: false,
}); });
// 处理音乐
// this.musicStatusChange();
} }
// else if (modeItem?.isStandMode) {
// 支架模式也使用gif图, 不需要播放视频了, 所以注释
// that.onPlayTap();
// }
this.setState({ this.setState({
isShowCountdown: false, isShowCountdown: false,
@ -949,7 +984,7 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
isShowCountdown: false, isShowCountdown: false,
}); });
if (modeItem.isStandMode) { if (ActiveModeItem.isCabinMode) {
// this.onPauseTap(); // this.onPauseTap();
this.setState({ this.setState({
title: "暂停护理", title: "暂停护理",
@ -967,7 +1002,7 @@ class IotCarePlan extends Component<any, any> {
// 获取仪器运行时间,更新currentTime, 判断仪器返回时间正常的情况下 // 获取仪器运行时间,更新currentTime, 判断仪器返回时间正常的情况下
const { totalWorkingSeconds, totalWorkingMinutes } = jsonStatus; const { totalWorkingSeconds, totalWorkingMinutes } = jsonStatus;
if (totalWorkingSeconds != 0 || totalWorkingMinutes != 0) { if (totalWorkingSeconds != 0 || totalWorkingMinutes != 0) {
const sceneTime = minSecToS(modeItem.currentTime); // 模式的总时长 const sceneTime = minSecToS(ActiveModeItem.modeTime); // 模式的总时长
const runTime = totalWorkingMinutes * 60 + totalWorkingSeconds; //仪器运行时长 const runTime = totalWorkingMinutes * 60 + totalWorkingSeconds; //仪器运行时长
const timeRemaining = sceneTime - runTime; // 剩余未运行时间 const timeRemaining = sceneTime - runTime; // 剩余未运行时间
this.setState({ this.setState({
@ -975,7 +1010,7 @@ class IotCarePlan extends Component<any, any> {
}); });
} }
this.endnursing(null, true); this.endnursing(null, true);
this.rmWL200NursingHistory(this.state.WL200NursingHistory); // this.rmWL200NursingHistory(this.state.WL200NursingHistory);
}, },
}; };
statusF[nWorkStatus] && statusF[nWorkStatus](); statusF[nWorkStatus] && statusF[nWorkStatus]();
@ -989,34 +1024,34 @@ class IotCarePlan extends Component<any, any> {
* 1. 2. * 1. 2.
* */ * */
saveNurseReport = async (isJump = true, from) => { saveNurseReport = async (isJump = true, from) => {
const { isStandStatus, standInfo, ActiveModeItem, options } = this.state; // const { isStandStatus, standInfo, ActiveModeItem, options } = this.state;
const currentScene = ActiveModeItem; // const currentScene = ActiveModeItem;
let sceneTime = minSecToS(currentScene.time); // let sceneTime = minSecToS(currentScene.time);
const timeRemaining = sceneTime - minSecToS(this.state.currentTime); // const timeRemaining = sceneTime - minSecToS(this.state.currentTime);
const form = { // const form = {
second: timeRemaining, // second: timeRemaining,
screne_id: currentScene.screne_id, // screne_id: currentScene.screne_id,
screne_name: currentScene.screne_name, // screne_name: currentScene.screne_name,
instrument_id: options?.devId, // instrument_id: options?.devId,
report: JSON.stringify({ // report: JSON.stringify({
positionRatio: Math.floor((timeRemaining / sceneTime) * 100), // positionRatio: Math.floor((timeRemaining / sceneTime) * 100),
}), // }),
}; // };
// log.info(commandMap.WL200Command, '保存护理报告saveNurseReport', '来自方法from:' + from, '护理时间timeRemaining:'+timeRemaining); // // log.info(commandMap.WL200Command, '保存护理报告saveNurseReport', '来自方法from:' + from, '护理时间timeRemaining:'+timeRemaining);
console.log("timeRemaining=>", timeRemaining); // console.log("timeRemaining=>", timeRemaining);
console.log("currentScene=>", currentScene); // console.log("currentScene=>", currentScene);
console.log("form=>", form); // console.log("form=>", form);
// const { data } = await UserNursingLogAdd(form) // // const { data } = await UserNursingLogAdd(form)
// // 清除缓存 // // // 清除缓存
// that.rmWL200NursingHistory(that.data.WL200NursingHistory, true); // // that.rmWL200NursingHistory(that.data.WL200NursingHistory, true);
// if (data.code == 200 && isJump) { // // if (data.code == 200 && isJump) {
// that.setData({ // // that.setData({
// showNurseSuccess: true // // showNurseSuccess: true
// }); // // });
// setTimeout(()=>{ // // setTimeout(()=>{
// wx.redirectTo({ url: `/pages/MatrixWL200/pages/nursingRecord/nursingRecord?instrument_id=${options?.devId}&id=${data.data}` }) // // wx.redirectTo({ url: `/pages/MatrixWL200/pages/nursingRecord/nursingRecord?instrument_id=${options?.devId}&id=${data.data}` })
// }, 2000); // // }, 2000);
// } // // }
}; };
/** /**
@ -1048,35 +1083,35 @@ class IotCarePlan extends Component<any, any> {
} }
} }
// 设置自定义模式数据
setCustomModeData() { setCustomModeData() {
const { basicModeList, modelActiveIndex, currentTime } = that.data; // const { ActiveModeItem, currentTime } = this.state;
const modeItem = basicModeList[modelActiveIndex]; // const modeItem = ActiveModeItem;
const group = modeItem.group; // const group = modeItem.group;
if (group.length == 1) return; // 只有1项不用管 // if (group.length == 1) return; // 只有1项不用管
// let inTimeScopeIndex = -1; // 选择的index
let inTimeScopeIndex = -1; // 选择的index // group.forEach((item, index) => {
group.forEach((item, index) => { // let startMinute = item.scope[0];
let startMinute = item.scope[0]; // let endMinute = item.scope[1];
let endMinute = item.scope[1]; // let targetMinute = currentTime.split(":")[0];
let targetMinute = currentTime.split(":")[0]; // let targetSecond = currentTime.split(":")[1];
let targetSecond = currentTime.split(":")[1]; // const isInTime = this.isInTimeScope(
const isInTime = this.isInTimeScope( // startMinute,
startMinute, // endMinute,
endMinute, // targetMinute,
targetMinute, // targetSecond
targetSecond // );
); // if (isInTime) inTimeScopeIndex = index;
if (isInTime) inTimeScopeIndex = index; // });
}); // if (modeItem.timeScopeIndex !== inTimeScopeIndex) {
if (modeItem.timeScopeIndex !== inTimeScopeIndex) { // // this.setState({
// this.setState({ // // [`basicModeList[${modelActiveIndex}].timeScopeIndex`]: inTimeScopeIndex,
// [`basicModeList[${modelActiveIndex}].timeScopeIndex`]: inTimeScopeIndex, // // [`basicModeList[${modelActiveIndex}].desc`]: group[inTimeScopeIndex].desc,
// [`basicModeList[${modelActiveIndex}].desc`]: group[inTimeScopeIndex].desc, // // [`basicModeList[${modelActiveIndex}].technique`]: group[inTimeScopeIndex].technique,
// [`basicModeList[${modelActiveIndex}].technique`]: group[inTimeScopeIndex].technique, // // [`basicModeList[${modelActiveIndex}].pause_img`]: group[inTimeScopeIndex].pause_img,
// [`basicModeList[${modelActiveIndex}].pause_img`]: group[inTimeScopeIndex].pause_img, // // [`basicModeList[${modelActiveIndex}].running_img`]: group[inTimeScopeIndex].running_img,
// [`basicModeList[${modelActiveIndex}].running_img`]: group[inTimeScopeIndex].running_img, // // })
// }) // }
}
} }
isInTimeScope(start, end, targetMinute, targetSecond) { isInTimeScope(start, end, targetMinute, targetSecond) {
const startTime = dayjs().set("minute", start).set("second", 0); const startTime = dayjs().set("minute", start).set("second", 0);
@ -1143,31 +1178,31 @@ class IotCarePlan extends Component<any, any> {
} }
// 工作状态 // 工作状态
handleWorkStatus = (_, workStatus) => { handleWorkStatus = (isBtnClick: boolean, workStatus) => {
const { facialMaskConnectStatus, isStandStatus, ActiveModeItem } = const { facialMaskConnectStatus, isStandStatus, ActiveModeItem } =
this.state; this.state;
const modeItem = ActiveModeItem;
let newWorkStatus = let newWorkStatus =
workStatus || workStatus ||
(this.state.workStatus == MODE_WORKING_ENUM.WORKING (this.state.workStatus == MODE_WORKING_ENUM.WORKING
? "pause" ? "pause"
: "working"); : "working");
if (_ && newWorkStatus == "working") { if (isBtnClick && newWorkStatus == "working") {
if (modeItem.modeClass === 2 && !isStandStatus) { // 舱体模式
if (ActiveModeItem.isCabinMode === 1 && !isStandStatus) {
this.showTips( this.showTips(
`检测到${this.state.deviceChineseName.WL200Stand}未连接成功,请确认面罩开机后与${this.state.deviceChineseName.WL200Stand}连接,并接通${this.state.deviceChineseName.WL200Stand}电源` `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源`
); );
return; return;
} }
if (!modeItem.isStandMode && facialMaskConnectStatus != 1) { // 非舱体模式
if (!ActiveModeItem.isCabinMode && facialMaskConnectStatus != 1) {
this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴"); this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴");
return; return;
} }
} }
const curModeData = ActiveModeItem;
const sendParams = { const sendParams = {
...deviceCommandSamples.pause, ...deviceCommandSamples.pause,
workMode: WORK_MODE_ENGLISH_NAME[curModeData.model_type], workMode: WORK_MODE_Chinese_NAME[ActiveModeItem.modeName], // 使用模式
workStatus: newWorkStatus, workStatus: newWorkStatus,
}; };
const pauseArrayBuffer = deviceToolKitInstance.toBleCommand( const pauseArrayBuffer = deviceToolKitInstance.toBleCommand(
@ -1180,14 +1215,6 @@ class IotCarePlan extends Component<any, any> {
workStatus: newWorkStatus, workStatus: newWorkStatus,
}); });
this.setTimer(); this.setTimer();
// 支架模式, 暂停, 需暂停视频播放
if (newWorkStatus == MODE_WORKING_ENUM.PAUSE && modeItem.isStandMode) {
this.onPauseTap();
}
// 支架模式, 开始播放, 需播放视频
if (newWorkStatus == MODE_WORKING_ENUM.WORKING && modeItem.isStandMode) {
this.onPlayTap();
}
console.info( console.info(
`handleWorkStatus 发送${newWorkStatus}指令成功 参数为 =>`, `handleWorkStatus 发送${newWorkStatus}指令成功 参数为 =>`,
sendParams sendParams
@ -1254,29 +1281,24 @@ class IotCarePlan extends Component<any, any> {
// 如果是强效舒缓,需要判断是否连接支架 // 如果是强效舒缓,需要判断是否连接支架
if (modelActiveItem.isStandMode && !isStandStatus) { if (modelActiveItem.isStandMode && !isStandStatus) {
this.showTips( this.showTips(
`检测到${this.state.deviceChineseName.WL200Stand}未连接成功,请确认面罩开机后与${this.state.deviceChineseName.WL200Stand}连接,并接通${this.state.deviceChineseName.WL200Stand}电源` `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源`
); );
// that.showTips('检测到支架未连接成功,请确认面罩开机后与支架连接,并接通支架电源');
return; return;
} else if (!modelActiveItem.isStandMode && isStandStatus) { } else if (!modelActiveItem.isStandMode && isStandStatus) {
this.showTips( this.showTips(`检测到面罩仍和舱体连接中,请分离后切换`);
`检测到面罩仍和${this.state.deviceChineseName.WL200Stand}连接中,请分离后切换`
);
return; return;
} }
if (modelActiveItem.isCustomMode && !customModeData.setCustomSuc) { if (modelActiveItem.isCustomMode && !customModeData.setCustomSuc) {
this.showTips( this.showTips(`${modelActiveItem.modeName}模式设置失败,请联系小助手`);
`${modelActiveItem.nursing_name}模式设置失败,请联系小助手`
);
return; return;
} }
// 开始执行护理 // 开始执行护理
this.handleWorkStatus(null, MODE_WORKING_ENUM.WORKING); this.handleWorkStatus(false, MODE_WORKING_ENUM.WORKING);
} }
// 结束护理? // 结束护理?
endNurseFun() { endNurseFun() {
// this.handleWorkStatus(null, "end"); // this.handleWorkStatus(false, "end");
setTimeout(() => { setTimeout(() => {
//TODO IOS关闭蓝牙太快导致关机指令没发出去暂时这么解决 //TODO IOS关闭蓝牙太快导致关机指令没发出去暂时这么解决
const isEnough = this.checkTime(); const isEnough = this.checkTime();
@ -1305,23 +1327,6 @@ class IotCarePlan extends Component<any, any> {
}, 500); }, 500);
} }
/**
*
*/
musicStatusChange() {
const { step, ActiveModeItem } = this.state;
const modeItem = ActiveModeItem;
this.setState({
musicStatus: !this.state.musicStatus,
});
// if (step == 2 && !modeItem.isStandMode) {
// if (this.state.musicStatus) {
// this.state.innerAudioContext?.play(); // 播放
// } else {
// this.state.innerAudioContext?.pause(); //暂停
// }
// }
}
// 检查时间是否达标 // 检查时间是否达标
checkTime() { checkTime() {
const { curDeviceInfo, workStatus, ActiveModeItem } = this.state; const { curDeviceInfo, workStatus, ActiveModeItem } = this.state;
@ -1370,12 +1375,12 @@ class IotCarePlan extends Component<any, any> {
// 删除WL200护理历史 // 删除WL200护理历史
rmWL200NursingHistory(WL200NursingHistory, hard = false) { rmWL200NursingHistory(WL200NursingHistory, hard = false) {
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");
} else if (hard) { // } else if (hard) {
Taro.removeStorageSync("WL200NursingHistory"); // Taro.removeStorageSync("WL200NursingHistory");
} // }
} }
//蓝牙断开连接处理 //蓝牙断开连接处理
@ -1440,11 +1445,26 @@ class IotCarePlan extends Component<any, any> {
}, 2000); }, 2000);
} }
/** 结束护理弹窗 */
onEndPlan = async () => {
this.setState({
isEndCarePlan: true,
});
};
confirmEndBtn = () => {
this.cancelEndBtn();
};
cancelEndBtn = () => {
this.setState({
isEndCarePlan: false,
});
};
/** 弹窗 END*/
render() { render() {
let { let {
name, name,
title, title,
isMusicPlay,
isShowStepTips, isShowStepTips,
ModeList, ModeList,
ModeType, ModeType,
@ -1457,46 +1477,46 @@ class IotCarePlan extends Component<any, any> {
ModeStepIndex, ModeStepIndex,
Electricity, Electricity,
errorTips, errorTips,
isEndCarePlan,
} = this.state; } = this.state;
return ( return (
<Block> <Block>
<Navbar titleSlot={title} isBack={true} /> <Navbar titleSlot={title} isBack={true} />
<PopupCountdown isShow={isShowCountdown} countdown={countdown} />
{ActiveModeItem.openSourceData && ( <View catchMove>
<PopupStepTips <PopupCountdown isShow={isShowCountdown} countdown={countdown} />
isShow={isShowStepTips} <PopupConfirm
isLarge={true} isLarge={true}
title={"" + "准备中"} isShow={isEndCarePlan}
confirmButtonText="开始护理" isClose={true}
data={ActiveModeItem.openSourceData} title="提示"
close={this.closeStepTips} content="是否结束护理"
textAlgin="center"
cancelButtonText="取消"
confirmButtonText="确定"
close={this.cancelEndBtn}
confirm={this.confirmEndBtn}
/> />
)} {ActiveModeItem.openSourceData && (
<PopupStepTips
isShow={isShowStepTips}
isLarge={true}
title={"" + "准备中"}
confirmButtonText="开始护理"
data={ActiveModeItem.openSourceData}
close={this.closeStepTips}
/>
)}
</View>
<View> <View>
<View className="iot-main"> <View className="iot-main">
<View className="banner-box"> <View className="banner-box">
<View className="music-btn" onClick={this.changeMusicStatus}>
{isMusicPlay ? (
<Image
className="music-btn_icon"
src={require("../../img/iot/volume_icon.png")}
mode="aspectFill"
/>
) : (
<Image
className="music-btn_icon"
src={require("../../img/iot/mute_icon.png")}
mode="aspectFill"
/>
)}
</View>
<View> <View>
{!isShowNurse && ( {!isShowNurse && (
<Video <Video
className="video-or-image" className="video-or-image"
src={ActiveModeItem.modeVideo} src={ActiveModeItem.modeVideo}
muted={isMusicPlay}
/> />
)} )}
@ -1540,12 +1560,22 @@ class IotCarePlan extends Component<any, any> {
<View className="item"> <View className="item">
<Text>WE200</Text> <Text>WE200</Text>
<View className="value flex aitems"> <View className="value flex aitems">
{Electricity === 5 && (
<Block>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View>
</Block>
)}
{Electricity === 4 && ( {Electricity === 4 && (
<Block> <Block>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 3 && ( {Electricity === 3 && (
@ -1554,6 +1584,7 @@ class IotCarePlan extends Component<any, any> {
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 2 && ( {Electricity === 2 && (
@ -1562,6 +1593,7 @@ class IotCarePlan extends Component<any, any> {
<View className="v1 battery_icon"></View> <View className="v1 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 1 && ( {Electricity === 1 && (
@ -1570,14 +1602,16 @@ class IotCarePlan extends Component<any, any> {
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
{Electricity === 1 && ( {Electricity === 0 && (
<Block> <Block>
<View className="v3 battery_icon"></View> <View className="v3 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View> <View className="v2 battery_icon"></View>
<View className="v2 battery_icon"></View>
</Block> </Block>
)} )}
</View> </View>

@ -205,17 +205,20 @@ class User extends Component<any, any> {
close={this.closeDev} close={this.closeDev}
confirm={this.closeDev} confirm={this.closeDev}
/> */} /> */}
<PopupAlert <View catchMove>
isShow={isNotRegister} <PopupAlert
isClose={true} isShow={isNotRegister}
title="提示" isClose={true}
content="暂未授权注册,请点击注册" title="提示"
confirmButtonText="确定" content="暂未授权注册,请点击注册"
textAlgin="center" confirmButtonText="确定"
type="1" textAlgin="center"
close={this.closeRegisterAlert} type="1"
confirm={this.closeRegisterAlert} close={this.closeRegisterAlert}
/> confirm={this.closeRegisterAlert}
/>
</View>
<Navbar transparent={true}></Navbar> <Navbar transparent={true}></Navbar>
<View className="user_bg_card"> <View className="user_bg_card">
<Image <Image
@ -400,28 +403,29 @@ class User extends Component<any, any> {
</View> </View>
</View> </View>
<PopupDrawer <View catchMove>
isShow={isShowCustomerService} <PopupDrawer
isClose={true} isShow={isShowCustomerService}
title="留言反馈" isClose={true}
content={ title="留言反馈"
<Block> content={
<Textarea <Block>
className="service-textarea" <Textarea
maxlength={100} className="service-textarea"
showCount={true} maxlength={100}
placeholder="请在此处写下您的意见与反馈" showCount={true}
placeholderStyle="font-weight: 400;font-size:28rpx;" placeholder="请在此处写下您的意见与反馈"
onInput={this.onInputTextarea} placeholderStyle="font-weight: 400;font-size:28rpx;"
></Textarea> onInput={this.onInputTextarea}
</Block> ></Textarea>
} </Block>
confirmButtonText="提交" }
textAlgin="left" confirmButtonText="提交"
close={this.closeCustomerService} textAlgin="left"
confirm={this.confirmCustomerService} close={this.closeCustomerService}
/> confirm={this.confirmCustomerService}
{/* <Toast_ /> */} />
</View>
</Block> </Block>
); );
} }

@ -12,6 +12,12 @@ const deviceInfoReducer = createSlice({
characteristicsuuid1: "", characteristicsuuid1: "",
characteristicId: "", characteristicId: "",
}, },
OtaDeviceTypeEnum: {
WL200: "WL200",
WE100: "WE100",
FACIALMASK: "FacialMask",
STAND: "Stand",
},
}, },
reducers: { reducers: {
setDeviceInfo(state, { payload }) { setDeviceInfo(state, { payload }) {

@ -616,6 +616,7 @@ const getTimeCode = () => {
return value; return value;
}; };
/** /**
* 是否需要版本升级
* @param currentVersionNo * @param currentVersionNo
* @param latestVersionNo * @param latestVersionNo
* @returns needToUpdate * @returns needToUpdate

Loading…
Cancel
Save