fix:蓝牙bug修复

master
blak-kong 2 years ago
parent ce09d36d6b
commit 70c94239fd

@ -36,7 +36,7 @@ import {
} from "@/utils/util";
// const log = require("@/utils/log");
import commandMap from "@/utils/commandMap";
import { bleCommandSamples } from "./test";
import { bleCommandSamples } from "./wl200";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");

@ -99,6 +99,7 @@
// width: 100%;
// height: 100%;
overflow: hidden;
background-color: #eee;
}
.error-block {

@ -102,6 +102,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
onClick={this.onClose}
></View>
{/* 非错误弹窗 */}
{!error && (
<View className={classnames("common-box device-connection-box")}>
<View
@ -110,7 +111,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
{data.bluetoothConnectingTitle}
</View>
<View className="device-popup-content-box">
{this.isImage(data.bluetoothConnecting) ? (
{!this.isImage(data.bluetoothConnecting) ? (
<Video className="videos" src={data.bluetoothConnecting} />
) : (
<Image
@ -187,6 +188,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
</View>
)}
{/* 错误与失败弹窗 */}
{error && (
<View className={classnames("common-box", "device-connection-box")}>
<View
@ -195,7 +197,15 @@ export default class DeviceConnectPopup extends Component<any, any> {
{data.bluetoothConnectFailTitle}
</View>
<View className="device-popup-content-box">
<Video className="videos" src={data.bluetoothConnectFail} />
{!this.isImage(data.bluetoothConnectFail) ? (
<Video className="videos" src={data.bluetoothConnectFail} />
) : (
<Image
className="images"
src={data.bluetoothConnectFail}
mode="aspectFill"
/>
)}
<View className="error-block">
<View className="tip1"></View>

@ -1,5 +1,10 @@
.site-popup-content-box {
margin: 0;
.absolutely-img {
width: 100%;
height: 600rpx;
background-color: #eee;
}
}
// .van-popup {
// background-color: transparent;

@ -100,18 +100,19 @@ export default class PopupInstrumentUploadTips extends Component<any, any> {
};
render() {
let { isShow, data, isLarge, title } = this.props;
let { isShow, data, isLarge, title, myClassName, zIndex } = this.props;
let { current } = this.state;
if (!zIndex) zIndex = 10001;
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
className={myClassName}
style="background-color: #fff;"
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
overlayStyle={`width: 100vw;padding: 0;z-index: ${zIndex} !important`}
onClick={this.onClickStop}
>
<View
@ -125,12 +126,7 @@ export default class PopupInstrumentUploadTips extends Component<any, any> {
return (
current === index && (
<View className="absolutely" key={"swiper_" + index}>
<View
style={{
width: "100%",
height: "600rpx",
}}
>
<View className="absolutely-img">
<Image
className="cover"
src={item.file}

@ -500,6 +500,7 @@ export default class Instrument extends Component<any, any> {
<Video
className="banner_item"
autoplay
loop
objectFit="cover"
enablePlayGesture
showFullscreenBtn={false}

@ -54,7 +54,7 @@ import {
import {
deviceCommandSamples,
bleCommandSamples,
} from "@/components/bluetoot/connection/test";
} from "@/components/bluetoot/connection/wl200";
import { minSecToS, s_to_ms, s_to_hms, sleep } from "@/utils/util";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
@ -206,8 +206,8 @@ class IotCarePlan extends Component<any, any> {
// 上一次护理记录未生成,是否继续连接设备
isShowReReadRecordConnect: false,
// 按钮是否可运行
isFooterBtnDisabled: false,
// 按钮是否可运行
isFooterBtnDisabled: true,
isFirstEntryMode: false, // 模式首次打开
};
}
@ -375,7 +375,7 @@ class IotCarePlan extends Component<any, any> {
setTimeout(() => {
this.modeCurrentFun(res.data.data[0]);
});
}, 100);
} else {
this.setState({ ModeList: res.data.data });
}
@ -414,19 +414,15 @@ class IotCarePlan extends Component<any, any> {
/** 选中护理模式 */
modeCurrentFun = async (data, isNotCheck = false) => {
// 仅在未开始护理前,切换模式的时候提示模式弹窗
if (!this.state.isShowNurse) {
this.openStepTips();
}
// 护理检查改变模式,是否提示切换护理模式
// isNotCheck为真时不进行校验直接切换
this.tempModeCurrent = data;
// 如果按钮不可点击则报错,内部自带检查底部按钮函数
this.onEmitErrorTips();
if (!isNotCheck) {
let isReturn = this.modeRuningChange();
if (isReturn) return;
}
let { isShowNurse } = this.state;
let currentServiceData = {
startSource: "",
stopSource: "",
@ -445,6 +441,13 @@ class IotCarePlan extends Component<any, any> {
currentTime,
});
// 如果按钮不可点击则报错,内部自带检查底部按钮函数
this.onEmitErrorTips();
if (!isNotCheck) {
let isReturn = this.modeRuningChange();
if (isReturn) return;
}
setTimeout(() => {
// 设置时间组合
if (data.serviceData.length > 0) {
@ -556,7 +559,14 @@ class IotCarePlan extends Component<any, any> {
// 如果检查通过,可运行,则执行下一步
if (!this.footerIsDisabled()) {
this.stepNext();
this.openStepTips(); // 仅在进入运行页的时候弹窗
setTimeout(() => {
this.onNursingTap();
// 倒计时弹窗: 倒计时完成后,自动开始,并判断弹窗
let downNum = CountDownTime[this.state.ActiveModeItem.modeType] || 3;
this.showCountdownFun(downNum, () => {});
}, 500);
return;
}
// 如果检查失败,则报错
@ -568,19 +578,21 @@ class IotCarePlan extends Component<any, any> {
* @description isCabinMode 0. 1.
*/
onEmitErrorTips = async () => {
let { ActiveModeItem } = this.state;
setTimeout(() => {
let { ActiveModeItem } = this.state;
// 按钮不可点击时,提示报错
let isDisabled = this.footerIsDisabled();
if (isDisabled) {
if (ActiveModeItem.isCabinMode === 0) {
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
} else {
this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
);
// 按钮不可点击时,提示报错
let isDisabled = this.footerIsDisabled();
if (isDisabled) {
if (ActiveModeItem.isCabinMode === 0) {
this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
} else {
this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
);
}
}
}
});
};
// 绘制能量图
@ -697,6 +709,9 @@ class IotCarePlan extends Component<any, any> {
this.onEmitErrorTips();
}, 500);
}
setTimeout(() => {
this.footerIsDisabled();
}, 100);
break;
default:
console.log("监听到到设备连接状态改变 this.footerIsDisabled()");
@ -715,6 +730,9 @@ class IotCarePlan extends Component<any, any> {
this.setState({
isStandStatus: isStandDevice,
});
setTimeout(() => {
this.footerIsDisabled();
});
// 连上面罩后, 获取仪器记录, 与缓存信息对比
if (!this.hadGotInstrumentHistoryData) {
@ -894,18 +912,18 @@ class IotCarePlan extends Component<any, any> {
});
/**
* 500
* 600
*/
const querySubDeviceArrayBuffer = deviceToolKitInstance.toBleCommand({
...bleCommandSamples.querySubDevice,
queryType: "WL200",
} as any);
setTimeout(() => {
console.log("发送查询指令");
console.log("发送查询附属设备指令 querySubDeviceArrayBuffer");
sendCommand({
value: querySubDeviceArrayBuffer,
});
}, 500);
}, 600);
/**
* 500
@ -914,7 +932,7 @@ class IotCarePlan extends Component<any, any> {
bleCommandSamples.queryDeviceStatus as any
);
setTimeout(() => {
console.log("发送查询设备指令");
console.log("发送查询设备电量指令");
sendCommand({
value: queryDeviceArrayBuffer,
});
@ -1821,7 +1839,7 @@ class IotCarePlan extends Component<any, any> {
this.setState({
isConnectShow: false,
});
this.onNursingTap();
this.onNursingTap("switch");
};
connectionClose = () => {
this.setState({
@ -1894,22 +1912,17 @@ class IotCarePlan extends Component<any, any> {
// 如果舱体状态和模式类型不相等,则禁用
let isFooterBtnDisabled = false;
if (isStandStatus) {
if (!isCanClick) {
isFooterBtnDisabled = true;
}
} else {
if (!isCanClick) {
isFooterBtnDisabled = true;
}
if (!isCanClick) {
isFooterBtnDisabled = true;
}
console.log("isCanClick", isCanClick);
console.log("isFooterBtnDisabled", isFooterBtnDisabled);
// 仅在值变化时更新state
if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
this.setState({
isFooterBtnDisabled: isFooterBtnDisabled,
});
}
// if (isFooterBtnDisabled !== this.state.isFooterBtnDisabled) {
this.setState({
isFooterBtnDisabled: isFooterBtnDisabled,
});
// }
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
};
@ -1967,6 +1980,8 @@ class IotCarePlan extends Component<any, any> {
<View catchMove>
<PopupInstrumentUploadTips
isShow={isFirstTipShow}
zIndex={10020}
myClassName="level-up"
title="打卡介绍"
data={nurseInfo}
close={this.onTipShowClose}

Loading…
Cancel
Save