From 67778a0d9127077d44f2e5d5cc9e75d6a5bc8ccb Mon Sep 17 00:00:00 2001 From: "L14\\huangyilong" <809440505@qq.com> Date: Fri, 31 May 2024 17:46:36 +0800 Subject: [PATCH] =?UTF-8?q?5.31=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/careplan/img/arrow-down.png | Bin 0 -> 270 bytes src/careplan/pages/planinfo/planinfo.tsx | 179 +- src/components/NursingPlanReport/index.tsx | 213 +- src/components/nursing/nursing.less | 8 + src/components/nursing/nursing.tsx | 663 ++-- src/components/popup/popup-drawer.tsx | 2 +- .../pages/instrument/instrument.tsx | 2 + src/moduleIOT/pages/iotCarePlan/FE200.tsx | 124 +- src/moduleIOT/pages/iotCarePlan/FR200.tsx | 200 +- src/moduleIOT/pages/iotCarePlan/WE200.tsx | 233 +- .../pages/iotCarePlan/WE200Function.ts | 3105 ++++++++--------- src/moduleIOT/pages/iotCarePlan/WE200State.js | 12 +- src/moduleIOT/pages/iotCarePlan/WL200.tsx | 167 +- .../pages/iotCarePlan/WL200Function.ts | 2118 +++++------ .../iotCarePlan/components/Bluetoot/FR200.ts | 46 +- .../iotCarePlan/components/Bluetoot/WE200.ts | 171 +- .../iotCarePlan/components/Bluetoot/WL200.ts | 350 +- .../ElectricityView/Electricity.tsx | 2 +- .../FacialCalibration/FacialCalibration.less | 27 +- .../FacialCalibration/FacialCalibration.tsx | 39 +- .../iotCarePlan/components/ModeList/WL200.tsx | 20 +- src/pages/activity/activity.tsx | 4 +- src/pages/index/index.tsx | 330 +- src/pages/initiate/initiate.tsx | 3 + .../pages/face_report/face_report.tsx | 95 +- .../pages/face_report_one/face_report_one.tsx | 86 +- .../face_report_we200/face_report_we200.tsx | 159 +- src/recoding/pages/recording/recording.tsx | 35 +- src/utils/bluetooth.js | 6 +- src/utils/carePlanApi.js | 11 +- src/utils/util.js | 1 - 32 files changed, 4597 insertions(+), 3816 deletions(-) create mode 100644 src/careplan/img/arrow-down.png diff --git a/package.json b/package.json index 85a43b8..32b0714 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "dependencies": { "@antmjs/vantui": "^3.3.5", "@flossom-npm/iot-translater": "^1.1.2", - "@flossom-npm/iot-translater-we100": "^1.1.1", + "@flossom-npm/iot-translater-we100": "^1.1.13", "@reduxjs/toolkit": "^2.0.1", "@tarojs/components": "~3.6.24", "@tarojs/helper": "~3.6.24", diff --git a/src/careplan/img/arrow-down.png b/src/careplan/img/arrow-down.png new file mode 100644 index 0000000000000000000000000000000000000000..6cd1e0e5ddc867c5ad447df8d59f067a60714aa6 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k3?#4J%UA`Zj01c^T!HjV5<$wUZ*4$r0wqCy z!3?vOZtBdch&m_qaj%cV6SH%twPyq6sytmBLo80ey|A0FL4l|BA#;=Xgwwz6*Q&~P z2>Hj{`7xdEZ`-mNwWmXlH=gI)8g}@M7DJo1`fJe*Mmpw`DuZ`@atJ?Ska|^MY1(dC zi&d^?gLUupXswcrzkT)M8BT-JH(4D?Zl8QtdNKr0lnxE@Sde>GgdwIi#^CpQZt3^z Vztj&XR0CbX;OXk;vd$@?2>?pnaOwa6 literal 0 HcmV?d00001 diff --git a/src/careplan/pages/planinfo/planinfo.tsx b/src/careplan/pages/planinfo/planinfo.tsx index d5d6f79..379b681 100644 --- a/src/careplan/pages/planinfo/planinfo.tsx +++ b/src/careplan/pages/planinfo/planinfo.tsx @@ -55,6 +55,7 @@ class carePlanInfo extends Component { planPerson: 0, // 护理计划参与人数 planinfoDetail: null, //护理计划详情页图片 planinstrumentList: [], // 护理计划仪器列表 + isJoinPlan: null, // 是否有已参加或待审核的计划 /** 护理计划主页数据 end */ /** 定制计划问卷星 */ @@ -76,7 +77,8 @@ class carePlanInfo extends Component { // 当前日程每日护理计划信息 schedulePlan: [], // 当前日程每日护理计划信息列表 schedulePlanDay: {}, // 当前展示的每日护理计划信息 默认展示第一天 - scheduleMarks: [], // 展示日历标记的数据 [] + scheduleMarks: [], // 护理计划天数展示 [] + scheduleMarksAtC: [], // 展示日历标记的数据 [] scheduleMarksDay: 0, // 当前选中的计划日程对应天数的下标 /** 计划日程组件数据 end */ @@ -86,7 +88,7 @@ class carePlanInfo extends Component { currentDay: 0, // 当前天数 totalProgress: 0, // 总任务数 currentProgress: 0, //已经完成的任务数 - isQualifyFor: 0, // 是否有领奖资格 + isQualifyFor: 0, // 是否显示奖励进度 /** 奖励完成度 end */ /** 只有确认按钮的弹窗组件数据 */ @@ -117,12 +119,19 @@ class carePlanInfo extends Component { isNotRegister: false, //是否未注册 notBindingList: [], //未绑定仪器列表 optionId: "", + cantJoin:false }; } async onLoad(option) { - console.log(option); + // 判断是否登录 + let mobile = Taro.getStorageSync("mobile"); + if (!mobile) { + // 未登录弹出去注册登录弹窗 + return this.setState({ isNotRegister: true }); + } + console.log(option, "护理计划id"); let { id } = option; // id 护理计划id if (id) { this.setState({ optionId: id }); @@ -133,6 +142,7 @@ class carePlanInfo extends Component { async getInfo(id) { let surveyNumber; // 问卷星分数 const userId = Taro.getStorageSync("userId"); // 用户id + const isJoinPlan = Taro.getStorageSync("isJoinPlan"); // 用户是否有参与或待审核的计划 // 未携带参数id(完成调查问卷重新进入) if (!id) { id = Taro.getStorageSync("currentPlanId"); @@ -141,24 +151,22 @@ class carePlanInfo extends Component { if (res.data.code !== 200) surveyNumber = -1; else surveyNumber = res.data.data; } - // 进入详情页携带了参数id(点击详情,分享链接) const res = await getPlayDetailApi({ planId: id }); if (res.data.code !== 200) return; console.log(res.data.data, "护理计划详情"); - const planInfo = res.data.data.plan; + const planInfo = res.data.data.plan; // 护理计划详情 Taro.setStorageSync("currentPlanInfo", planInfo); - let scheduleList = res.data.data.cycleList; - const flag = planInfo.joinStatus !== 0 && planInfo.joinStatus !== -1; // 计划不是可参与状态 + let scheduleList = res.data.data.cycleList; // 护理日程列表 let planinfoDetail = decodeURIComponent(planInfo.activeDetail); planinfoDetail = planinfoDetail.replace( /\ { surveyUrl: `https://insightlab.wjx.cn/vm/YDYDrHk.aspx?sojumpparm=user_id@${userId};activity_id@${planInfo.id}`, // 定制计划星卷问卷地址(测试地址), isReward: planInfo.isReward, // 是否有计划奖励 rewardConditions: planInfo.rewardConditions, // 获取奖励所需要的护理天数, - isCollapsePlanInfo: flag, // 是否收起计划详情(不是可参与则收起计划详情展示计划日程) + isCollapsePlanInfo: planInfo.joinStatus === 1, // 是否收起计划详情(不是可参与则收起计划详情展示计划日程) }, async () => { // 获取计划主要仪器 @@ -202,8 +210,8 @@ class carePlanInfo extends Component { this.setState({ isRelevancyShow: true }); // 未匹配到合适的日程 } } - // 进入的是非可参与的计划详情页 - if (flag) await this.getPlanNowProgress(); + // 进入的是参与中的计划详情页 + if (planInfo.joinStatus === 1) await this.getPlanNowProgress(); // 浏览护理计划详情获取小程序标签 browseSetWechatTagApi({ planId: this.state.id })?.catch(() => {}); } @@ -224,7 +232,7 @@ class carePlanInfo extends Component { if (res.data.code !== 200 || !res.data.data) return; // 本地缓存当前护理计划,用于仪器护理页请求接口判断医美模式的显示 Taro.setStorageSync("PlanNowProgress", res.data.data); - const cycleId = res.data.data.cycleId; + const cycleId = res.data.data.cycleId; // 当前计划参加的日程 console.log(res.data.data, "今日护理进度"); let nursingProgression = []; if (res.data.data.details?.length > 0) { @@ -237,7 +245,7 @@ class carePlanInfo extends Component { img: item.modeBanner, name: item.instrumentName, description: item.modeName, - time: item.modeTime / 60 + "分钟", + time: this.setTime(item.modeTime) + "分钟", status: item.status, // 0未完成 1已完成 }; }); @@ -250,7 +258,7 @@ class carePlanInfo extends Component { currentDay: res.data.data.currentDay, // 当前天数 totalProgress: res.data.data.totalProgress, // 总任务数 currentProgress: res.data.data.currentProgress, // 已经完成的任务数 - isQualifyFor: res.data.data.isQualifyFor, // 是否有领奖资格 + isQualifyFor: res.data.data.isQualifyFor, // 是否显示奖励进度 isRewardFinish: res.data.data.currentProgress >= res.data.data.totalProgress, // 任务是否完成 }, @@ -334,6 +342,7 @@ class carePlanInfo extends Component { }; shareCheck(params) { + console.log(params, "params"); if (params.planId) { this.setState({ id: params.planId }); } @@ -434,20 +443,34 @@ class carePlanInfo extends Component { getInstrumentList = async (data) => { const res = await getBindInstrumentListApi(data); if (res.data.code !== 200) return; + const instrumentList: any[] = []; + res.data.data && + res.data.data.forEach((item) => { + const code = instrumentList.find((subItem: any) => { + return subItem.instrumentId === item.instrumentId; + }); + if (!code) instrumentList.push(item); + }); + if (!data.cycleId) { // 护理计划主页显示的仪器 - this.setState({ planinstrumentList: res.data.data }); + this.setState({ planinstrumentList: instrumentList }); } else { // 护理计划日程显示的仪器 - this.setState({ scheduleinstrumentList: res.data.data }); + this.setState({ scheduleinstrumentList: instrumentList }); } }; // 点击前往定制 customize = () => { - const { id, status, surveyUrl, isRelevancyCustom, scheduleList } = + let activity = Taro.getStorageSync('activity') + if (activity == 2) { + this.setState({ cantJoin: true }); + return + } + const { id, isJoinPlan, surveyUrl, isRelevancyCustom, scheduleList } = this.state; - if (status === -1) { + if (!!isJoinPlan) { // 正在参与其他护理计划 this.setState({ isPromptShow: true, @@ -475,6 +498,23 @@ class carePlanInfo extends Component { // go("/pages/webView/webView"); } else { // 没有关联定制计划,弹出定制弹窗 默认选中第一个日程并获取相关数据 + if (scheduleList.length === 0) { + this.setState({ + isPromptShow: true, + promptdata: { + hidden: true, + ...this.state.promptdata, + content: ( + + 当前计划未配置日程 + 请联系管理员 + + ), + }, + }); + this.setState({ isPlanSchedule: false }); + return setTimeout(() => this.setState({ isPromptShow: false }), 2000); + } this.setState({ currentSchedule: scheduleList[0] }, async () => { this.getInstrumentList({ planId: this.state.id, @@ -504,6 +544,9 @@ class carePlanInfo extends Component { const scheduleMarks = res.data.data.map((item) => { return { value: item.date, color: item.color }; }); + const scheduleMarksAtC = scheduleMarks.filter((item) => { + return item.color; + }); const schedulePlanDay = { idDayOff: res.data.data[0].isDayOff, step: !res.data.data[0].isDayOff @@ -512,6 +555,7 @@ class carePlanInfo extends Component { }; this.setState({ scheduleMarks, + scheduleMarksAtC, schedulePlanDay, schedulePlan: res.data.data, }); @@ -534,6 +578,13 @@ class carePlanInfo extends Component { }); return step; }; + setTime = (data) => { + const time = data / 60; + const arr = time.toString().split("."); + const len = arr[1]?.split("").length; + if (len >= 2) return time.toFixed(2); + else return time; + }; // 点击收起更多 planInfoCollapse = (str) => { @@ -617,14 +668,7 @@ class carePlanInfo extends Component { }; // 点击前往护理 - goToNursing = (prepareData) => { - console.log("前往护理", prepareData); - let item = { - ...prepareData, - type: prepareData.stepType, - nursingPlanId: prepareData.id, - id: prepareData.instrumentId, - }; + goToNursing = (item) => { Taro.setStorageSync("prepareData", item); Taro.switchTab({ url: "/pages/index/index" }); }; @@ -642,16 +686,16 @@ class carePlanInfo extends Component { closeAlert = () => { this.setState({ isNotRegister: false }); this.setState({ isNotBinding: false }); + this.setState({ cantJoin: false }); + + Taro.switchTab({ url: "/pages/index/index" }); }; toBinding() { let { notBindingList } = this.state; - console.log(notBindingList, "..........................."); - let ids: any = []; notBindingList.map((item) => { ids.push(item.instrumentId); }); - console.log(ids, "..........................."); go( `/instrument/pages/instrument/instrument?isOnly=true&id=${JSON.stringify( @@ -666,6 +710,10 @@ class carePlanInfo extends Component { toRegister() { go(`/pages/register/register?isShare=true&planId=${this.state.id}`); } + + customBack = () => { + Taro.switchTab({ url: "/pages/index/index" }); + }; // 点击回看计划报告 scheduledReports = () => { this.setState({ isNursingShow: true }, () => { @@ -680,6 +728,7 @@ class carePlanInfo extends Component { // 护理计划详情数据 name, planJoinId, + isJoinPlan, planImg, status, planDay, @@ -697,6 +746,7 @@ class carePlanInfo extends Component { scheduleinstrumentList, schedulePlanDay, scheduleMarks, + scheduleMarksAtC, scheduleMarksDay, isReward, @@ -721,6 +771,7 @@ class carePlanInfo extends Component { isCollapsePlanInfo, isCollapsePlanSchedule, isNotJoin, + cantJoin } = this.state; // 计划日程组件 @@ -805,7 +856,7 @@ class carePlanInfo extends Component { {/* 日期组件 */} {/* 日程step */} @@ -897,7 +948,12 @@ class carePlanInfo extends Component { return ( - + { close={this.closeAlert} confirm={this.toRegister.bind(this)} /> + + { content={content} confirmButtonText="知道了" textAlgin="center" - type="1" close={this.closeAlert} confirm={this.toIndex} /> @@ -987,12 +1054,14 @@ class carePlanInfo extends Component { 计划进度: (第{currentDay}天/第{totalDay}天) - - 计划完成度: {planFinish}{" "} - - ( {currentProgress}/{totalProgress} ) - - + {!!isQualifyFor && !!isReward && ( + + 奖励完成度: {planFinish}{" "} + + ( {currentProgress}/{totalProgress} ) + + + )} 注意:假设中止护理计划,护理进度和完成度将清零 @@ -1010,7 +1079,7 @@ class carePlanInfo extends Component { > {plan} @@ -1073,12 +1142,8 @@ class carePlanInfo extends Component { {/* 护理计划 */} - - + + {name} {status === -1 && 可参与} @@ -1160,7 +1225,9 @@ class carePlanInfo extends Component { }} /> - {item.instrumentName} + + {item.instrumentName} + ); @@ -1184,7 +1251,7 @@ class carePlanInfo extends Component { {isCollapsePlanInfo && ( )} @@ -1207,7 +1274,7 @@ class carePlanInfo extends Component { {/* 计划非可参与才展示的部分 */} - {status !== 0 && status !== -1 && ( + {status === 1 && ( {/* 有计划奖励且有领奖资格才显示 */} {!!isQualifyFor && !!isReward && ( @@ -1241,7 +1308,7 @@ class carePlanInfo extends Component { {isCollapsePlanSchedule && ( )} @@ -1261,13 +1328,13 @@ class carePlanInfo extends Component { {/* 底部按钮 */} - {(status === -1 || status === 0) && ( + {status !== 1 && ( 前往定制 @@ -1297,13 +1364,13 @@ class carePlanInfo extends Component { )} - {status !== -1 && status !== 0 && status !== 1 && ( + {/* {status !== -1 && status !== 0 && status !== 1 && ( 回看计划报告 - )} + )} */} ); diff --git a/src/components/NursingPlanReport/index.tsx b/src/components/NursingPlanReport/index.tsx index c70c95b..9b547f2 100644 --- a/src/components/NursingPlanReport/index.tsx +++ b/src/components/NursingPlanReport/index.tsx @@ -40,30 +40,31 @@ class NursingPlanReport extends Component { planJoinId: "", // 用户参与的护理计划id img: "", // 弹窗图片 NursingPlanReportData: {}, // 弹窗数据 - rewardState: { - integral: "", // 积分奖励 - physical: "", // 实物奖励 - physicalUrl: "", // 实物奖励地址 - link: { - rewardJumpTitle: "", // 奖励跳转标题 - rewardJumpContent: "", // 奖励跳转内容 - rewardJumpType: "", // 奖励跳转类型 1跳外部链接 2跳视频号 3跳视频号直播间 4跳内部链接 - rewardJumpWithoutUrl: "", // 奖励跳转外部路径 - rewardJumpVideoId: "", // 奖励跳转视频号id - rewardJumpVideoFeedId: "", // 奖励跳转视频号feedId - rewardJumpUrl: "", // 内部跳转路径 - rewardJumpParam: "", // 跳转参数, - rewardConditions: "", // 领取奖励需要的护理天数 - }, // 跳转奖励 - }, + rewardType: "", // 奖励类型 + isPointsReward: 0, // 是否有积分奖励 + rewardPoints: "", // 积分奖励 + prizeName: "", // 获得奖品 + wxAppid: "", // 奖品跳转Appid + rewardEntityUrl: "", // 奖品跳转地址 + link: { + rewardJumpTitle: "", // 奖励跳转标题 + rewardJumpContent: "", // 奖励跳转内容 + rewardJumpType: "", // 奖励跳转类型 1跳外部链接 2跳视频号 3跳视频号直播间 4跳内部链接 + rewardJumpWithoutUrl: "", // 奖励跳转外部路径 + rewardJumpVideoId: "", // 奖励跳转视频号id + rewardJumpVideoFeedId: "", // 奖励跳转视频号feedId + rewardJumpUrl: "", // 内部跳转路径 + rewardJumpParam: "", // 跳转参数, + rewardConditions: "", // 领取奖励需要的护理天数 + }, // 跳转奖励 + isReward: 0, // 是否有计划奖励 isSurvey: 0, // 是否需要填写问卷 1是 0否 surveyRewardUrl: "", // 奖励登记星卷问卷地址 - isQualifyFor: 1, // 是否有领奖资格 1是 0否 - isSetReward: 1, // 是否已经领取奖励 1是 0否 + isQualifyFor: 0, // 是否显示奖励进度 1是 0否 + isSetReward: 0, // 是否已经领取奖励 1是 0否 isRewardAudit: 0, // 是否需要审核 1是 0否 isRewardProcess: "", // 当前状态 - isRewardFinish: true, // 是否完成计划进度 }; } @@ -90,38 +91,39 @@ class NursingPlanReport extends Component { // isSurvey: 1, // 测试 TODO // surveyRewardUrl: `${res.data.data.surveyRewardUrl}?sojumpparm=user_id@${uesrId};activity_id@${planInfo.id}`, // 奖励登记星卷问卷地址 surveyRewardUrl: `https://insightlab.wjx.cn/vm/ew7cY2Z.aspx?sojumpparm=user_id@${uesrId};activity_id@${planId}`, // 问卷星测试地址 TODO - isQualifyFor: res.data.data.isQualifyFor, // 是否有领奖资格 1是 0否 + isQualifyFor: res.data.data.isQualifyFor, // 是否显示奖励进度 1是 0否 // isQualifyFor: 1, // 测试 TODO isSetReward: res.data.data.isSetReward, // 是否已经领取奖励 1是 0否 // isSetReward: 0, // 测试 TODO isRewardAudit: res.data.data.isExamine, // 是否需要审核 1是 0否 - // isRewardAudit: 0, // 测试 TODO + // isRewardAudit: 1, // 测试 TODO + // 1参与中 2待审核 3审核通过 4审核未通过 5已终止 6已过期 7已结束 isRewardProcess: res.data.data.status, // 当前状态 - // isRewardProcess: 4, // 测试 TODO - // isPointsReward: res.data.data.isPointsReward, // 是否有积分奖励 - rewardState: { - integral: res.data.data.isPointsReward - ? res.data.data.rewardPoints + "积分" - : "", // 积分奖励 - physical: res.data.data.prizeName, // 实物奖励 - // physical: "", // 测试 TODO - physicalUrl: res.data.data.rewardEntityUrl, // 实物奖励地址 - link: { - rewardJumpTitle: res.data.data.rewardJumpTitle, // 奖励跳转标题 - rewardJumpContent: res.data.data.rewardJumpContent, // 奖励跳转内容 - - rewardJumpType: res.data.data.rewardJumpType, // 奖励跳转类型 - // 0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间 - rewardJumpUrl: res.data.data.rewardJumpUrl, // 1内部跳转路径 - rewardJumpWithoutUrl: res.data.data.rewardJumpWithoutUrl, // 3奖励跳转外部路径 - rewardJumpVideoId: res.data.data.rewardJumpVideoId, // 5奖励跳转视频号id - rewardJumpVideoFeedId: res.data.data.rewardJumpVideoFeedId, // 5奖励跳转视频号feedId - rewardJumpParam: res.data.data.rewardJumpParam, // 跳转参数, + // isRewardProcess: 3, // 测试 TODO + rewardType: res.data.data.rewardType, // 奖励类型 + // rewardType: '2,3', // 奖励类型 + isPointsReward: res.data.data.isPointsReward, // 是否有积分奖励 + // isPointsReward: 0, // 是否有积分奖励 + rewardPoints: res.data.data.rewardPoints, // 积分奖励 + // rewardPoints: 0, // 积分奖励 + prizeName: res.data.data.prizeName, // 获得奖品 + // prizeName: "实物奖励1", // 获得奖品 + wxAppid: res.data.data.wxAppid, // 奖品跳转Appid + rewardEntityUrl: res.data.data.rewardEntityUrl, // 奖品跳转地址 + link: { + rewardJumpTitle: res.data.data.rewardJumpTitle, // 奖励跳转标题 + rewardJumpContent: res.data.data.rewardJumpContent, // 奖励跳转内容 + rewardJumpType: res.data.data.rewardJumpType, // 奖励跳转类型 + // 0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间 + rewardJumpUrl: res.data.data.rewardJumpUrl, // 1内部跳转路径 + rewardJumpWithoutUrl: res.data.data.rewardJumpWithoutUrl, // 3奖励跳转外部路径 + rewardJumpVideoId: res.data.data.rewardJumpVideoId, // 5奖励跳转视频号id + rewardJumpVideoFeedId: res.data.data.rewardJumpVideoFeedId, // 5奖励跳转视频号feedId + rewardJumpParam: res.data.data.rewardJumpParam, // 跳转参数, + rewardConditions: res.data.data.rewardConditions, // 领取奖励需要的护理天数 + }, // 跳转奖励 - rewardConditions: res.data.data.rewardConditions, // 领取奖励需要的护理天数 - }, // 跳转奖励 - }, - NursingPlanReportData: { ...res.data.data }, + NursingPlanReportData: { ...res.data.data, totalDay: 1 }, }, () => { this.textOnclk(); // 初始化弹窗 @@ -159,16 +161,18 @@ class NursingPlanReport extends Component { let { isSurvey, isReward, + prizeName, + rewardType, isEnrolled, - isSetReward, + // isSetReward, isQualifyFor, isRewardAudit, + // isPointsReward, isRewardProcess, } = this.state; const { isRewardFinish } = this.props; - const { integral, physical } = this.state.rewardState; + const physical = rewardType.includes("2"); // 存在实物奖励 const NursingPlanReportData = { ...this.state.NursingPlanReportData }; - const reward = [integral, physical].filter((item) => item).join("、"); // 没有计划奖励 if (!isReward) { NursingPlanReportData.key = "确定"; @@ -193,7 +197,7 @@ class NursingPlanReport extends Component { NursingPlanReportData.text = "审核未通过,请联系微信小助理确认"; return this.setState({ NursingPlanReportData }); } - NursingPlanReportData.text = `获得奖品:${reward}`; + NursingPlanReportData.text = `获得奖品:${prizeName}`; // 需要登记且未登记 if (isSurvey && !isEnrolled) { NursingPlanReportData.key = "前往登记领奖"; @@ -202,7 +206,7 @@ class NursingPlanReport extends Component { if (physical) NursingPlanReportData.key = "去领奖"; else NursingPlanReportData.key = "已领奖"; // 是否已领奖 - if (integral && !isSetReward) this.goToAward(); // 未领奖 + // if (isPointsReward && !isSetReward) this.goToAward(); // 存在积分奖励且未领奖 this.setState({ NursingPlanReportData }); }; @@ -222,10 +226,15 @@ class NursingPlanReport extends Component { this.setState({ isSetReward: 1 }); }; - // 点击跳转实物链接 TODO + // 点击跳转实物链接 jumpReal = async () => { - const { physicalUrl } = this.state.rewardState; - console.log("跳转实物链接", physicalUrl); + const { wxAppid, rewardEntityUrl } = this.state; + const data = { + appId: wxAppid, + path: rewardEntityUrl, + }; + goJump(data, 4); + console.log("跳转实物链接", wxAppid, rewardEntityUrl); }; // 点击领奖 @@ -233,13 +242,14 @@ class NursingPlanReport extends Component { let { isReward, isSurvey, + rewardType, isEnrolled, isQualifyFor, isRewardAudit, - isRewardFinish, isRewardProcess, } = this.state; - const { physical } = this.state.rewardState; + const { isRewardFinish } = this.props; + const physical = rewardType.includes("2"); // 存在实物奖励 if (!isReward) return this.setState({ isNursingPlanReport: false }); // 没有计划奖励 if (!isQualifyFor) return this.setState({ isNursingPlanReport: false }); // 没有领奖资格 if (!isRewardFinish) return this.setState({ isNursingPlanReport: false }); // 未完成计划进度 @@ -262,7 +272,7 @@ class NursingPlanReport extends Component { rewardJumpVideoId, rewardJumpWithoutUrl, rewardJumpVideoFeedId, - } = this.state.rewardState.link; + } = this.state.link; const data = { redirect_url: "", redirect_appid: "", @@ -278,11 +288,13 @@ class NursingPlanReport extends Component { const { img, isReward, + rewardType, isQualifyFor, isRewardAudit, NursingPlanReportData, isRewardProcess, } = this.state; + const jump = rewardType.includes("3"); let { title, isShow, @@ -297,7 +309,7 @@ class NursingPlanReport extends Component { if (!zIndex) zIndex = 100; // 计算总护理时长 - let totalNursingTime = ""; + let totalNursingTime = "0分0秒"; if (NursingPlanReportData.totalNursingTime) { const [h, m, s] = NursingPlanReportData.totalNursingTime.split(":"); totalNursingTime = `${h * 60 + (m - 0)}分${s}秒`; @@ -378,50 +390,55 @@ class NursingPlanReport extends Component { {NursingPlanReportData.text && ( {NursingPlanReportData.text} )} - {/* 有奖励有领奖资格且完成计划才显示 */} - {!!isReward && !!isRewardFinish && !!isQualifyFor && ( + {/* 有跳转奖励才显示 */} + {jump && ( - {/* 不需要审核则直接显示 */} - {!isRewardAudit && ( - - - - {NursingPlanReportData.rewardJumpTitle} - - - {NursingPlanReportData.rewardJumpContent} - - - - - - - )} - {/* 需要审核只有审核通过才显示 */} - {!!isRewardAudit && isRewardProcess === 3 && ( - - - - {NursingPlanReportData.rewardJumpTitle} + {/* 有奖励有领奖资格且完成计划才显示 */} + {!!isReward && !!isRewardFinish && !!isQualifyFor && ( + + {/* 不需要审核则直接显示 */} + {!isRewardAudit && ( + + + + {NursingPlanReportData.rewardJumpTitle} + + + {NursingPlanReportData.rewardJumpContent} + + + + + - - {NursingPlanReportData.rewardJumpContent} + )} + {/* 需要审核只有审核通过才显示 */} + {!!isRewardAudit && isRewardProcess === 3 && ( + + + + {NursingPlanReportData.rewardJumpTitle} + + + {NursingPlanReportData.rewardJumpContent} + + + + + - - - - - + )} + )} )} diff --git a/src/components/nursing/nursing.less b/src/components/nursing/nursing.less index 19b8fbf..1cbed10 100644 --- a/src/components/nursing/nursing.less +++ b/src/components/nursing/nursing.less @@ -304,4 +304,12 @@ .integral .button.go { background-color: #ccc; +} + +.popuppicker { + display: flex; + height: 120rpx; + align-items: center; + justify-content: space-between; + padding: 0 100rpx; } \ No newline at end of file diff --git a/src/components/nursing/nursing.tsx b/src/components/nursing/nursing.tsx index 06dfa07..feb9e04 100644 --- a/src/components/nursing/nursing.tsx +++ b/src/components/nursing/nursing.tsx @@ -1,5 +1,5 @@ import classnames from "classnames"; -import { Component } from "react"; +import React, { Component, LegacyRef } from "react"; import { Block, View, Image, Text, Picker, Switch } from "@tarojs/components"; @@ -9,7 +9,7 @@ import PopupAlert from "@/components/popup/popup-alert"; import PopupDrawer from "@/components/popup/popup-drawer"; import NursingPlanReport from "../NursingPlanReport"; -import { go } from "../../utils/traoAPI"; +import { go, goJump } from "../../utils/traoAPI"; import "./nursing.less"; @@ -26,8 +26,15 @@ import { import { GetIsAttentionOfficialAccount } from "@/utils/Interface"; import Taro from "@tarojs/taro"; +import _ from "lodash"; +import { Popup, DatetimePicker } from "@antmjs/vantui"; + + +let MembraneClothOne =['DiyFacial','DiyWater','WaterLightEssence','ShapeBeautyEssence'] +let MembraneClothTwo =['PreMakeup_Custom','EyeCarving_Custom'] export default class Nursing extends Component { + PickerTimeProp: any; constructor(props) { super(props); this.state = { @@ -49,31 +56,37 @@ export default class Nursing extends Component { status: 0, //今日护理任务是否已完成 0未完成 1已完成 myPlanStep: [], // 当天护理步骤 myPlanTaskList: [], // 当天护理计划任务 - isPlanSchedule: false, // 护理步骤的弹窗 + isPlanSchedule: null, // 护理步骤的弹窗 usePlanScheduleShow: 1, // 护理前弹窗是否展示 prepareData: null, // 准备参加的护理数据 - isAccountShow: false, //公众号引导弹窗 + isAccountShow: null, //公众号引导弹窗 nextTime: "", // 下次护理时间 - myPlanNextDay: "6月25日", // 下次护理日期 + myPlanNextDay: "", // 下次护理日期 myPlanNextTime: "20:00", // 下次护理提醒的时间 - isWarn: false, // 是否开启下次护理提醒 + myPlanNextTimePicker: "", // 当前选中的时间 + isWarn: null, // 是否开启下次护理提醒 + showDatePicker: false, // 时间选择器是否禁用 /** 我的护理 END */ /** 领奖相关 */ - isRewardEnd: false, // 护理计划是否已结束 + isRewardEnd: null, // 护理计划是否已结束 integralText: "", // 奖励后的按钮显示 isReward: 0, // 是否有计划奖励 - isQualifyFor: 0, // 是否有领奖资格 + isQualifyFor: 0, // 是否显示奖励进度 isSetReward: 0, // 是否已经领取奖励 - isRewardFinish: true, // 是否完成计划进度 - isRewardAudit: true, // 领奖是否需要审核 - isRewardProcess: "1", // 2审核中 1审核通过 0审核不通过 - isSurvey: true, // 是否需要登记 - isEnrolled: true, // 是否已经登记 + isRewardFinish: null, // 是否完成计划进度 + isRewardAudit: null, // 领奖是否需要审核 + isRewardProcess: null, // 1参与中 2待审核 3审核通过 4审核未通过 + isSurvey: null, // 是否需要登记 + isEnrolled: null, // 是否已经登记 surveyRewardUrl: "", // 登记地址 - - rewardState: {}, //领奖相关数据 + rewardType: "", // 奖励类型 + isPointsReward: 0, // 是否有积分奖励 + rewardPoints: "", // 积分奖励 + prizeName: "", // 获得奖品 + wxAppid: "", // 奖品跳转Appid + rewardEntityUrl: "", // 奖品跳转地址 isPromptShow: false, // 点击问号的弹窗 isNursingShow: false, // 护理计划报告弹窗是否创建 @@ -95,12 +108,14 @@ export default class Nursing extends Component { }, // 问卷弹窗数据 cycleId: "", // 问卷弹窗选择的数据 + + // 提示弹窗内容 + content: "", }; + this.PickerTimeProp = React.createRef(); } - componentDidMount() { - this.getPlanNowProgress(); - } + componentDidMount() {} componentWillUnmount() {} @@ -114,7 +129,17 @@ export default class Nursing extends Component { console.log(res.data.data, "今日护理进度"); const info = res.data.data; // 防止错误导致卡死 - if (!info) return; + if (!info || info.joinStatus === 5) { + this.setState({ info: false }); + return; // 计划已终止 + } + if (info.joinStatus === 4) { + // 计划审核不通过 弹窗弹出一次 首页不显示我的护理区域 + this.setState({ info: false, planId: info.planId }, () => { + this.getCycleEndReport(); + }); + return; + } let myPlanStep = []; let myPlanTaskList = []; // 今日有护理任务 @@ -129,7 +154,7 @@ export default class Nursing extends Component { img: item.modeBanner, name: item.instrumentName, description: item.modeName, - time: item.modeTime / 60 + "分钟", + time: this.setTime(item.modeTime) + "分钟", status: item.status, // 0未完成 1已完成 }; }); @@ -159,25 +184,29 @@ export default class Nursing extends Component { myPlanNextTime, myPlanTaskList, isWarn: info.isWarn, - isReward: info.isReward, - isQualifyFor: info.isQualifyFor, status: info.status, planId: info.planId, nextTime: info.nextTime, totalDay: info.totalDay, + isReward: info.isReward, planTitle: info.planTitle, planJoinId: info.planJoinId, progressId: info.progressId, currentDay: info.currentDay, + isQualifyFor: info.isQualifyFor, totalProgress: info.totalProgress, currentProgress: info.currentProgress, usePlanScheduleShow: info.useIsShow, - isRewardEnd: info.joinStatus !== 1 || info.joinStatus !== 2, - // isRewardEnd: true, // 当前计划是否结束 1参与中 2待审核 3审核通过 + isRewardEnd: info.joinStatus !== 1, + // isRewardEnd: true, // 当前计划是否结束 1参与中 2待审核 3审核通过 4审核失败 5已终止 6已过期 7已结束 }, async () => { this.checkCycleEnd(); // 单日程结束弹窗 - if (this.state.isRewardEnd) this.getCycleEndReport(); // 非参与中调用护理计划报告接口 + if (this.state.isRewardEnd) { + this.getCycleEndReport(); // 非参与中调用护理计划报告接口 + } else { + Taro.setStorageSync("isPromptShow", false); + } } ); }; @@ -190,6 +219,13 @@ export default class Nursing extends Component { }); return step; }; + setTime = (data) => { + const time = data / 60; + const arr = time.toString().split("."); + const len = arr[1]?.split("").length; + if (len >= 2) return time.toFixed(2); + else return time; + }; // 获取护理报告部分数据 getCycleEndReport = async () => { @@ -212,28 +248,47 @@ export default class Nursing extends Component { // isSurvey: 1, // 测试 TODO // surveyRewardUrl: `${res.data.data.surveyRewardUrl}?sojumpparm=user_id@${uesrId};activity_id@${planInfo.id}`, // 奖励登记星卷问卷地址 surveyRewardUrl: `https://insightlab.wjx.cn/vm/ew7cY2Z.aspx?sojumpparm=user_id@${uesrId};activity_id@${planId}`, // 问卷星测试地址 TODO - isQualifyFor: res.data.data.isQualifyFor, // 是否有领奖资格 1是 0否 + isQualifyFor: res.data.data.isQualifyFor, // 是否显示奖励进度 1是 0否 // isQualifyFor: 1, // 测试 TODO isSetReward: res.data.data.isSetReward, // 是否已经领取奖励 1是 0否 // isSetReward: 0, // 测试 TODO isRewardAudit: res.data.data.isExamine, // 是否需要审核 1是 0否 - // isRewardAudit: 0, // 测试 TODO + // isRewardAudit: 1, // 测试 TODO + // 1参与中 2待审核 3审核通过 4审核未通过 5已终止 6已过期 7已结束 isRewardProcess: res.data.data.status, // 当前状态 - // isRewardProcess: 4, // 测试 TODO + // isRewardProcess: 3, // 测试 TODO + rewardType: res.data.data.rewardType, // 奖励类型 + // rewardType: '2,3', // 奖励类型 + isPointsReward: res.data.data.isPointsReward, // 是否有积分奖励 + // isPointsReward: 0, // 是否有积分奖励 + rewardPoints: res.data.data.rewardPoints, // 积分奖励 + // rewardPoints: 0, // 积分奖励 + prizeName: res.data.data.prizeName, // 获得奖品 + // prizeName: '实物奖励1', // 获得奖品 + wxAppid: res.data.data.wxAppid, // 奖品跳转Appid + rewardEntityUrl: res.data.data.rewardEntityUrl, // 奖品跳转地址 isRewardFinish: currentProgress >= totalProgress, // 是否完成计划进度 当前任务数大于总任务数 // isRewardFinish: true, // 测试 TODO - // isPointsReward: res.data.data.isPointsReward, // 是否有积分奖励 - rewardState: { - integral: res.data.data.isPointsReward - ? res.data.data.rewardPoints + "积分" - : "", // 积分奖励 - physical: res.data.data.prizeName, // 实物奖励 - // physical: "", // 测试 TODO - physicalUrl: res.data.data.rewardEntityUrl, // 实物奖励地址 - }, }, () => { this.init(); + const { planTitle, isRewardProcess } = this.state; + const isPromptShow = Taro.getStorageSync("isPromptShow"); + if (isPromptShow) return; // 已提示过 + if (isRewardProcess === 2) { + const content = ( + + 你已完成{planTitle} + 请联系微信助理进行审核 + + ); + Taro.setStorageSync("isPromptShow", true); + this.setState({ isPromptShow: true, content }); + } else { + // isRewardProcess === 3 || 4 || 7 + this.textOnclk(); + Taro.setStorageSync("isPromptShow", true); + } } ); }; @@ -244,28 +299,39 @@ export default class Nursing extends Component { isSurvey, isReward, isEnrolled, + rewardType, isSetReward, isQualifyFor, isRewardAudit, isRewardFinish, + isPointsReward, isRewardProcess, } = this.state; - const { integral, physical } = this.state.rewardState; + const physical = rewardType.includes("2"); // 存在实物奖励 if (!isReward) return this.setState({ integralText: "" }); // 没有计划奖励 - if (!isQualifyFor) return this.setState({ integralText: "" }); // 没有领奖资格 + if (!isQualifyFor) return this.setState({ integralText: "" }); // 是否显示奖励进度 if (!isRewardFinish) return this.setState({ integralText: "" }); // 未完成计划进度 if (isRewardAudit && isRewardProcess === 4) { return this.setState({ integralText: "" }); // 需要审核审核未通过 } if (isSurvey && !isEnrolled) { - - return this.setState({ integralText: "去登记" }); // 需要登记且未登记 } - console.log(isSurvey, isEnrolled,'1475869'); if (physical) this.setState({ integralText: "去领奖" }); else this.setState({ integralText: "已领奖" }); - if (integral && !isSetReward) this.goToAward(); // 未领奖 + if (isPointsReward && !isSetReward) this.goToAward(); // 未领奖 + }; + + // 点击问号 + questionMark = () => { + const content = ( + + 完成当天护理计划的护理任务可以 + 增加计划完成度,达到足够的护理天数 + 则有资格领取计划奖励 + + ); + this.setState({ isPromptShow: true, content }); }; // 点击去领奖 @@ -299,77 +365,161 @@ export default class Nursing extends Component { goToPlan = () => { const { prepareData } = this.state; this.setState({ isPlanSchedule: false }); - console.log("前往护理", prepareData); let item = { ...prepareData, type: prepareData.stepType, nursingPlanId: prepareData.id, id: prepareData.instrumentId, }; - this.props.goNursing(item); + console.log("前往护理1", item); + if(item.model === "WE200"){ + if(MembraneClothOne.includes(item.modeType)){ + Taro.setStorageSync("WE200SelectMode1", item.modeType); + }else{ + Taro.setStorageSync("WE200SelectMode2", item.modeType); + } + + } + + this.props.goNursing(item,'护理计划'); }; // 是否开启下次护理提醒 changeSwitch = async (e) => { const { planJoinId } = this.state; if (e.detail.value) { - const res = await updateJoinIsWarnApi({ - joinPlanId: planJoinId, - status: 1, - }); - if (res.data.code !== 200) { - return this.setState({ isWarn: false }); - } - this.setState({ isWarn: true }); console.log("开启护理提醒"); + const resp = await GetIsAttentionOfficialAccount(); + if (resp.data.code !== 200) return this.setState({ isWarn: false }); + if (resp.data.data) { + // 关注了公众号 + this.setState({ showDatePicker: true }); + // const res = await updateProgressWarnTimeApi({ + // progressId, + // time: myPlanNextTimePicker, + // }); + // if (res.data.code !== 200) return this.setState({ myPlanNextTime:myPlanNextTimePicker }); + // this.setState({ myPlanNextTime: newMyPlanNextTime }); + // console.log("提醒时间", newMyPlanNextTime); + } else { + // 未关注公众号 + this.setState({ isAccountShow: true, isWarn: true }, () => { + this.setState({ isWarn: false }); + }); + } + // const res = await updateJoinIsWarnApi({ + // joinPlanId: planJoinId, + // status: 1, + // }); + // if (res.data.code !== 200) { + // return this.setState({ isWarn: false }); + // } + // this.setState({ isWarn: true }); } else { + this.setState({ showDatePicker: false }); // 关闭护理提醒 const res = await updateJoinIsWarnApi({ joinPlanId: planJoinId, status: 0, }); - if (res.data.code !== 200) return; + if (res.data.code !== 200) return this.setState({ isWarn: true }); this.setState({ isWarn: false }); console.log("关闭护理提醒"); } }; + onInput = (event) => { + this.setState({ myPlanNextTimePicker: event.detail }); + }; + + onClickStop = async () => { + const { planJoinId, progressId, myPlanNextTime, myPlanNextTimePicker } = + this.state; + // 修改下次护理时间 + const res = await updateProgressWarnTimeApi({ + progressId, + time: myPlanNextTimePicker, + }); + // 修改失败 + if (res.data.code !== 200) return this.setState({ myPlanNextTime }); + // 修改成功 + this.setState({ myPlanNextTime: myPlanNextTimePicker }); + console.log("提醒时间", myPlanNextTimePicker); + // 打开护理提醒 + const resp = await updateJoinIsWarnApi({ + joinPlanId: planJoinId, + status: 1, + }); + // 开启失败 + if (resp.data.code !== 200) return this.setState({ isWarn: false }); + // 开启成功 + this.setState({ isWarn: true, showDatePicker: false }); + }; + + onPopupClose = () => { + this.setState({ showDatePicker: false }); + }; + // 时间选择器点击确定(修改下次提醒时间) changePlanNextTime = async (e) => { - const { progressId, myPlanNextTime } = this.state; - const newMyPlanNextTime = e.detail.value; - const resp = await GetIsAttentionOfficialAccount(); - if (resp.data.code !== 200) { - return this.setState({ isWarn: false }); - } - if (resp.data.data) { - // 关注了公众号 - const res = await updateProgressWarnTimeApi({ - progressId, - time: newMyPlanNextTime, - }); - if (res.data.code !== 200) return this.setState({ myPlanNextTime }); - this.setState({ myPlanNextTime: newMyPlanNextTime }); - console.log("提醒时间", newMyPlanNextTime); - } else { - // 未关注公众号 - this.setState({ isAccountShow: true, isWarn: false }, () => { - this.CancelPlanNextTime(); - }); - } + // const { progressId, myPlanNextTime } = this.state; + // const newMyPlanNextTime = e.detail.value; + // const resp = await GetIsAttentionOfficialAccount(); + // if (resp.data.code !== 200) { + // return this.setState({ isWarn: false }); + // } + // if (resp.data.data) { + // // 关注了公众号 + // const res = await updateProgressWarnTimeApi({ + // progressId, + // time: newMyPlanNextTime, + // }); + // if (res.data.code !== 200) return this.setState({ myPlanNextTime }); + // this.setState({ myPlanNextTime: newMyPlanNextTime }); + // console.log("提醒时间", newMyPlanNextTime); + // } else { + // // 未关注公众号 + // this.setState({ isAccountShow: true, isWarn: false }, () => { + // this.cancelPlanNextTime(); + // }); + // } }; // 时间选择器点击取消 - CancelPlanNextTime = async () => { + cancelPlanNextTime = async () => { // 关闭护理提醒 - const { planJoinId } = this.state; - const res = await updateJoinIsWarnApi({ - joinPlanId: planJoinId, - status: 0, - }); - if (res.data.code !== 200) return; - this.setState({ isWarn: false }); - console.log("关闭护理提醒"); + // const { planJoinId } = this.state; + // const res = await updateJoinIsWarnApi({ + // joinPlanId: planJoinId, + // status: 0, + // }); + // if (res.data.code !== 200) return; + // this.setState({ isWarn: false }); + // console.log("关闭护理提醒"); + }; + + clickPlanNextTime = async () => { + // const { isWarn, isWarnPicker, planJoinId } = this.state; + // console.log(isWarn, "slahflansnkla"); + // if (isWarn) { + // // 关闭护理提醒 + // const res = await updateJoinIsWarnApi({ + // joinPlanId: planJoinId, + // status: 0, + // }); + // if (res.data.code !== 200) return; + // this.setState({ isWarn: 0 }); + // } else { + // // 开启护理提醒 + // // const res = await updateJoinIsWarnApi({ + // // joinPlanId: planJoinId, + // // status: 1, + // // }); + // // if (res.data.code !== 200) return; + // // this.setState({ isWarn: 1 }); + // this.setState({ isWarnPicker: false }); + // console.log(this.PickerTimeProp.current.onClick); + // } }; // 获取单日程结束问卷数据 @@ -412,8 +562,13 @@ export default class Nursing extends Component { // 点击跳转实物链接 TODO jumpReal = async () => { - const { physicalUrl } = this.state.rewardState; - console.log("跳转实物链接", physicalUrl); + const { wxAppid, rewardEntityUrl } = this.state; + const data = { + appId: wxAppid, + path: rewardEntityUrl, + }; + goJump(data, 4); + console.log("跳转实物链接", wxAppid, rewardEntityUrl); }; // 点击领奖 @@ -422,12 +577,14 @@ export default class Nursing extends Component { isReward, isSurvey, isEnrolled, + rewardType, isQualifyFor, isRewardAudit, isRewardFinish, + // isPointsReward, isRewardProcess, } = this.state; - const { physical } = this.state.rewardState; + const physical = rewardType.includes("2"); // 存在实物奖励 if (!isReward) return; // 没有计划奖励 if (!isQualifyFor) return; // 没有领奖资格 if (!isRewardFinish) return; // 未完成计划进度 @@ -470,6 +627,7 @@ export default class Nursing extends Component { myPlanNextDay, myPlanNextTime, isWarn, + showDatePicker, isPromptShow, isPlanSchedule, isQuesShow, @@ -478,162 +636,179 @@ export default class Nursing extends Component { isRewardAudit, isRewardEnd, isRewardProcess, - rewardState, isNursingShow, isAccountShow, + + prizeName, + + content, } = this.state; - // 奖品 - const reward = [rewardState.integral, rewardState.physical].filter( - (item) => item - ); return ( - {!!info && ( - - {/* 护理报告弹窗 */} - {isNursingShow && ( - this.setState({ isNursingPlanReport: false })} - close={() => this.setState({ isNursingPlanReport: false })} - /> - )} - - {/* 日程结束后问卷 */} - - - {quesOption.optionTitle} - - {quesOption.optionJson.map((item, index) => { - return ( - this.selectQuesOption(item.cycleId)} - > - {cycleId === item.cycleId && ( - - )} - {cycleId !== item.cycleId && ( - - )} - - {item.optionContent} - - - ); - })} - - } - confirm={this.quesOptionNext} - /> - - {/* 我的护理问号点击弹窗 */} - - 完成当天护理计划的护理任务可以 - 增加计划完成度,达到足够的护理天数 - 则有资格领取计划奖励 - - } - confirm={() => this.setState({ isPromptShow: false })} + + {/* 护理报告弹窗 */} + {isNursingShow && ( + this.setState({ isNursingPlanReport: false })} + close={() => this.setState({ isNursingPlanReport: false })} /> + )} - {/* 公众号引导弹窗 */} - - + {/* 日程结束后问卷 */} + + + {quesOption.optionTitle} - } - confirm={() => this.setState({ isAccountShow: false })} - /> - - {/* 今日护理步骤 */} - this.goToPlan()} - close={() => this.setState({ isPlanSchedule: false })} - > - - 第{currentDay}天   ({currentDate.split("-").join(".")} - ) - - - {myPlanStep.map((item, index) => { + {quesOption.optionJson.map((item, index) => { return ( - - Step{index + 1} - - {item.map((subitem, subindex) => { - return ( - - - - {index === 1 - ? subitem.instrumentName - : subitem.productName} - - - {index === 1 - ? subitem.modeName - : subitem.introduce} - - - ); - })} - + this.selectQuesOption(item.cycleId)} + > + {cycleId === item.cycleId && ( + + )} + {cycleId !== item.cycleId && ( + + )} + + {item.optionContent} + ); })} - + } + confirm={this.quesOptionNext} + /> + {/* 我的护理问号点击弹窗 */} + this.setState({ isPromptShow: false })} + /> + + {/* 时间选择器 */} + + + 取消 + + 确定 + + + + {/* 确定 */} + + + {/* 公众号引导弹窗 */} + + + + } + confirm={() => this.setState({ isAccountShow: false })} + /> + + {/* 今日护理步骤 */} + this.goToPlan()} + close={() => this.setState({ isPlanSchedule: false })} + > + + 第{currentDay}天   ({currentDate.split("-").join(".")}) + + + {myPlanStep.map((item, index) => { + return ( + + Step{index + 1} + + {item.map((subitem, subindex) => { + return ( + + + + {index === 1 + ? subitem.instrumentName + : subitem.productName} + + + {index === 1 + ? subitem.modeName + : subitem.introduce} + + + ); + })} + + + ); + })} + + + {!!info && ( 我的护理 @@ -663,7 +838,7 @@ export default class Nursing extends Component { this.setState({ isPromptShow: true })} + onClick={this.questionMark} /> { - - 获得奖品: {reward.join("、")} - + 获得奖品: {prizeName} { - 获得奖品: {reward.join("、")} + 获得奖品: {prizeName} { 下次护理提醒: {myPlanNextDay} {myPlanNextTime} - - - + onCancel={this.cancelPlanNextTime} + onClick={this.clickPlanNextTime} + > */} + + {/* */} )} - - )} + )} + ); } diff --git a/src/components/popup/popup-drawer.tsx b/src/components/popup/popup-drawer.tsx index e5c44b8..b71ce40 100644 --- a/src/components/popup/popup-drawer.tsx +++ b/src/components/popup/popup-drawer.tsx @@ -74,7 +74,7 @@ export default class PopupDrawer extends Component { closeOnClickOverlay={false} position={postion || "bottom"} round - overlayStyle="width: 100vw;padding: 0;" + overlayStyle="width: 100vw;padding: 0;padding-bottom:40rpx" style={`bottom:${bottom}rpx`} onClick={this.onClickStop} > diff --git a/src/instrument/pages/instrument/instrument.tsx b/src/instrument/pages/instrument/instrument.tsx index 4765021..007ef09 100644 --- a/src/instrument/pages/instrument/instrument.tsx +++ b/src/instrument/pages/instrument/instrument.tsx @@ -183,6 +183,8 @@ class Instrument extends Component { if (data.code === 200) { Taro.setStorageSync("isWelcome", true); Taro.setStorageSync("mobile", data.data.mobile); + Taro.setStorageSync("activity", data.data.activity); + Taro.setStorageSync("clock", data.data.clock); this.props.tokenRefresh(data.data); } else { msg("请求失败,尝试重新请求"); diff --git a/src/moduleIOT/pages/iotCarePlan/FE200.tsx b/src/moduleIOT/pages/iotCarePlan/FE200.tsx index cd2950c..ea2ef01 100644 --- a/src/moduleIOT/pages/iotCarePlan/FE200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FE200.tsx @@ -431,7 +431,10 @@ class IotCarePlanFE200 extends Component { resetMode = (data: any) => { console.log("resetMode 重置", data); // 每次切换/准备切换时,清除定时器 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } let GearData = this.state.GearData; let currentGear = this.state.currentGear; @@ -1064,7 +1067,10 @@ class IotCarePlanFE200 extends Component { value: pauseArrayBuffer, }).then(() => { this.workStatus = "pause"; - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } console.info(`发送暂停指令成功 参数为 =>`, sendParams); }); this.switchVideoPause(); // 暂停 @@ -1232,7 +1238,10 @@ class IotCarePlanFE200 extends Component { this.closeTips(); }, pause: () => { - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.setState({ title: "暂停护理", isStopNurse: true, @@ -1241,7 +1250,10 @@ class IotCarePlanFE200 extends Component { end: () => { // 已进入了报告阶段, 防止重复进入, 主要防止在手动点击结束护理接收到仪器消息 console.log("END 护理结束"); - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } // this.endnursing(true); }, }; @@ -1273,7 +1285,10 @@ class IotCarePlanFE200 extends Component { endnursing = (isAuto) => { if (isAuto == true) { // 仪器自动上报完成, 直接上报并跳转报告页 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } const isEnough = this.isCheckNurseTime(); if (isEnough) { if (this.state.ActiveModeItem?.modeType === "moistureTest") { @@ -1317,7 +1332,10 @@ class IotCarePlanFE200 extends Component { } // 切换模式后, 需要重新设置计时器, 以防进行中的计时器 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.currentTimeTimer = setInterval(() => { let { DeviceConnectStatus, @@ -1341,7 +1359,7 @@ class IotCarePlanFE200 extends Component { this.elapsedTime = checkTime; // 每隔15秒发一次心跳 - if (this.elapsedTime > 0 && this.elapsedTime % 20 === 0) { + if (this.elapsedTime > 10 && this.elapsedTime % 15 === 0) { this.hearting = true; // 心跳中,禁止切换和暂停操作 let minuteNum = Math.floor((this.elapsedTime + 1) / 60); let secondsNum = Math.floor((this.elapsedTime + 1) % 60); @@ -1374,7 +1392,10 @@ class IotCarePlanFE200 extends Component { this.setDeviceSyncTime(); } } else { - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.videoContext.seek(this.elapsedTime); this.setState({ currentTime: "00:00", @@ -1577,12 +1598,10 @@ class IotCarePlanFE200 extends Component { this.isGearChangeIng = false; }, 2000); - if (this.PromoteModeType.includes(ActiveModeItem?.modeType)) { - if (ActiveModeItem?.modeType === "essence") { - // 促渗需要暂停 - this.onSwitchChange(); - this.openTips("请补充适量精华后,点击启动护理"); - } + if (ActiveModeItem?.modeType === "essence") { + // 促渗需要暂停 + this.onSwitchChange(); + this.openTips("请补充适量精华后,点击启动护理"); } }); }; @@ -1648,7 +1667,10 @@ class IotCarePlanFE200 extends Component { console.log("发送切换挡位 changeGear sendParams", sendParams); /* 逻辑暂停一秒视频和倒计时 */ - if (this.currentTimeTimer) clearTimeout(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.switchVideoPause(); /* 逻辑暂停一秒视频和倒计时 */ sendCommand({ @@ -2448,11 +2470,11 @@ class IotCarePlanFE200 extends Component { this.saveNurseReport(false); // 保存护理记录但不跳转 setTimeout(() => { - this.VideoSrcLoad(""); - setTimeout(() => { - this.modeCurrentFun(this.state.ActiveModeItem, true); - }, 100); - }, 1000); + this.resetMode(this.state.ActiveModeItem); + this.setState({ + currentTime: this.state.currentVideoTime, + }); + }, 600); }; /** 弹窗 END*/ @@ -2484,7 +2506,10 @@ class IotCarePlanFE200 extends Component { let { GearData, ActiveModeItem } = this.state.GearData; // let nursingData = JSON.parse(data.nursingData); // 跳转前置空定时器,防止重复提交 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } if ("moistureTest" === ActiveModeItem?.modeType) { //水分 } else { @@ -2500,17 +2525,30 @@ class IotCarePlanFE200 extends Component { this.setState({ currentVideoSrc: "", }); - go( + // go( + // "/recoding/pages/face_report/face_report?id=" + + // reportId + + // "&recordId=" + + // instrumentId + + // "&report=" + + // report + + // "&date=" + + // ActiveModeItem?.updateTime + + // "&instrumentModel=FE200" + // ); + let url = "/recoding/pages/face_report/face_report?id=" + - reportId + - "&recordId=" + - instrumentId + - "&report=" + - report + - "&date=" + - ActiveModeItem?.updateTime + - "&instrumentModel=FE200" - ); + reportId + + "&recordId=" + + instrumentId + + "&report=" + + report + + "&date=" + + ActiveModeItem?.updateTime + + "&instrumentModel=FE200"; + Taro.redirectTo({ + url, + }); } }; // 完成配对 @@ -2522,30 +2560,6 @@ class IotCarePlanFE200 extends Component { // 重连蓝牙初始化监听 this.init(); - - if (this.state.ActiveModeItem.modeType !== "moistureTest") { - // 重连中状态赋值true - this.isBluetoothReconnectionIng = true; - - if (this.isCheckNurseTime()) { - // 延迟一秒,继续倒计时 - setTimeout(() => { - this.resetTimer(); - }, 1000); - // 满足时间条件,提示是否保存部分护理记录 - this.judgementWorkStatus( - MODE_WORKING_ENUM.PAUSE, - this.state.ActiveModeItem?.modeType - ); - this.setState({ - isShowTipsSave: true, - }); - return true; - } else { - // 时间不足,关机并提示 - this.endNurseFun(); - } - } }; connectionClose = () => { this.setState({ diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index c45529b..1e09e13 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -159,6 +159,7 @@ class IotCarePlanFR200 extends Component { if (option.modeId) { this.setState({ activeModeID: option.modeId }); } + if (option.GearData) { this.setState({ GearData: option.GearData }); } @@ -198,7 +199,10 @@ class IotCarePlanFR200 extends Component { // 检测断线重连同步 setTimeout(() => { this.workStatus = null; - this.currentTimeTimer && clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.switchVideoPause(); Taro.showLoading({ title: "同步中...", @@ -214,8 +218,8 @@ class IotCarePlanFR200 extends Component { isConnectionBlutoot: false, // 断开蓝牙 }); } else { - this.setDeviceSyncTime(); - this.switchVideoPlay(); + // this.setDeviceSyncTime(); + // this.switchVideoPlay(); // 不需要强制播放视频,否则会超前一秒 } Taro.hideLoading(); }, 5000); @@ -435,7 +439,10 @@ class IotCarePlanFR200 extends Component { resetMode = (data: any) => { console.log("resetMode 重置", data); // 每次切换/准备切换时,清除定时器 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } let GearData = this.state.GearData; let currentGear = this.state.currentGear; @@ -987,7 +994,10 @@ class IotCarePlanFR200 extends Component { value: pauseArrayBuffer, }).then(() => { this.workStatus = "pause"; - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } console.info(`发送暂停指令成功 参数为 =>`, sendParams); }); this.switchVideoPause(); // 暂停 @@ -1157,7 +1167,10 @@ class IotCarePlanFR200 extends Component { this.closeTips(); }, pause: () => { - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.setState({ title: "暂停护理", isStopNurse: true, @@ -1166,7 +1179,10 @@ class IotCarePlanFR200 extends Component { end: () => { // 已进入了报告阶段, 防止重复进入, 主要防止在手动点击结束护理接收到仪器消息 console.log("END 护理结束"); - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } // this.endnursing(true); }, @@ -1199,7 +1215,10 @@ class IotCarePlanFR200 extends Component { endnursing = (isAuto) => { if (isAuto == true) { // 仪器自动上报完成, 直接上报并跳转报告页 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } const isEnough = this.isCheckNurseTime(); if (isEnough) { if (this.state.ActiveModeItem?.modeType === "moistureTest") { @@ -1243,7 +1262,10 @@ class IotCarePlanFR200 extends Component { } // 切换模式后, 需要重新设置计时器, 以防进行中的计时器 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.currentTimeTimer = setInterval(() => { let { DeviceConnectStatus, @@ -1267,7 +1289,7 @@ class IotCarePlanFR200 extends Component { this.elapsedTime = checkTime; // 每隔15秒发一次心跳 - if (this.elapsedTime > 0 && this.elapsedTime % 20 === 0) { + if (this.elapsedTime > 10 && this.elapsedTime % 15 === 0) { this.hearting = true; // 心跳中,禁止切换和暂停操作 let minuteNum = Math.floor((this.elapsedTime + 1) / 60); let secondsNum = Math.floor((this.elapsedTime + 1) % 60); @@ -1300,8 +1322,12 @@ class IotCarePlanFR200 extends Component { this.setDeviceSyncTime(); } } else { - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.videoContext.seek(this.elapsedTime); + this.videoContext.pause(); this.setState({ currentTime: "00:00", waterStepIndex: 0, // 水分测试步骤 @@ -1500,12 +1526,10 @@ class IotCarePlanFR200 extends Component { this.isGearChangeIng = false; }, 2000); - if (this.PromoteModeType.includes(ActiveModeItem?.modeType)) { - if (ActiveModeItem?.modeType === "essence") { - // 促渗需要暂停 - this.onSwitchChange(); - this.openTips("请补充适量精华后,点击启动护理"); - } + if (ActiveModeItem?.modeType === "essence") { + // 促渗需要暂停 + this.onSwitchChange(); + this.openTips("请补充适量精华后,点击启动护理"); } }); }; @@ -1568,7 +1592,10 @@ class IotCarePlanFR200 extends Component { ); console.log("发送切换挡位 sendParams", sendParams); /* 逻辑暂停一秒视频和倒计时 */ - if (this.currentTimeTimer) clearTimeout(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } this.switchVideoPause(); /* 逻辑暂停一秒视频和倒计时 */ sendCommand({ @@ -1943,6 +1970,8 @@ class IotCarePlanFR200 extends Component { } /** 设置WL200护理历史 */ setFR200NursingHistory = (jsonStatus: any) => { + console.log("setFR200NursingHistory", jsonStatus); + if (!jsonStatus) return; let { currentDevice, ActiveModeItem } = this.state; const params = { createDate: dayjs().format("YYYY-MM-DD"), @@ -2107,6 +2136,7 @@ class IotCarePlanFR200 extends Component { break; case "nasolabialFold": Allmun = 240; + break; case "mandibularLine": Allmun = 180; break; @@ -2116,26 +2146,20 @@ class IotCarePlanFR200 extends Component { default: // 如果 expression 不匹配任何 case 值,则执行 default 子句中的代码块 } + // 能量发数 - filtered = filtered.slice(0, Allmun); + filtered = filtered.slice(-Allmun); + let joulePerSecond:any =[] // 脸部能量数组 + let impedanceList:any =[] //阻抗数组 // 脸部能量 - let faceEnergy = 0; + // let faceEnergy = 0; filtered.forEach((item) => { - faceEnergy += item.joulePerSecond; + + joulePerSecond.push(item.joulePerSecond)// 脸部能量数组 + impedanceList.push(item.impedance)// 脸部能量数组 }); - // 计算平均数 - // let sum = filtered.reduce((accumulator, currentValue) => accumulator + currentValue.impedance, 0); - // let average = sum / filtered.length; - - // 最大 - let max: any = Math.max(...filtered.map((item) => item.impedance)); - max = this.determineTier(max); - // 最小 - let min: any = Math.min(...filtered.map((item) => item.impedance)); - min = this.determineTier(min); - // 平均数最大等级处于2 - let average: any = max / 2; - average = this.determineTier(average); + + // 能量图里面的图谱每10秒为一个数组 // 创建一个空数组用于存储分组后的结果 @@ -2160,27 +2184,14 @@ class IotCarePlanFR200 extends Component { groupedAa.push(average); } - // let nursingData = { - // // nursingTime:result, - // nursingData: JSON.stringify({ - // faceEnergy, - // max, - // min, - // average, - // groupedAa, - // filtered: filtered.length, - // workMode: nowFR200NursingHistory.workMode, - // }), - // }; + return { nursingData: JSON.stringify({ - faceEnergy, - max, - min, - average, - groupedAa, - filtered: filtered.length, + groupedAa, //echarts图表数据 + joulePerSecond, //焦耳,脸部能量数据相加 + impedanceList, //阻抗,算最大值和最小值平均值 + filtered: filtered.length, //能量发数 workMode: nowFR200NursingHistory.workMode, }), energyValue: filtered.length, @@ -2243,7 +2254,7 @@ class IotCarePlanFR200 extends Component { params = { ...params, gearPositionList }; } - let res1: any = await this.todoPromise(); + let res1: any = await this.todoPromise(); //计算脸部护理报告页数据 if (!res1?.showFace) { params = { ...params, ...res1 }; } @@ -2358,11 +2369,11 @@ class IotCarePlanFR200 extends Component { this.saveNurseReport(false); // 保存护理记录但不跳转 setTimeout(() => { - this.VideoSrcLoad(""); - setTimeout(() => { - this.modeCurrentFun(this.state.ActiveModeItem, true); - }, 100); - }, 1000); + this.resetMode(this.state.ActiveModeItem); + this.setState({ + currentTime: this.state.currentVideoTime, + }); + }, 600); }; /** 弹窗 END*/ @@ -2395,7 +2406,10 @@ class IotCarePlanFR200 extends Component { console.log(ActiveModeItem, "查看模式类型"); // 跳转前置空定时器,防止重复提交 - if (this.currentTimeTimer) clearInterval(this.currentTimeTimer); + if (this.currentTimeTimer) { + clearInterval(this.currentTimeTimer); + this.currentTimeTimer = null; + } if (this.BaseModeType.includes(ActiveModeItem?.modeType)) { //脸部 let ids = Number(reportId); @@ -2437,18 +2451,32 @@ class IotCarePlanFR200 extends Component { this.handleWorkStatus(false, "end"); - go( + let url = "/recoding/pages/face_report/face_report?id=" + - reportId + - "&recordId=" + - instrumentId + - "&report=" + - report + - "&date=" + - ActiveModeItem?.updateTime + - "&instrumentModel=" + - "FR200" - ); + reportId + + "&recordId=" + + instrumentId + + "&report=" + + report + + "&date=" + + ActiveModeItem?.updateTime + + "&instrumentModel=" + + "FR200"; + Taro.redirectTo({ + url, + }); + // go( + // "/recoding/pages/face_report/face_report?id=" + + // reportId + + // "&recordId=" + + // instrumentId + + // "&report=" + + // report + + // "&date=" + + // ActiveModeItem?.updateTime + + // "&instrumentModel=" + + // "FR200" + // ); } }; @@ -2462,30 +2490,6 @@ class IotCarePlanFR200 extends Component { // 重连蓝牙初始化监听 this.init(); - - if (this.state.ActiveModeItem.modeType !== "moistureTest") { - // 重连中状态赋值true - this.isBluetoothReconnectionIng = true; - - if (this.isCheckNurseTime()) { - // 延迟一秒,继续倒计时 - setTimeout(() => { - this.resetTimer(); - }, 1000); - // 满足时间条件,提示是否保存部分护理记录 - this.judgementWorkStatus( - MODE_WORKING_ENUM.PAUSE, - this.state.ActiveModeItem?.modeType - ); - this.setState({ - isShowTipsSave: true, - }); - return true; - } else { - // 时间不足,关机并提示 - this.endNurseFun(); - } - } }; connectionClose = () => { this.setState({ @@ -2637,13 +2641,11 @@ class IotCarePlanFR200 extends Component { } setTimeout(() => { this.videoContext.play(); - console.log("this.videoContext play", this.videoContext); }); }; switchVideoPause = () => { setTimeout(() => { this.videoContext.pause(); - console.log("this.videoContext pause", this.videoContext); }); }; @@ -2920,7 +2922,11 @@ class IotCarePlanFR200 extends Component { className="video-or-image" src={currentVideoSrc ? currentVideoSrc : ""} loop={ActiveModeItem?.modeType !== "moistureTest"} - controls={false} + controls={ + ActiveModeItem?.modeType === "moistureTest" + ? true + : false + } enableProgressGesture={false} muted={videoVoiceStatus} objectFit="cover" diff --git a/src/moduleIOT/pages/iotCarePlan/WE200.tsx b/src/moduleIOT/pages/iotCarePlan/WE200.tsx index b7dd3e4..c118926 100644 --- a/src/moduleIOT/pages/iotCarePlan/WE200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/WE200.tsx @@ -91,6 +91,7 @@ class IotCarePlanWE200 extends Component { super(props); this.state = JSON.parse(JSON.stringify(WE200State)); } + InconsistentMembraneFabricGear:[]; //不同膜布的记录挡位 timer: any = null; loadingTipsTimer: any = null; // 蓝牙连接提示 deviceToolKitInstance:any = deviceToolKitInstanceM01; @@ -128,7 +129,7 @@ class IotCarePlanWE200 extends Component { isSyncHistory = Taro.getStorageSync("isSyncHistory"); // 是否正在检查历史中: 用于断线重连 isForceJump = true; // 提交护理记录时,是否强制跳转: 用于断线重连 - + videoContext: any = null; //视频控制器 isEndShutdown: boolean = true; // 获取上报/提交数据时,是否关机仪器 false不关机 true关机 @@ -211,7 +212,9 @@ class IotCarePlanWE200 extends Component { this.hadCheckReport = false; } - + async onReady() { + this.videoContext = Taro.createVideoContext("myVideo", this); + } async initData() { WE200Function.Step1.initData.call(this) } @@ -308,9 +311,152 @@ class IotCarePlanWE200 extends Component { WE200Function.pop.closeStepTips.call(this,data) }; + SetGear =(data,modetype,key)=>{ + + let gearData:any=[] + if(modetype === 1){ //mo1 + gearData = [ + { name: "额头", forehead: 1, Total: 10 }, + { name: "左脸颊", forehead: 1, Total: 10 }, + { name: "右脸颊", forehead: 1, Total: 10 }, + { name: "下颌线", forehead: 1, Total: 10 }, + ]; + }else{ //mo2 + gearData = [ + { name: "额头", forehead: 1, Total: 10 }, + { name: "左脸颊", forehead: 1, Total: 10 }, + { name: "右脸颊", forehead: 1, Total: 10 }, + ] + } + + if(data.length > 0){ + data.forEach((e,index) => { + gearData[index].forehead =e[key] + }); + } + + + return gearData + }; + SetGearTyep =(savedGear, membraneType)=>{ + if (savedGear) { + return this.SetGear(savedGear, membraneType, 'gear'); + } else { + return this.SetGear([], membraneType,); + } + + + }; + + handleShapeBeautyEssence=() =>{ + let {currentNursing,currentAnswer,currentQuizData} =this.state + + // 获取仪器挡位和本地挡位 + const WE200NursingHistoryInstrumentGear = Taro.getStorageSync(`WE200NursingHistoryInstrumentGear${this.state.checkeModeType}`) + + + if (WE200NursingHistoryInstrumentGear) { + this.setState({ iscurrentGearReset: true }); + } + + const WE200PrivateCustomCurrentData = Taro.getStorageSync(`WE200PrivateCustomCurrentData${this.state.currentDevice.id}`); + if (!WE200PrivateCustomCurrentData) { + this.setState({ isCurrentQuiz: true }); + } else { + currentNursing.partitionConfigArray= WE200PrivateCustomCurrentData.partitionConfigArray + currentNursing.electricFrequency= WE200PrivateCustomCurrentData.electricFrequency + currentAnswer= WE200PrivateCustomCurrentData.currentAnswer + currentQuizData =WE200PrivateCustomCurrentData?.currentQuizData + this.customizedCurrentCareTime.time= WE200PrivateCustomCurrentData.electricFrequency[1].value + this.customizedCurrentCareTime.show= WE200PrivateCustomCurrentData.electricFrequency[1].show + + this.setState({ + iscurrentResult: true, + currentNursing,currentAnswer,currentQuizData + }); + + } + } + handleEyeCarvingCustom=(deviceId)=>{ + // 获取仪器挡位和本地挡位 + const WE200eyeSculptureMasterData = Taro.getStorageSync(`WE200eyeSculptureMasterData${deviceId}`) + if (!WE200eyeSculptureMasterData) { + this.setState({ isEyePopAnswer: true }); + } else { + this.setState({ + + radarData: WE200eyeSculptureMasterData.radarData, + radarMax: WE200eyeSculptureMasterData.radarMax, + eyeResultData: WE200eyeSculptureMasterData.eyeResultData, + currentAnswer: WE200eyeSculptureMasterData.currentAnswer, + isEyeResult: true, + }); + this.eyeSculptureMasterCareTime = WE200eyeSculptureMasterData.eyeSculptureMasterCareTime; + } + + } + // 处理默认模式 +handleDefaultMode(ActiveModeItem, istitle) { + if (ActiveModeItem.counterpointCalibrationData.show && !istitle) { + this.setState({ isFacialCalibration: true }); + } else { + this.StartInstrument(); + } +} +InitShapeBeautyEssence(mode, modeData) { + const customizationElectricQuestion = JSON.parse(mode.customizationElectricQuestion); + let {currentQuizData} =this.state + currentQuizData[0].file = [customizationElectricQuestion.problemOneImg]; + currentQuizData[1].file = [customizationElectricQuestion.problemTwoImg]; + currentQuizData[2].file = [customizationElectricQuestion.problemThreeImg]; + currentQuizData[3].file = [ + customizationElectricQuestion.problemFourImg, + customizationElectricQuestion.problemFourSlightImg, + customizationElectricQuestion.problemFourModerateImg, + customizationElectricQuestion.problemFourSevereImg + ]; + currentQuizData[4].file = [ + customizationElectricQuestion.problemFiveImg, + customizationElectricQuestion.problemFiveSlightImg, + customizationElectricQuestion.problemFiveModerateImg, + customizationElectricQuestion.problemFiveSevereImg + ]; + currentQuizData[5].file = [ + customizationElectricQuestion.problemSixImg, + customizationElectricQuestion.problemSixSlightImg, + customizationElectricQuestion.problemSixeModerateImg, + customizationElectricQuestion.problemSixSevereImg + ]; + this.setState({ + currentQuizData + }) +} +InitEyeCarvingCustom(mode, modeData) { + const eyeNursingQuestion = JSON.parse(mode.eyeNursingQuestion); + let {eyeAnswerData} =this.state + eyeAnswerData[0].file = [eyeNursingQuestion.eyeCarvingProbleOneImg]; + eyeAnswerData[1].file = [ + eyeNursingQuestion.eyeCarvingProbleTwoGrade0Img, + eyeNursingQuestion.eyeCarvingProbleTwoGrade1Img, + eyeNursingQuestion.eyeCarvingProbleTwoGrade2Img, + eyeNursingQuestion.eyeCarvingProbleTwoGrade3Img, + eyeNursingQuestion.eyeCarvingProbleTwoGrade4Img, + eyeNursingQuestion.eyeCarvingProbleTwoGrade5Img + ]; + + eyeAnswerData[0].ChekboxList = []; + const eyeNursingRadar = JSON.parse(mode.eyeNursingRadar); + eyeNursingRadar.radarChartTable.forEach(item => { + eyeAnswerData[0].ChekboxList.push(item.describe); + eyeAnswerData[0].min = eyeNursingRadar.min; + }); + this.setState({ + radarMax:eyeNursingRadar.max,eyeAnswerData, + }) +} /** 同步设备运行信息:运行时间 */ updateDeviceSyncData = (newData, jsonStatus) => { @@ -343,8 +489,23 @@ class IotCarePlanWE200 extends Component { }; /** 检查时间是否达标仪器最低护理时间 */ - isCheckNurseTime() { - return WE200Function.Step2.isCheckNurseTime.call(this) + isCheckNurseTime=async ()=>{ /** 检查时间是否达标仪器最低护理时间 */ + const { currentDevice, ActiveModeItem,checkeModeType } = this.state; + let sceneTime + sceneTime =await this.CurrentConversionTime() + + + const timeRemaining = sceneTime - minSecToS(this.state.currentTime); // 当前模式已运行时间 + + let nursingTimeStr = currentDevice?.nursingTimeStr; + let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间 + + console.log("检查已运行时间", timeRemaining, nursingTime); + if (timeRemaining >= nursingTime) { + return true; + } else { + return false; + } } /*** 护理记录 START ***/ /** 小程序查询护理记录概要 */ @@ -392,7 +553,28 @@ class IotCarePlanWE200 extends Component { rmWE200NursingHistory = () => { WE200Function.LocalStorageOfData.rmWE200NursingHistory.call(this) }; - + async CurrentConversionTime(){ + let {checkeModeType,ActiveModeItem} =this.state + + let time + let ms + console.log(checkeModeType,'checkeModeType',this.customizedCurrentCareTime); + + if('ShapeBeautyEssence' === checkeModeType){//私人定制 + if(this.customizedCurrentCareTime.show === 1){ //等于1的时候才显示,才使用这个私人定制时间 + ms =await s_to_ms(this.customizedCurrentCareTime.time * 60) + time= await minSecToS(ms) + }else{ + time=await minSecToS(ActiveModeItem.modeTimeStr); + } + }else if('EyeCarving_Custom' === checkeModeType){ // 眼雕大师 + ms =await s_to_ms(this.eyeSculptureMasterCareTime * 60) + time= minSecToS(ms) + }else{ + time= minSecToS(ActiveModeItem.modeTimeStr); + } + return time + } // 模式选中后下一步 modeSelect = () => { WE200Function.Step1.modeSelect.call(this) @@ -486,8 +668,9 @@ class IotCarePlanWE200 extends Component { }; - getWE200NursingHistoryGear() { - return WE200Function.LocalStorageOfData.getWE200NursingHistoryGear.call(this) + async getWE200NursingHistoryGear() { + let gear= await WE200Function.LocalStorageOfData.getWE200NursingHistoryGear.call(this) + return gear } /** * @name 提交护理记录 完成护理后自动调用,会跳转页面 @@ -501,8 +684,8 @@ class IotCarePlanWE200 extends Component { WE200Function.Step2.PostNursingLogClock.call(this,data,isJump) }; // 面部肌肉对位校准-选中记录本地 - FacialCalibrationSelect = () => { - WE200Function.pop.FacialCalibrationSelect.call(this) + FacialCalibrationSelect = (e) => { + WE200Function.pop.FacialCalibrationSelect.call(this,e) }; // 面部校准弹窗确认 FacialCalibrationConfirm = () => { @@ -564,6 +747,15 @@ class IotCarePlanWE200 extends Component { WE200Function.pop.closeNotEnoughTime.call(this) }; + // 手动打开视频 + handleClickVideo = () => { + + + // 开始播放 + this.videoContext.play(); + // 暂停播放 + // videoRef.pause(); + }; /** 完成护理提交:跳转护理报告页 */ goNursingPage = async ( modeType, @@ -583,16 +775,29 @@ class IotCarePlanWE200 extends Component { modeId) }; + getSavedInstrumentGear= async(checkeModeType) =>{ + const WE200NursingHistoryInstrumentGear = Taro.getStorageSync("WE200NursingHistoryInstrumentGear" +checkeModeType); + const WE200NursingHistoryGear = Taro.getStorageSync("WE200NursingHistoryGear" +checkeModeType); + return WE200NursingHistoryInstrumentGear || WE200NursingHistoryGear; + } // 重连完成配对 pairingChange =async () => { WE200Function.Bluetooth.pairingChange.call(this) }; - connectionClose = () => { + connectionClose =async () => { + this.setState({ isConnectShow: false, }); - Taro.switchTab({ url: "/pages/index/index" }); + // 断线时,如果已运行时间满足最低运行时间,则直接提交结束任务 + if (await this.isCheckNurseTime()) { + this.endNurseFun(); + } else { + + this.WE200NursingHistory.id = ""; + this.setState({ isNotEnoughTime: true }); + } }; @@ -710,6 +915,7 @@ class IotCarePlanWE200 extends Component { confirmButtonText="知道了" data={ActiveModeItem?.openSourceData} close={this.closeStepTips} + handleClickVideo={this.handleClickVideo} /> ) } @@ -794,11 +1000,11 @@ class IotCarePlanWE200 extends Component { ); } diff --git a/src/recoding/pages/face_report_one/face_report_one.tsx b/src/recoding/pages/face_report_one/face_report_one.tsx index b35988d..243ff09 100644 --- a/src/recoding/pages/face_report_one/face_report_one.tsx +++ b/src/recoding/pages/face_report_one/face_report_one.tsx @@ -49,11 +49,13 @@ export default class Index extends Component { year: new Date().getFullYear(), month: new Date().getMonth() + 1, show: false, + cantClock:false, clockStatistics: [], punchInInfo: { clockImageList: [], clockContent: "", }, + monthTime: [ { month: 1, time: 0 }, { month: 2, time: 0 }, @@ -77,8 +79,21 @@ export default class Index extends Component { // 打开/关闭弹窗 setShow(show: boolean) { + if (show) { + let clock = Taro.getStorageSync('clock') + + if (clock == 2) { + this.setState({ cantClock: true }) + }else{ + this.setState({ show }); + } + return + } this.setState({ show }); } + closeAlert = () => { + this.setState({ cantClock: false }); + }; // 查询用户护理记录的当月统计信息 async getStatistics(id) { let ids = Number(id); @@ -142,6 +157,9 @@ export default class Index extends Component { }); return; } + if (punchInInfo.clockContent.length > 120) { + punchInInfo.clockContent.splice(119, punchInInfo.clockContent.length - 120) + } let res = await InstrumentInfo.apiClock.postInsertClockLog(punchInInfo) if (res.data.code === 200) { showModal({ @@ -287,16 +305,18 @@ export default class Index extends Component { let Bool = JSON.parse(options?.report); if (!Bool) { this.setState({ - reportShow: Bool, + reportShow: Bool, }); } this.init(options); this.getRouteId(); this.getClockStatistics(); } - init(options) { + async init(options) { let obj = JSON.parse(options.obj); - + this.setState({ //防止echarts图表渲染不出来 + EchartsData: { ...obj } + }) let recordData = this.state.recordData; let modeImage = this.state.modeImage; @@ -318,17 +338,53 @@ export default class Index extends Component { break; default: } + + let faceEnergy:any =0 //脸部能量 + obj.data.joulePerSecond.forEach((item) => { + faceEnergy +=item + }); + + + let max:any =Math.max(...obj.data.impedanceList); //最大等级 + max = await this.determineTier(max); + let min:any =Math.min(...obj.data.impedanceList); //最小等级 + min =await this.determineTier(min); + // 平均数最大等级处于2 + let average: any = max / 2; //平均能量等级 + average = this.determineTier(average); recordData = { ...obj, ...obj.data, + filtered:obj.data.impedanceList.length,//能量发数 + faceEnergy, + max, + min, + average, }; - this.setState({ recordData, modeImage, EchartsData: { ...obj } }); + console.log(recordData,'recordDatarecordData',obj); + + this.setState({ recordData, modeImage }); } + // 计算挡位 + determineTier = (sun) => { + // 定义每档的范围 + const tiers = [0, 200, 280, 360, 440, 520, 600, 680, 760, 840]; + + // 遍历每一档的范围,找到 sun 所属的档 + for (let i = 0; i < tiers.length; i++) { + if (sun < tiers[i + 1]) { + return i + 1; + } + } + + // 如果 sun 不在任何一档范围内,返回默认档或处理错误 + return "10"; + }; customBack = () => { Taro.switchTab({ url: "/pages/index/index" }); }; onUnload() { - if(this.state.reportShow){ + if (this.state.reportShow) { Taro.switchTab({ url: "/pages/index/index" }); } // 监听页面卸载,移除侧滑事件监听 @@ -355,12 +411,13 @@ export default class Index extends Component { monthTime, reportShow, EchartsData, + cantClock } = this.state; return ( @@ -420,9 +477,10 @@ export default class Index extends Component { 能量等级图谱-{recordData.modeName} - + + @@ -505,7 +563,7 @@ export default class Index extends Component { @@ -521,6 +579,16 @@ export default class Index extends Component { + ); } diff --git a/src/recoding/pages/face_report_we200/face_report_we200.tsx b/src/recoding/pages/face_report_we200/face_report_we200.tsx index ef56c06..4dd3ce6 100644 --- a/src/recoding/pages/face_report_we200/face_report_we200.tsx +++ b/src/recoding/pages/face_report_we200/face_report_we200.tsx @@ -1,8 +1,9 @@ import Taro from "@tarojs/taro"; import classnames from "classnames"; import { Component, PropsWithChildren, useEffect, useState } from "react"; -import { Progress, Tab, Tabs, Dialog, Popup,Circle } from "@antmjs/vantui"; +import { Progress, Tab, Tabs, Dialog, Popup, Circle } from "@antmjs/vantui"; import { showModal } from "@/utils/traoAPI"; +import PopupAlert from "@/components/popup/popup-alert"; import { Block, @@ -12,7 +13,7 @@ import { Input, Button, Textarea, - + } from "@tarojs/components"; import { date, getdates, previewImage } from "../../../utils/util"; @@ -48,7 +49,9 @@ export default class Index extends Component { reportPageImg: '', InputText1: '', InputText2: '', - isCircle:false //显示环形进度条 + isCircle: false, //显示环形进度条 + cantClock: false, + }; } @@ -57,7 +60,8 @@ export default class Index extends Component { componentWillUnmount() { Taro.eventCenter.off('SetInstrumentGear'); Taro.removeStorageSync("WE200BluetoothConnectivity"); - } + + } // 查询用户护理记录的当月统计信息 async getStatistics(id) { @@ -87,6 +91,9 @@ export default class Index extends Component { }); return; } + if (punchInInfo.clockContent.length > 120) { + punchInInfo.clockContent.splice(119, punchInInfo.clockContent.length - 120) + } InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => { showModal({ t2: "您已完成今日打卡", @@ -115,9 +122,23 @@ export default class Index extends Component { // Taro.eventCenter.trigger('myEvent') // } // 打开/关闭弹窗 + closeAlert = () => { + this.setState({ cantClock: false }); + }; setShow(show: boolean) { + if (show) { + let clock = Taro.getStorageSync('clock') + + if (clock == 2) { + this.setState({ cantClock: true }) + }else{ + this.setState({ show }); + } + return + } this.setState({ show }); } + /**分页获取用户的打卡记录 page size*/ async getClockStatistics(year = this.state.year) { let res = await InstrumentInfo.apiClock.getClockStatistics({ year }); @@ -134,23 +155,23 @@ export default class Index extends Component { } } // 获取护理时间 - async GetnursingTime(instrumentId,modeId){ - + async GetnursingTime(instrumentId, modeId) { + let data = { - instrumentId,modeId + instrumentId, modeId } let res1 = await InstrumentInfo.apiClock.getNursingTime(data); - console.log(res1 ,'111111'); - if(res1.data.code === 200){ + console.log(res1, '111111'); + if (res1.data.code === 200) { this.setState({ - nursingTime:res1.data.data.nursingTime + nursingTime: res1.data.data.nursingTime }) } - + } async getRouteId(instrumentId) { let punchInInfo = this.state.punchInInfo - + this.getStatistics(instrumentId); @@ -210,9 +231,9 @@ export default class Index extends Component { } // 录入是false, enterReset(show) { - + let WE200BluetoothConnectivity = Taro.getStorageSync("WE200BluetoothConnectivity"); - if(!WE200BluetoothConnectivity){ //代表蓝牙断开 + if (!WE200BluetoothConnectivity) { //代表蓝牙断开 Taro.showToast({ title: '蓝牙已断开', icon: 'none', @@ -221,16 +242,16 @@ export default class Index extends Component { return } let { gear, modeKey } = this.state - - if (show) { + + if (show) { // 重置 Taro.removeStorageSync("WE200NursingHistoryInstrumentGear" + modeKey); - Taro.eventCenter.trigger('SetInstrumentGear', modeKey,gear,false); + Taro.eventCenter.trigger('SetInstrumentGear', modeKey, gear, false); Taro.removeStorageSync("WE200NursingHistoryGear" + modeKey); } else { // 录入. - Taro.eventCenter.trigger('SetInstrumentGear', modeKey,gear,true); + Taro.eventCenter.trigger('SetInstrumentGear', modeKey, gear, true); Taro.setStorageSync("WE200NursingHistoryInstrumentGear" + modeKey, gear); } @@ -248,25 +269,25 @@ export default class Index extends Component { this.setState({ isCircle: true }) - let that =this - setTimeout(function() { + let that = this + setTimeout(function () { that.setState({ isCircle: false, isEnterReset: show }) - }, 2000); - + }, 2000); + } // 完成进度 async CompletionProgress(recordId, modeId, nursingTime) { let data = {} if (nursingTime === null) { data = { - id:recordId, modeId + id: recordId, modeId } } else { data = { - id:recordId, modeId, nursingTime + id: recordId, modeId, nursingTime } } @@ -275,11 +296,11 @@ export default class Index extends Component { if (res1.data.code === 200 && res1.data.data !== null) { this.setState({ - percentage: res1.data.data + percentage: res1.data.data }) } } - + async onLoad(options) { console.log(options, "查看传过来的参数"); let obj = JSON.parse(options.data); @@ -300,9 +321,12 @@ export default class Index extends Component { } else if (obj.modeType === "ShapeBeautyEssence") { //私人定制电流 InputText1 = '是否将电流模式/挡位录入仪器中' InputText2 = '录入后可以离线使用该模式/挡位' + } else if (obj.modeType === "DiyWater") { //DIY水膜模式 + InputText1 = '是否将官配电流配方录入仪器中' + InputText2 = '录入后可以离线使用该电流配方' } this.setState({ - NursingSite: obj.partitonReports, // 面部数据 数组0是额头-1是左脸颊-2是右脸颊-3是下颚线 + NursingSite: obj.partitonReports, // 面部数据 数组0是额头-1是左脸颊-2是右脸颊-3是下颌线 modeName: options.modeName, modeKey: obj.modeType, nursingTime: options.nursingTime, @@ -312,20 +336,20 @@ export default class Index extends Component { reportPageImg: obj?.reportPageImg, InputText1, InputText2 }) - console.log(obj.gear,'查案挡位'); + console.log(obj, '查案挡位'); // 仪器挡位 let WE200NursingHistoryInstrumentGear = Taro.getStorageSync( "WE200NursingHistoryInstrumentGear" + obj.modeType ); // 当之前仪器挡位与现在仪器挡位一致的时候显示重置 - if(WE200NursingHistoryInstrumentGear){ + if (WE200NursingHistoryInstrumentGear) { // 当他都一样的时候返回true const isEqual = WE200NursingHistoryInstrumentGear.every(itemA => obj.gear.some(itemB => itemB.gear === itemA.gear)); - + this.setState({ - isEnterReset:isEqual ? false: true // 当之前仪器挡位与现在仪器挡位一致的时候显示重置 + isEnterReset: isEqual ? false : true // 当之前仪器挡位与现在仪器挡位一致的时候显示重置 }) - + } let that = this setTimeout(function () { @@ -333,7 +357,7 @@ export default class Index extends Component { }, 3000); const searchParams = new URLSearchParams(window.location.search); - // 仪器id + // 仪器id const instrumentId = searchParams.get("instrumentId"); this.getRouteId(instrumentId); this.getClockStatistics() @@ -343,18 +367,18 @@ export default class Index extends Component { this.setState({ isInstrumentCare: Bool, }); - // 获取本次护理时间 - this.GetnursingTime(instrumentId,options.modeId) - } + // 获取本次护理时间 + this.GetnursingTime(instrumentId, options.modeId) + } // 完成进度条 this.CompletionProgress(options.recordId, options.modeId, null) - + } customBack = () => { Taro.switchTab({ url: "/pages/index/index" }); }; onUnload() { - if(this.state.isInstrumentCare){ + if (this.state.isInstrumentCare) { Taro.switchTab({ url: "/pages/index/index" }); } // 监听页面卸载,移除侧滑事件监听 @@ -372,7 +396,7 @@ export default class Index extends Component { GoIndex = () => { Taro.switchTab({ url: "/pages/index/index" }); }; - transValue(value) { + transValue(value) { if (!value) return 0; var val = value * 1; // 转number if (val < 1000) return val; @@ -402,10 +426,11 @@ export default class Index extends Component { currentAnswer, reportPageImg, InputText1, - InputText2 + InputText2, + cantClock } = this.state; return ( - + { 模式:{modeName} 本次护理时间:{nursingTime} 完成度: - 100 - // ? 100 - // : recordData.completionPercentage * 100 - // } - percentage={percentage} - strokeWidth='11' - color='linearGradient(to right, #eecda1, #ffe9c7) !important' - /> + 100 + // ? 100 + // : recordData.completionPercentage * 100 + // } + percentage={percentage} + strokeWidth='11' + color='linearGradient(to right, #eecda1, #ffe9c7) !important' + /> {percentage}% - { isInstrumentCare&& modeKey === 'ShapeBeautyEssence' && 电流配方:{currentAnswer}} - { isInstrumentCare&& modeKey === 'EyeCarving_Custom' && 电流配方:{currentAnswer}} + {isInstrumentCare && modeKey === 'ShapeBeautyEssence' && 电流配方:{currentAnswer}} + {isInstrumentCare && modeKey === 'EyeCarving_Custom' && 电流配方:{currentAnswer}} {/* 电流配方:A1B1C1 */} @@ -515,9 +540,9 @@ export default class Index extends Component { {InputText1} 注意:{InputText2} - {this.state.isCircle && isEnterReset && } - {!this.state.isCircle && isEnterReset && 录入} - + {this.state.isCircle && isEnterReset && } + {!this.state.isCircle && isEnterReset && 录入} + ) : ( @@ -525,9 +550,9 @@ export default class Index extends Component { 你已录入模式/挡位,是否重置 注意:重置后模式/挡位讲恢复出厂设置 - {this.state.isCircle && !isEnterReset && } - {!this.state.isCircle && !isEnterReset && 重置} - + {this.state.isCircle && !isEnterReset && } + {!this.state.isCircle && !isEnterReset && 重置} + ) )} @@ -535,7 +560,7 @@ export default class Index extends Component { {modeKey == "WaterLightEssence" && - 提拉次数*:肌提美容仪通过锻炼面部颧大肌、额小肌、笑肌三大提肌,提拉苹果肌和下颚线,故该数据为综合脸颊处的提拉次数核算所得 + 提拉次数*:肌提美容仪通过锻炼面部颧大肌、额小肌、笑肌三大提肌,提拉苹果肌和下颌线,故该数据为综合脸颊处的提拉次数核算所得 } {isInstrumentCare ? ( @@ -597,7 +622,7 @@ export default class Index extends Component { @@ -613,8 +638,18 @@ export default class Index extends Component { + - + ); } } diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index 8010129..fac7993 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -16,10 +16,10 @@ import { } from "@tarojs/components"; import { go } from "@/utils/traoAPI"; import { Popup } from "@antmjs/vantui"; +import PopupAlert from "@/components/popup/popup-alert"; /** 自定义组件 **/ import Navbar from "@/components/navbar/navbar"; -import PopupClock from "@/components/popup/popup-clock"; /** 自定义组件 **/ import { InstrumentInfo } from "@/utils/Interface"; import { date, getdates, previewImage } from "@/utils/util"; @@ -67,6 +67,8 @@ export default class Recording extends Component { }, navigationBarHeight: "", statusBarHeight: "", + cantClock:false, + }; } @@ -192,6 +194,17 @@ export default class Recording extends Component { }; // 打开/关闭弹窗 setShow(show: boolean) { + + if (show) { + let clock = Taro.getStorageSync('clock') + + if (clock == 2) { + this.setState({ cantClock: true }) + }else{ + this.setState({ show }); + } + return + } this.setState({ show }); } // 选择仪器 @@ -532,6 +545,9 @@ export default class Recording extends Component { }); return; } + if (punchInInfo.clockContent.length > 120) { + punchInInfo.clockContent.splice(119, punchInInfo.clockContent.length - 120) + } InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => { showModal({ t2: "您已完成今日打卡", @@ -555,7 +571,9 @@ export default class Recording extends Component { delta: 1, }); } - + closeAlert = () => { + this.setState({ cantClock: false }); + }; setStatusBar() { Taro.getSystemInfoAsync({ success: (res) => { @@ -593,6 +611,7 @@ export default class Recording extends Component { statusBarHeight, startYear, endYear, + cantClock } = this.state; const statusBarHeightRpx = statusBarHeight * 2; const navigationBarHeightRpx = navigationBarHeight * 2; @@ -953,7 +972,7 @@ export default class Recording extends Component { @@ -969,6 +988,16 @@ export default class Recording extends Component { + ); } diff --git a/src/utils/bluetooth.js b/src/utils/bluetooth.js index 1a47003..610d9a5 100644 --- a/src/utils/bluetooth.js +++ b/src/utils/bluetooth.js @@ -190,14 +190,14 @@ export const getBLEDeviceServices = (deviceId) => { //获取服务以及服务的uuid deviceId, success(res) { - console.log(res); + // console.log(res); let servicesuuid = res.services[0].uuid; //主要服务 wx.getBLEDeviceCharacteristics({ //获取蓝牙低功耗设备某个服务中所有特征 (characteristic)。 deviceId, serviceId: servicesuuid, success(ress) { - console.log(ress); + // console.log(ress); let characteristicsuuid0 = ress.characteristics[0].uuid; let characteristicsuuid1 = ress.characteristics[1].uuid; reslove({ @@ -219,7 +219,7 @@ export const getBLEDeviceServices = (deviceId) => { }; export const notifyBLECharacteristicValueChange = (info) => { - console.log(info); + // console.log(info); return new Promise((reslove, reject) => { wx.notifyBLECharacteristicValueChange({ state: true, // 启用 notify 功能 diff --git a/src/utils/carePlanApi.js b/src/utils/carePlanApi.js index cbf5585..26457b3 100644 --- a/src/utils/carePlanApi.js +++ b/src/utils/carePlanApi.js @@ -161,7 +161,16 @@ export const browseSetWechatTagApi = (data) => { method: "get", data, }); -} +}; + +// 查询用户指定月份的护理任务列表 +export const listCalendarApi = (data) => { + return Ajax({ + url: "/nursingPlan/listCalendar", + method: "get", + data, + }); +}; // // 护理列表 // export const getCarePlanList = (data) => { diff --git a/src/utils/util.js b/src/utils/util.js index ded5ecb..77bc78b 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -362,7 +362,6 @@ const s_to_s = (s) => { const minSecToS = (minSecStr) => { if (!minSecStr) return 0; let strArr = minSecStr.split(":"); - console.info(strArr, "strArr"); return strArr.length ? parseInt(strArr[0]) * 60 + parseInt(strArr[1]) : 0; };