fix:bug修复

master
blak-kong 2 years ago
parent 0f0bca2771
commit b426251c83

@ -61,8 +61,8 @@
"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(); // 具体页面自定义返回逻辑
} }
}; };

@ -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"

@ -115,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 });
}; };

@ -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);
@ -176,7 +180,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 +213,18 @@ class IotCarePlan extends Component<any, any> {
isShowNursingSuccess: false, // 护理成功弹窗 isShowNursingSuccess: false, // 护理成功弹窗
isShowTipsSave: false, // 切换模式时,提示是否保存部分护理记录 isShowTipsSave: false, // 切换模式时,提示是否保存部分护理记录
// 初次护理弹窗
isFirstTipShow: false,
nurseInfo: [],
// 上一次护理记录未生成,是否继续连接设备
isShowReReadRecordConnect: false,
}; };
} }
// 不涉及渲染的页面变量 // 不涉及渲染的页面变量
isRuning: any = false; // 设备是否运行中
jsonStatus: any = {}; // 同步设备返回数据,用于结束 jsonStatus: any = {}; // 同步设备返回数据,用于结束
tempModeCurrent: any = {}; // 临时保存的当前模式 tempModeCurrent: any = {}; // 临时保存的当前模式
elapsedTime: any = 0; // 设备已运行时间 elapsedTime: any = 0; // 设备已运行时间
@ -231,7 +243,7 @@ class IotCarePlan extends Component<any, any> {
} }
componentDidMount() {} componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
componentDidShow() { componentDidShow() {
console.log("页面显示了"); console.log("页面显示了");
@ -266,9 +278,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 +293,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 +332,6 @@ class IotCarePlan extends Component<any, any> {
return option; return option;
} }
async init() { async init() {
// 查询自定义设备指令 // 查询自定义设备指令
const queryInstructionParams = { const queryInstructionParams = {
@ -419,9 +426,10 @@ class IotCarePlan extends Component<any, any> {
/** 选中护理模式 */ /** 选中护理模式 */
modeCurrentFun = async (data, isNotCheck = false) => { modeCurrentFun = async (data, isNotCheck = false) => {
// 是否跳过护理检查 // 护理检查改变模式,是否提示切换护理模式
// isNotCheck为真时不进行校验直接切换
this.tempModeCurrent = data;
if (!isNotCheck) { if (!isNotCheck) {
this.tempModeCurrent = data;
let isReturn = this.modeRuningChange(); let isReturn = this.modeRuningChange();
if (isReturn) return; if (isReturn) return;
} }
@ -471,7 +479,7 @@ class IotCarePlan extends Component<any, any> {
this.onStartNurse(); this.onStartNurse();
setTimeout(() => { setTimeout(() => {
this.onNursingTap(); this.onNursingTap();
}, 1000); }, 800);
} }
}; };
/** 设备运行中切换模式 */ /** 设备运行中切换模式 */
@ -482,23 +490,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 +540,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],
@ -612,9 +625,7 @@ class IotCarePlan extends Component<any, any> {
}; };
// 绘制能量图 // 绘制能量图
drawProwerPicture() { drawProwerPicture() {}
}
/** 切换光照 */ /** 切换光照 */
onSwitchChange = async () => { onSwitchChange = async () => {
@ -650,7 +661,6 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
facialMaskConnectStatus: true, facialMaskConnectStatus: true,
}); });
// log.info(commandMap.WL200Command, "配对成功");
} }
break; break;
@ -661,15 +671,32 @@ class IotCarePlan extends Component<any, any> {
// 附属设备是否连接支架 // 附属设备是否连接支架
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, isCanClick: this.state.ActiveModeItem?.isCabinMode === 1,
}); });
if (!this.state.isStandStatus && this.isRuning) {
// 断开连接直接暂停
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
this.state.ActiveModeItem?.modeType
);
}
} else { } else {
console.log("舱体支架断开连接"); console.log("舱体支架断开连接");
if (this.state.isStandStatus && this.isRuning) {
// 断开连接直接暂停
this.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
this.state.ActiveModeItem?.modeType
);
}
this.setState({ this.setState({
isStandStatus: false, isStandStatus: false,
isCanClick: this.state.ActiveModeItem?.isCabinMode !== 1, isCanClick: this.state.ActiveModeItem?.isCabinMode !== 1,
isStopNurse: true,
}); });
} }
break; break;
@ -948,8 +975,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 +1048,7 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
isShowCountdown: false, isShowCountdown: false,
hadShowBreakTips: false hadShowBreakTips: false,
}); });
}, },
pause: () => { pause: () => {
@ -1067,7 +1093,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,7 +1116,6 @@ 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 &&
@ -1268,7 +1293,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 +1305,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 +1315,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() {
@ -1670,8 +1667,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,15 +1733,44 @@ 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 */
render() { render() {
let { let {
@ -1778,6 +1804,9 @@ class IotCarePlan extends Component<any, any> {
currentDevice, currentDevice,
isConnectionBlutoot, isConnectionBlutoot,
isShowTipsSave, isShowTipsSave,
isFirstTipShow,
nurseInfo,
isShowReReadRecordSave,
} = this.state; } = this.state;
return ( return (
@ -1785,6 +1814,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 +1854,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 +1896,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 +1915,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 +1960,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 +1974,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 +1987,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,7 +2033,7 @@ class IotCarePlan extends Component<any, any> {
ActiveModeItem={ActiveModeItem} ActiveModeItem={ActiveModeItem}
/> />
<Echarts></Echarts> {/* <Echarts></Echarts> */}
</View> </View>
<Footer <Footer
@ -1990,10 +2046,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