qsj 2 years ago
commit 557fb4226c

@ -63,13 +63,14 @@ export const fr200DeviceControlCommand = {
* face: "01", 面部 * face: "01", 面部
* eyes: "02", 眼部 * eyes: "02", 眼部
* *
* nasolabialFold: "03", 法令纹 * nasolabialFold: "03", 法令纹Pro
* mandibularLine: "04", 下颌线 * mandibularLine: "04", 下颌线Pro
* led: "05", led * led: "05", led
* headLiftingPro: "09", 抬头纹Pro
*
* moistureTest: "06", 水分测试 * moistureTest: "06", 水分测试
* maskPenetration: "07",面膜促渗 * maskPenetration: "07",面膜促渗
* essence: "08", 精华模式 * essence: "08", 精华模式
* headLiftingPro: "09", 抬头纹Pro
* *
* neck: "0A", 颈纹 * neck: "0A", 颈纹
* partition: "11", 分区模式 废弃VM1001 * partition: "11", 分区模式 废弃VM1001

@ -347,7 +347,7 @@ class Instrument extends Component<any, any> {
// this.openBindingVisible(); // this.openBindingVisible();
msg("绑定成功"); msg("绑定成功");
setTimeout(() => { setTimeout(() => {
setStorageSync("instrument_detail", JSON.stringify(channelInfo)); setStorageSync("instrument_detail", channelInfo);
this.getInstrumentIntroInfo(channelInfo.id); this.getInstrumentIntroInfo(channelInfo.id);
}, 500); }, 500);
} else if (code === 202) { } else if (code === 202) {
@ -384,6 +384,7 @@ class Instrument extends Component<any, any> {
Taro.setStorageSync("isScan", true); Taro.setStorageSync("isScan", true);
Taro.setStorageSync("serial", channelInfo.serialCode); Taro.setStorageSync("serial", channelInfo.serialCode);
Taro.switchTab({ url: "/pages/index/index" }); Taro.switchTab({ url: "/pages/index/index" });
return;
// this.openBindingVisible(); // this.openBindingVisible();
} else if (res.data.code === 202) { } else if (res.data.code === 202) {
this.changeBindBox(); this.changeBindBox();
@ -414,7 +415,7 @@ class Instrument extends Component<any, any> {
this.setState({ isVisibleBinding: false }); this.setState({ isVisibleBinding: false });
msg("绑定成功"); msg("绑定成功");
setTimeout(() => { setTimeout(() => {
setStorageSync("instrument_detail", JSON.stringify(channelInfo)); setStorageSync("instrument_detail", channelInfo);
this.getInstrumentIntroInfo(channelInfo.id); this.getInstrumentIntroInfo(channelInfo.id);
}, 500); }, 500);
} else if (res.data.code === 202) { } else if (res.data.code === 202) {
@ -444,7 +445,7 @@ class Instrument extends Component<any, any> {
if (data.code === 200) { if (data.code === 200) {
msg("换绑成功"); msg("换绑成功");
setTimeout(() => { setTimeout(() => {
setStorageSync("instrument_detail", JSON.stringify(channelInfo)); setStorageSync("instrument_detail", channelInfo);
this.getInstrumentIntroInfo(channelInfo.id); this.getInstrumentIntroInfo(channelInfo.id);
}, 500); }, 500);
} }
@ -457,7 +458,7 @@ class Instrument extends Component<any, any> {
}); });
if (res.data.code === 200) { if (res.data.code === 200) {
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
go("/instrument/pages/instrument/intro??customBack=true&id=" + id); go("/instrument/pages/instrument/intro?customBack=true&id=" + id);
} else { } else {
Taro.switchTab({ url: "/pages/index/index" }); Taro.switchTab({ url: "/pages/index/index" });
} }

@ -67,6 +67,7 @@ class Intro extends Component<any, any> {
} }
componentDidMount() { componentDidMount() {
let strObj = getStorageSync("instrument_detail"); let strObj = getStorageSync("instrument_detail");
console.log("strObj", strObj);
if (strObj) { if (strObj) {
let instrument = strObj; let instrument = strObj;
this.getInstrumentInfo(instrument.id); this.getInstrumentInfo(instrument.id);

@ -143,6 +143,8 @@ class IotCarePlanFR200 extends Component<any, any> {
/** 护理过程 END*/ /** 护理过程 END*/
// 模式列表 // 模式列表
TestModeStepIndex: 0,
currentWorkModeType: 1,
isModeLock: false, // 模式是否锁定 isModeLock: false, // 模式是否锁定
isSwitchActiveMode: false, // 是否显示弹窗切换模式 isSwitchActiveMode: false, // 是否显示弹窗切换模式
ModeList: [], ModeList: [],
@ -232,9 +234,7 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log(option,'跳转过来的数据'); console.log(option,'跳转过来的数据');
if (option.modeId) { if (option.modeId) {
this.setState({ activeModeID: option.modeId }) this.setState({ activeModeID: option.modeId })
setTimeout(() => {
console.log(this.state,'查看');
})
} }
// 保持屏幕常亮 // 保持屏幕常亮
Taro.setKeepScreenOn({ Taro.setKeepScreenOn({
@ -245,9 +245,9 @@ class IotCarePlanFR200 extends Component<any, any> {
this.getInstrumentClockDetail(); this.getInstrumentClockDetail();
} }
componentDidMount() { } componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
componentDidShow() { componentDidShow() {
console.log("页面显示了"); console.log("页面显示了");
@ -370,6 +370,7 @@ class IotCarePlanFR200 extends Component<any, any> {
}); });
}; };
// 获取模式列表
GetModeList = async (id) => { GetModeList = async (id) => {
let params = { let params = {
instrumentId: id, instrumentId: id,
@ -379,7 +380,6 @@ class IotCarePlanFR200 extends Component<any, any> {
if (res.data.code === 200) { if (res.data.code === 200) {
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
this.setState({ this.setState({
ActiveModeItem: res.data.data[0],
ModeList: res.data.data, ModeList: res.data.data,
}); });
@ -432,7 +432,9 @@ class IotCarePlanFR200 extends Component<any, any> {
}, 0); }, 0);
} }
/** 选中护理模式 */ /**
* @name /
* */
modeCurrentFun = async (data, isNotCheck = false) => { modeCurrentFun = async (data, isNotCheck = false) => {
let { isShowNurse,activeModeID } = this.state; let { isShowNurse,activeModeID } = this.state;
// 护理检查改变模式,是否提示切换护理模式 // 护理检查改变模式,是否提示切换护理模式
@ -462,14 +464,26 @@ class IotCarePlanFR200 extends Component<any, any> {
let currentTime = data.modeTimeStr; let currentTime = data.modeTimeStr;
// 根据模式,动态设置底部按钮样式
let currentWorkModeType = 1;
if (data.modeType === "moistureTest") {
currentWorkModeType = 3;
} else if (
data.modeType === "maskPenetration" ||
data.modeType === "essence"
) {
currentWorkModeType = 2;
}
this.setState({ this.setState({
ActiveModeItem: data, ActiveModeItem: data,
activeModeID: data.id, activeModeID: data.id,
ModeID: "mode_" + data.id, ModeID: "mode_" + data.id,
currentServiceData, currentServiceData,
ModeStepIndex: 0, ModeStepIndex: 0,
currentTime,
ModeType: this.ModeTypeArray[data.modeClass], ModeType: this.ModeTypeArray[data.modeClass],
currentTime,
currentWorkModeType,
}); });
setTimeout(() => { setTimeout(() => {
@ -593,12 +607,12 @@ class IotCarePlanFR200 extends Component<any, any> {
onStartNurse = async () => { onStartNurse = async () => {
this.stepNext(); this.stepNext();
setTimeout(() => { setTimeout(() => {
this.onNursingTap(); this.onNursingTap();
// 倒计时弹窗: 倒计时完成后,自动开始,并判断弹窗 // // 倒计时弹窗: 倒计时完成后,自动开始,并判断弹窗
let downNum = CountDownTime[this.state.ActiveModeItem.modeType] || 3; // let downNum = CountDownTime[this.state.ActiveModeItem.modeType] || 3;
this.showCountdownFun(downNum, () => { }); // this.showCountdownFun(downNum, () => {});
}, 500); }, 500);
// 如果检查失败,则报错 // 如果检查失败,则报错
this.onEmitErrorTips(); this.onEmitErrorTips();
@ -618,7 +632,7 @@ class IotCarePlanFR200 extends Component<any, any> {
}; };
// 绘制能量图 // 绘制能量图
drawProwerPicture() { } drawProwerPicture() {}
/** 切换光照 */ /** 切换光照 */
onSwitchChange = async () => { onSwitchChange = async () => {
@ -731,6 +745,18 @@ class IotCarePlanFR200 extends Component<any, any> {
case "working": case "working":
//设备的运行中状态 //设备的运行中状态
console.log("设备状态同步 运行中状态", jsonStatus); console.log("设备状态同步 运行中状态", jsonStatus);
if (jsonStatus.workMode === "moistureTest") {
// 水分测试
// teststatus:success
}
// 脸部模式
if (jsonStatus.workMode === "face") {
// impedance
// totalWorkingMinutes: 0
// totalWorkingSeconds: 24
}
// this.judgementWorkStatus( // this.judgementWorkStatus(
// MODE_WORKING_ENUM.WORKING, // MODE_WORKING_ENUM.WORKING,
// jsonStatus.workMode // jsonStatus.workMode
@ -1207,9 +1233,11 @@ class IotCarePlanFR200 extends Component<any, any> {
}; };
// 水分测试需要特殊处理 // 水分测试需要特殊处理
// 水分测试准备 水分测试工作 水分测试启动
if (ActiveModeItem.modeType === "moistureTest") { if (ActiveModeItem.modeType === "moistureTest") {
sendParams.testStatus = "standby"; // 切换为准备 sendParams.testStatus = "standby"; // 切换为准备
if (isBtnClick) { if (isBtnClick) {
// 水分测试启动
sendParams.testStatus = "start"; // 点击开始再开始 sendParams.testStatus = "start"; // 点击开始再开始
} }
} }
@ -1480,7 +1508,10 @@ class IotCarePlanFR200 extends Component<any, any> {
/** 获取小程序本地缓存的历史记录 */ /** 获取小程序本地缓存的历史记录 */
getFR200NursingHistory() { getFR200NursingHistory() {
this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
console.log(this.FR200NursingHistory, '获取本地数据++++++++++++++++++++++++++++++++++++++++++'); console.log(
this.FR200NursingHistory,
"获取本地数据++++++++++++++++++++++++++++++++++++++++++"
);
// 是否同步历史记录 // 是否同步历史记录
let isSyncHistory = Taro.getStorageSync("isSyncHistory"); let isSyncHistory = Taro.getStorageSync("isSyncHistory");
@ -1557,6 +1588,11 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
Taro.setStorageSync("FR200NursingHistory", params); Taro.setStorageSync("FR200NursingHistory", params);
console.log("更新updateFR200NursingHistory"); console.log("更新updateFR200NursingHistory");
// 基础模式可在这里调用函数更新图标Echarts
// 最新一条数据jsonStatus
// 注意事项只拿working状态
// todo
} else { } else {
this.setFR200NursingHistory(jsonStatus); this.setFR200NursingHistory(jsonStatus);
} }
@ -1595,29 +1631,31 @@ class IotCarePlanFR200 extends Component<any, any> {
todoPromise = async () => { todoPromise = async () => {
const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
// 护理脸部 // 护理脸部
if (nowFR200NursingHistory.workMode === 'face') { if (nowFR200NursingHistory.workMode === "face") {
// 把working=工作中的状态数据筛选出来 // 把working=工作中的状态数据筛选出来
let filtered = nowFR200NursingHistory.dataArray.filter(item => item.workStatus === 'working'); let filtered = nowFR200NursingHistory.dataArray.filter(
(item) => item.workStatus === "working"
);
// 能量发数 // 能量发数
filtered = filtered.slice(0, 360); filtered = filtered.slice(0, 360);
// 脸部能量 // 脸部能量
let faceEnergy = 0 let faceEnergy = 0;
filtered.forEach(item => { filtered.forEach((item) => {
faceEnergy += item.joulePerSecond faceEnergy += item.joulePerSecond;
}) });
// 计算平均数 // 计算平均数
// let sum = filtered.reduce((accumulator, currentValue) => accumulator + currentValue.impedance, 0); // let sum = filtered.reduce((accumulator, currentValue) => accumulator + currentValue.impedance, 0);
// let average = sum / filtered.length; // let average = sum / filtered.length;
// 最大 // 最大
let max: any = Math.max(...filtered.map(item => item.impedance)); let max: any = Math.max(...filtered.map((item) => item.impedance));
max = this.determineTier(max) max = this.determineTier(max);
// 最小 // 最小
let min: any = Math.min(...filtered.map(item => item.impedance)); let min: any = Math.min(...filtered.map((item) => item.impedance));
min = this.determineTier(min) min = this.determineTier(min);
// 平均数最大等级处于2 // 平均数最大等级处于2
let average: any = max / 2 let average: any = max / 2;
average = this.determineTier(average) average = this.determineTier(average);
// 能量图里面的图谱每10秒为一个数组 // 能量图里面的图谱每10秒为一个数组
// 创建一个空数组用于存储分组后的结果 // 创建一个空数组用于存储分组后的结果
@ -1629,14 +1667,14 @@ class IotCarePlanFR200 extends Component<any, any> {
let group = filtered.slice(i, i + 10); let group = filtered.slice(i, i + 10);
// 找到组中最大的 name 值 // 找到组中最大的 name 值
let maxName = Math.max(...group.map(obj => obj.impedance)); let maxName = Math.max(...group.map((obj) => obj.impedance));
// 计算并存储每组的平均数 // 计算并存储每组的平均数
let average:any = this.determineTier(maxName / 2); let average: any = this.determineTier(maxName / 2);
// let average = maxName / 2; // let average = maxName / 2;
if(average >=1) { if (average >= 1) {
average=average-1 average = average - 1;
average=average *10 average = average * 10;
} }
// 将包含该组对象和平均数的对象添加到 groupedAa 数组中 // 将包含该组对象和平均数的对象添加到 groupedAa 数组中
groupedAa.push(average); groupedAa.push(average);
@ -1645,30 +1683,35 @@ class IotCarePlanFR200 extends Component<any, any> {
let nursingData = { let nursingData = {
// nursingTime:result, // nursingTime:result,
nursingData: JSON.stringify({ nursingData: JSON.stringify({
faceEnergy, max, min, average, groupedAa, filtered: filtered.length, workMode: nowFR200NursingHistory.workMode faceEnergy,
}) max,
} min,
average,
groupedAa,
filtered: filtered.length,
workMode: nowFR200NursingHistory.workMode,
}),
};
return nursingData return nursingData;
} else { } else {
let GearData = this.state.GearData; let GearData = this.state.GearData;
// 肌肤报告 // 肌肤报告
let Allnum = 0 let Allnum = 0;
GearData.forEach(e => { GearData.forEach((e) => {
Allnum = +e.forehead Allnum = +e.forehead;
}); });
// 向下取整 // 向下取整
Allnum = Math.floor(Allnum / 3); Allnum = Math.floor(Allnum / 3);
let nursingData = { let nursingData = {
nursingData: JSON.stringify({ nursingData: JSON.stringify({
Allnum, GearData Allnum,
}) GearData,
} }),
return nursingData };
return nursingData;
} }
};
}
// 计算挡位 // 计算挡位
determineTier = (sun) => { determineTier = (sun) => {
@ -1683,8 +1726,8 @@ class IotCarePlanFR200 extends Component<any, any> {
} }
// 如果 sun 不在任何一档范围内,返回默认档或处理错误 // 如果 sun 不在任何一档范围内,返回默认档或处理错误
return '10'; return "10";
} };
/** 提交护理记录:完成护理后自动调用,会跳转页面 */ /** 提交护理记录:完成护理后自动调用,会跳转页面 */
PostNursingLogClock = async (data: any = null, isJump = true) => { PostNursingLogClock = async (data: any = null, isJump = true) => {
// todo 建议写一个Promise异步函数用 await 执行,在提交前处理好数据 // todo 建议写一个Promise异步函数用 await 执行,在提交前处理好数据
@ -1695,19 +1738,17 @@ class IotCarePlanFR200 extends Component<any, any> {
if (data) { if (data) {
params = data; params = data;
} else { } else {
params = { params = {
instrumentId: currentDevice.id, instrumentId: currentDevice.id,
instrumentName: currentDevice.name, instrumentName: currentDevice.name,
modeId: ActiveModeItem.id, modeId: ActiveModeItem.id,
modeName: ActiveModeItem.modeName, modeName: ActiveModeItem.modeName,
nursingTime: s_to_hms(this.elapsedTime), nursingTime: s_to_hms(this.elapsedTime),
}; };
} }
let res1: any = await this.todoPromise() let res1: any = await this.todoPromise();
console.log(res1, '查看返回数据'); console.log(res1, "查看返回数据");
params = { ...params, ...res1 } params = { ...params, ...res1 };
let res: any = await InstrumentInfo.apiNursingLog.addLog(params); let res: any = await InstrumentInfo.apiNursingLog.addLog(params);
console.log("PostNursingLogClock", res); console.log("PostNursingLogClock", res);
if (res.data.code === 200) { if (res.data.code === 200) {
@ -1728,7 +1769,6 @@ class IotCarePlanFR200 extends Component<any, any> {
isShowNursingSuccess: false, isShowNursingSuccess: false,
}); });
this.goFaceReport(res1, ActiveModeItem.id); // 跳转 this.goFaceReport(res1, ActiveModeItem.id); // 跳转
}, 2000); }, 2000);
} }
@ -1886,30 +1926,36 @@ class IotCarePlanFR200 extends Component<any, any> {
/** 完成护理提交:跳转护理报告页 */ /** 完成护理提交:跳转护理报告页 */
goFaceReport = (data, id) => { goFaceReport = (data, id) => {
let nursingData = JSON.parse(data.nursingData) let nursingData = JSON.parse(data.nursingData);
// 跳转前置空定时器,防止重复提交 // 跳转前置空定时器,防止重复提交
if (currentTimeTimer) clearInterval(currentTimeTimer); if (currentTimeTimer) clearInterval(currentTimeTimer);
if (['face', 'eyes', 'nasolabialFold', 'mandibularLine', 'headLiftingPro'].includes(nursingData.workMode)) { if (
[
"face",
"eyes",
"nasolabialFold",
"mandibularLine",
"headLiftingPro",
].includes(nursingData.workMode)
) {
let obj = { let obj = {
modeName: nursingData.modeName, modeName: nursingData.modeName,
data: nursingData data: nursingData,
} };
let report = true; let report = true;
go( go(
"/recoding/pages/face_report_one/face_report_one?id=" + "/recoding/pages/face_report_one/face_report_one?id=" +
id + id +
"&report=" + "&report=" +
report + "&obj=" + report +
JSON.stringify(obj) "&obj=" +
JSON.stringify(obj)
); );
} else if ("moistureTest" === nursingData.workMode) {
} else if ('moistureTest' === nursingData.workMode) { console.log("水分测试");
console.log('水分测试');
} else { } else {
go("/pages/face_report/face_report?id=" + this.state.currentDevice.id); go("/pages/face_report/face_report?id=" + this.state.currentDevice.id);
} }
}; };
// 完成配对 // 完成配对
@ -2011,6 +2057,7 @@ class IotCarePlanFR200 extends Component<any, any> {
ModeStepIndex, ModeStepIndex,
currentServiceData, currentServiceData,
ActiveModeItem, ActiveModeItem,
currentWorkModeType,
isSwitchActiveMode, isSwitchActiveMode,
ModeID, ModeID,
activeModeID, activeModeID,
@ -2035,6 +2082,7 @@ class IotCarePlanFR200 extends Component<any, any> {
isRuningTest, isRuningTest,
isShowHistoryMsg, isShowHistoryMsg,
isModeLock, isModeLock,
TestModeStepIndex,
} = this.state; } = this.state;
return ( return (
@ -2180,9 +2228,9 @@ class IotCarePlanFR200 extends Component<any, any> {
deviceInfo={currentDevice} deviceInfo={currentDevice}
close={this.connectionClose} close={this.connectionClose}
isDisconnect={!isConnectionBlutoot} isDisconnect={!isConnectionBlutoot}
offlineChange={() => { }} offlineChange={() => {}}
pairingChange={this.pairingChange} pairingChange={this.pairingChange}
upgradeFun={() => { }} upgradeFun={() => {}}
/> />
)} )}
@ -2278,12 +2326,15 @@ class IotCarePlanFR200 extends Component<any, any> {
)} )}
{ActiveModeItem.modeType === "moistureTest" && ( {ActiveModeItem.modeType === "moistureTest" && (
<WaterTest></WaterTest> <WaterTest
isRuningTest={isRuningTest}
TestModeStepIndex={TestModeStepIndex}
></WaterTest>
)} )}
</View> </View>
<Footer <Footer
currentWorkMode={ActiveModeItem.modeType} currentWorkModeType={currentWorkModeType}
isRuningTest={isRuningTest} isRuningTest={isRuningTest}
isStopNurse={isStopNurse} isStopNurse={isStopNurse}
onEmitStartNurse={this.onStartNurse} onEmitStartNurse={this.onStartNurse}

@ -3,7 +3,7 @@ import "./FR200.less";
interface Props { interface Props {
// isShowNurse: boolean; // isShowNurse: boolean;
currentWorkMode: string; // 当前工作模式 currentWorkModeType: number; // 当前工作模式 1基础脸部等只有结束按钮 2.促渗,可以开始暂停和结束 3.水分测试
isStopNurse: boolean; isStopNurse: boolean;
isRuningTest: boolean; // 是否在运行测试 isRuningTest: boolean; // 是否在运行测试
onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件 onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件
@ -11,7 +11,7 @@ interface Props {
onEmitEndPlan: Function; onEmitEndPlan: Function;
} }
function Index({ function Index({
currentWorkMode, currentWorkModeType,
isStopNurse, isStopNurse,
isRuningTest, isRuningTest,
onEmitStartNurse, onEmitStartNurse,
@ -33,7 +33,7 @@ function Index({
return ( return (
<Block> <Block>
<View className="iot-footer"> <View className="iot-footer">
{currentWorkMode === "moistureTest" && ( {currentWorkModeType === 3 && (
<Block> <Block>
{!isRuningTest ? ( {!isRuningTest ? (
<View className="btn " onClick={onStartNurse}> <View className="btn " onClick={onStartNurse}>
@ -45,7 +45,7 @@ function Index({
</Block> </Block>
)} )}
{currentWorkMode !== "moistureTest" && ( {currentWorkModeType === 2 && (
<View className="switch-btn-box"> <View className="switch-btn-box">
<View className="btn-item border-right" onClick={onSwitchChange}> <View className="btn-item border-right" onClick={onSwitchChange}>
{isStopNurse ? ( {isStopNurse ? (
@ -79,6 +79,19 @@ function Index({
</View> </View>
</View> </View>
)} )}
{currentWorkModeType === 1 && (
<View className="switch-btn-box">
<View className="btn-item" onClick={onEndPlan}>
<Image
className="btn-icon"
src={require("@/img/iot/over_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text"></Text>
</View>
</View>
)}
</View> </View>
</Block> </Block>
); );

@ -6,12 +6,11 @@ import { Popup, Progress, Slider } from "@antmjs/vantui";
import "./index.less"; import "./index.less";
interface Props { interface Props {
Electricity: any; isRuningTest: boolean; // 是否已开始水分测试
matrixElectricity: any; TestModeStepIndex: number; // 当前测试步骤
facialMaskConnectStatus: any;
} }
function Index() { function Index(isRuningTest, TestModeStepIndex) {
const stepIndex = 0; const stepIndex = 0;
const testIndex = 1; const testIndex = 1;
@ -33,53 +32,56 @@ function Index() {
}, },
]; ];
return ( return (
<Block> <Block>
<View> <View>
<View className='water_test'> {!isRuningTest && (
<View className='test_step flex aitems sb'> <View className="water_test">
<View className="test_step flex aitems sb">
{stepList.map((item, index) => { {stepList.map((item, index) => {
return ( return (
<View className='step_block flex aitems' key={index}> <View className="step_block flex aitems" key={index}>
<View className='step_top flex aitems'> <View className="step_top flex aitems">
<View className='drop'></View> <View className="drop"></View>
<View className='step_num'>{item.value}</View> <View className="step_num">{item.value}</View>
{index != 2 && <View className='line'></View>} {index != 2 && <View className="line"></View>}
</View> </View>
<View className='step_name'>{item.name}</View> <View className="step_name">{item.name}</View>
</View> </View>
); );
})} })}
</View> </View>
<View className='test_txt'> <View className="test_txt">
</View> </View>
</View> </View>
)}
<View className='testing'> {isRuningTest && (
<View className='testing_header flex aitems'> <View className="testing">
<View className="testing_header flex aitems">
{stepList.map((item, index) => { {stepList.map((item, index) => {
return ( return (
<View <View
className='items flex aitems jcenter' className="items flex aitems jcenter"
key={index} key={index}
style={stepIndex == index ? "background: #fff" : ""} style={stepIndex == index ? "background: #fff" : ""}
> >
{stepIndex > index && ( {stepIndex > index && (
<Image <Image
className='finish_img' className="finish_img"
src={require("@/img/full-scran.png")} src={require("@/img/full-scran.png")}
mode='aspectFill' mode="aspectFill"
></Image> ></Image>
)} )}
<View className='value'>{item.value}</View> <View className="value">{item.value}</View>
<View className='name'>{item.name}</View> <View className="name">{item.name}</View>
</View> </View>
); );
})} })}
</View> </View>
<View className='testing_content'> <View className="testing_content">
<View className='progress_box flex aitems'> <View className="progress_box flex aitems">
<View className='title'> <View className="title">
{stepList[stepIndex].name + "水分测试"} {stepList[stepIndex].name + "水分测试"}
</View> </View>
{/* <view class='progress_block flex aitems'> */} {/* <view class='progress_block flex aitems'> */}
@ -87,22 +89,22 @@ function Index() {
style={{ style={{
width: "300rpx", width: "300rpx",
}} }}
percentage='80' percentage="80"
strokeWidth='14' strokeWidth="14"
showPivot={false} showPivot={false}
color='#C2E5F3' color="#C2E5F3"
></Progress> ></Progress>
{stepList[stepIndex].finish && 80 >= 99 ? ( {stepList[stepIndex].finish && 80 >= 99 ? (
<Image <Image
className='finish_img' className="finish_img"
src={require("@/img/finished.png")} src={require("@/img/finished.png")}
mode='aspectFill' mode="aspectFill"
></Image> ></Image>
) : ( ) : (
<Image <Image
className='finish_img' className="finish_img"
src={require("@/img/no-finish.png")} src={require("@/img/no-finish.png")}
mode='aspectFill' mode="aspectFill"
></Image> ></Image>
)} )}
{/* </view> */} {/* </view> */}
@ -110,7 +112,7 @@ function Index() {
{/* <view class='tips' wx:if='{{!finish}}'> */} {/* <view class='tips' wx:if='{{!finish}}'> */}
{/* 请参考视频指引,将仪器紧贴<text style='color: #000000'>额头区域</text> */} {/* 请参考视频指引,将仪器紧贴<text style='color: #000000'>额头区域</text> */}
{/* </view> */} {/* </view> */}
<View className='tips flex sb'> <View className="tips flex sb">
<View> <View>
{(testIndex == 1 || testIndex == 2 || testIndex == 4) && ( {(testIndex == 1 || testIndex == 2 || testIndex == 4) && (
@ -129,10 +131,9 @@ function Index() {
</View> </View>
</View> </View>
</View> </View>
</View> )}
</View>
</Block>
</Block>
); );
} }

@ -674,11 +674,8 @@ class Index extends Component<any, any> {
} }
// 0已绑定 1未绑定 2已解绑 // 0已绑定 1未绑定 2已解绑
if (instrumentInfo.bindingStatus === 0) { if (instrumentInfo.bindingStatus === 0) {
setTimeout(() => {
this.isBindingSerial();
}, 100);
let isBind = this.state.instrumentList.find( let isBind = this.state.instrumentList.find(
(item) => item.id === instrumentInfo.id (item) => item.id === instrumentInfo.instrumentId
); );
if (isBind) { if (isBind) {
msg("序列号已绑定"); msg("序列号已绑定");
@ -688,7 +685,6 @@ class Index extends Component<any, any> {
BeforeBindingErrorText: "序列号已被其他用户绑定", BeforeBindingErrorText: "序列号已被其他用户绑定",
}); });
} }
return; return;
} else if ( } else if (
instrumentInfo.bindingStatus === 1 || instrumentInfo.bindingStatus === 1 ||
@ -749,7 +745,7 @@ class Index extends Component<any, any> {
msg("绑定成功"); msg("绑定成功");
let obj = unbindingInstrumentList.find( let obj = unbindingInstrumentList.find(
(item) => item.id === instrumentInfo.id (item) => item.id === instrumentInfo.instrumentId
); );
if (obj) { if (obj) {
setStorageSync("instrument_detail", obj); setStorageSync("instrument_detail", obj);
@ -757,8 +753,8 @@ class Index extends Component<any, any> {
setTimeout(() => { setTimeout(() => {
// 绑定成功后,先查询设备介绍页,有数据则跳转,没数据则刷新已绑定数据 // 绑定成功后,先查询设备介绍页,有数据则跳转,没数据则刷新已绑定数据
this.getInstrumentIntroInfo(instrumentInfo.id); this.getInstrumentIntroInfo(instrumentInfo.instrumentId);
}, 1000); }, 500);
return; return;
} else if (data.code === 204) { } else if (data.code === 204) {
this.setState({ this.setState({
@ -780,9 +776,10 @@ class Index extends Component<any, any> {
let res = await InstrumentInfo.instructionInfo({ let res = await InstrumentInfo.instructionInfo({
instrumentId: id, instrumentId: id,
}); });
console.log("res", res);
if (res.data.code === 200) { if (res.data.code === 200) {
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
go("/instrument/pages/instrument/intro??customBack=true&id=" + id); go("/instrument/pages/instrument/intro?customBack=true&id=" + id);
} else { } else {
this.bindingInstrumentList(); this.bindingInstrumentList();
} }
@ -804,8 +801,13 @@ class Index extends Component<any, any> {
if (data.code === 200) { if (data.code === 200) {
msg("换绑成功"); msg("换绑成功");
setTimeout(() => { setTimeout(() => {
setStorageSync("instrument_detail", JSON.stringify(instrumentInfo)); let obj = this.state.unbindingInstrumentList.find(
this.getInstrumentIntroInfo(instrumentInfo.id); (item) => item.id === instrumentInfo.instrumentId
);
if (obj) {
setStorageSync("instrument_detail", obj);
}
this.getInstrumentIntroInfo(instrumentInfo.instrumentId);
}, 500); }, 500);
} }
}; };

@ -16,7 +16,6 @@ page {
color: #666; color: #666;
padding: 0 32rpx; padding: 0 32rpx;
position: sticky; position: sticky;
top: 174rpx;
z-index: 9; z-index: 9;
} }
@ -74,8 +73,6 @@ page {
background: #f8f8f8; background: #f8f8f8;
padding-top: 25rpx; padding-top: 25rpx;
padding-bottom: 29rpx; padding-bottom: 29rpx;
position: sticky;
top: 286rpx;
z-index: 9; z-index: 9;
} }

@ -61,6 +61,8 @@ export default class Recording extends Component<any, any> {
clockImageList: [], clockImageList: [],
clockContent: "", clockContent: "",
}, },
navigationBarHeight: '',
statusBarHeight: ''
}; };
} }
@ -267,13 +269,16 @@ export default class Recording extends Component<any, any> {
this.getLatestClockRecord(); this.getLatestClockRecord();
this.getClockStatistics(); this.getClockStatistics();
this.DayTime(); this.DayTime();
this.setStatusBar();
} }
componentDidShow() { } componentDidShow() { }
componentDidHide() { } componentDidHide() { }
async initData() { } async initData() {
}
// 选择年份 // 选择年份
onChangeYear(event) { onChangeYear(event) {
this.setState({ year: event.detail.value }); this.setState({ year: event.detail.value });
@ -410,6 +415,25 @@ export default class Recording extends Component<any, any> {
delta: 1, delta: 1,
}); });
} }
setStatusBar() {
Taro.getSystemInfoAsync({
success: (res) => {
const statusBarHeight = res.statusBarHeight || 0;
// 获取微信胶囊的位置信息 width,height,top,right,left,bottom
const custom = Taro.getMenuButtonBoundingClientRect();
// 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
const navigationBarHeight =
custom.height + (custom.top - statusBarHeight) * 2;
this.setState({
statusBarHeight,
navigationBarHeight,
});
},
});
}
render() { render() {
let { let {
current, current,
@ -427,12 +451,19 @@ export default class Recording extends Component<any, any> {
monthTime, monthTime,
show, show,
punchInInfo, punchInInfo,
navigationBarHeight,
statusBarHeight
} = this.state; } = this.state;
const statusBarHeightRpx = statusBarHeight * 2;
const navigationBarHeightRpx = navigationBarHeight * 2;
const height = statusBarHeightRpx + navigationBarHeightRpx
return ( return (
<Block> <Block>
<Navbar isBack titleSlot="护理记录"></Navbar> <Navbar isBack titleSlot='护理记录'></Navbar>
<View className="tabs"> <View className='tabs' style={{
top: height + "rpx", position: 'sticky'
}}
>
<View <View
className={classnames("tab", { className={classnames("tab", {
tab_active: current === 0, tab_active: current === 0,
@ -453,7 +484,10 @@ export default class Recording extends Component<any, any> {
</View> </View>
</View> </View>
{current === 0 && ( {current === 0 && (
<ScrollView className="products_list" scroll-x="true"> <ScrollView className='products_list' scroll-x='true' style={{
top: height + 110 + 'rpx', position: 'sticky'
}}
>
<View <View
className={classnames("all", { className={classnames("all", {
products_item_active: !curIndex, products_item_active: !curIndex,
@ -471,11 +505,11 @@ export default class Recording extends Component<any, any> {
onClick={this.onChangeProduct.bind(this, item.id)} onClick={this.onChangeProduct.bind(this, item.id)}
> >
<Image <Image
className="products_cover" className='products_cover'
src={item.logo} src={item.logo}
mode="aspectFill" mode='aspectFill'
></Image> ></Image>
<View className="products_title">{item.name}</View> <View className='products_title'>{item.name}</View>
</View> </View>
))} ))}
</ScrollView> </ScrollView>
@ -483,17 +517,17 @@ export default class Recording extends Component<any, any> {
{current === 0 && recordList.length === 0 && ( {current === 0 && recordList.length === 0 && (
<View> <View>
<View className="nodata"> <View className='nodata'>
<Image <Image
className="nodata_img" className='nodata_img'
src={require("@/img/nodata.png")} src={require("@/img/nodata.png")}
></Image> ></Image>
<View className="nodata_text"></View> <View className='nodata_text'></View>
</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'>
@ -520,12 +554,12 @@ 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 <View
className={classnames("tip", { className={classnames("tip", {
tag_active: item.online === 2, tag_active: item.online === 2,
@ -536,7 +570,7 @@ export default class Recording extends Component<any, any> {
</View> </View>
{item.instrumentType === 2 && ( {item.instrumentType === 2 && (
<View <View
className="top-right" className='top-right'
onClick={this.toReport.bind( onClick={this.toReport.bind(
this, this,
item.instrumentId, item.instrumentId,
@ -546,23 +580,23 @@ export default class Recording extends Component<any, any> {
> >
<Image <Image
className="arrow_icon" className='arrow_icon'
src={require("@/img/index/right.png")} src={require("@/img/index/right.png")}
mode="aspectFill" mode='aspectFill'
></Image> ></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"> <View className='subtitle'>
{item.nursingTime} {item.nursingTime}
</View> </View>
</View> </View>
@ -574,7 +608,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'
@ -582,52 +616,52 @@ 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 <Picker
mode="date" mode='date'
fields="year" fields='year'
onChange={this.onChangeYear.bind(this)} onChange={this.onChangeYear.bind(this)}
value="{{year}}" value='{{year}}'
end="{{today}}" end='{{today}}'
> >
<View className="clock_in_statistics_date flex aitems"> <View className='clock_in_statistics_date flex aitems'>
<View>{year}</View> <View>{year}</View>
<Image <Image
className="more_icon" className='more_icon'
src={require("@/img/arrow-down.png")} src={require("@/img/arrow-down.png")}
mode="widthFix" mode='widthFix'
></Image> ></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 && ( {item.time > 0 && (
<View className="buoy">{item.time}</View> <View className='buoy'>{item.time}</View>
)} )}
<View <View
className="column" className='column'
style={{ height: `calc(186/31*${item.time}rpx)` }} style={{ height: `calc(186/31*${item.time}rpx)` }}
></View> ></View>
<View className="month">{item.month}</View> <View className='month'>{item.month}</View>
</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"> <View className='time'>
{item.year}{item.month} {item.year}{item.month}
</View> </View>
<View <View
className="more_box flex aitems" className='more_box flex aitems'
onClick={this.onChangeMore.bind( onClick={this.onChangeMore.bind(
this, this,
item.id, item.id,
@ -635,7 +669,7 @@ export default class Recording extends Component<any, any> {
item.month item.month
)} )}
> >
<View className="more_text"> <View className='more_text'>
{" "} {" "}
{!item.isMore ? "展开更多" : "收起更多"} {!item.isMore ? "展开更多" : "收起更多"}
</View> </View>
@ -645,51 +679,51 @@ export default class Recording extends Component<any, any> {
? "rotate(180deg)" ? "rotate(180deg)"
: "rotate(0deg)", : "rotate(0deg)",
}} }}
className="more_icon" className='more_icon'
src={require("@/img/arrow-down.png")} src={require("@/img/arrow-down.png")}
mode="widthFix" 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"> <View className='statistic_num'>
{(item.percentage * 100).toFixed(2)}% {(item.percentage * 100).toFixed(2)}%
</View> </View>
<View className="statistic_desc"></View> <View className='statistic_desc'></View>
</View> </View>
<View className="border"></View> <View className='border'></View>
</View> </View>
{item.isMore && item.detail && ( {item.isMore && item.detail && (
<View> <View>
{item.detail.map((obj) => ( {item.detail.map((obj) => (
<View key={obj.id}> <View key={obj.id}>
<View style="height: 57rpx"></View> <View style='height: 57rpx'></View>
<View className="month_item"> <View className='month_item'>
<View className="month_item_date"> <View className='month_item_date'>
{obj.updateTime} {obj.updateTime}
</View> </View>
<View className="month_image_box flex sb"> <View className='month_image_box flex sb'>
{obj.clockImg.map((img) => ( {obj.clockImg.map((img) => (
<Image <Image
key={img} key={img}
className="month_item_cover" className='month_item_cover'
src={img} src={img}
></Image> ></Image>
))} ))}
</View> </View>
<View className="month_item_date"> <View className='month_item_date'>
{/* 小紫弹智能射频仪、花至抗老射频仪PRO{" "} */} {/* 小紫弹智能射频仪、花至抗老射频仪PRO{" "} */}
{obj.instrumentName === null {obj.instrumentName === null
? "" ? ""
: obj.instrumentName} : obj.instrumentName}
</View> </View>
<View className="month_item_note"> <View className='month_item_note'>
{obj.clockContent} {obj.clockContent}
</View> </View>
</View> </View>
@ -704,8 +738,8 @@ export default class Recording extends Component<any, any> {
</View> </View>
)} )}
{!clockShow && ViewAddInstrument === "true" && ( {!clockShow && ViewAddInstrument === "true" && (
<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}>
@ -715,64 +749,64 @@ export default class Recording extends Component<any, any> {
)} )}
<Popup show={show} onClose={() => this.setState({ show: false })}> <Popup show={show} onClose={() => this.setState({ show: false })}>
<View className="popBox"> <View className='popBox'>
<Image <Image
className="close_icon" className='close_icon'
src={require("@/img/close.png")} src={require("@/img/close.png")}
mode="widthFix" mode='widthFix'
onClick={this.setShow.bind(this, false)} onClick={this.setShow.bind(this, false)}
></Image> ></Image>
<View className="popTitle"></View> <View className='popTitle'></View>
<View className="popSubtitle"> <View className='popSubtitle'>
<View className="bold">{clockStatistics[0]?.clockNum}</View>{" "} <View className='bold'>{clockStatistics[0]?.clockNum}</View>{" "}
<View className="bold"> <View className='bold'>
{(clockStatistics[0]?.percentage * 100).toFixed(1)}% {(clockStatistics[0]?.percentage * 100).toFixed(1)}%
</View> </View>
</View> </View>
<View className="img_box"> <View className='img_box'>
{punchInInfo.clockImageList.map((item, index) => ( {punchInInfo.clockImageList.map((item, index) => (
<View key={item} className="img"> <View key={item} className='img'>
<Image className="showImg" src={item} mode="widthFix"></Image> <Image className='showImg' src={item} mode='widthFix'></Image>
<Image <Image
className="closeImg" className='closeImg'
src={require("@/img/close1.png")} src={require("@/img/close1.png")}
mode="widthFix" mode='widthFix'
onClick={this.delImg.bind(this, index)} onClick={this.delImg.bind(this, index)}
></Image> ></Image>
</View> </View>
))} ))}
{punchInInfo.clockImageList.length < 3 && ( {punchInInfo.clockImageList.length < 3 && (
<View <View
className="addBox" className='addBox'
onClick={this.handleChooseImage.bind(this)} onClick={this.handleChooseImage.bind(this)}
> >
<Image <Image
className="showImg" className='showImg'
src={require("@/img/clock_in_upload/add-image.png")} src={require("@/img/clock_in_upload/add-image.png")}
mode="widthFix" 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>

Loading…
Cancel
Save