临时提交,准备合并

master
blak-kong 2 years ago
parent 474dfe2637
commit 40f33ed5a6

@ -24,6 +24,9 @@ class App extends Component<PropsWithChildren> {
return;
}
// 每次进入小程序,删除可能残留的同步状态
Taro.removeStorageSync("isSyncHistory");
// go("/pages/iotCarePlan/iotCarePlan");
// go("/pages/instrument_clickin_upload/index");
// go("/pages/instrument/intro");

@ -22,7 +22,7 @@ function Index({ isShowNurse, ActiveModeItem }: Props) {
<View className="modelInfo-title"></View>
<View className="modelInfo-effect">{ActiveModeItem.modeDesc}</View>
</View>
{ActiveModeItem.combineData.length > 0 && (
{ActiveModeItem?.combineData && (
<View className="modelInfo-line">
<View className="modelInfo-title"></View>
<View className="modelInfo-light-box">

@ -209,6 +209,8 @@ class IotCarePlan extends Component<any, any> {
// 按钮是否不可运行
isFooterBtnDisabled: true,
// isFirstEntryMode: false, // 模式首次打开
isShowHistoryMsg: false, // 是否显示正在同步历史
};
}
@ -260,6 +262,7 @@ class IotCarePlan extends Component<any, any> {
if (obj) {
this.setState({
currentDevice: obj,
title: obj.name,
});
await this.GetModeList(obj.id);
@ -377,7 +380,7 @@ class IotCarePlan extends Component<any, any> {
// this.modeCurrentFun(res.data.data[0]);
// }, 100);
} else {
this.setState({ ModeList: res.data.data });
this.setState({ ModeList: [] });
}
}
};
@ -797,6 +800,13 @@ class IotCarePlan extends Component<any, any> {
jsonStatus
);
this.workStatus = jsonStatus.workStatus;
this.setState({
Electricity: jsonStatus.battery,
// fr200Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery,
});
// 判断设备主动上报的关机事件
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
// 判断id是否一致, 一致的话则生成护理报表, 并提示
@ -810,13 +820,6 @@ class IotCarePlan extends Component<any, any> {
return;
}
this.workStatus = jsonStatus.workStatus;
this.setState({
Electricity: jsonStatus.battery,
// fr200Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery,
});
if (jsonStatus?.workMode === this.state.ActiveModeItem.modeType) {
this.setState({
workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
@ -1444,6 +1447,12 @@ class IotCarePlan extends Component<any, any> {
await sleep(2);
}
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) {
this.setState({ isShowHistoryMsg: false });
Taro.removeStorageSync("isSyncHistory");
}
// 2.判断是否已存在缓存的护理记录:如果没有历史,则缓存
let workStatus = this.workStatus;
let WL200NursingHistory = this.WL200NursingHistory;
@ -1541,10 +1550,16 @@ class IotCarePlan extends Component<any, any> {
/** 获取小程序本地缓存的历史记录 */
getWL200NursingHistory() {
this.WL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
// 同步历史记录
if (this.state.isSyncHistory) {
// 同步历史记录
this.setState({});
// 是否同步历史记录
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) {
// 直接进入开始护理状态
this.setState({
isShowNurse: true,
isShowHistoryMsg: true,
});
}
}
/** 设置WL200护理历史 */
@ -1980,6 +1995,7 @@ class IotCarePlan extends Component<any, any> {
nurseInfo,
isShowReReadRecordSave,
isFooterBtnDisabled,
isShowHistoryMsg,
} = this.state;
return (
@ -2120,6 +2136,10 @@ class IotCarePlan extends Component<any, any> {
)}
</View>
{isShowHistoryMsg && (
<View className="sync-history-msg">...</View>
)}
<View>
<View className="iot-main">
<View className="banner-box">
@ -2189,10 +2209,12 @@ class IotCarePlan extends Component<any, any> {
/>
)}
<ModeContent
isShowNurse={isShowNurse}
ActiveModeItem={ActiveModeItem}
/>
{ActiveModeItem.combineData && (
<ModeContent
isShowNurse={isShowNurse}
ActiveModeItem={ActiveModeItem}
/>
)}
{/* <Echarts></Echarts> */}
</View>

@ -417,8 +417,6 @@ class Index extends Component<any, any> {
};
gourl = (e) => {
const { url } = e.currentTarget.dataset;
if (this.isRegister()) {
go(url);
@ -481,11 +479,11 @@ class Index extends Component<any, any> {
mask: true,
});
let { data: res } = await InstrumentInfo.bindingInstrumentList();
console.log(res,'查看绑定的设备');
console.log(res, "查看绑定的设备");
// Taro.hideLoading();
if (res.code === 200) {
if(res.data.length === 0){
if (res.data.length === 0) {
this.setState({ ViewAddInstrument: false });
}
this.setState({ instrumentList: res.data });
@ -752,7 +750,6 @@ class Index extends Component<any, any> {
// 跳转仪器介绍页
goNursing = (item) => {
if (item.status === 0) {
setStorageSync("instrument_detail", item);
this.setState({ connectInstrument: item });
@ -768,7 +765,6 @@ class Index extends Component<any, any> {
/** 蓝牙逻辑 */
bindBlockLeft() {
if (!this.state.isRegisterBoolean) {
//未注册授权
this.alertRegister();
@ -927,6 +923,7 @@ class Index extends Component<any, any> {
let item = getStorageSync("instrument_detail");
this.setState({ connectInstrument: item });
setTimeout(() => this.bindBlockLeft());
Taro.setStorageSync("isSyncHistory", true);
};
// 扫码绑定必须先完成注册弹窗:确定以后删除扫码缓存,防止死循环

@ -385,7 +385,6 @@ export default class Instrument extends Component<any, any> {
let { data } = await InstrumentInfo.exchangeBinding({
serial: channelInfo.serialCode,
});
console.log("exchangeBinding", data);
Taro.hideLoading();
this.closeBinding();
if (data.code === 200) {

Loading…
Cancel
Save