master
rongweikang 2 years ago
commit 6cba4cc658

@ -55,15 +55,14 @@
"@tarojs/runtime": "3.6.19", "@tarojs/runtime": "3.6.19",
"@tarojs/shared": "3.6.19", "@tarojs/shared": "3.6.19",
"@tarojs/taro": "3.6.19", "@tarojs/taro": "3.6.19",
"@visactor/taro-vchart": "^1.9.0",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"echarts": "^5.5.0", "echarts": "^5.5.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"react": "^18.0.0", "react": "^18.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-redux": "^9.0.3", "react-redux": "^9.0.3",
"taro-ui": "^3.2.0", "taro-react-echarts": "^1.2.2",
"taro-react-echarts": "^1.2.2" "taro-ui": "^3.2.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.8.0",

@ -149,7 +149,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
</Block> </Block>
)} )}
</View> </View>
<View className="block2"> {/* <View className="block2">
{connectionSuccess ? ( {connectionSuccess ? (
<Block> <Block>
<View className="icon"> <View className="icon">
@ -175,7 +175,7 @@ export default class DeviceConnectPopup extends Component<any, any> {
</View> </View>
</Block> </Block>
)} )}
</View> </View> */}
</View> </View>
<View className="common-popup-btns"> <View className="common-popup-btns">
<Button <Button

@ -40,7 +40,7 @@ export default class Navbar extends Component<any, any> {
if (!this.props.isCustomBack) { if (!this.props.isCustomBack) {
back(); back();
} else { } else {
this.props.customBack(); this.props.customBack(); // 具体页面自定义返回逻辑
} }
}; };
@ -49,8 +49,7 @@ export default class Navbar extends Component<any, any> {
success: (res) => { success: (res) => {
const statusBarHeight = res.statusBarHeight || 0; const statusBarHeight = res.statusBarHeight || 0;
// 获取微信胶囊的位置信息 width,height,top,right,left,bottom // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
// const custom = Taro.getMenuButtonBoundingClientRect(); const custom = Taro.getMenuButtonBoundingClientRect();
const custom = { height: 60, top: 20 };
// 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2 // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
const navigationBarHeight = const navigationBarHeight =
custom.height + (custom.top - statusBarHeight) * 2; custom.height + (custom.top - statusBarHeight) * 2;

@ -62,3 +62,9 @@
font-family: PingFang SC; font-family: PingFang SC;
} }
} }
.instrument-swiper-step {
width: 600rpx;
height: 720rpx;
margin: 0 auto;
}

@ -71,9 +71,7 @@ export default class PopupInstrumentUploadTips extends Component<any, any> {
} }
this.setState({ current }); this.setState({ current });
} }
onClickSwiperItem(item) {
goJump(item);
}
onFinish(event) { onFinish(event) {
const { current } = event.detail; const { current } = event.detail;
const { toRight, isClick } = this.state; const { toRight, isClick } = this.state;
@ -94,7 +92,7 @@ export default class PopupInstrumentUploadTips extends Component<any, any> {
onNext = async () => { onNext = async () => {
let { current } = this.state; let { current } = this.state;
if (current === this.props.data.length) { if (current === this.props.data.length - 1) {
this.onClose(); this.onClose();
} else { } else {
this.setState({ current: current + 1 }); this.setState({ current: current + 1 });
@ -122,42 +120,29 @@ export default class PopupInstrumentUploadTips extends Component<any, any> {
></View> ></View>
<View className={classnames("common-box upload-tips-common-box")}> <View className={classnames("common-box upload-tips-common-box")}>
<View className="site-popup-content-box"> <View className="site-popup-content-box">
<Swiper <View className="absolutely instrument-swiper-step">
className="absolutely"
style="width: 600rpx;height: 720rpx"
current={current}
onChange={this.onChange.bind(this)}
onAnimationFinish={this.onFinish.bind(this)}
duration={800}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
disableTouch={true} // 禁止滑动
>
{data.map((item, index) => { {data.map((item, index) => {
return ( return (
<SwiperItem current === index && (
className="absolutely" <View className="absolutely" key={"swiper_" + index}>
onClick={this.onClickSwiperItem.bind(this, item)} <View
key={"swiper_" + index} style={{
> width: "100%",
<View height: "600rpx",
style={{ }}
width: "100%", >
height: "600rpx", <Image
}} className="cover"
> src={item.file}
<Image mode="aspectFit"
className="cover" ></Image>
src={item.file} </View>
mode="aspectFit" <View className="tips-message">{item.message}</View>
></Image>
</View> </View>
<View className="tips-message">{item.message}</View> )
</SwiperItem>
); );
})} })}
</Swiper> </View>
</View> </View>
<View> <View>
@ -170,15 +155,19 @@ export default class PopupInstrumentUploadTips extends Component<any, any> {
)} )}
{data.length > 1 && current === 0 && ( {data.length > 1 && current === 0 && (
<View className="popup-btn-one"> <View className="popup-btn-one">
<Button className="popup-btn" onClick={this.onPrev}> <Button className="popup-btn" onClick={this.onNext}>
</Button> </Button>
</View> </View>
)} )}
{data.length > 1 && ( {data.length > 1 && current > 0 && (
<View className="common-popup-btns"> <View className="common-popup-btns">
<Button className="common-popup-btn2" onClick={this.onPrev}> <Button
{current > 0 && current < data.length - 1 && "上一步"} className="common-popup-btn2"
style="color:#000"
onClick={this.onPrev}
>
</Button> </Button>
<Button className="common-popup-btn2" onClick={this.onNext}> <Button className="common-popup-btn2" onClick={this.onNext}>
{current > 0 && current < data.length - 1 && "下一步"} {current > 0 && current < data.length - 1 && "下一步"}

@ -85,7 +85,7 @@ export default class PopupStepTips extends Component<any, any> {
onNext = async () => { onNext = async () => {
let { current } = this.state; let { current } = this.state;
if (current === this.props.data.length) { if (current === this.props.data.length - 1) {
this.onClose(); this.onClose();
} else { } else {
this.setState({ current: current + 1 }); this.setState({ current: current + 1 });
@ -146,57 +146,54 @@ export default class PopupStepTips extends Component<any, any> {
</View> </View>
)} */} )} */}
<View className="step-popup-content-box"> <View className="step-popup-content-box">
<Swiper <View className="absolutely instrument-swiper-step">
className="step-absolutely"
current={current}
duration={800}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
disableTouch={true} // 禁止滑动
>
{data.map((item, index) => { {data.map((item, index) => {
return ( return (
<SwiperItem className="absolutely" key={"swiper_" + index}> current === index && (
<View className="step-img"> <View className="absolutely" key={"swiper_" + index}>
<Image <View
className="cover" style={{
src={item.openSourceUrl} width: "100%",
mode="aspectFit" height: "600rpx",
></Image> }}
>
<Image
className="cover"
src={item.openSourceUrl}
mode="aspectFit"
></Image>
</View>
<View className="tips-message">{item.openContent}</View>
</View> </View>
<View className="tips-message">{item.openContent}</View> )
</SwiperItem>
); );
})} })}
</Swiper> </View>
</View> </View>
<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.onClose}>
<Button className="popup-btn" onClick={this.onConfirm}>
{confirmButtonText} </Button>
</Button>
) : (
<Button className="popup-btn" onClick={this.onClose}>
{confirmButtonText}
</Button>
)}
</View> </View>
)} )}
{data.length > 1 && current === 0 && ( {data.length > 1 && current === 0 && (
<View className="popup-btn-one"> <View className="popup-btn-one">
<Button className="popup-btn" onClick={this.onPrev}> <Button className="popup-btn" onClick={this.onNext}>
</Button> </Button>
</View> </View>
)} )}
{data.length > 1 && ( {data.length > 1 && current > 0 && (
<View className="common-popup-btns"> <View className="common-popup-btns">
<Button className="common-popup-btn2" onClick={this.onPrev}> <Button
{current > 0 && current < data.length - 1 && "上一步"} className="common-popup-btn2"
style="color:#000"
onClick={this.onPrev}
>
</Button> </Button>
<Button className="common-popup-btn2" onClick={this.onNext}> <Button className="common-popup-btn2" onClick={this.onNext}>
{current > 0 && current < data.length - 1 && "下一步"} {current > 0 && current < data.length - 1 && "下一步"}

@ -7,6 +7,7 @@ import Navbar from "../../components/navbar/navbar";
import "./consultant.less"; import "./consultant.less";
import { getContactWorker } from "../../utils/Interface"; import { getContactWorker } from "../../utils/Interface";
import { back } from "@/utils/traoAPI";
export default class Consultant extends Component<any, any> { export default class Consultant extends Component<any, any> {
constructor(props) { constructor(props) {
@ -16,6 +17,7 @@ export default class Consultant extends Component<any, any> {
pictureUrl: "", pictureUrl: "",
}; };
} }
$instance = Taro.getCurrentInstance();
async onLoad() { async onLoad() {
this.initData(); this.initData();
@ -36,11 +38,25 @@ export default class Consultant extends Component<any, any> {
} }
} }
customBack = () => {
let customBack = this.$instance.router?.params?.customBack;
if (customBack) {
Taro.switchTab({ url: "/pages/index/index" });
return;
}
back();
};
render() { render() {
const { pictureUrl } = this.state; const { pictureUrl } = this.state;
return ( return (
<Block> <Block>
<Navbar titleSlot="联系客服" isBack={true} /> <Navbar
titleSlot="联系客服"
isBack={true}
isCustomBack
customBack={this.customBack}
/>
<View className="img"> <View className="img">
<Image <Image
src={pictureUrl} src={pictureUrl}

@ -55,20 +55,16 @@ import {
setStorageSync, setStorageSync,
showModal, showModal,
} from "@/utils/traoAPI"; } from "@/utils/traoAPI";
import commandMap from "@/utils/commandMap";
import InstrumentTypeEnum from "@/components/bluetoot/InstrumentTypeEnum";
import OtaDeviceTypeEnum from "@/components/bluetoot/OtaDeviceTypeEnum";
// const log = require("@/utils/log"); // const log = require("@/utils/log");
class Index extends Component<any, any> { class Index extends Component<any, any> {
// pageCtx = Taro.getCurrentInstance().page;
$instance = Taro.getCurrentInstance(); $instance = Taro.getCurrentInstance();
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
showEquipment: false, // 扫码绑定设备弹窗
isRegisterBoolean: false, // 是否已登录 isRegisterBoolean: false, // 是否已登录
isShowPrivacyPopup: false, isShowPrivacyPopup: false,
isShowSiteSwiper: false, isShowSiteSwiper: false,
@ -146,8 +142,6 @@ class Index extends Component<any, any> {
} }
async onLoad() { async onLoad() {
console.log(1123131233);
// 仅非扫码进入页面时,校验跳转欢迎页 // 仅非扫码进入页面时,校验跳转欢迎页
if (!this.$instance.router?.params?.q) { if (!this.$instance.router?.params?.q) {
const isFirst = Taro.getStorageSync("isWelcome"); const isFirst = Taro.getStorageSync("isWelcome");
@ -155,9 +149,10 @@ class Index extends Component<any, any> {
go("/pages/initiate/initiate"); go("/pages/initiate/initiate");
} }
} }
if (Taro.getStorageSync("skip")) { // 判断是否跳过了注册
if (Taro.getStorageSync("skipRegister")) {
this.setState({ showEquipment: true }); this.setState({ showEquipment: true });
Taro.removeStorageSync("skip"); Taro.removeStorageSync("skipRegister");
} }
} }
@ -490,6 +485,10 @@ class Index extends Component<any, any> {
instrumentInfo.bindingStatus === 1 || instrumentInfo.bindingStatus === 1 ||
instrumentInfo.bindingStatus === 2 instrumentInfo.bindingStatus === 2
) { ) {
// 判断是否已绑定同名仪器,如果已绑定,判断序列号是否一致
// 如果自己已绑定,判断扫码序列号和已绑定序列号是否一致,如果一致:忽略
// 如果自己已绑定,判断扫码序列号和已绑定序列号是否一致,如果不一致:提示换绑
// 以上逻辑交给后端处理,直接查询是否绑定或换绑
setTimeout(() => { setTimeout(() => {
this.isBindingSerial(); this.isBindingSerial();
}, 100); }, 100);
@ -539,7 +538,7 @@ class Index extends Component<any, any> {
if (data.code === 200) { if (data.code === 200) {
msg("绑定成功"); msg("绑定成功");
setTimeout(() => { setTimeout(() => {
go("/pages/instrument/intro?id=" + instrumentInfo.id); go("/pages/instrument/intro??customBack=true&id=" + instrumentInfo.id);
}, 2000); }, 2000);
return; return;
} else if (data.code === 202) { } else if (data.code === 202) {
@ -553,6 +552,7 @@ class Index extends Component<any, any> {
} }
}; };
// 换绑仪器
exchangeBinding = async () => { exchangeBinding = async () => {
Taro.showLoading({ Taro.showLoading({
title: "请求中...", title: "请求中...",
@ -575,7 +575,7 @@ class Index extends Component<any, any> {
}; };
onBindErrorConfirm = () => { onBindErrorConfirm = () => {
this.onBindErrorClose(); this.onBindErrorClose();
go("/pages/consultant/consultant"); go("/pages/consultant/consultant?customBack=true");
}; };
onBeforeBindClose = () => { onBeforeBindClose = () => {
this.setState({ isBeforeBinding: false }); this.setState({ isBeforeBinding: false });
@ -750,6 +750,7 @@ class Index extends Component<any, any> {
instrumentInfo, instrumentInfo,
instrumentList, instrumentList,
showEquipment, showEquipment,
bindEquipment,
// 升级弹窗 // 升级弹窗
isShowUpdateVersionTip, isShowUpdateVersionTip,
@ -765,6 +766,25 @@ class Index extends Component<any, any> {
return ( return (
<Block> <Block>
<View catchMove> <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}
/> */}
<PopupAlert <PopupAlert
isShow={isBindingError} isShow={isBindingError}
title="提示" title="提示"
@ -845,8 +865,10 @@ class Index extends Component<any, any> {
title="提示" title="提示"
content={ content={
<Block> <Block>
<View className="mb10"></View> <View className="mb10">
<View className="mb10">uniquie14231</View> {instrumentInfo.instrumentName}
</View>
<View className="mb10">{instrumentInfo.serial}</View>
<View className="mb10"></View> <View className="mb10"></View>
</Block> </Block>
} }

@ -25,6 +25,7 @@ import { getImgInfo, contraction } from "@/utils/compressImage";
/* 自定义组件 */ /* 自定义组件 */
import Navbar from "@/components/navbar/navbar"; import Navbar from "@/components/navbar/navbar";
import PopupAlert from "@/components/popup/popup-alert"; import PopupAlert from "@/components/popup/popup-alert";
import PopupBinding from "@/components/popup/popup-binding";
/* 组件 */ /* 组件 */
import "./instrument.less"; import "./instrument.less";
@ -61,6 +62,10 @@ export default class Instrument extends Component<any, any> {
userinfo: null, userinfo: null,
showLoginPopup: "", showLoginPopup: "",
fromUrl: "", fromUrl: "",
isVisibleBinding: false,
isRegisterBoolean: false,
isExchangeBinding: false,
}; };
} }
$instance = Taro.getCurrentInstance(); $instance = Taro.getCurrentInstance();
@ -183,10 +188,19 @@ export default class Instrument extends Component<any, any> {
const { channelInfo } = this.state; const { channelInfo } = this.state;
if (channelInfo.id === item.id) return; if (channelInfo.id === item.id) return;
channelInfo.serialCode = ""; channelInfo.serialCode = "";
channelInfo.manualCodeBinding = "";
channelInfo.scanCodeBinding = "";
this.setState({ this.setState({
channelInfo: item, channelInfo: channelInfo,
isVideo: this.isVideo(item.banner), isVideo: this.isVideo(item.banner),
}); });
setTimeout(() => {
this.setState({
channelInfo: item,
});
}, 10);
} }
closeDev = () => { closeDev = () => {
@ -248,7 +262,7 @@ export default class Instrument extends Component<any, any> {
console.log("bindingInstrument", res); console.log("bindingInstrument", res);
Taro.hideLoading(); Taro.hideLoading();
if (res.code === 200) { if (res.code === 200) {
this.binding(); this.openBindingVisible();
} else if (res.code === 204) { } else if (res.code === 204) {
this.setState({ isBindingCheckError: false }); this.setState({ isBindingCheckError: false });
} else { } else {
@ -267,7 +281,8 @@ export default class Instrument extends Component<any, any> {
}); });
Taro.hideLoading(); Taro.hideLoading();
if (res.data.code === 200) { if (res.data.code === 200) {
this.binding(); // this.bindingInstrument();
this.openBindingVisible();
} else if (res.data.code === 204) { } else if (res.data.code === 204) {
this.setState({ isBindingCheckError: true }); this.setState({ isBindingCheckError: true });
} else { } else {
@ -275,7 +290,8 @@ export default class Instrument extends Component<any, any> {
} }
}; };
binding = async () => { // 调用绑定接口
bindingInstrument = async () => {
Taro.showLoading({ Taro.showLoading({
title: "请求中...", title: "请求中...",
mask: true, mask: true,
@ -297,6 +313,24 @@ export default class Instrument extends Component<any, any> {
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
} }
}; };
// 换绑仪器
exchangeBinding = async () => {
Taro.showLoading({
title: "请求中...",
mask: true,
});
let { channelInfo } = this.state;
let { data } = await InstrumentInfo.exchangeBinding({
serial: channelInfo.serialCode,
});
console.log("exchangeBinding", data);
Taro.hideLoading();
this.closeBinding();
if (data.code !== 200) {
//todo
}
};
onBindErrorClose = () => { onBindErrorClose = () => {
this.setState({ isBindingError: false }); this.setState({ isBindingError: false });
}; };
@ -313,6 +347,25 @@ export default class Instrument extends Component<any, any> {
Taro.switchTab({ url: "/pages/index/index" }); Taro.switchTab({ url: "/pages/index/index" });
}; };
// 打开绑定弹窗
openBindingVisible = () => {
this.setState({ isVisibleBinding: true });
};
closeBinding = () => {
this.setState({ isVisibleBinding: false });
};
confirmBinding = () => {
let { isExchangeBinding } = this.state;
if (!isExchangeBinding) {
// 绑定仪器
this.bindingInstrument();
} else {
// 换绑仪器
this.exchangeBinding();
}
};
render() { render() {
let { let {
isBindingError, isBindingError,
@ -321,6 +374,9 @@ export default class Instrument extends Component<any, any> {
inputType, inputType,
style, style,
equipmentList, equipmentList,
isVisibleBinding,
isRegisterBoolean,
isExchangeBinding,
} = this.state; } = this.state;
return ( return (
<Block> <Block>
@ -340,6 +396,16 @@ export default class Instrument extends Component<any, any> {
isCustomBack isCustomBack
customBack={this.customBack} customBack={this.customBack}
/> />
<PopupBinding
type={channelInfo.bindingStatus}
isShow={isVisibleBinding}
isRegisterBoolean={isRegisterBoolean}
isExchangeBinding={isExchangeBinding}
data={channelInfo}
close={this.closeBinding}
confirm={this.confirmBinding}
/>
<PopupAlert <PopupAlert
isShow={isBindingError} isShow={isBindingError}
title="提示" title="提示"

@ -12,12 +12,12 @@ import {
} from "@tarojs/components"; } from "@tarojs/components";
/* 自定义组件 */ /* 自定义组件 */
import Navbar from "../../components/navbar/navbar"; import Navbar from "@/components/navbar/navbar";
// import PopupAlert from "../../components/popup/popup-alert"; // import PopupAlert from "../../components/popup/popup-alert";
/* 组件 */ /* 组件 */
import { InstrumentInfo } from "../../utils/Interface"; import { InstrumentInfo } from "@/utils/Interface";
import { setStorageSync, getStorageSync, go } from "../../utils/traoAPI"; import { setStorageSync, getStorageSync, go, back } from "@/utils/traoAPI";
import "./intro.less"; import "./intro.less";
@ -32,6 +32,7 @@ class Intro extends Component<any, any> {
isNursing: false, isNursing: false,
}; };
} }
$instance = Taro.getCurrentInstance();
async onLoad() {} async onLoad() {}
componentDidMount() {} componentDidMount() {}
@ -93,11 +94,25 @@ class Intro extends Component<any, any> {
}); });
} }
customBack = () => {
let customBack = this.$instance.router?.params?.customBack;
if (customBack) {
Taro.switchTab({ url: "/pages/index/index" });
return;
}
back();
};
render() { render() {
let { current, introList, instrument } = this.state; let { current, introList, instrument } = this.state;
return ( return (
<Block> <Block>
<Navbar titleSlot="仪器绑定" isBack={true} /> <Navbar
titleSlot="仪器绑定"
isBack
isCustomBack
customBack={this.customBack}
/>
<View style="position: relative"> <View style="position: relative">
<Swiper <Swiper
className="main" className="main"

@ -87,14 +87,10 @@ export default class InstrumentClickInUpload extends Component<any, any> {
let instrumentDetail = JSON.parse(objStr); let instrumentDetail = JSON.parse(objStr);
this.setState({ instrumentDetail }); this.setState({ instrumentDetail });
} }
const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get("id");
setTimeout(() => { setTimeout(() => {
this.firstNurseInfo(); this.firstNurseInfo();
this.getLatestClockRecord(); this.getLatestClockRecord();
this.modeInfoList(id); this.modeInfoList(this.state.instrumentDetail.id);
}, 10); }, 10);
} }
@ -119,8 +115,10 @@ export default class InstrumentClickInUpload extends Component<any, any> {
let { punchInInfo } = this.state; let { punchInInfo } = this.state;
let res = await InstrumentInfo.apiClock.getLatestClockRecord(); let res = await InstrumentInfo.apiClock.getLatestClockRecord();
if (res.data.code === 200) { if (res.data.code === 200) {
punchInInfo.clockContent = res.data.data.clockContent; if (res.data.data) {
punchInInfo.clockImageList = res.data.data.clockImg; punchInInfo.clockContent = res.data.data.clockContent;
punchInInfo.clockImageList = res.data.data.clockImg;
}
} }
this.setState({ punchInInfo }); this.setState({ punchInInfo });
}; };

@ -5,18 +5,18 @@ import { useState, useEffect } from "react";
import "./index.less"; import "./index.less";
interface Props { interface Props {
isCanClick: boolean;
isShowNurse: boolean; isShowNurse: boolean;
isStopNurse: boolean; isStopNurse: boolean;
isDisabled: boolean; // 是否禁用开始暂停按钮:模式与连接设备是否一致
onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件 onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件
onEmitSwitchChange: Function; onEmitSwitchChange: Function;
onEmitEndPlan: Function; onEmitEndPlan: Function;
onEmitErrorTips: Function; // 不可点击,提示错误 onEmitErrorTips: Function; // 不可点击,提示错误
} }
function Index({ function Index({
isCanClick,
isShowNurse, isShowNurse,
isStopNurse, isStopNurse,
isDisabled,
onEmitStartNurse, onEmitStartNurse,
onEmitSwitchChange, onEmitSwitchChange,
onEmitEndPlan, onEmitEndPlan,
@ -27,7 +27,9 @@ function Index({
}; };
const onSwitchChange = () => { const onSwitchChange = () => {
onEmitSwitchChange(); if (!isDisabled) {
onEmitSwitchChange();
}
}; };
const onEndPlan = () => { const onEndPlan = () => {
@ -43,12 +45,12 @@ function Index({
<View className="footer"> <View className="footer">
{!isShowNurse && ( {!isShowNurse && (
<Block> <Block>
{isCanClick ? ( {isDisabled ? (
<View className="btn" onClick={onStartNurse}> <View className="btn btn-disable" onClick={onStartNurse}>
</View> </View>
) : ( ) : (
<View className="btn btn-disable" onClick={onStartNurse}> <View className="btn" onClick={onStartNurse}>
</View> </View>
)} )}
@ -56,7 +58,7 @@ function Index({
)} )}
{isShowNurse && ( {isShowNurse && (
<View className="switch-btn-box"> <View className="switch-btn-box">
{isCanClick && ( {!isDisabled && (
<View className="btn-item border-right" onClick={onSwitchChange}> <View className="btn-item border-right" onClick={onSwitchChange}>
{isStopNurse ? ( {isStopNurse ? (
<Block> <Block>
@ -79,8 +81,11 @@ function Index({
)} )}
</View> </View>
)} )}
{!isCanClick && ( {isDisabled && (
<View className="btn-item border-right" onClick={onErrorTips}> <View
className="btn-item border-right btn-disable"
onClick={onErrorTips}
>
{isStopNurse ? ( {isStopNurse ? (
<Block> <Block>
<Image <Image

@ -105,7 +105,11 @@ function Index({
{activeModeID === item.id && ( {activeModeID === item.id && (
<View className="mode-pic"> <View className="mode-pic">
<Image src={item.modeBanner} mode="aspectFill" /> <Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View> </View>
)} )}
</View> </View>
@ -159,7 +163,11 @@ function Index({
{activeModeID === item.id && ( {activeModeID === item.id && (
<View className="mode-pic"> <View className="mode-pic">
<Image src={item.modeBanner} mode="aspectFill" /> <Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View> </View>
)} )}
</View> </View>
@ -213,7 +221,11 @@ function Index({
{activeModeID === item.id && ( {activeModeID === item.id && (
<View className="mode-pic"> <View className="mode-pic">
<Image src={item.modeBanner} mode="aspectFill" /> <Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View> </View>
)} )}
</View> </View>

@ -32,6 +32,7 @@
width: 690rpx; width: 690rpx;
height: 640rpx; height: 640rpx;
border-radius: 30rpx; border-radius: 30rpx;
animation-iteration-count: 1; // gif只播放一次
} }
.iot-device { .iot-device {
width: 690rpx; width: 690rpx;
@ -86,6 +87,7 @@
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
box-sizing: border-box; box-sizing: border-box;
border-radius: 30rpx; border-radius: 30rpx;
z-index: 10100 !important; // 提升层级,防止被其他元素遮挡
.msg-tips-img { .msg-tips-img {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;

@ -2,9 +2,14 @@ import Taro from "@tarojs/taro";
import dayjs from "dayjs"; import dayjs from "dayjs";
import classnames from "classnames"; import classnames from "classnames";
// eslint-disable-next-line import/no-named-as-default // eslint-disable-next-line import/no-named-as-default
import React, { Component, PropsWithChildren, useEffect, useState } from "react"; import React, {
Component,
import Echarts from "./components/Echart/index" PropsWithChildren,
useEffect,
useState,
} from "react";
import Echarts from "./components/Echart/index";
import { import {
Block, Block,
View, View,
@ -26,6 +31,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 PopupInstrumentUploadTips from "@/components/popup/popup-instrument-upload-tips";
import ConnectionBluetoot from "@/components/bluetoot/connection"; import ConnectionBluetoot from "@/components/bluetoot/connection";
/* 公共组件 END */ /* 公共组件 END */
@ -54,7 +60,7 @@ import {
bleCommandSamples, bleCommandSamples,
} from "@/components/bluetoot/connection/test"; } from "@/components/bluetoot/connection/test";
import { Progress } from '@antmjs/vantui' import { Progress } from "@antmjs/vantui";
import { import {
s_to_s, s_to_s,
s_to_m, s_to_m,
@ -128,8 +134,6 @@ let DeviceSyncData = {
}; };
let deviceToolKitInstance = deviceToolKitInstanceWL200; let deviceToolKitInstance = deviceToolKitInstanceWL200;
class IotCarePlan extends Component<any, any> { class IotCarePlan extends Component<any, any> {
constructor(props) { constructor(props) {
super(props); super(props);
@ -165,7 +169,6 @@ class IotCarePlan extends Component<any, any> {
/** 连接设备 End */ /** 连接设备 End */
/** 护理过程 */ /** 护理过程 */
isCanClick: false, // 是否可以点击开始按钮/启动暂停
isStandStatus: false, // 当前模式是否舱体/支架模式 isStandStatus: false, // 当前模式是否舱体/支架模式
isShowStepTips: false, // 是否显示介绍步骤弹窗 isShowStepTips: false, // 是否显示介绍步骤弹窗
isConnectionBlutoot: true, // 是否已连接蓝牙 isConnectionBlutoot: true, // 是否已连接蓝牙
@ -176,7 +179,7 @@ class IotCarePlan extends Component<any, any> {
/** 护理过程 END*/ /** 护理过程 END*/
// 模式列表 // 模式列表
isSwitchActiveMode: true, // 是否显示弹窗切换模式 isSwitchActiveMode: false, // 是否显示弹窗切换模式
ModeList: [], ModeList: [],
ModeType: "all", // all visor面罩 cabin舱体 yimeish医美 ModeType: "all", // all visor面罩 cabin舱体 yimeish医美
modeClass: "", // 1面罩 2舱体 3医美 modeClass: "", // 1面罩 2舱体 3医美
@ -209,10 +212,21 @@ class IotCarePlan extends Component<any, any> {
isShowNursingSuccess: false, // 护理成功弹窗 isShowNursingSuccess: false, // 护理成功弹窗
isShowTipsSave: false, // 切换模式时,提示是否保存部分护理记录 isShowTipsSave: false, // 切换模式时,提示是否保存部分护理记录
// 初次护理弹窗
isFirstTipShow: false,
nurseInfo: [],
// 上一次护理记录未生成,是否继续连接设备
isShowReReadRecordConnect: false,
// 按钮是否可运行
isFooterBtnDisabled: false,
}; };
} }
// 不涉及渲染的页面变量 // 不涉及渲染的页面变量
isRuning: any = false; // 设备是否运行中
jsonStatus: any = {}; // 同步设备返回数据,用于结束 jsonStatus: any = {}; // 同步设备返回数据,用于结束
tempModeCurrent: any = {}; // 临时保存的当前模式 tempModeCurrent: any = {}; // 临时保存的当前模式
elapsedTime: any = 0; // 设备已运行时间 elapsedTime: any = 0; // 设备已运行时间
@ -231,7 +245,7 @@ class IotCarePlan extends Component<any, any> {
} }
componentDidMount() {} componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
componentDidShow() { componentDidShow() {
console.log("页面显示了"); console.log("页面显示了");
@ -266,9 +280,9 @@ class IotCarePlan extends Component<any, any> {
console.log("info"); console.log("info");
// 如果不存在设备模式值,则判断为首次进入,弹窗提示 // 如果不存在设备模式值,则判断为首次进入,弹窗提示
let isFirstEntry = getStorageSync("isFirstEntry_" + info.id); let isFirstTipShow = getStorageSync("first_instrument_" + info.id);
if (!isFirstEntry) { if (!isFirstTipShow) {
this.setState({ isShowStepTips: true }); this.firstNurseInfo();
} }
} }
@ -281,30 +295,27 @@ class IotCarePlan extends Component<any, any> {
// 初始化蓝牙 // 初始化蓝牙
// this.init(); // this.init();
} }
getOption() { getOption() {
const option = { const option = {
grid: { top: 8, right: 8, bottom: 24, left: 36 }, grid: { top: 8, right: 8, bottom: 24, left: 36 },
xAxis: { xAxis: {
type: 'category', type: "category",
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
}, },
series: [ series: [
{ {
data: [820, 932, 901, 934, 1290, 1330, 1320], data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line', type: "line",
smooth: true, smooth: true,
}, },
], ],
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
}, },
// title: { // title: {
// text: 'ECharts 示例' // text: 'ECharts 示例'
@ -323,8 +334,6 @@ class IotCarePlan extends Component<any, any> {
return option; return option;
} }
async init() { async init() {
// 查询自定义设备指令 // 查询自定义设备指令
const queryInstructionParams = { const queryInstructionParams = {
@ -364,6 +373,7 @@ class IotCarePlan extends Component<any, any> {
isConnectionBlutoot: false, // 断开蓝牙 isConnectionBlutoot: false, // 断开蓝牙
isShowCountdown: false, // 关闭倒计时,防止倒计时还在运行 isShowCountdown: false, // 关闭倒计时,防止倒计时还在运行
}); });
this.footerIsDisabled();
}; };
GetModeList = async (id) => { GetModeList = async (id) => {
@ -419,23 +429,24 @@ class IotCarePlan extends Component<any, any> {
/** 选中护理模式 */ /** 选中护理模式 */
modeCurrentFun = async (data, isNotCheck = false) => { modeCurrentFun = async (data, isNotCheck = false) => {
// 是否跳过护理检查 // 护理检查改变模式,是否提示切换护理模式
// isNotCheck为真时不进行校验直接切换
this.tempModeCurrent = data;
this.footerIsDisabled();
if (!isNotCheck) { if (!isNotCheck) {
this.tempModeCurrent = data;
let isReturn = this.modeRuningChange(); let isReturn = this.modeRuningChange();
if (isReturn) return; if (isReturn) return;
} }
let { isStandStatus, isShowNurse } = this.state; let { isStandStatus, isShowNurse } = this.state;
// 舱体模式无法对应的时候,置灰开始按钮
let isCabinMode = data.isCabinMode === 1; // let isCabinMode = data.isCabinMode === 1;
if (isStandStatus === isCabinMode) { // if (isStandStatus === isCabinMode) {
this.setState({ isCanClick: true }); // 是否舱体一致时,可以点击 // this.setState({ isCanClick: true }); // 是否舱体一致时,可以点击
} else { // } else {
this.setState({ isCanClick: false }); // this.setState({ isCanClick: false });
} // }
console.log("isStandStatus", isStandStatus, isCabinMode);
console.log("isStandStatus === isCabinMode", isStandStatus === isCabinMode);
let currentServiceData = { let currentServiceData = {
startSource: "", startSource: "",
@ -471,7 +482,7 @@ class IotCarePlan extends Component<any, any> {
this.onStartNurse(); this.onStartNurse();
setTimeout(() => { setTimeout(() => {
this.onNursingTap(); this.onNursingTap();
}, 1000); }, 800);
} }
}; };
/** 设备运行中切换模式 */ /** 设备运行中切换模式 */
@ -482,23 +493,24 @@ class IotCarePlan extends Component<any, any> {
this.workStatus === MODE_WORKING_ENUM.WORKING this.workStatus === MODE_WORKING_ENUM.WORKING
) { ) {
const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData; const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData;
const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds; const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds; // 设备时间
let { ActiveModeItem } = this.state; let { ActiveModeItem } = this.state;
if (!ActiveModeItem || totalTime === 0) { if (!ActiveModeItem || totalTime === 0) {
return false; return false;
} }
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准 if (this.state.step == 2 && this.state.facialMaskConnectStatus == 1) {
const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = minSecToS(currentScene.modeTimeStr); // 场景最小护理时间
if (
sceneTime <= totalTime &&
this.state.step == 2 &&
this.state.facialMaskConnectStatus == 1
) {
// 提示切换护理模式 // 提示切换护理模式
this.hanldeChangeNurseFun(); if (this.isCheckNurseTime()) {
// 满足时间条件,提示是否保存部分护理记录
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
this.state.ActiveModeItem?.modeType
);
this.setState({
isShowTipsSave: true,
});
}
return true; return true;
} }
} }
@ -531,29 +543,33 @@ class IotCarePlan extends Component<any, any> {
let { SwitchActiveModeItem, ActiveModeItem, isStandStatus } = this.state; let { SwitchActiveModeItem, ActiveModeItem, isStandStatus } = this.state;
let modeArray = ["all", "visor", "cabin", "yimeish"]; let modeArray = ["all", "visor", "cabin", "yimeish"];
// 切换护理模式时,需判断舱体和面罩是否切换 // 切换护理模式时,需判断舱体和面罩是否切换
if (SwitchActiveModeItem.isCabinMode !== ActiveModeItem.isCabinMode) { // if (SwitchActiveModeItem.isCabinMode !== ActiveModeItem.isCabinMode) {
if (SwitchActiveModeItem.isCabinMode === 1) { // if (SwitchActiveModeItem.isCabinMode === 1) {
// 判断舱体是否连接成功 // // 判断舱体是否连接成功
if (!isStandStatus) { // if (!isStandStatus) {
console.log( // console.log(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源" // "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
); // );
this.openErrorTipsText( // this.showTips(
"检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源" // "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
); // );
return; // // this.openErrorTipsText(
} // // "检测到面罩与舱体未连接成功,请确认面罩是否和舱体连接并接通舱体电源"
} else { // // );
// 判断舱体是否断开连接 // // return;
if (isStandStatus) { // }
console.log("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体"); // } else {
this.openErrorTipsText( // // 判断舱体是否断开连接
"检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体" // if (isStandStatus) {
); // console.log("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
return; // this.showTips("检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体");
} // // this.openErrorTipsText(
} // // "检测到面罩与舱体仍在连接中,该模式需要分离面罩和舱体"
} // // );
// // return;
// }
// }
// }
this.setState({ this.setState({
ModeType: modeArray[SwitchActiveModeItem.modeClass], ModeType: modeArray[SwitchActiveModeItem.modeClass],
@ -582,22 +598,19 @@ class IotCarePlan extends Component<any, any> {
}; };
/** 开始护理按钮:点击开始,页面进行到下一步 */ /** 开始护理按钮:点击开始,页面进行到下一步 */
onStartNurse = async () => { onStartNurse = async () => {
// 开发者工具 // 如果检查通过,可运行,则执行下一步
// const platform = Taro.getSystemInfoSync().platform; if (!this.footerIsDisabled()) {
// if (platform === "devtools") {
// // 仅开发者工具,直接运行
// this.stepNext();
// }
let { isStandStatus, ActiveModeItem } = this.state;
let isCabinMode = ActiveModeItem.isCabinMode === 1;
if (isStandStatus === isCabinMode) {
this.stepNext(); this.stepNext();
return; return;
} }
// 如果检查失败,则报错
this.onEmitErrorTips(); this.onEmitErrorTips();
}; };
/** 不可切换光照提示 */
/**
* @name
* @description isCabinMode 0. 1.
*/
onEmitErrorTips = async () => { onEmitErrorTips = async () => {
let { isStandStatus, ActiveModeItem } = this.state; let { isStandStatus, ActiveModeItem } = this.state;
if (isStandStatus) { if (isStandStatus) {
@ -612,9 +625,7 @@ class IotCarePlan extends Component<any, any> {
}; };
// 绘制能量图 // 绘制能量图
drawProwerPicture() { drawProwerPicture() {}
}
/** 切换光照 */ /** 切换光照 */
onSwitchChange = async () => { onSwitchChange = async () => {
@ -642,38 +653,76 @@ class IotCarePlan extends Component<any, any> {
/** 蓝牙相关 */ /** 蓝牙相关 */
switchBLEMatch = (jsonStatus: any) => { switchBLEMatch = (jsonStatus: any) => {
console.log("蓝牙相关", jsonStatus); console.log("蓝牙相关", jsonStatus);
let { ActiveModeItem } = this.state;
switch (jsonStatus.bleCommandType) { switch (jsonStatus.bleCommandType) {
// 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。 // 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。
case "SendMatchCode": case "SendMatchCode":
if (jsonStatus.matchedSuccess) { if (jsonStatus.matchedSuccess) {
console.log("设备配对成功"); console.log("设备配对成功");
this.setState({ this.setState({
facialMaskConnectStatus: true, facialMaskConnectStatus: 1,
}); });
// log.info(commandMap.WL200Command, "配对成功");
} }
break; break;
// 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了 // 设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了
case "BleStatusSync": case "BleStatusSync":
console.log("BleStatusSync 附属设备状态主动上报", jsonStatus); console.log("BleStatusSync 附属设备状态主动上报", jsonStatus);
switch (jsonStatus.connectMessage?.deviceName) { switch (jsonStatus.connectMessage?.deviceName) {
case "WL200":
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
} else {
// 清除时间倒计时定时器
this.setState({
facialMaskConnectStatus: 0, // 蓝牙断开
isFooterBtnDisabled: false, // 蓝牙断开所以不可点击
});
// 断开连接直接暂停
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
ActiveModeItem?.modeType
);
// 设备断开时,给定一个断开时间
ActiveModeItem.breakTimeStr = this.state.currentTime;
}
break;
// 附属设备是否连接支架 // 附属设备是否连接支架
case "Stand": case "Stand":
if (jsonStatus.connectMessage?.connectType == "CONNECTED") { if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
console.log("舱体支架连接");
this.setState({ this.setState({
isStandStatus: true, isStandStatus: true,
isCanClick: this.state.ActiveModeItem?.isCabinMode === 1,
}); });
if (!this.state.isStandStatus && this.isRuning) {
// 断开连接直接暂停
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
ActiveModeItem?.modeType
);
}
} else { } else {
console.log("舱体支架断开连接"); console.log("舱体支架断开连接");
if (this.state.isStandStatus && this.isRuning) {
// 断开连接直接暂停
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
ActiveModeItem?.modeType
);
}
// 设备断开时,给定一个断开时间
ActiveModeItem.breakTimeStr = this.state.currentTime;
this.setState({ this.setState({
isStandStatus: false, isStandStatus: false,
isCanClick: this.state.ActiveModeItem?.isCabinMode !== 1, isStopNurse: true,
ActiveModeItem,
}); });
} }
break; break;
default: default:
console.log("监听到到设备连接状态改变 this.footerIsDisabled()");
this.footerIsDisabled(); // 判断底部运行按钮是否可点击
break; break;
} }
break; break;
@ -687,9 +736,6 @@ class IotCarePlan extends Component<any, any> {
console.log("支架是否链接", isStandDevice); console.log("支架是否链接", isStandDevice);
this.setState({ this.setState({
isStandStatus: isStandDevice, isStandStatus: isStandDevice,
isCanClick: isStandDevice
? this.state.ActiveModeItem?.isCabinMode === 1
: this.state.ActiveModeItem?.isCabinMode !== 1,
}); });
// 连上面罩后, 获取仪器记录, 与缓存信息对比 // 连上面罩后, 获取仪器记录, 与缓存信息对比
@ -754,25 +800,34 @@ class IotCarePlan extends Component<any, any> {
"设备主动上报给小程序的指令 一般是工作状态改变", "设备主动上报给小程序的指令 一般是工作状态改变",
jsonStatus jsonStatus
); );
this.workStatus = jsonStatus.workStatus; this.workStatus = jsonStatus.workStatus;
this.setState({ this.setState({
Electricity: jsonStatus.battery, Electricity: jsonStatus.battery,
// fr200Electricity: jsonStatus.battery, // fr200Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery, matrixElectricity: jsonStatus.matrixBattery,
workMode: jsonStatus?.workMode,
}); });
// 判断是否在step == 2(护理中)
if ( if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) {
this.state.step == 2 && this.setState({
jsonStatus.workStatus !== MODE_WORKING_ENUM.END workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
) { });
this.updateDeviceSyncData(
{ // 判断是否在step == 2(护理中)
totalWorkingMinutes: jsonStatus.totalWorkingMinutes, // 仅当设备模式与小程序是否一致,才允许更改设备运行时间
totalWorkingSeconds: jsonStatus.totalWorkingSeconds, if (
}, this.state.facialMaskConnectStatus === 1 &&
jsonStatus this.state.step == 2 &&
); jsonStatus.workStatus !== MODE_WORKING_ENUM.END
) {
this.updateDeviceSyncData(
{
totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
},
jsonStatus
);
}
} }
if ( if (
@ -948,8 +1003,7 @@ class IotCarePlan extends Component<any, any> {
* params * params
*/ */
judgementWorkStatus(nWorkStatus, nWorkMode) { judgementWorkStatus(nWorkStatus, nWorkMode) {
const { step, isStandStatus, workMode, ActiveModeItem, ModeList } = const { step, workMode, ActiveModeItem, ModeList } = this.state;
this.state;
const opts: any = {}; const opts: any = {};
// ActiveModeItem // ActiveModeItem
let nowModeItem; let nowModeItem;
@ -1022,7 +1076,7 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
isShowCountdown: false, isShowCountdown: false,
hadShowBreakTips: false hadShowBreakTips: false,
}); });
}, },
pause: () => { pause: () => {
@ -1067,7 +1121,7 @@ class IotCarePlan extends Component<any, any> {
if (isAuto == true) { if (isAuto == true) {
// 仪器自动上报完成, 直接上报并跳转报告页 // 仪器自动上报完成, 直接上报并跳转报告页
clearInterval(currentTimeTimer); clearInterval(currentTimeTimer);
const isEnough = this.checkNurseTime(); const isEnough = this.isCheckNurseTime();
if (isEnough) { if (isEnough) {
this.saveNurseReport(true, "endnursing"); this.saveNurseReport(true, "endnursing");
} }
@ -1090,16 +1144,25 @@ class IotCarePlan extends Component<any, any> {
ModeStepIndex, ModeStepIndex,
ActiveModeItem, ActiveModeItem,
} = this.state; } = this.state;
console.log("resetTimer workStatus", this.workStatus);
if ( if (
this.workStatus == MODE_WORKING_ENUM.WORKING && this.workStatus == MODE_WORKING_ENUM.WORKING &&
step == 2 && step == 2 &&
facialMaskConnectStatus == 1 facialMaskConnectStatus == 1
) { ) {
let totalSeconds = minSecToS(ActiveModeItem.modeTimeStr); let totalSeconds = minSecToS(ActiveModeItem.modeTimeStr);
let currentSeconds = minSecToS(currentTime); // 现在的倒计时剩余时间:同步时检查是否断开重连,如果是,则使用断开的剩余时长,进行倒计时计算
let currentSeconds = ActiveModeItem?.breakTimeStr
? minSecToS(ActiveModeItem.breakTimeStr)
: minSecToS(currentTime);
let checkTime = totalSeconds - currentSeconds; let checkTime = totalSeconds - currentSeconds;
this.elapsedTime = checkTime; this.elapsedTime = checkTime;
// 完成重连同步则删除重连时间字段
if (ActiveModeItem?.breakTimeStr) {
delete ActiveModeItem?.breakTimeStr;
this.setState({ ActiveModeItem });
}
// 判断剩余时间是否大于1
if (currentSeconds >= 1) { if (currentSeconds >= 1) {
// 小程序显示倒计时 // 小程序显示倒计时
this.setState({ this.setState({
@ -1130,6 +1193,8 @@ class IotCarePlan extends Component<any, any> {
currentServiceData currentServiceData
); );
this.updateWL200NursingHistory(currentServiceData);
this.setState({ this.setState({
ModeStepIndex: index, ModeStepIndex: index,
currentServiceData, currentServiceData,
@ -1197,6 +1262,8 @@ class IotCarePlan extends Component<any, any> {
* *
*/ */
onNursingTap() { onNursingTap() {
// 如果已禁止运行,则停止执行后续逻辑
if (this.state.isFooterBtnDisabled) return;
// 防止多次点击 // 防止多次点击
if (this.state.hadClickStart) return; if (this.state.hadClickStart) return;
this.setState({ this.setState({
@ -1268,7 +1335,7 @@ class IotCarePlan extends Component<any, any> {
// 结束护理 // 结束护理
endNurseFun() { endNurseFun() {
this.handleWorkStatus(false, "end"); this.handleWorkStatus(false, "end");
if (this.checkNurseTime()) { if (this.isCheckNurseTime()) {
this.PostNursingLogClock(); this.PostNursingLogClock();
} else { } else {
// 时间不满足,回到主页 // 时间不满足,回到主页
@ -1280,21 +1347,8 @@ class IotCarePlan extends Component<any, any> {
} }
} }
// 手动切换护理
hanldeChangeNurseFun() {
// 满足时间条件,提示是否保存部分护理记录
if (this.checkNurseTime()) {
// 打开提示保存护理弹窗
this.setState({
isShowTipsSave: true,
});
} else {
// 不满足条件,直接切换
}
}
/** 检查时间是否达标仪器最低护理时间 */ /** 检查时间是否达标仪器最低护理时间 */
checkNurseTime() { isCheckNurseTime() {
const { currentDevice, ActiveModeItem } = this.state; const { currentDevice, ActiveModeItem } = this.state;
const currentScene = ActiveModeItem; const currentScene = ActiveModeItem;
let sceneTime = minSecToS(currentScene.modeTimeStr); let sceneTime = minSecToS(currentScene.modeTimeStr);
@ -1303,28 +1357,13 @@ class IotCarePlan extends Component<any, any> {
let nursingTimeStr = currentDevice?.nursingTimeStr; let nursingTimeStr = currentDevice?.nursingTimeStr;
let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间 let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间
console.log("检查已运行时间", timeRemaining, nursingTime);
if (timeRemaining >= nursingTime) { if (timeRemaining >= nursingTime) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
/** 检查时间是否达标仪器最低护理时间 */
isCheckNurseTime(deviceItem, ModeItem) {
const currentScene = ModeItem;
let sceneTime = minSecToS(currentScene.modeTimeStr);
const timeRemaining = sceneTime - minSecToS(this.state.currentTime); // 当前模式已运行时间
let nursingTimeStr = deviceItem?.nursingTimeStr;
let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间
if (timeRemaining >= nursingTime) {
return true;
} else {
return false;
}
}
/*** 护理记录 START ***/ /*** 护理记录 START ***/
/** 小程序查询护理记录 */ /** 小程序查询护理记录 */
getInstrumentHistoryData() { getInstrumentHistoryData() {
@ -1410,7 +1449,8 @@ class IotCarePlan extends Component<any, any> {
let totalSeconds = jsonStatus.totalSeconds; // 从仪器上获取的使用时间 let totalSeconds = jsonStatus.totalSeconds; // 从仪器上获取的使用时间
let neededTotalSeconds = jsonStatus.neededTotalSeconds; // 从仪器上获取的使用时间 let neededTotalSeconds = jsonStatus.neededTotalSeconds; // 从仪器上获取的使用时间
console.log( console.log(
"从仪器上获取的使用时间 neededTotalSeconds", "从仪器上获取的使用时间 totalSeconds: %d neededTotalSeconds: %d",
totalSeconds,
neededTotalSeconds neededTotalSeconds
); );
let nursingTimeStr = currentDevice?.nursingTimeStr; let nursingTimeStr = currentDevice?.nursingTimeStr;
@ -1481,6 +1521,32 @@ class IotCarePlan extends Component<any, any> {
Taro.setStorageSync("WL200NursingHistory", params); Taro.setStorageSync("WL200NursingHistory", params);
console.log("保存setWL200NursingHistory"); console.log("保存setWL200NursingHistory");
}; };
/** 更新WL200护理历史运行时间 */
updateWL200NursingHistory = (data: any = null) => {
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
if (this.WL200NursingHistory) {
let params: any = this.WL200NursingHistory;
params.currentTime = this.state.currentTime;
// 设置正确封面
if (data) {
params.currentServiceData = data;
} else {
let currentServiceData = {
startSource: "",
stopSource: "",
};
let serviceLength = this.state.ActiveModeItem.serviceData.length;
if (serviceLength > 0) {
currentServiceData = this.state.ActiveModeItem.serviceData[0];
}
params.currentServiceData = currentServiceData;
}
Taro.setStorageSync("WL200NursingHistory", params);
console.log("更新updateWL200NursingHistory");
}
};
/** 删除WL200护理历史 */ /** 删除WL200护理历史 */
rmWL200NursingHistory = (WL200NursingHistory, hard = false) => { rmWL200NursingHistory = (WL200NursingHistory, hard = false) => {
const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory"); const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
@ -1670,8 +1736,8 @@ class IotCarePlan extends Component<any, any> {
}); });
}; };
confirmEndBtn = () => { confirmEndBtn = () => {
console.log("confirmEndBtn", this.checkNurseTime()); console.log("confirmEndBtn", this.isCheckNurseTime());
if (this.checkNurseTime()) { if (this.isCheckNurseTime()) {
this.endNurseFun(); this.endNurseFun();
this.cancelEndBtn(); this.cancelEndBtn();
} else { } else {
@ -1736,14 +1802,60 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
isShowTipsSave: false, isShowTipsSave: false,
}); });
this.modeCurrentFun(this.tempModeCurrent, false); this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验
}; };
confirmTipsSave = async () => { confirmTipsSave = async () => {
this.setState({ this.setState({
isShowTipsSave: false, isShowTipsSave: false,
}); });
// isShowTipsSave
this.PostNursingLogClock(null, false); this.PostNursingLogClock(null, false);
this.modeCurrentFun(this.tempModeCurrent, false); this.modeCurrentFun(this.tempModeCurrent, true); // 不进行校验
};
/** 初次护理信息弹窗 */
firstNurseInfo = async () => {
let { currentDevice } = this.state;
let res = await InstrumentInfo.firstNurseInfo({
instrumentId: currentDevice.id,
});
if (res.data.code === 200) {
let isFirstTipShow = getStorageSync(
"first_instrument_" + currentDevice.id
);
if (!isFirstTipShow) {
// 首次进入页面:自动打开打卡介绍弹窗
this.setState({ nurseInfo: res.data.data, isFirstTipShow: true });
setStorageSync("first_instrument_" + currentDevice.id, true);
} else {
this.setState({ nurseInfo: res.data.data });
}
}
};
onTipShowOpen = async () => {
this.setState({ isFirstTipShow: true });
};
onTipShowClose = async () => {
setStorageSync("first_instrument_" + this.state.currentDevice.id, "true");
this.setState({ isFirstTipShow: false });
};
/** 初次护理信息弹窗 END */
/**
* @name
* @description
* @returns true
*/
footerIsDisabled = () => {
let { isStandStatus } = this.state;
let isCanClick = isStandStatus
? this.tempModeCurrent?.isCabinMode === 1
: this.tempModeCurrent?.isCabinMode === 0;
let isFooterBtnDisabled = !(isStandStatus === isCanClick);
this.setState({
isFooterBtnDisabled: isFooterBtnDisabled,
});
return isFooterBtnDisabled; // 数据更新有延迟,返回用于判断
}; };
render() { render() {
@ -1778,6 +1890,10 @@ class IotCarePlan extends Component<any, any> {
currentDevice, currentDevice,
isConnectionBlutoot, isConnectionBlutoot,
isShowTipsSave, isShowTipsSave,
isFirstTipShow,
nurseInfo,
isShowReReadRecordSave,
isFooterBtnDisabled,
} = this.state; } = this.state;
return ( return (
@ -1785,6 +1901,14 @@ class IotCarePlan extends Component<any, any> {
<Navbar titleSlot={title} isBack /> <Navbar titleSlot={title} isBack />
<View catchMove> <View catchMove>
<PopupInstrumentUploadTips
isShow={isFirstTipShow}
title="打卡介绍"
data={nurseInfo}
close={this.onTipShowClose}
confirm={this.onTipShowClose}
/>
<PopupCountdown isShow={isShowCountdown} countdown={countdown} /> <PopupCountdown isShow={isShowCountdown} countdown={countdown} />
<PopupConfirm <PopupConfirm
@ -1817,9 +1941,9 @@ class IotCarePlan extends Component<any, any> {
onEmitShowAll={this.openModeSwitch} onEmitShowAll={this.openModeSwitch}
/> />
} }
textAlgin='center' textAlgin="center"
cancelButtonText='取消' cancelButtonText="取消"
confirmButtonText='确定' confirmButtonText="确定"
close={this.cancelModeSwitchBtn} close={this.cancelModeSwitchBtn}
confirm={this.confirmModeSwitchBtn} confirm={this.confirmModeSwitchBtn}
/> />
@ -1859,7 +1983,7 @@ class IotCarePlan extends Component<any, any> {
confirm={this.closeErrorTipsText} confirm={this.closeErrorTipsText}
/> />
<PopupAlert <PopupConfirm
isShow={isShowTipsSave} isShow={isShowTipsSave}
isClose isClose
zIndex={10020} zIndex={10020}
@ -1878,6 +2002,25 @@ class IotCarePlan extends Component<any, any> {
confirm={this.confirmTipsSave} 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 <PopupStatus
isShow={isShowNursingSuccess} isShow={isShowNursingSuccess}
isClose isClose
@ -1904,12 +2047,12 @@ class IotCarePlan extends Component<any, any> {
</View> </View>
<View> <View>
<View className='iot-main'> <View className="iot-main">
<View className='banner-box'> <View className="banner-box">
<View> <View>
{!isShowNurse && ( {!isShowNurse && (
<Video <Video
className='video-or-image' className="video-or-image"
src={ActiveModeItem.modeVideo} src={ActiveModeItem.modeVideo}
/> />
)} )}
@ -1918,12 +2061,12 @@ class IotCarePlan extends Component<any, any> {
<Block> <Block>
{isStopNurse ? ( {isStopNurse ? (
<Image <Image
className='video-or-image' className="video-or-image"
src={currentServiceData.stopSource} src={currentServiceData.stopSource}
/> />
) : ( ) : (
<Image <Image
className='video-or-image' className="video-or-image"
src={currentServiceData.startSource} src={currentServiceData.startSource}
/> />
)} )}
@ -1931,25 +2074,25 @@ class IotCarePlan extends Component<any, any> {
)} )}
{errorTips && ( {errorTips && (
<Block> <Block>
<View className='msg-tips'> <View className="msg-tips">
<Image <Image
className='msg-tips-img' className="msg-tips-img"
src={require("../../img/tips.png")} src={require("../../img/tips.png")}
/> />
<View className='msg-tips-content'>{errorTips}</View> <View className="msg-tips-content">{errorTips}</View>
</View> </View>
</Block> </Block>
)} )}
</View> </View>
<View className='iot-device'> <View className="iot-device">
<View className='item'> <View className="item">
<Text className='device-time'> <Text className="device-time">
<Text className='time'>{currentTime}</Text> <Text className="time">{currentTime}</Text>
</Text> </Text>
</View> </View>
<View className='line' /> <View className="line" />
<ElectricityView <ElectricityView
Electricity={Electricity} Electricity={Electricity}
matrixElectricity={matrixElectricity} matrixElectricity={matrixElectricity}
@ -1977,11 +2120,11 @@ class IotCarePlan extends Component<any, any> {
ActiveModeItem={ActiveModeItem} ActiveModeItem={ActiveModeItem}
/> />
<Echarts></Echarts> {/* <Echarts></Echarts> */}
</View> </View>
<Footer <Footer
isCanClick={isCanClick} isDisabled={isFooterBtnDisabled}
isShowNurse={isShowNurse} isShowNurse={isShowNurse}
isStopNurse={isStopNurse} isStopNurse={isStopNurse}
onEmitStartNurse={this.onStartNurse} onEmitStartNurse={this.onStartNurse}
@ -1990,10 +2133,7 @@ class IotCarePlan extends Component<any, any> {
onEmitErrorTips={this.onEmitErrorTips} onEmitErrorTips={this.onEmitErrorTips}
/> />
</View> </View>
<Block id='ccccc' style={{ width: '300px', height: '300px' }}>66666666666666666666</Block> </Block>
<Block id='myBox' style={{ width: '300px', height: '300px' }}></Block>
</Block >
); );
} }
} }

@ -104,7 +104,7 @@ export default class Recording extends Component<any, any> {
let res = await InstrumentInfo.apiClock.getLatestClockRecord(); let res = await InstrumentInfo.apiClock.getLatestClockRecord();
if (res.data.code === 200) { if (res.data.code === 200) {
if (!res.data.data) { if (!res.data.data) {
this.setShow(true); // this.setShow(true);
} else { } else {
let punchInInfo = { let punchInInfo = {
clockImageList: res.data.data.clockImg, clockImageList: res.data.data.clockImg,

@ -55,7 +55,9 @@ class Register extends Component<any, any> {
url: "/pages/index/index", url: "/pages/index/index",
}); });
}; };
back() { skipRegister() {
// 跳过注册
Taro.setStorageSync("skipRegister", true);
Taro.navigateBack({ Taro.navigateBack({
delta: 1, delta: 1,
}); });
@ -210,7 +212,7 @@ class Register extends Component<any, any> {
> >
</Button> </Button>
<View className="text" onClick={this.back}> <View className="text" onClick={this.skipRegister}>
&gt; &gt;
</View> </View>
</View> </View>

Loading…
Cancel
Save