fix:bug修复,仪器断开和重连bug修复

master
blak-kong 2 years ago
parent bc9b6bc487
commit 64302d397e

@ -138,6 +138,9 @@ class Index extends Component<any, any> {
isShowVersionUpgrading: false, // 升级中
isShowVersionUpgradFinish: false, // 升级完成:升级内容公告
versionUpgradFinishNodes: "", // 公告内容
// 设备是否重连弹窗
isShowReConnectDeviceRecordWL200: false,
};
}
@ -588,7 +591,6 @@ class Index extends Component<any, any> {
// 跳转仪器介绍页
goNursing = (item) => {
console.log("goNursing", item);
setStorageSync("instrument_detail", JSON.stringify(item));
this.setState({ connectInstrument: item });
setTimeout(() => this.bindBlockLeft());
@ -729,6 +731,35 @@ class Index extends Component<any, any> {
};
/** iot版本升级 END */
/**
* @name WL200
* @description
*/
initDeviceNursingHistory = async () => {
let WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
if (WL200NursingHistory) {
this.setState({
isShowReConnectDeviceRecordWL200: true,
});
}
};
closeReConnectDeviceRecordWL200 = () => {
Taro.removeStorageSync("WL200NursingHistory");
this.setState({
isShowReConnectDeviceRecordWL200: false,
});
};
confirmReConnectDeviceRecordWL200 = () => {
let WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
console.log("WL200NursingHistory", WL200NursingHistory);
this.setState({
isShowReConnectDeviceRecordWL200: false,
});
// this.goNursing()
};
render() {
let {
calendarComplete,
@ -752,7 +783,6 @@ class Index extends Component<any, any> {
instrumentInfo,
instrumentList,
showEquipment,
bindEquipment,
// 升级弹窗
isShowUpdateVersionTip,
@ -763,30 +793,31 @@ class Index extends Component<any, any> {
// 蓝牙连接
isConnectShow,
connectInstrument,
// 设备存在记录,是否重连
isShowReConnectDeviceRecordWL200,
} = this.state;
return (
<Block>
<View catchMove>
{/* <PopupConfirm
isShow={isShowBindConfirm}
isClose
zIndex={10020}
myClassName="level-up"
title="提示"
content={
<Block>
<View>{}</View>
<View>{}</View>
<View>{}</View>
</Block>
}
cancelButtonText="暂不绑定"
confirmButtonText="确认"
textAlgin="center"
close={this.closeBindConfirm}
confirm={this.confirmBindConfirm}
/> */}
<PopupConfirm
isShow={isShowReConnectDeviceRecordWL200}
isClose
title="提示"
zIndex={10020}
myClassName="level-up"
content={
<Block>
<View></View>
<View></View>
</Block>
}
cancelButtonText="暂不绑定"
confirmButtonText="确认"
textAlgin="center"
close={this.closeReConnectDeviceRecordWL200}
confirm={this.confirmReConnectDeviceRecordWL200}
/>
<PopupAlert
isShow={isBindingError}
title="提示"

@ -127,7 +127,10 @@ class Initiate extends Component<any, any> {
}, 300);
} else {
msg("请求失败,尝试重新请求");
this.WCUserLogin();
// 防止快速请求
setTimeout(() => {
this.WCUserLogin();
}, 2000);
}
}

@ -0,0 +1,76 @@
.iot-footer {
position: fixed;
bottom: 0;
z-index: 99;
display: flex;
align-items: baseline;
width: 100%;
height: 153rpx;
background: #ffffff;
box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21);
padding-bottom: env(safe-area-inset-bottom);
box-sizing: border-box;
.btn {
width: 690rpx;
height: 90rpx;
background: #000;
border-radius: 45rpx;
color: #fff;
line-height: 90rpx;
text-align: center;
margin: 21rpx 49rpx 42rpx 30rpx;
font-size: 32rpx;
}
.text {
display: flex;
align-items: center;
font-size: 32rpx;
font-weight: bold;
color: #000;
}
.btn-disable {
background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */
color: #fff !important; /* 设置按钮文字颜色为白色 */
border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */
}
.switch-btn-box {
width: 100vw;
display: flex;
align-items: center;
margin-top: 34rpx;
.btn-item {
height: 70rpx;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
.btn-icon {
width: 36rpx;
height: 36rpx;
margin-right: 18rpx;
}
.btn-text {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
}
.border-right {
border-right: 1px solid #ddd;
}
.btn-disable {
color: #fff !important; /* 设置按钮文字颜色为白色 */
border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */
background-color: #fff !important; /* 设置按钮背景颜色为灰色 */
.btn-text {
color: #ccc !important; /* 设置按钮文字颜色为白色 */
border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */
background-color: #fff !important; /* 设置按钮背景颜色为灰色 */
}
}
}
}

@ -42,7 +42,7 @@ function Index({
return (
<Block>
<View className="footer">
<View className="iot-footer">
{!isShowNurse && (
<Block>
{isDisabled ? (

@ -9,7 +9,6 @@ interface Props {
activeModeID: any;
ModeList: any;
ModeType: string; // all visor cabin yimeish
ActiveModeItem: any;
isShowNurse: boolean; // 是否已进入护理详情页
isPop: boolean; // 是否弹窗
onEmit: Function; // 每次点击item回调事件和数据给父组件
@ -20,7 +19,6 @@ function Index({
isPop,
ModeList,
ModeType,
ActiveModeItem,
ModeID,
activeModeID,
onEmit,
@ -30,9 +28,7 @@ function Index({
let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式
let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后
// const [ModeID, setModeID] = useState<any>("mode_" + ActiveModeItem.id);
// const [activeModeID, setactiveModeID] = useState<any>(ActiveModeItem.id);
console.log("ModeType", ModeType);
const yimeishClick = (item) => {
onEmit(item);
};

@ -75,10 +75,10 @@
}
.msg-tips {
position: absolute;
top: 50%;
top: 40%;
left: 0;
right: 0;
transform: translateY(-50%);
transform: translateY(-40%);
display: flex;
align-items: center;
max-width: 635rpx;
@ -121,73 +121,6 @@
}
}
.footer {
position: fixed;
bottom: 0;
z-index: 99;
display: flex;
align-items: baseline;
width: 100%;
height: 153rpx;
background: #ffffff;
box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21);
padding-bottom: env(safe-area-inset-bottom);
box-sizing: border-box;
.btn {
width: 690rpx;
height: 90rpx;
background: #000;
border-radius: 45rpx;
color: #fff;
line-height: 90rpx;
text-align: center;
margin: 21rpx 49rpx 42rpx 30rpx;
font-size: 32rpx;
}
.text {
display: flex;
align-items: center;
font-size: 32rpx;
font-weight: bold;
color: #000;
}
.btn-disable {
background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */
color: #fff !important; /* 设置按钮文字颜色为白色 */
border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */
}
.switch-btn-box {
width: 100vw;
display: flex;
align-items: center;
margin-top: 34rpx;
.btn-item {
height: 70rpx;
display: flex;
flex: 1;
align-items: center;
justify-content: center;
.btn-icon {
width: 36rpx;
height: 36rpx;
margin-right: 18rpx;
}
.btn-text {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
}
.border-right {
border-right: 1px solid #ddd;
}
}
}
.battery_icon {
width: 8rpx;
height: 20rpx;

@ -227,6 +227,7 @@ class IotCarePlan extends Component<any, any> {
Taro.setKeepScreenOn({
keepScreenOn: true,
});
this.getWL200NursingHistory();
this.initData();
}
componentDidMount() {}
@ -339,7 +340,7 @@ class IotCarePlan extends Component<any, any> {
Taro.onBLEConnectionStateChange(this.listener);
await this.notifyBLECharacteristicValueChange();
this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
// this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
}
listener = (res) => {
console.log("listener res", res);
@ -518,43 +519,16 @@ class IotCarePlan extends Component<any, any> {
};
// 弹窗确定切换护理模式
confirmModeSwitchBtn = () => {
let { SwitchActiveModeItem, ActiveModeItem, isStandStatus } = this.state;
let modeArray = ["all", "visor", "cabin", "yimeish"];
// 切换护理模式时,需判断舱体和面罩是否切换
// if (SwitchActiveModeItem.isCabinMode !== ActiveModeItem.isCabinMode) {
// if (SwitchActiveModeItem.isCabinMode === 1) {
// // 判断舱体是否连接成功
// if (!isStandStatus) {
// console.log(
// "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
// );
// this.showTips(
// "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
// );
// // this.openErrorTipsText(
// // "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
// // );
// // return;
// }
// } else {
// // 判断舱体是否断开连接
// if (isStandStatus) {
// console.log("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
// this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
// // this.openErrorTipsText(
// // "检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体"
// // );
// // return;
// }
// }
// }
let { SwitchActiveModeItem } = this.state;
this.cancelModeSwitchBtn();
this.modeCurrentFun(SwitchActiveModeItem);
let modeArray = ["all", "visor", "cabin", "yimeish"];
this.setState({
ModeType: modeArray[SwitchActiveModeItem.modeClass],
});
setTimeout(() => {
this.modeCurrentFun(SwitchActiveModeItem);
this.cancelModeSwitchBtn();
console.log("ModeType", this.state.ModeType);
}, 100);
};
@ -590,15 +564,14 @@ class IotCarePlan extends Component<any, any> {
* @description isCabinMode 0. 1.
*/
onEmitErrorTips = async () => {
let { isStandStatus, ActiveModeItem } = this.state;
if (isStandStatus) {
if (ActiveModeItem.isCabinMode === 0) {
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
} else {
this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
);
}
let { ActiveModeItem } = this.state;
if (ActiveModeItem.isCabinMode === 0) {
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
} else {
this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
);
}
};
@ -650,12 +623,11 @@ class IotCarePlan extends Component<any, any> {
case "WL200":
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
} else {
// 清除时间倒计时定时器
this.setState({
facialMaskConnectStatus: 0, // 蓝牙断开
isFooterBtnDisabled: false, // 蓝牙断开所以不可点击
});
// 断开连接直接暂停
// 断开连接直接暂停:会自动暂停定时器
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
ActiveModeItem?.modeType
@ -697,6 +669,10 @@ class IotCarePlan extends Component<any, any> {
isStopNurse: true,
ActiveModeItem,
});
setTimeout(() => {
this.onEmitErrorTips();
}, 500);
}
break;
default:
@ -780,6 +756,18 @@ class IotCarePlan extends Component<any, any> {
jsonStatus
);
// 判断设备主动上报的关机事件
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
this.rmWL200NursingHistory(this.WL200NursingHistory, true);
// 判断护理时间,如果不足,则提示不足
if (!this.isCheckNurseTime()) {
this.setState({ isNotEnoughTime: true });
} else {
this.endNurseFun();
}
return;
}
this.workStatus = jsonStatus.workStatus;
this.setState({
Electricity: jsonStatus.battery,
@ -931,7 +919,9 @@ class IotCarePlan extends Component<any, any> {
console.log("时间校准频率默认5秒一次", TIME_CALIBRATION_FREQUENCY);
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = minSecToS(currentScene.modeTimeStr); // 场景时间
let sceneTime = ActiveModeItem?.breakTimeStr
? minSecToS(ActiveModeItem.breakTimeStr)
: minSecToS(currentScene.modeTimeStr); // 场景时间
console.log("场景时间 sceneTime", sceneTime);
console.log("当前显示时间 currentTime", currentTime);
@ -997,6 +987,13 @@ class IotCarePlan extends Component<any, any> {
});
}
opts.workStatus = nWorkStatus;
let nowCurrentTime = ActiveModeItem.modeTimeStr;
// 完成重连同步则删除重连时间字段
if (ActiveModeItem?.breakTimeStr) {
nowCurrentTime = ActiveModeItem?.breakTimeStr;
}
const statusF = {
sleep: () => {
this.setState({
@ -1008,7 +1005,7 @@ class IotCarePlan extends Component<any, any> {
isShowCountdown: false,
});
if (nowModeItem?.isCabinMode && step == 2) {
opts.currentTime = nowModeItem.modeTimeStr;
opts.currentTime = nowCurrentTime;
} else if (!nowModeItem?.isCabinMode && step == 2) {
// fix: 启动非支架模式倒计时时连上支架仪器的状态变为standby
opts.step = 1;
@ -1036,7 +1033,7 @@ class IotCarePlan extends Component<any, any> {
});
}
if (nowModeItem) {
opts.currentTime = nowModeItem.modeTimeStr;
opts.currentTime = nowCurrentTime;
}
// startSettingCountDown 用于标记打开了倒计时loading
if (!this.state.isShowCountdown) {
@ -1133,17 +1130,21 @@ class IotCarePlan extends Component<any, any> {
step == 2 &&
facialMaskConnectStatus == 1
) {
let totalSeconds = minSecToS(ActiveModeItem.modeTimeStr);
// 现在的倒计时剩余时间:同步时检查是否断开重连,如果是,则使用断开的剩余时长,进行倒计时计算
let currentSeconds = ActiveModeItem?.breakTimeStr
let totalSeconds = ActiveModeItem?.breakTimeStr
? minSecToS(ActiveModeItem.breakTimeStr)
: minSecToS(currentTime);
: minSecToS(ActiveModeItem.modeTimeStr);
// 现在的倒计时剩余时间:同步时检查是否断开重连,如果是,则使用断开的剩余时长,进行倒计时计算
let currentSeconds = minSecToS(currentTime);
let checkTime = totalSeconds - currentSeconds;
// 缓存经过的时间:用于接口提交
this.elapsedTime = checkTime;
// 完成重连同步则删除重连时间字段
// 如果存在中断时间,则要加上间隔的时间
if (ActiveModeItem?.breakTimeStr) {
delete ActiveModeItem?.breakTimeStr;
this.setState({ ActiveModeItem });
let intervalTime =
minSecToS(ActiveModeItem.modeTimeStr) -
minSecToS(ActiveModeItem.breakTimeStr);
this.elapsedTime += intervalTime;
}
// 判断剩余时间是否大于1
@ -1480,6 +1481,7 @@ class IotCarePlan extends Component<any, any> {
console.log("同步异常,但设备运行中");
}
};
/** 获取小程序本地缓存的历史记录 */
getWL200NursingHistory() {
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
@ -1530,7 +1532,12 @@ class IotCarePlan extends Component<any, any> {
console.log("更新updateWL200NursingHistory");
}
};
/** 删除WL200护理历史 */
/**
* @name WL200
* @description 1 2
* IDID
*
*/
rmWL200NursingHistory = (WL200NursingHistory, hard = false) => {
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
if (nowWL200NursingHistory.id == WL200NursingHistory.id) {
@ -1561,6 +1568,7 @@ class IotCarePlan extends Component<any, any> {
console.log("PostNursingLogClock", res);
if (res.data.code === 200) {
this.rmWL200NursingHistory(this.WL200NursingHistory); // 护理完成,删除记录
if (isJump) {
this.setState({
isShowNursingSuccess: true,
@ -1773,11 +1781,13 @@ class IotCarePlan extends Component<any, any> {
this.setState({
isConnectShow: false,
});
this.onNursingTap();
};
connectionClose = () => {
this.setState({
isConnectShow: false,
});
Taro.switchTab({ url: "/pages/index/index" });
};
// 手动护理模式切换:提示是否保存护理
@ -1834,7 +1844,22 @@ class IotCarePlan extends Component<any, any> {
let isCanClick = isStandStatus
? this.tempModeCurrent?.isCabinMode === 1
: this.tempModeCurrent?.isCabinMode === 0;
let isFooterBtnDisabled = !(isStandStatus === isCanClick);
// 如果舱体状态和模式类型不相等,则禁用
let isFooterBtnDisabled = false;
if (isStandStatus) {
if (!isCanClick) {
isFooterBtnDisabled = true;
}
} else {
if (!isCanClick) {
isFooterBtnDisabled = true;
}
}
console.log("isStandStatus", isStandStatus);
console.log("isFooterBtnDisabled", isFooterBtnDisabled);
console.log("isCanClick", isCanClick);
this.setState({
isFooterBtnDisabled: isFooterBtnDisabled,
});
@ -1917,7 +1942,6 @@ class IotCarePlan extends Component<any, any> {
isShowNurse={isShowNurse}
ModeList={ModeList}
ModeType={ModeType}
ActiveModeItem={SwitchActiveModeItem}
onEmit={this.switchModeCurrentFun}
onEmitShowAll={this.openModeSwitch}
/>
@ -1983,25 +2007,6 @@ class IotCarePlan extends Component<any, any> {
confirm={this.confirmTipsSave}
/>
<PopupConfirm
isShow={isShowReReadRecordSave}
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
isShow={isShowNursingSuccess}
isClose
@ -2090,7 +2095,6 @@ class IotCarePlan extends Component<any, any> {
ModeType={ModeType}
ModeID={ModeID}
activeModeID={activeModeID}
ActiveModeItem={ActiveModeItem}
onEmit={this.modeCurrentFun}
onEmitShowAll={this.openModeSwitch}
/>

Loading…
Cancel
Save