fix:蓝牙bug修复

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

@ -36,7 +36,7 @@ import {
} 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 "./wl200";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200"); const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");

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

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

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

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

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

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

Loading…
Cancel
Save