临时提交

master
blak-kong 2 years ago
parent 67d6d9fb88
commit 9b6a4077e2

@ -533,7 +533,7 @@ class ConnectionBluetoot extends Component<any, any> {
let currentDevicesName = getStorageSync("currentDevicesName"); let currentDevicesName = getStorageSync("currentDevicesName");
let deviceVersionNo = jsonStatus.versionNo; let deviceVersionNo = jsonStatus.versionNo;
let latestVersionNo = deviceInfo.iotVersion; let latestVersionNo = deviceInfo.iotVersion;
if (currentDevicesName.indexOf("12CAA") < -1) { if (currentDevicesName.indexOf("12CAA") === -1) {
latestVersionNo = deviceInfo.we200IotVersion; latestVersionNo = deviceInfo.we200IotVersion;
} }
// 判断版本号是否需要升级 // 判断版本号是否需要升级
@ -541,9 +541,14 @@ class ConnectionBluetoot extends Component<any, any> {
deviceVersionNo, deviceVersionNo,
latestVersionNo latestVersionNo
); );
console.log("isNeedToUpdateBl", isNeedToUpdateBl);
if (isNeedToUpdateBl) { if (isNeedToUpdateBl) {
// 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗 // 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗
this.props.upgradeFun(); this.props.upgradeFun();
} else {
// 不需要升级,跳转进入仪器详情页
if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
this.pairingChange(this.state);
} }
break; break;
case "offlineClockSummary": case "offlineClockSummary":
@ -648,6 +653,7 @@ class ConnectionBluetoot extends Component<any, any> {
const value = this.isWL200() const value = this.isWL200()
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any) ? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any); : deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
sendCommand({ value }); sendCommand({ value });
} }
} }
@ -807,9 +813,6 @@ class ConnectionBluetoot extends Component<any, any> {
case 10000: case 10000:
errorText = "未初始化蓝牙适配器"; errorText = "未初始化蓝牙适配器";
break; break;
case 10000:
errorText = "未初始化蓝牙适配器";
break;
case 10001: case 10001:
errorText = "当前蓝牙适配器不可用"; errorText = "当前蓝牙适配器不可用";
break; break;
@ -940,14 +943,13 @@ class ConnectionBluetoot extends Component<any, any> {
if (sendGetVersionTimerNum >= 10) { if (sendGetVersionTimerNum >= 10) {
// 超时未返回版本号 // 超时未返回版本号
if (isGetVersionTimer) clearTimeout(isGetVersionTimer); if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
console.log("超时未返回版本号 this.pairingChange", this.state); console.log("超时未返回版本号 this.pairingChange", this.state);
// this.pairingChange(this.state); // this.pairingChange(this.state);
} else { } else {
this.sendGetVersion(); this.sendGetVersion();
} }
} }
}, 600); }, 1000);
// 5秒后没有收到版本返回直接跳去护理页 // 5秒后没有收到版本返回直接跳去护理页
// if (isGetVersionTimer) clearTimeout(isGetVersionTimer); // if (isGetVersionTimer) clearTimeout(isGetVersionTimer);

@ -5,7 +5,7 @@ import { useState, useEffect } from "react";
import "./index.less"; import "./index.less";
interface Props { interface Props {
isConnectionBlutoot: boolean; isCanClick: boolean;
isShowNurse: boolean; isShowNurse: boolean;
isStopNurse: boolean; isStopNurse: boolean;
onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件 onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件
@ -13,7 +13,7 @@ interface Props {
onEmitEndPlan: Function; onEmitEndPlan: Function;
} }
function Index({ function Index({
isConnectionBlutoot, isCanClick,
isShowNurse, isShowNurse,
isStopNurse, isStopNurse,
onEmitStartNurse, onEmitStartNurse,
@ -37,7 +37,7 @@ function Index({
<View className="footer"> <View className="footer">
{!isShowNurse && ( {!isShowNurse && (
<Block> <Block>
{isConnectionBlutoot ? ( {isCanClick ? (
<View className="btn" onClick={onStartNurse}> <View className="btn" onClick={onStartNurse}>
</View> </View>

@ -57,8 +57,7 @@ import {
} from "@/utils/util"; } from "@/utils/util";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
const deviceToolKitInstanceWE100 = new DeviceToolKitWE100("WE100", "M01"); const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200");
let currentTimeTimer: any = null; // 当前项目时间定时器 let currentTimeTimer: any = null; // 当前项目时间定时器
let CountdownTimer: any = null; let CountdownTimer: any = null;
@ -70,22 +69,6 @@ let switchModeStatus = "free"; // 用于标记是否在切换模式中, free:
// 设备运行时间校准频率,每多少秒校准一次 // 设备运行时间校准频率,每多少秒校准一次
const TIME_CALIBRATION_FREQUENCY = 5; const TIME_CALIBRATION_FREQUENCY = 5;
// 模式类型
const WORK_MODE_NAME_ENUM = {
POWERFULSOOTHING: "powerfulSoothing",
STABILITY: "Stability",
BRIGHTEN: "Brighten",
FIRMSKIN: "FirmSkin",
MaskCustom: "MaskCustom",
BrightenStand: "BrightenStand",
FirmSkinStand: "FirmSkinStand",
SmallpoxSoothingPro: "SmallpoxSoothingPro",
SmallpoxSoothing: "SmallpoxSoothing",
MixNursePro: "MixNursePro",
MixNurse: "MixNurse",
ScalpCare: "ScalpCare",
};
// 组合模式:分别对应的是哪几个模式类型 // 组合模式:分别对应的是哪几个模式类型
// 黄光590nm // 黄光590nm
// 红光630nm // 红光630nm
@ -114,12 +97,12 @@ const MODE_WORKING_ENUM = {
END: "end", END: "end",
}; };
// 倒计时时间 // 不同模式启动前的倒计时时间
let CountDownTime = { let CountDownTime = {
powerfulSoothing: 6, powerfulSoothing: 6,
Stability: 4, Stability: 3,
Brighten: 4, Brighten: 3,
FirmSkin: 4, FirmSkin: 3,
MaskCustom: 6, MaskCustom: 6,
BrightenStand: 6, BrightenStand: 6,
FirmSkinStand: 6, FirmSkinStand: 6,
@ -134,7 +117,7 @@ let DeviceSyncData = {
totalWorkingMinutes: 0, totalWorkingMinutes: 0,
totalWorkingSeconds: 0, totalWorkingSeconds: 0,
}; };
let deviceToolKitInstance = deviceToolKitInstanceWE100; // we100 let deviceToolKitInstance = deviceToolKitInstanceWL200;
class IotCarePlan extends Component<any, any> { class IotCarePlan extends Component<any, any> {
constructor(props) { constructor(props) {
@ -142,20 +125,18 @@ class IotCarePlan extends Component<any, any> {
this.state = { this.state = {
name: "iotCarePlan", name: "iotCarePlan",
title: "美容仪名字", // 页面标题 title: "美容仪名字", // 页面标题
instrument: "WE200", // 当前设备
currentDevice: { currentDevice: {
name: "", name: "",
model: "", model: "",
}, // 当前设备 },
/** 连接设备 */ /** 连接设备 */
hasVersion: false, // 是否已查询到版本号 hasVersion: false, // 是否已查询到版本号
curDeviceInfo: {}, // 当前设备信息
basicModeList: [], //模式列表 basicModeList: [], //模式列表
modelActiveIndex: 0, //模式下标 modelActiveIndex: 0, //模式下标
sliderProgress: 22, sliderProgress: 22,
isStandStatus: false, // 支架开启状态(支架就是舱体) facialMaskConnectStatus: 1, // 面罩连接状态 0未连接 1已连接
facialMaskConnectStatus: 0, // 面罩连接状态 0未连接 1已连接
workStatus: "", // 工作状态 workStatus: "", // 工作状态
Electricity: 4, // WL200电量 Electricity: 4, // WL200电量
matrixElectricity: 4, // WE200发箍电量 matrixElectricity: 4, // WE200发箍电量
@ -164,10 +145,7 @@ class IotCarePlan extends Component<any, any> {
gear: { gear: 1 }, gear: { gear: 1 },
currentShowDialog: "", currentShowDialog: "",
// countdown: 3, // 倒计时
step: 1, // 1:选择模式并播放视频, 2:护理中 step: 1, // 1:选择模式并播放视频, 2:护理中
isCheckedMaskVersion: false, // 是否检查过固件版本了
isAskedOta: false, // 询问过用户是否需要OTA
showVideoPlayBtn: true, // 视频播放按钮 showVideoPlayBtn: true, // 视频播放按钮
duration: 0, // 视频总时长 duration: 0, // 视频总时长
hadShowBreakTips: false, // 是否展示过支架断开提示 hadShowBreakTips: false, // 是否展示过支架断开提示
@ -175,12 +153,15 @@ class IotCarePlan extends Component<any, any> {
/** 连接设备 End */ /** 连接设备 End */
/** 护理过程 */
isStandStatus: false, // 当前模式是否舱体/支架模式
isShowStepTips: false, // 是否显示介绍步骤弹窗 isShowStepTips: false, // 是否显示介绍步骤弹窗
isConnectionBlutoot: false, // 是否已连接蓝牙 isConnectionBlutoot: true, // 是否已连接蓝牙
isShowNurse: false, // 是否开始并显示护理 isShowNurse: false, // 是否开始并显示护理
isStopNurse: false, // 是否暂停护理 isStopNurse: false, // 是否暂停护理
isEndNurse: false, // 是否结束护理 isEndNurse: false, // 是否结束护理
errorTips: "", // 错误提示 errorTips: "", // 错误提示
/** 护理过程 END*/
// 模式列表 // 模式列表
isSwitchActiveMode: false, // 是否显示弹窗切换模式 isSwitchActiveMode: false, // 是否显示弹窗切换模式
@ -198,21 +179,20 @@ class IotCarePlan extends Component<any, any> {
startSource: "", startSource: "",
stopSource: "", stopSource: "",
}, },
// 模式组合 // 模式组合
isCombineSuccess: false, // 组合模式是否设置成功 isCombineSuccess: false, // 组合模式是否设置成功
// 倒计时 // 倒计时
isShowCountdown: false, // 倒计时弹窗 isShowCountdown: false, // 倒计时弹窗
countdown: 3, countdown: 3,
// 是否结束护理 // 是否结束护理
isEndCarePlan: false, isEndCarePlan: false,
// 最后执行步骤位置 // 最后执行步骤位置
endPlace: "", endPlace: "",
currentTime: "01:00", currentTime: "01:00",
}; };
} }
hadGotInstrumentHistoryData = false; // 已缓存仪器历史数据
async onLoad() { async onLoad() {
// 保持屏幕常亮 // 保持屏幕常亮
@ -244,7 +224,7 @@ class IotCarePlan extends Component<any, any> {
currentDevice: info, currentDevice: info,
}); });
this.GetModeList(info.id); await this.GetModeList(info.id);
console.log("info"); console.log("info");
// 如果不存在设备模式值,则判断为首次进入,弹窗提示 // 如果不存在设备模式值,则判断为首次进入,弹窗提示
@ -321,7 +301,9 @@ class IotCarePlan extends Component<any, any> {
ModeList: res.data.data, ModeList: res.data.data,
}); });
this.modeCurrentFun(res.data.data[0]); setTimeout(() => {
this.modeCurrentFun(res.data.data[0]);
});
} else { } else {
this.setState({ ModeList: res.data.data }); this.setState({ ModeList: res.data.data });
} }
@ -360,6 +342,17 @@ class IotCarePlan extends Component<any, any> {
/** 选中护理模式 */ /** 选中护理模式 */
modeCurrentFun = async (data) => { modeCurrentFun = async (data) => {
let { isStandStatus } = this.state;
// 舱体模式无法对应的时候,置灰开始按钮
let isCabinMode = data.isCabinMode === 1;
if (isStandStatus === isCabinMode) {
this.setState({ isCanClick: true });
} else {
this.setState({ isCanClick: false });
}
console.log("isStandStatus", isStandStatus, isCabinMode);
console.log("isStandStatus === isCabinMode", isStandStatus === isCabinMode);
let currentServiceData = { let currentServiceData = {
startSource: "", startSource: "",
stopSource: "", stopSource: "",
@ -431,22 +424,19 @@ class IotCarePlan extends Component<any, any> {
ModeType: modeArray[modeClass], ModeType: modeArray[modeClass],
isShowNurse: true, isShowNurse: true,
isStopNurse: true, isStopNurse: true,
isStandStatus: this.state.ActiveModeItem.isCabinMode === 1,
workStatus: "pause", workStatus: "pause",
step: 2, step: 2,
}); });
this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY); setTimeout(() => {
this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY);
});
}; };
/** 开始护理按钮:点击开始,页面进行到下一步 */ /** 开始护理按钮:点击开始,页面进行到下一步 */
onStartNurse = async () => { onStartNurse = async () => {
this.stepNext(); let { isCanClick } = this.state;
return; if (isCanClick) {
let { isConnectionBlutoot } = this.state;
if (isConnectionBlutoot) {
this.stepNext(); this.stepNext();
} else {
// todo 提示未连接蓝牙
} }
}; };
/** 切换光照 */ /** 切换光照 */
@ -474,6 +464,7 @@ class IotCarePlan extends Component<any, any> {
/** 蓝牙相关 */ /** 蓝牙相关 */
switchBLEMatch = (jsonStatus: any) => { switchBLEMatch = (jsonStatus: any) => {
console.log("蓝牙相关", jsonStatus);
switch (jsonStatus.bleCommandType) { switch (jsonStatus.bleCommandType) {
// 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。 // 如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。
case "SendMatchCode": case "SendMatchCode":
@ -485,39 +476,34 @@ class IotCarePlan extends Component<any, any> {
// 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了 // 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了
case "BleStatusSync": case "BleStatusSync":
console.log("BleStatusSync", jsonStatus);
switch (jsonStatus.connectMessage?.deviceName) { switch (jsonStatus.connectMessage?.deviceName) {
case "WL200": // 附属设备是否WL200
console.log( // case "WL200":
"BleStatusSync 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上", // console.log(
jsonStatus.connectMessage?.connectType == "CONNECTED" // "BleStatusSync 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上",
); // jsonStatus.connectMessage?.connectType == "CONNECTED"
if (jsonStatus.connectMessage?.connectType == "CONNECTED") { // );
// 已连接WL200 // if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
this.setState({ isConnectionBlutoot: true }); // // 已连接WL200
// this.setState({ isConnectionBlutoot: true });
// 附属设备连接成功,如何区分是哪个设备?
this.setState({ // // 附属设备连接成功,如何区分是哪个设备?
facialMaskConnectStatus: 1, // 面罩已连接 // this.setState({
}); // facialMaskConnectStatus: 1, // 面罩已连接
deviceToolKitInstance = deviceToolKitInstanceWL200; // });
console.log( // deviceToolKitInstance = deviceToolKitInstanceWL200;
"检查版本isCheckedMaskVersion", // } else {
this.state.isCheckedMaskVersion // // WL200连接失败
); // // deviceToolKitInstance = deviceToolKitInstanceWE100;
if (!this.state.isCheckedMaskVersion) { // // // TODO 护理中(step==2)时, 如果断开, 可能需要暂停
this.checkVersion(); // console.log("WL200连接失败或断开");
} // this.setState({
} else { // facialMaskConnectStatus: 0,
// WL200连接失败 // });
// deviceToolKitInstance = deviceToolKitInstanceWE100; // }
// // TODO 护理中(step==2)时, 如果断开, 可能需要暂停 // break;
console.log("WL200连接失败或断开"); // 附属设备是否连接支架
this.setState({
facialMaskConnectStatus: 0,
});
}
break;
// 是否附属设备是否连接支架
case "Stand": case "Stand":
if (jsonStatus.connectMessage?.connectType == "CONNECTED") { if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
this.setState({ this.setState({
@ -534,50 +520,28 @@ class IotCarePlan extends Component<any, any> {
case "QueryMatchStatus": case "QueryMatchStatus":
const isStandDevice = const isStandDevice =
jsonStatus?.subDeviceList?.includes("Stand") || false; jsonStatus?.subDeviceList?.includes("Stand") || false;
const isConnectedMask =
jsonStatus?.subDeviceList?.includes("WL200") || false;
deviceToolKitInstance = isConnectedMask deviceToolKitInstance = deviceToolKitInstanceWL200;
? deviceToolKitInstanceWL200
: deviceToolKitInstanceWE100;
console.log("连接and更改成功 deviceToolKitInstance", isConnectedMask);
if (!this.state.isCheckedMaskVersion && isConnectedMask) {
this.checkVersion(); // 检查版本
}
console.log("支架是否链接", isStandDevice); console.log("支架是否链接", isStandDevice);
console.log("面罩是否链接", isConnectedMask);
if (isConnectedMask) { this.setState({
this.setState({ isStandStatus: isStandDevice,
isConnectionBlutoot: true, });
facialMaskConnectStatus: 1,
// 连上面罩后, 获取仪器记录, 与缓存信息对比,
if (!this.hadGotInstrumentHistoryData) {
// 查询护理记录
this.getInstrumentHistoryData();
// 如果不延时, 无法获取到仪器状态
const queryDeviceArrayBuffer = deviceToolKitInstance.toBleCommand(
bleCommandSamples.queryDeviceStatus as any
);
console.log("发送查询设备指令 获取仪器状态");
sendCommand({
value: queryDeviceArrayBuffer,
}); });
} }
// 连上面罩后, 获取仪器记录, 与缓存信息对比,
// if (
// isConnectedMask &&
// !this.state.hadGotInstrumentHistoryData
// ) {
// // 如果不延时, 无法获取到仪器状态
// const queryDeviceArrayBuffer =
// deviceToolKitInstance.toBleCommand(
// bleCommandSamples.queryDeviceStatus as any
// );
// console.log("发送查询设备指令");
// sendCommand({
// value: queryDeviceArrayBuffer,
// });
// // 打开ota页面需要关闭
// // that.data.getInstrumentHistoryDataTimer = setTimeout(() => {
// // that.getInstrumentHistoryData();
// // }, 3000);
// }
// this.setData({
// isStandStatus: isStandDevice,
// facialMaskConnectStatus: `${isConnectedMask ? 1 : 0}`,
// // currentTime: this.data.standInfo.currentTime
// });
} }
}; };
@ -666,7 +630,7 @@ class IotCarePlan extends Component<any, any> {
switch (jsonStatus.infoQueryType) { switch (jsonStatus.infoQueryType) {
// 自定义模式设置 // 自定义模式设置
case "customModeSet": case "customModeSet":
console.log(">>>>>>>>>>>>>>>自定义模式>>>>>>>>>>>>>>>"); console.log(">>>>>>>>>>>>>>>设置自定义模式>>>>>>>>>>>>>>>");
console.log( console.log(
"InfoQuery customModeSet responseStatus=====>", "InfoQuery customModeSet responseStatus=====>",
jsonStatus jsonStatus
@ -681,28 +645,25 @@ class IotCarePlan extends Component<any, any> {
break; break;
// 自定义模式信息 // 自定义模式信息
case "customModeInfo": case "customModeInfo":
console.log(">>>>>>>>>>>>>>>查询自定义模式信息>>>>>>>>>>>>>>>");
console.log( console.log(
"InfoQuery customModeInfo responseStatus=====>", "InfoQuery customModeInfo responseStatus=====>",
jsonStatus jsonStatus
); );
break; break;
case "versionInfo": case "versionInfo":
console.log(
"InfoQuery versionInfo responseStatus=====>",
jsonStatus
);
if (jsonStatus.versionNo) {
// 清理计时器
if (checkVersionTimeout) clearTimeout(checkVersionTimeout);
if (this.state.hasVersion) return;
this.setState({
hasVersion: true,
});
}
break; break;
// 当前报告 // 当前报告
case "currentMaskReportInfo": case "currentMaskReportInfo":
// 每次切换模式并开始运行后生成一个新的自增ID
// commandType: "InfoQuery"
// createDate: ""
// gear: 0
// id: 73
// infoQueryType: "currentMaskReportInfo"
// neededTotalSeconds: 900
// totalSeconds: 0
// workMode: "BrightenStand"
console.log("当前面罩报告 currentMaskReportInfo", jsonStatus); console.log("当前面罩报告 currentMaskReportInfo", jsonStatus);
// if (!this.state.hadCheckReport) { // if (!this.state.hadCheckReport) {
// this.state.hadCheckReport = true; // this.state.hadCheckReport = true;
@ -750,35 +711,6 @@ class IotCarePlan extends Component<any, any> {
}); });
}; };
// 检查版本
checkVersion = () => {
this.sendCheckVersion();
this.setState({
isCheckedMaskVersion: true,
});
if (checkVersionTimeout) clearTimeout(checkVersionTimeout);
checkVersionTimeout = setTimeout(() => {
if (this.state.hasVersion) {
if (checkVersionTimeout) clearTimeout(checkVersionTimeout);
} else {
this.sendCheckVersion();
}
}, 600);
};
// 检查版本指令
sendCheckVersion = () => {
deviceToolKitInstance.setDebug(true);
// 加定时器查询版本
const queryVersion = deviceToolKitInstance.toBleCommand({
commandType: "InfoQuery",
infoQueryType: "versionInfo",
otaDeviceType: "WL200",
});
sendCommand({
value: queryVersion,
});
};
//待完善,以后同步设备数据到小程序的事件,在这个事件里判断是否需要更新页面(是否需要触发setData) //待完善,以后同步设备数据到小程序的事件,在这个事件里判断是否需要更新页面(是否需要触发setData)
updateDeviceSyncData = (newData, jsonStatus) => { updateDeviceSyncData = (newData, jsonStatus) => {
DeviceSyncData = { DeviceSyncData = {
@ -885,9 +817,9 @@ class IotCarePlan extends Component<any, any> {
this.setState({ this.setState({
isShowCountdown: false, isShowCountdown: false,
}); });
if (nowModeItem?.isStandMode && step == 2) { if (nowModeItem?.isCabinMode && step == 2) {
opts.currentTime = nowModeItem.modeTime; opts.currentTime = nowModeItem.modeTime;
} else if (!nowModeItem?.isStandMode && step == 2) { } else if (!nowModeItem?.isCabinMode && step == 2) {
// fix: 启动非支架模式倒计时时连上支架仪器的状态变为standby // fix: 启动非支架模式倒计时时连上支架仪器的状态变为standby
opts.step = 1; opts.step = 1;
} }
@ -956,7 +888,7 @@ class IotCarePlan extends Component<any, any> {
}, },
end: () => { end: () => {
// 仪器返回护理结束, 支架模式不需要了 // 仪器返回护理结束, 支架模式不需要了
// if (modeItem.isStandMode) { // if (modeItem.isCabinMode) {
// this.onPauseTap(); // this.onPauseTap();
// } // }
// 已进入了报告阶段, 防止重复进入, 主要防止在手动点击结束护理接收到仪器消息 // 已进入了报告阶段, 防止重复进入, 主要防止在手动点击结束护理接收到仪器消息
@ -1128,9 +1060,9 @@ class IotCarePlan extends Component<any, any> {
const sendParams = { const sendParams = {
...deviceCommandSamples.pause, ...deviceCommandSamples.pause,
workMode: ActiveModeItem.modeType, // 使用模式 workMode: ActiveModeItem.modeType, // 使用模式
// workMode: "MaskCustom",
workStatus: newWorkStatus, workStatus: newWorkStatus,
}; };
console.log("准备发送自定义指令", ActiveModeItem, sendParams);
const pauseArrayBuffer = deviceToolKitInstance.toBleCommand( const pauseArrayBuffer = deviceToolKitInstance.toBleCommand(
sendParams as any sendParams as any
); );
@ -1162,21 +1094,23 @@ class IotCarePlan extends Component<any, any> {
hadClickStart: false, hadClickStart: false,
}); });
}, 500); }, 500);
const { const {
ActiveModeItem, ActiveModeItem,
workStatus, workStatus,
isStandStatus, isStandStatus,
facialMaskConnectStatus, facialMaskConnectStatus,
customModeData,
} = this.state; } = this.state;
const modelActiveItem = ActiveModeItem;
// log.info( if (isStandStatus === 1 && ActiveModeItem.isCabinMode === 0) {
// commandMap.WL200Command, console.log("已连接舱体,只可选择舱体模式");
// "点击开始护理按钮", return;
// `当前模式: ${modelActiveIndex}`, }
// `当前面罩状态:${facialMaskConnectStatus}`, if (isStandStatus === 0 && ActiveModeItem.isCabinMode === 1) {
// `当前仪器模式:${workStatus}` console.log("未连接舱体!");
// ); return;
}
console.info( console.info(
commandMap.WL200Command, commandMap.WL200Command,
"点击开始护理按钮", "点击开始护理按钮",
@ -1184,7 +1118,7 @@ class IotCarePlan extends Component<any, any> {
`当前面罩状态:${facialMaskConnectStatus}`, `当前面罩状态:${facialMaskConnectStatus}`,
`当前仪器模式:${workStatus}` `当前仪器模式:${workStatus}`
); );
console.log(modelActiveItem); console.log(ActiveModeItem);
console.log("isStandStatus:" + isStandStatus); console.log("isStandStatus:" + isStandStatus);
console.log( console.log(
workStatus !== MODE_WORKING_ENUM.WORKING && workStatus !== MODE_WORKING_ENUM.WORKING &&
@ -1198,12 +1132,12 @@ class IotCarePlan extends Component<any, any> {
return; return;
} }
// 如果是强效舒缓,需要判断是否连接支架 // 如果是强效舒缓,需要判断是否连接支架
if (modelActiveItem.isStandMode && !isStandStatus) { if (ActiveModeItem.isCabinMode && !isStandStatus) {
this.showTips( this.showTips(
`检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源` `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源`
); );
return; return;
} else if (!modelActiveItem.isStandMode && isStandStatus) { } else if (!ActiveModeItem.isCabinMode && isStandStatus) {
this.showTips(`检测到面罩仍和舱体连接中,请分离后切换`); this.showTips(`检测到面罩仍和舱体连接中,请分离后切换`);
return; return;
} }
@ -1211,7 +1145,7 @@ class IotCarePlan extends Component<any, any> {
ActiveModeItem.modeType === "MaskCustom" && ActiveModeItem.modeType === "MaskCustom" &&
!this.state.isCombineSuccess !this.state.isCombineSuccess
) { ) {
this.showTips(`${modelActiveItem.modeName}模式设置失败,请联系小助手`); this.showTips(`${ActiveModeItem.modeName}模式设置失败,请联系小助手`);
return; return;
} }
// 开始执行护理 // 开始执行护理
@ -1268,6 +1202,20 @@ class IotCarePlan extends Component<any, any> {
} }
} }
getInstrumentHistoryData() {
this.hadGotInstrumentHistoryData = true;
console.log("发送获取currentMaskReportInfo指令");
setTimeout(() => {
const queryCurrentMaskReportInfoBuffer =
deviceToolKitInstance.toBleCommand({
...(bleCommandSamples.queryCurrentMaskReportInfo as any),
});
sendCommand({
value: queryCurrentMaskReportInfoBuffer,
});
}, 3000);
}
// 删除WL200护理历史 // 删除WL200护理历史
rmWL200NursingHistory(WL200NursingHistory, hard = false) {} rmWL200NursingHistory(WL200NursingHistory, hard = false) {}
@ -1296,11 +1244,6 @@ class IotCarePlan extends Component<any, any> {
totalWorkingSeconds, totalWorkingSeconds,
}; };
}); });
console.log(
"组合时间ServiceTimeData",
serviceData,
ActiveModeItem.serviceData
);
return serviceData; return serviceData;
} }
// 设置护理时间组合 // 设置护理时间组合
@ -1319,14 +1262,12 @@ class IotCarePlan extends Component<any, any> {
let oldTime = old.totalWorkingMinutes * 60 + old.totalWorkingSeconds; let oldTime = old.totalWorkingMinutes * 60 + old.totalWorkingSeconds;
let value = oldTime + curTime; let value = oldTime + curTime;
console.log("value", value);
ModeStepTimeArray.push(value); ModeStepTimeArray.push(value);
return { return {
totalWorkingMinutes: newTotalWorkingMinutes, totalWorkingMinutes: newTotalWorkingMinutes,
totalWorkingSeconds: newTotalWorkingSeconds, totalWorkingSeconds: newTotalWorkingSeconds,
}; };
} }
console.log("curTime", curTime);
ModeStepTimeArray.push(curTime); ModeStepTimeArray.push(curTime);
return { return {
totalWorkingMinutes: newTotalWorkingMinutes, totalWorkingMinutes: newTotalWorkingMinutes,
@ -1460,7 +1401,7 @@ class IotCarePlan extends Component<any, any> {
isShowUpdateVersionTip, isShowUpdateVersionTip,
isShowVersionUpgrading, isShowVersionUpgrading,
isShowStepTips, isShowStepTips,
isConnectionBlutoot, isCanClick,
isShowNurse, isShowNurse,
isStopNurse, isStopNurse,
ModeList, ModeList,
@ -1487,6 +1428,7 @@ class IotCarePlan extends Component<any, any> {
<View catchMove> <View catchMove>
<PopupCountdown isShow={isShowCountdown} countdown={countdown} /> <PopupCountdown isShow={isShowCountdown} countdown={countdown} />
<PopupConfirm <PopupConfirm
isLarge isLarge
isClose isClose
@ -1613,7 +1555,7 @@ class IotCarePlan extends Component<any, any> {
</View> </View>
<Footer <Footer
isConnectionBlutoot={isConnectionBlutoot} isCanClick={isCanClick}
isShowNurse={isShowNurse} isShowNurse={isShowNurse}
isStopNurse={isStopNurse} isStopNurse={isStopNurse}
onEmitStartNurse={this.onStartNurse} onEmitStartNurse={this.onStartNurse}

@ -2,7 +2,17 @@ import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, Image, Input, Button, ScrollView, Picker, Textarea } from "@tarojs/components"; import {
Block,
View,
Text,
Image,
Input,
Button,
ScrollView,
Picker,
Textarea,
} from "@tarojs/components";
import { go } from "@/utils/traoAPI"; import { go } from "@/utils/traoAPI";
import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui"; import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
@ -10,9 +20,9 @@ import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import Navbar from "../../components/navbar/navbar"; import Navbar from "../../components/navbar/navbar";
import PopupClock from "../../components/popup/popup-clock"; import PopupClock from "../../components/popup/popup-clock";
/** 自定义组件 **/ /** 自定义组件 **/
import { InstrumentInfo } from '../../utils/Interface' import { InstrumentInfo } from "../../utils/Interface";
import { date, getdates, previewImage } from "../../utils/util"; import { date, getdates, previewImage } from "../../utils/util";
import { showModal } from '../../utils/traoAPI.js' import { showModal } from "../../utils/traoAPI.js";
import "./recording.less"; import "./recording.less";
@ -47,14 +57,14 @@ export default class Recording extends Component<any, any> {
show: false, show: false,
punchInInfo: { punchInInfo: {
clockImageList: [], clockImageList: [],
clockContent: '', clockContent: "",
}, },
}; };
} }
componentDidMount() { } componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
// 格式化时间 // 格式化时间
getTime(time) { getTime(time) {
const hour = time.slice(0, 2); const hour = time.slice(0, 2);
@ -62,46 +72,45 @@ export default class Recording extends Component<any, any> {
const second = time.slice(6, 8); const second = time.slice(6, 8);
if (hour > 0) { if (hour > 0) {
return hour + '时' + minute + '分' + second + '秒' return hour + "时" + minute + "分" + second + "秒";
} else { } else {
return minute + '分' + second + '秒' return minute + "分" + second + "秒";
} }
} }
// 获取仪器列表 // 获取仪器列表
async getBindingInstrumentList() { async getBindingInstrumentList() {
let res = await InstrumentInfo.bindingInstrumentList() let res = await InstrumentInfo.bindingInstrumentList();
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ bindingInstrumentList: res.data.data }) this.setState({ bindingInstrumentList: res.data.data });
} }
} }
// 获取护理历程 // 获取护理历程
async getRecord(id) { async getRecord(id) {
let data = {} let data = {};
if (id != null) { if (id != null) {
data['instrumentId'] = id data["instrumentId"] = id;
} }
let res = await InstrumentInfo.apiNursingLog.getRecord(data) let res = await InstrumentInfo.apiNursingLog.getRecord(data);
if (res.data.code === 200) { if (res.data.code === 200) {
res.data.rows.map(item => { res.data.rows.map((item) => {
item.nursingTime = this.getTime(item.nursingTime) item.nursingTime = this.getTime(item.nursingTime);
item.createTime = getdates(item.createTime).replace(/-/g, '.') item.createTime = getdates(item.createTime).replace(/-/g, ".");
});
}) this.setState({ recordList: res.data.rows });
this.setState({ recordList: res.data.rows })
} }
} }
// 查询用户当天最新的一条打卡记录 // 查询用户当天最新的一条打卡记录
async getLatestClockRecord() { async getLatestClockRecord() {
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,
clockContent: res.data.data.clockContent, clockContent: res.data.data.clockContent,
} };
this.setState({ punchInInfo }) this.setState({ punchInInfo });
} }
} }
} }
@ -113,34 +122,34 @@ export default class Recording extends Component<any, any> {
online: 1, online: 1,
modeId: 100, modeId: 100,
modeName: "护理记录测试", modeName: "护理记录测试",
nursingTime: "00:15:00" nursingTime: "00:15:00",
} };
let res = await InstrumentInfo.apiNursingLog.addLog(data) let res = await InstrumentInfo.apiNursingLog.addLog(data);
if (res.data.code === 200) { if (res.data.code === 200) {
} }
} }
/**分页获取用户的打卡记录 page size*/ /**分页获取用户的打卡记录 page size*/
async getClockStatistics(year = this.state.year) { async getClockStatistics(year = this.state.year) {
let res = await InstrumentInfo.apiClock.getClockStatistics({ year }) let res = await InstrumentInfo.apiClock.getClockStatistics({ year });
if (res.data.code === 200) { if (res.data.code === 200) {
res.data.data.reverse() res.data.data.reverse();
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
res.data.data.map((item, index) => { res.data.data.map((item, index) => {
item.isMore = false item.isMore = false;
item.detail = [] item.detail = [];
if (index === 0) { if (index === 0) {
item.isMore = true item.isMore = true;
this.getList(item.id, item.year, item.month) this.getList(item.id, item.year, item.month);
} }
this.state.monthTime.map(monthItem => { this.state.monthTime.map((monthItem) => {
if (monthItem.month == item.month) { if (monthItem.month == item.month) {
monthItem.time = item.clockNum monthItem.time = item.clockNum;
} }
}) });
}) });
this.setState({ monthTime: this.state.monthTime }) this.setState({ monthTime: this.state.monthTime });
} else { } else {
let monthTime = [ let monthTime = [
{ month: 1, time: 0 }, { month: 1, time: 0 },
@ -155,87 +164,86 @@ export default class Recording extends Component<any, any> {
{ month: 10, time: 0 }, { month: 10, time: 0 },
{ month: 11, time: 0 }, { month: 11, time: 0 },
{ month: 12, time: 0 }, { month: 12, time: 0 },
] ];
this.setState({ monthTime }) this.setState({ monthTime });
} }
this.setState({ clockStatistics: res.data.data }) this.setState({ clockStatistics: res.data.data });
} }
} }
// 文本框输入文字 // 文本框输入文字
handleTextareaInput(e) { handleTextareaInput(e) {
const punchInInfo = this.state.punchInInfo const punchInInfo = this.state.punchInInfo;
punchInInfo.clockContent = e.detail.value punchInInfo.clockContent = e.detail.value;
this.setState({ punchInInfo }) this.setState({ punchInInfo });
} }
// 打开/关闭弹窗 // 打开/关闭弹窗
setShow(show: boolean) { setShow(show: boolean) {
this.setState({ show }) this.setState({ show });
} }
// 选择仪器 // 选择仪器
onChangeProduct(id) { onChangeProduct(id) {
this.setState({ curIndex: id }) this.setState({ curIndex: id });
this.getRecord(id) this.getRecord(id);
this.addLog() this.addLog();
}; }
// 展开收起 // 展开收起
onChangeMore(id, year, month) { onChangeMore(id, year, month) {
this.state.clockStatistics.map(item => { this.state.clockStatistics.map((item) => {
if (item.id === id) { if (item.id === id) {
item.isMore = !item.isMore item.isMore = !item.isMore;
if (item.isMore && item.detail.length === 0) { if (item.isMore && item.detail.length === 0) {
this.getList(id, year, month) this.getList(id, year, month);
} }
} }
}) });
this.setState({ clockStatistics: this.state.clockStatistics }) this.setState({ clockStatistics: this.state.clockStatistics });
} }
// 获取当月打卡记录 // 获取当月打卡记录
async getList(id, year, month) { async getList(id, year, month) {
let data = { let data = {
year, month year,
} month,
let res = await InstrumentInfo.apiClock.getList(data) };
let res = await InstrumentInfo.apiClock.getList(data);
if (res.data.code === 200) { if (res.data.code === 200) {
console.log(this.state.clockStatistics, 88888); console.log(this.state.clockStatistics, 88888);
this.state.clockStatistics.map(item => { this.state.clockStatistics.map((item) => {
if (item.id === id) { if (item.id === id) {
item.detail = res.data.data item.detail = res.data.data;
item.detail.map(obj => { item.detail.map((obj) => {
obj.updateTime = getdates(obj.updateTime).replace(/-/g, '.') obj.updateTime = getdates(obj.updateTime).replace(/-/g, ".");
}) });
} }
}) });
this.setState({ clockStatistics: this.state.clockStatistics }) this.setState({ clockStatistics: this.state.clockStatistics });
} }
} }
async onLoad() { async onLoad() {
this.getRecord(null) this.getRecord(null);
this.getBindingInstrumentList() this.getBindingInstrumentList();
this.getLatestClockRecord() this.getLatestClockRecord();
this.getClockStatistics() this.getClockStatistics();
} }
componentDidShow() { } componentDidShow() {}
componentDidHide() { } componentDidHide() {}
async initData() { } async initData() {}
// 选择年份 // 选择年份
onChangeYear(event) { onChangeYear(event) {
this.setState({ year: event.detail.value }) this.setState({ year: event.detail.value });
this.getClockStatistics(event.detail.value) this.getClockStatistics(event.detail.value);
} }
// 点击tab栏 // 点击tab栏
onTab = async (event) => { onTab = async (event) => {
const { current } = event.currentTarget.dataset; const { current } = event.currentTarget.dataset;
this.setState({ current }); this.setState({ current });
if (current === 1) { if (current === 1) {
this.getClockStatistics() this.getClockStatistics();
} }
}; };
// 跳转到护理报告 // 跳转到护理报告
@ -246,72 +254,87 @@ export default class Recording extends Component<any, any> {
handleChooseImage() { handleChooseImage() {
Taro.chooseMedia({ Taro.chooseMedia({
count: 1, count: 1,
mediaType: ['image'], mediaType: ["image"],
sourceType: ['album', 'camera'], sourceType: ["album", "camera"],
success: (res) => { success: (res) => {
const tempFilePaths = res.tempFiles.map((item) => item.tempFilePath) const tempFilePaths = res.tempFiles.map((item) => item.tempFilePath);
tempFilePaths?.forEach((item) => { tempFilePaths?.forEach((item) => {
// eslint-disable-next-line @typescript-eslint/no-shadow // eslint-disable-next-line @typescript-eslint/no-shadow
InstrumentInfo.apiClock.clockFileUpload({ clockImg: item }).then((res) => { InstrumentInfo.apiClock
const currentImage = res.data.url .clockFileUpload({ clockImg: item })
const newImageList = .then((res) => {
this.state.punchInInfo.clockImageList.length >= 3 const currentImage = res.data.url;
? this.state.punchInInfo.clockImageList const newImageList =
: [... this.state.punchInInfo.clockImageList, currentImage] this.state.punchInInfo.clockImageList.length >= 3
const punchInInfo = this.state.punchInInfo ? this.state.punchInInfo.clockImageList
punchInInfo.clockImageList = newImageList : [...this.state.punchInInfo.clockImageList, currentImage];
this.setState({ punchInInfo }) const punchInInfo = this.state.punchInInfo;
}) punchInInfo.clockImageList = newImageList;
}) this.setState({ punchInInfo });
});
});
}, },
fail: (err) => { fail: (err) => {
console.info('err', err) console.info("err", err);
}, },
}) });
} }
// 删除打卡图片 // 删除打卡图片
delImg(i) { delImg(i) {
const punchInInfo = this.state.punchInInfo const punchInInfo = this.state.punchInInfo;
punchInInfo.clockImageList.splice(i, 1) punchInInfo.clockImageList.splice(i, 1);
this.setState({ punchInInfo }) this.setState({ punchInInfo });
} }
async submit() { async submit() {
let punchInInfo = this.state.punchInInfo || {} let punchInInfo = this.state.punchInInfo || {};
if (!punchInInfo.clockImageList.length) { if (!punchInInfo.clockImageList.length) {
Taro.showToast({ Taro.showToast({
title: '请上传图片', title: "请上传图片",
icon: 'none', icon: "none",
}) });
return return;
} }
if (!punchInInfo.clockContent) { if (!punchInInfo.clockContent) {
Taro.showToast({ Taro.showToast({
title: '请输入打卡心得', title: "请输入打卡心得",
icon: 'none', icon: "none",
}) });
return return;
} }
InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => { InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => {
showModal({ showModal({
t2: '您已完成今日打卡', t2: "您已完成今日打卡",
btn1show: false, btn1show: false,
}).then(() => { }).then(() => {
this.setShow(false) this.setShow(false);
}) });
});
})
} }
back() { back() {
Taro.navigateBack({ Taro.navigateBack({
delta: 1, delta: 1,
}) });
} }
render() { render() {
let { current, array, name, recordList, bindingInstrumentList, curIndex, clockStatistics, statistics, year, today, monthTime, show, punchInInfo } = this.state; let {
current,
array,
name,
recordList,
bindingInstrumentList,
curIndex,
clockStatistics,
statistics,
year,
today,
monthTime,
show,
punchInInfo,
} = this.state;
return ( return (
<Block> <Block>
<Navbar isBack titleSlot='护理记录'></Navbar> <Navbar isBack titleSlot="护理记录"></Navbar>
<View className='tabs'> <View className="tabs">
<View <View
className={classnames("tab", { className={classnames("tab", {
tab_active: current === 0, tab_active: current === 0,
@ -331,42 +354,48 @@ export default class Recording extends Component<any, any> {
</View> </View>
</View> </View>
{current === 0 && <ScrollView className='products_list' scroll-x='true' > {current === 0 && (
<View className={classnames("all", { <ScrollView className="products_list" scroll-x="true">
products_item_active: !curIndex, <View
})} onClick={this.onChangeProduct.bind(this, null)} className={classnames("all", {
> products_item_active: !curIndex,
</View>
{bindingInstrumentList.map((item: any, index: any) => (
<View key={item.id}
className={classnames("products_item", {
products_item_active: curIndex === item.id,
})} })}
onClick={this.onChangeProduct.bind(this, item.id)} onClick={this.onChangeProduct.bind(this, null)}
> >
<Image className='products_cover'
src={require("../../img/test/1706692819894.jpg")} mode='aspectFit'
></Image>
<View className='products_title'></View>
</View> </View>
))} {bindingInstrumentList.map((item: any, index: any) => (
</ScrollView>} <View
key={item.id}
{current === 0 && className={classnames("products_item", {
recordList.length === products_item_active: curIndex === item.id,
0 && ( })}
<View> onClick={this.onChangeProduct.bind(this, item.id)}
<View className='nodata'> >
<Image <Image
className='nodata_img' className="products_cover"
src={require("../../img/nodata.png")} src={require("../../img/test/1706692819894.jpg")}
mode="aspectFit"
></Image> ></Image>
<View className='nodata_text'></View> <View className="products_title"></View>
</View> </View>
))}
</ScrollView>
)}
{current === 0 && recordList.length === 0 && (
<View>
<View className="nodata">
<Image
className="nodata_img"
src={require("../../img/nodata.png")}
></Image>
<View className="nodata_text"></View>
</View> </View>
)} </View>
)}
{current === 0 && ( {current === 0 && (
<View style='padding-bottom:200px'> <View style="padding-bottom:200px">
{/* <View className='instrument_item' > {/* <View className='instrument_item' >
<View className='instrument_top flex sb aitems'> <View className='instrument_top flex sb aitems'>
<View className='time_box flex aitems'> <View className='time_box flex aitems'>
@ -393,35 +422,50 @@ export default class Recording extends Component<any, any> {
</View> </View>
</View> */} </View> */}
<View className="instrument_list ">
<View className='instrument_list '>
{recordList.map((item: any, index: any) => ( {recordList.map((item: any, index: any) => (
<View className='recording-box' key={item.id}> <View className="recording-box" key={item.id}>
<View className='box-top'> <View className="box-top">
<View className='top-left'> <View className="top-left">
<View className='date'>{item.createTime}</View> <View className="date">{item.createTime}</View>
<View className={classnames("tip", { <View
tag_active: item.online === 2, className={classnames("tip", {
})} tag_active: item.online === 2,
>{item.online ? '在线' : '离线'}</View> })}
>
{item.online ? "在线" : "离线"}
</View>
</View> </View>
{item.instrumentType === 2 && {item.instrumentType === 2 && (
<View className='top-right' onClick={this.toReport.bind(this, item.instrumentId, item.id)}> <View
className="top-right"
onClick={this.toReport.bind(
this,
item.instrumentId,
item.id
)}
>
<Image className='arrow_icon' src={require("../../img/index/right.png")} mode='aspectFill'></Image> <Image
className="arrow_icon"
src={require("../../img/index/right.png")}
mode="aspectFill"
></Image>
</View> </View>
} )}
</View> </View>
<View className='box-bottom'> <View className="box-bottom">
<Image <Image
className='recording_img' className="recording_img"
src={item.modeImage} src={item.modeImage}
></Image> ></Image>
<View className='bottom-right'> <View className="bottom-right">
<View className='title'>{item.instrumentName}</View> <View className="title">{item.instrumentName}</View>
<View className='subtitle-box'> <View className="subtitle-box">
<View className='subtitle'>{item.modeName}</View> <View className="subtitle">{item.modeName}</View>
<View className='subtitle'>{item.nursingTime}</View> <View className="subtitle">
{item.nursingTime}
</View>
</View> </View>
</View> </View>
</View> </View>
@ -431,7 +475,7 @@ export default class Recording extends Component<any, any> {
</View> </View>
)} )}
{current === 1 && ( {current === 1 && (
<View style='padding-bottom:200px'> <View style="padding-bottom:200px">
{/* <View className='nodata'> {/* <View className='nodata'>
<Image <Image
className='nodata_img' className='nodata_img'
@ -439,139 +483,198 @@ export default class Recording extends Component<any, any> {
></Image> ></Image>
<View className='nodata_text'></View> <View className='nodata_text'></View>
</View> */} </View> */}
<View style='height: 30rpx; background: #F8F8F8'></View> <View style="height: 30rpx; background: #F8F8F8"></View>
<View className='clock_in_statistics m-x-30 flex sb'> <View className="clock_in_statistics m-x-30 flex sb">
<View className='flex sb ab'> <View className="flex sb ab">
<View className='clock_in_statistics_title'></View> <View className="clock_in_statistics_title"></View>
<Picker mode='date' fields='year' onChange={this.onChangeYear.bind(this)} value='{{year}}' end='{{today}}'> <Picker
<View className='clock_in_statistics_date flex aitems'> mode="date"
fields="year"
onChange={this.onChangeYear.bind(this)}
value="{{year}}"
end="{{today}}"
>
<View className="clock_in_statistics_date flex aitems">
<View>{year}</View> <View>{year}</View>
<Image className='more_icon' src={require('../../img/arrow-down.png')} mode='widthFix'></Image> <Image
className="more_icon"
src={require("../../img/arrow-down.png")}
mode="widthFix"
></Image>
</View> </View>
</Picker> </Picker>
</View> </View>
<View className='chart flex sb'> <View className="chart flex sb">
{ {monthTime.map((item) => (
monthTime.map(item => ( <View className="flex fc aitems" key={item.month}>
<View className='flex fc aitems' key={item.month}> {item.time > 0 && (
{ <View className="buoy">{item.time}</View>
item.time > 0 && <View className='buoy' >{item.time}</View> )}
} <View
<View className='column' style={{ height: `calc(186/31*${item.time}rpx)` }}></View> className="column"
<View className='month'>{item.month}</View> style={{ height: `calc(186/31*${item.time}rpx)` }}
</View> ></View>
)) <View className="month">{item.month}</View>
} </View>
))}
</View> </View>
</View> </View>
<View style='padding-bottom: env(safe-area-inset-bottom)' > <View style="padding-bottom: env(safe-area-inset-bottom)">
<View className='month_box m-x-30'> <View className="month_box m-x-30">
{clockStatistics.map(item => ( {clockStatistics.map((item) => (
<View className='month_statistics' key={item.id}> <View className="month_statistics" key={item.id}>
<View className='flex aitems sb'> <View className="flex aitems sb">
<View className='time'>{item.year}{item.month}</View> <View className="time">
<View className='more_box flex aitems' onClick={this.onChangeMore.bind(this, item.id, item.year, item.month)}> {item.year}{item.month}
<View className='more_text'> {!item.isMore ? '展开更多' : '收起更多'}</View> </View>
<Image style={{ transform: (item.isMore) ? 'rotate(180deg)' : 'rotate(0deg)' }} className='more_icon' <View
src={require("../../img/arrow-down.png")} mode='widthFix' className="more_box flex aitems"
onClick={this.onChangeMore.bind(
this,
item.id,
item.year,
item.month
)}
>
<View className="more_text">
{" "}
{!item.isMore ? "展开更多" : "收起更多"}
</View>
<Image
style={{
transform: item.isMore
? "rotate(180deg)"
: "rotate(0deg)",
}}
className="more_icon"
src={require("../../img/arrow-down.png")}
mode="widthFix"
></Image> ></Image>
</View> </View>
</View> </View>
<View style='height: 59rpx'></View> <View style="height: 59rpx"></View>
<View className='statistic'> <View className="statistic">
<View className='statistic_item'> <View className="statistic_item">
<View className='statistic_num'>{item.clockNum}</View> <View className="statistic_num">{item.clockNum}</View>
<View className='statistic_desc'></View> <View className="statistic_desc"></View>
</View> </View>
<View className='statistic_item'> <View className="statistic_item">
<View className='statistic_num'>{(item.percentage * 100).toFixed(2)}%</View> <View className="statistic_num">
<View className='statistic_desc'></View> {(item.percentage * 100).toFixed(2)}%
</View>
<View className="statistic_desc"></View>
</View> </View>
<View className='border'></View> <View className="border"></View>
</View> </View>
{item.isMore && item.detail && <View> {item.isMore && item.detail && (
{ <View>
item.detail.map(obj => ( {item.detail.map((obj) => (
<View key={obj}> <View key={obj}>
<View style='height: 57rpx' ></View> <View style="height: 57rpx"></View>
<View className='month_item'> <View className="month_item">
<View className='month_item_date'>{obj.updateTime}</View> <View className="month_item_date">
<View className='month_image_box flex sb'> {obj.updateTime}
{obj.clockImg.map(img => (<Image key={img} className='month_item_cover' src={img} ></Image>))} </View>
<View className="month_image_box flex sb">
{obj.clockImg.map((img) => (
<Image
key={img}
className="month_item_cover"
src={img}
></Image>
))}
</View>
<View className="month_item_date">
PRO{" "}
</View>
<View className="month_item_note">
{obj.clockContent}
</View> </View>
<View className='month_item_date'>PRO </View>
<View className='month_item_note'>{obj.clockContent}</View>
</View> </View>
</View>))} </View>
</View> ))}
} </View>
)}
</View> </View>
)) ))}
}
</View> </View>
</View> </View>
</View> </View>
) )}
} <View className="footer flex aitems">
<View className='footer flex aitems' > <View className="btn" onClick={this.setShow.bind(this, true)}>
<View className='btn' onClick={this.setShow.bind(this, true)}></View>
</View>
<View className="text" onClick={this.back}> <View className="text" onClick={this.back}>
> &gt;
</View> </View>
</View> </View>
<Popup show={show} onClose={() => this.setState({ show: false })}> <Popup show={show} onClose={() => this.setState({ show: false })}>
<View className='popBox'> <View className="popBox">
<Image className='close_icon' <Image
src={require("../../img/close.png")} mode='widthFix' onClick={this.setShow.bind(this, false)} className="close_icon"
src={require("../../img/close.png")}
mode="widthFix"
onClick={this.setShow.bind(this, false)}
></Image> ></Image>
<View className='popTitle'></View> <View className="popTitle"></View>
<View className='popSubtitle'><View className='bold'>{clockStatistics[0]?.clockNum}</View> <View className='bold'>{(clockStatistics[0]?.percentage * 100).toFixed(1)}%</View></View> <View className="popSubtitle">
<View className='img_box'>
{ <View className="bold">{clockStatistics[0]?.clockNum}</View>{" "}
punchInInfo.clockImageList.map((item, index) => (
<View key={item} className='img'> <View className="bold">
<Image className='showImg' {(clockStatistics[0]?.percentage * 100).toFixed(1)}%
src={item} mode='widthFix' </View>
></Image>
<Image className='closeImg' </View>
src={require('../../img/close1.png')} <View className="img_box">
mode='widthFix' {punchInInfo.clockImageList.map((item, index) => (
onClick={this.delImg.bind(this, index)} <View key={item} className="img">
></Image> <Image className="showImg" src={item} mode="widthFix"></Image>
</View> <Image
)) className="closeImg"
} src={require("../../img/close1.png")}
{punchInInfo.clockImageList.length < 3 && mode="widthFix"
<View className='addBox' onClick={this.handleChooseImage.bind(this)}> onClick={this.delImg.bind(this, index)}
<Image className='showImg' ></Image>
src={require("../../img/clock_in_upload/add-image.png")} mode='widthFix' </View>
))}
{punchInInfo.clockImageList.length < 3 && (
<View
className="addBox"
onClick={this.handleChooseImage.bind(this)}
>
<Image
className="showImg"
src={require("../../img/clock_in_upload/add-image.png")}
mode="widthFix"
></Image> ></Image>
</View> </View>
} )}
</View> </View>
<View className='info4'> <View className="info4">
<View className='content'> <View className="content">
<Textarea <Textarea
placeholderStyle='color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;' placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;"
placeholder='请记录一下今天的护理心得吧' placeholder="请记录一下今天的护理心得吧"
maxlength={120} maxlength={120}
onInput={this.handleTextareaInput.bind(this)} onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent} value={punchInInfo.clockContent}
></Textarea> ></Textarea>
</View> </View>
<View className='tip'> <View className="tip">
{'' + (punchInInfo.clockContent.length || 0) + '/120'} {"" + (punchInInfo.clockContent.length || 0) + "/120"}
</View> </View>
</View> </View>
<View className='popbtnbox flex aitems jcenter'> <View className="popbtnbox flex aitems jcenter">
<View className='btn1' onClick={this.submit.bind(this)}> <View className="btn1" onClick={this.submit.bind(this)}>
</View> </View>
</View> </View>
</View> </View>
</Popup> </Popup>
</Block > </Block>
); );
} }
} }

@ -40,7 +40,6 @@ class Register extends Component<any, any> {
// isRead: true, // isRead: true,
fromUrl: "", fromUrl: "",
serial: Taro.getStorageSync("serial"), serial: Taro.getStorageSync("serial"),
}; };
} }
@ -59,7 +58,7 @@ class Register extends Component<any, any> {
back() { back() {
Taro.navigateBack({ Taro.navigateBack({
delta: 1, delta: 1,
}) });
} }
onDisagreeTap = () => { onDisagreeTap = () => {
// 关闭小程序 // 关闭小程序
@ -153,13 +152,13 @@ class Register extends Component<any, any> {
go("/pages/userPolicy/userPolicy"); go("/pages/userPolicy/userPolicy");
}; };
componentDidMount() { } componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
componentDidShow() { } componentDidShow() {}
componentDidHide() { } componentDidHide() {}
async initData() { async initData() {
const { data } = await MpSplashDetail({ const { data } = await MpSplashDetail({
@ -199,8 +198,8 @@ class Register extends Component<any, any> {
</View> </View>
</View> </View>
{ {serial && (
serial && <View className='footer1' > <View className="footer1">
<Button <Button
type="primary" type="primary"
disabled={!isChecked || isButtonDisabled} disabled={!isChecked || isButtonDisabled}
@ -212,13 +211,12 @@ class Register extends Component<any, any> {
</Button> </Button>
<View className="text" onClick={this.back}> <View className="text" onClick={this.back}>
> &gt;
</View> </View>
</View> </View>
} )}
{ {!serial && (
!serial && <Button <Button
type="primary" type="primary"
disabled={!isChecked || isButtonDisabled} disabled={!isChecked || isButtonDisabled}
open-type="getPhoneNumber" open-type="getPhoneNumber"
@ -228,7 +226,7 @@ class Register extends Component<any, any> {
> >
</Button> </Button>
} )}
<View className="checked_box"> <View className="checked_box">
{isChecked ? ( {isChecked ? (

Loading…
Cancel
Save