5.31推送

master
L14\huangyilong 2 years ago
parent 53f85e483d
commit 67778a0d91

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

@ -55,6 +55,7 @@ class carePlanInfo extends Component<any, any> {
planPerson: 0, // 护理计划参与人数
planinfoDetail: null, //护理计划详情页图片
planinstrumentList: [], // 护理计划仪器列表
isJoinPlan: null, // 是否有已参加或待审核的计划
/** 护理计划主页数据 end */
/** 定制计划问卷星 */
@ -76,7 +77,8 @@ class carePlanInfo extends Component<any, any> {
// 当前日程每日护理计划信息
schedulePlan: [], // 当前日程每日护理计划信息列表
schedulePlanDay: {}, // 当前展示的每日护理计划信息 默认展示第一天
scheduleMarks: [], // 展示日历标记的数据 []
scheduleMarks: [], // 护理计划天数展示 []
scheduleMarksAtC: [], // 展示日历标记的数据 []
scheduleMarksDay: 0, // 当前选中的计划日程对应天数的下标
/** 计划日程组件数据 end */
@ -86,7 +88,7 @@ class carePlanInfo extends Component<any, any> {
currentDay: 0, // 当前天数
totalProgress: 0, // 总任务数
currentProgress: 0, //已经完成的任务数
isQualifyFor: 0, // 是否有领奖资格
isQualifyFor: 0, // 是否显示奖励进度
/** 奖励完成度 end */
/** 只有确认按钮的弹窗组件数据 */
@ -117,12 +119,19 @@ class carePlanInfo extends Component<any, any> {
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<any, any> {
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<any, any> {
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(
/\<img/g,
'<img style="width:100%;height:auto;display:block"'
);
console.log(planinfoDetail);
); // 护理详情的富文本数据
this.setState(
{
surveyNumber,
isJoinPlan, // 用户是否有参与或待审核的计划
surveyNumber, // 问卷星分数
scheduleList, // 计划日程列表
planinfoDetail, // 护理计划详情数据,
id: planInfo.id, // 护理计划id
@ -172,7 +180,7 @@ class carePlanInfo extends Component<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
};
shareCheck(params) {
console.log(params, "params");
if (params.planId) {
this.setState({ id: params.planId });
}
@ -434,20 +443,34 @@ class carePlanInfo extends Component<any, any> {
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<any, any> {
// go("/pages/webView/webView");
} else {
// 没有关联定制计划,弹出定制弹窗 默认选中第一个日程并获取相关数据
if (scheduleList.length === 0) {
this.setState({
isPromptShow: true,
promptdata: {
hidden: true,
...this.state.promptdata,
content: (
<View style={{ fontSize: "32rpx", lineHeight: "60rpx" }}>
<View></View>
<View></View>
</View>
),
},
});
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<any, any> {
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<any, any> {
};
this.setState({
scheduleMarks,
scheduleMarksAtC,
schedulePlanDay,
schedulePlan: res.data.data,
});
@ -534,6 +578,13 @@ class carePlanInfo extends Component<any, any> {
});
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<any, any> {
};
// 点击前往护理
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<any, any> {
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<any, any> {
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<any, any> {
// 护理计划详情数据
name,
planJoinId,
isJoinPlan,
planImg,
status,
planDay,
@ -697,6 +746,7 @@ class carePlanInfo extends Component<any, any> {
scheduleinstrumentList,
schedulePlanDay,
scheduleMarks,
scheduleMarksAtC,
scheduleMarksDay,
isReward,
@ -721,6 +771,7 @@ class carePlanInfo extends Component<any, any> {
isCollapsePlanInfo,
isCollapsePlanSchedule,
isNotJoin,
cantJoin
} = this.state;
// 计划日程组件
@ -805,7 +856,7 @@ class carePlanInfo extends Component<any, any> {
{/* 日期组件 */}
<AtCalendar
currentDate={scheduleMarks[0]?.value}
scheduleMarks={scheduleMarks}
scheduleMarks={scheduleMarksAtC}
/>
{/* 日程step */}
@ -897,7 +948,12 @@ class carePlanInfo extends Component<any, any> {
return (
<Block>
<Navbar titleSlot={name} isBack={true} />
<Navbar
titleSlot={name}
isBack
isCustomBack
customBack={this.customBack}
/>
<PopupAlert
isShow={isNotRegister}
isClose
@ -909,6 +965,18 @@ class carePlanInfo extends Component<any, any> {
close={this.closeAlert}
confirm={this.toRegister.bind(this)}
/>
<PopupAlert
isShow={cantJoin}
isClose
title="提示"
content="您已被限制参加,请联系微信小助理"
confirmButtonText="前往注册"
textAlgin="center"
type="1"
close={this.closeAlert}
confirm={this.closeAlert}
/>
<PopupAlert
isShow={isNotBinding}
isClose
@ -927,7 +995,6 @@ class carePlanInfo extends Component<any, any> {
content={content}
confirmButtonText="知道了"
textAlgin="center"
type="1"
close={this.closeAlert}
confirm={this.toIndex}
/>
@ -987,12 +1054,14 @@ class carePlanInfo extends Component<any, any> {
<View className="endplan-progress">
: ({currentDay}/{totalDay})
</View>
<View className="endplan-finish">
: {planFinish}{" "}
<Text>
( {currentProgress}/{totalProgress} )
</Text>
</View>
{!!isQualifyFor && !!isReward && (
<View className="endplan-finish">
: {planFinish}{" "}
<Text>
( {currentProgress}/{totalProgress} )
</Text>
</View>
)}
<View className="endplan-tips">
:,
</View>
@ -1010,7 +1079,7 @@ class carePlanInfo extends Component<any, any> {
>
<ScrollView
scrollY
style="overflow:hidden;position:relative;height:1020rpx"
style="overflow:hidden;position:relative;height:60vh "
>
{plan}
</ScrollView>
@ -1073,12 +1142,8 @@ class carePlanInfo extends Component<any, any> {
{/* 护理计划 */}
<View className="pages">
<View className="title">
<Image
src={planImg}
mode="aspectFit"
style="width:100%;height:500rpx"
/>
<View className="title" style="width:100%;height:440rpx">
<Image src={planImg} mode="scaleToFill" />
<View className="title_name">
<Text className="name">{name}</Text>
{status === -1 && <Text className="item status0"></Text>}
@ -1160,7 +1225,9 @@ class carePlanInfo extends Component<any, any> {
}}
/>
</View>
<View className="instrumentname">{item.instrumentName}</View>
<View className="instrumentname">
{item.instrumentName}
</View>
</View>
</View>
);
@ -1184,7 +1251,7 @@ class carePlanInfo extends Component<any, any> {
</Text>
{isCollapsePlanInfo && (
<Image
src={require("../../img/right.png")}
src={require("../../img/arrow-down.png")}
style="width: 20rpx;height: 20rpx;margin-left:10rpx"
/>
)}
@ -1207,7 +1274,7 @@ class carePlanInfo extends Component<any, any> {
</View>
{/* 计划非可参与才展示的部分 */}
{status !== 0 && status !== -1 && (
{status === 1 && (
<Block>
{/* 有计划奖励且有领奖资格才显示 */}
{!!isQualifyFor && !!isReward && (
@ -1241,7 +1308,7 @@ class carePlanInfo extends Component<any, any> {
</Text>
{isCollapsePlanSchedule && (
<Image
src={require("../../img/right.png")}
src={require("../../img/arrow-down.png")}
style="width: 20rpx;height: 20rpx;margin-left:10rpx"
/>
)}
@ -1261,13 +1328,13 @@ class carePlanInfo extends Component<any, any> {
</View>
{/* 底部按钮 */}
{(status === -1 || status === 0) && (
{status !== 1 && (
<View className="button">
<View
className={classnames("center", {
disabled: status === -1,
disabled: !!isJoinPlan,
})}
onClick={this.customize}
onClick={this.customize.bind(this)}
>
</View>
@ -1297,13 +1364,13 @@ class carePlanInfo extends Component<any, any> {
</View>
</View>
)}
{status !== -1 && status !== 0 && status !== 1 && (
{/* {status !== -1 && status !== 0 && status !== 1 && (
<View className="button">
<View className="center" onClick={this.scheduledReports}>
</View>
</View>
)}
)} */}
</View>
</Block>
);

@ -40,30 +40,31 @@ class NursingPlanReport extends Component<any, any> {
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<any, any> {
// 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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
rewardJumpVideoId,
rewardJumpWithoutUrl,
rewardJumpVideoFeedId,
} = this.state.rewardState.link;
} = this.state.link;
const data = {
redirect_url: "",
redirect_appid: "",
@ -278,11 +288,13 @@ class NursingPlanReport extends Component<any, any> {
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<any, any> {
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<any, any> {
{NursingPlanReportData.text && (
<View className="text"> {NursingPlanReportData.text}</View>
)}
{/* 有奖励有领奖资格且完成计划才显示 */}
{!!isReward && !!isRewardFinish && !!isQualifyFor && (
{/* 有跳转奖励才显示 */}
{jump && (
<Block>
{/* 不需要审核则直接显示 */}
{!isRewardAudit && (
<View className="link">
<View className="left">
<View className="title">
{NursingPlanReportData.rewardJumpTitle}
</View>
<View className="text">
{NursingPlanReportData.rewardJumpContent}
</View>
</View>
<View className="right">
<Button
className="right-button"
onClick={this.goToUnderstand}
>
</Button>
</View>
</View>
)}
{/* 需要审核只有审核通过才显示 */}
{!!isRewardAudit && isRewardProcess === 3 && (
<View className="link">
<View className="left">
<View className="title">
{NursingPlanReportData.rewardJumpTitle}
{/* 有奖励有领奖资格且完成计划才显示 */}
{!!isReward && !!isRewardFinish && !!isQualifyFor && (
<Block>
{/* 不需要审核则直接显示 */}
{!isRewardAudit && (
<View className="link">
<View className="left">
<View className="title">
{NursingPlanReportData.rewardJumpTitle}
</View>
<View className="text">
{NursingPlanReportData.rewardJumpContent}
</View>
</View>
<View className="right">
<Button
className="right-button"
onClick={this.goToUnderstand}
>
</Button>
</View>
</View>
<View className="text">
{NursingPlanReportData.rewardJumpContent}
)}
{/* 需要审核只有审核通过才显示 */}
{!!isRewardAudit && isRewardProcess === 3 && (
<View className="link">
<View className="left">
<View className="title">
{NursingPlanReportData.rewardJumpTitle}
</View>
<View className="text">
{NursingPlanReportData.rewardJumpContent}
</View>
</View>
<View className="right">
<Button
className="right-button"
onClick={this.goToUnderstand}
>
</Button>
</View>
</View>
</View>
<View className="right">
<Button
className="right-button"
onClick={this.goToUnderstand}
>
</Button>
</View>
</View>
)}
</Block>
)}
</Block>
)}

@ -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;
}

@ -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<any, any> {
PickerTimeProp: any;
constructor(props) {
super(props);
this.state = {
@ -49,31 +56,37 @@ export default class Nursing extends Component<any, any> {
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<any, any> {
},
// 问卷弹窗数据
cycleId: "", // 问卷弹窗选择的数据
// 提示弹窗内容
content: "",
};
this.PickerTimeProp = React.createRef();
}
componentDidMount() {
this.getPlanNowProgress();
}
componentDidMount() {}
componentWillUnmount() {}
@ -114,7 +129,17 @@ export default class Nursing extends Component<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
});
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<any, any> {
// 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 = (
<View style={{ fontSize: "32rpx", lineHeight: "60rpx" }}>
<View>{planTitle}</View>
<View></View>
</View>
);
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<any, any> {
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 = (
<View style={{ fontSize: "32rpx", lineHeight: "60rpx" }}>
<View></View>
<View>,</View>
<View></View>
</View>
);
this.setState({ isPromptShow: true, content });
};
// 点击去领奖
@ -299,77 +365,161 @@ export default class Nursing extends Component<any, any> {
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<any, any> {
// 点击跳转实物链接 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<any, any> {
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<any, any> {
myPlanNextDay,
myPlanNextTime,
isWarn,
showDatePicker,
isPromptShow,
isPlanSchedule,
isQuesShow,
@ -478,162 +636,179 @@ export default class Nursing extends Component<any, any> {
isRewardAudit,
isRewardEnd,
isRewardProcess,
rewardState,
isNursingShow,
isAccountShow,
prizeName,
content,
} = this.state;
// 奖品
const reward = [rewardState.integral, rewardState.physical].filter(
(item) => item
);
return (
<Block>
{!!info && (
<Block>
{/* 护理报告弹窗 */}
{isNursingShow && (
<NursingPlanReport
planId={planId}
totalDayAll={totalDay}
planJoinId={planJoinId}
isRewardFinish={isRewardFinish}
isShow={this.state.isNursingPlanReport}
title={"护理计划报告"}
confirm={() => this.setState({ isNursingPlanReport: false })}
close={() => this.setState({ isNursingPlanReport: false })}
/>
)}
{/* 日程结束后问卷 */}
<PopupAlert
title="护理计划"
textAlgin="left"
confirmButtonText="下一步"
isShow={isQuesShow}
content={
<View className="questionnaire">
<View className="questionnaire-title">
{quesOption.optionTitle}
</View>
{quesOption.optionJson.map((item, index) => {
return (
<View
className="questionnaire-item"
key={index}
onClick={() => this.selectQuesOption(item.cycleId)}
>
{cycleId === item.cycleId && (
<Image
className="img"
src={require("../../img/finished.png")}
/>
)}
{cycleId !== item.cycleId && (
<Image
className="img"
src={require("../../img/Ellipse65.png")}
/>
)}
<Text style={{ paddingLeft: "90rpx" }}>
{item.optionContent}
</Text>
</View>
);
})}
</View>
}
confirm={this.quesOptionNext}
/>
{/* 我的护理问号点击弹窗 */}
<PopupAlert
title="提示"
textAlgin="center"
confirmButtonText="知道了"
isShow={isPromptShow}
content={
<View style={{ fontSize: "32rpx", lineHeight: "60rpx" }}>
<View></View>
<View>,</View>
<View></View>
</View>
}
confirm={() => this.setState({ isPromptShow: false })}
<Block>
{/* 护理报告弹窗 */}
{isNursingShow && (
<NursingPlanReport
planId={planId}
totalDayAll={totalDay}
planJoinId={planJoinId}
isRewardFinish={isRewardFinish}
isShow={this.state.isNursingPlanReport}
title={"护理计划报告"}
confirm={() => this.setState({ isNursingPlanReport: false })}
close={() => this.setState({ isNursingPlanReport: false })}
/>
)}
{/* 公众号引导弹窗 */}
<PopupAlert
title="请长按识别关注公众号"
textAlgin="center"
confirmButtonText="我知道了"
isShow={isAccountShow}
content={
<View style={{ display: "flex", justifyContent: "center" }}>
<Image
show-menu-by-longpress={true}
src={require("../../img/qrcode.jpg")}
style="width: 400rpx;height: 400rpx"
/>
{/* 日程结束后问卷 */}
<PopupAlert
title="护理计划"
textAlgin="left"
confirmButtonText="下一步"
isShow={isQuesShow}
content={
<View className="questionnaire">
<View className="questionnaire-title">
{quesOption.optionTitle}
</View>
}
confirm={() => this.setState({ isAccountShow: false })}
/>
{/* 今日护理步骤 */}
<PopupDrawer
isClose
postion="bottom"
title="今日护理步骤"
confirmButtonText="确定"
isShow={isPlanSchedule}
confirm={() => this.goToPlan()}
close={() => this.setState({ isPlanSchedule: false })}
>
<View className="steptime">
{currentDay}&nbsp;&nbsp; ({currentDate.split("-").join(".")}
)
</View>
<View className="stepoperate">
{myPlanStep.map((item, index) => {
{quesOption.optionJson.map((item, index) => {
return (
<View key={"stepoperate" + index} className="step_item">
<View className="step_item-title">Step{index + 1}</View>
<View className="step_item-cont">
{item.map((subitem, subindex) => {
return (
<View
className="step_item-list"
key={"step1" + subindex}
>
<Image
className="step_item-img"
src={
index === 1
? subitem.modeBanner
: subitem.productImg
}
/>
<View className="step_item-name">
{index === 1
? subitem.instrumentName
: subitem.productName}
</View>
<View className="step_item-operate">
{index === 1
? subitem.modeName
: subitem.introduce}
</View>
</View>
);
})}
</View>
<View
className="questionnaire-item"
key={index}
onClick={() => this.selectQuesOption(item.cycleId)}
>
{cycleId === item.cycleId && (
<Image
className="img"
src={require("../../img/finished.png")}
/>
)}
{cycleId !== item.cycleId && (
<Image
className="img"
src={require("../../img/Ellipse65.png")}
/>
)}
<Text style={{ paddingLeft: "90rpx" }}>
{item.optionContent}
</Text>
</View>
);
})}
</View>
</PopupDrawer>
}
confirm={this.quesOptionNext}
/>
{/* 我的护理问号点击弹窗 */}
<PopupAlert
title="提示"
textAlgin="center"
confirmButtonText="知道了"
isShow={isPromptShow}
content={content}
confirm={() => this.setState({ isPromptShow: false })}
/>
{/* 时间选择器 */}
<Popup show={showDatePicker} position="bottom" round>
<View
style={{
display: "flex",
height: "100rpx",
alignItems: "center",
justifyContent: "space-between",
padding: "0 40rpx",
fontSize: "36rpx",
borderBottom: "1px solid #ccc",
}}
>
<View onClick={this.onPopupClose}></View>
<View onClick={this.onClickStop} style={{ color: "green" }}>
</View>
</View>
<DatetimePicker
type="time"
value={myPlanNextTime}
onInput={_.throttle(this.onInput.bind(this), 500)}
/>
{/* <View className="btn_confirm">确定</View> */}
</Popup>
{/* 公众号引导弹窗 */}
<PopupAlert
title="请长按识别关注公众号"
textAlgin="center"
confirmButtonText="我知道了"
isShow={isAccountShow}
content={
<View style={{ display: "flex", justifyContent: "center" }}>
<Image
show-menu-by-longpress={true}
src={require("../../img/qrcode.jpg")}
style="width: 400rpx;height: 400rpx"
/>
</View>
}
confirm={() => this.setState({ isAccountShow: false })}
/>
{/* 今日护理步骤 */}
<PopupDrawer
isClose
postion="bottom"
title="今日护理步骤"
confirmButtonText="确定"
isShow={isPlanSchedule}
confirm={() => this.goToPlan()}
close={() => this.setState({ isPlanSchedule: false })}
>
<View className="steptime">
{currentDay}&nbsp;&nbsp; ({currentDate.split("-").join(".")})
</View>
<View className="stepoperate">
{myPlanStep.map((item, index) => {
return (
<View key={"stepoperate" + index} className="step_item">
<View className="step_item-title">Step{index + 1}</View>
<View className="step_item-cont">
{item.map((subitem, subindex) => {
return (
<View
className="step_item-list"
key={"step1" + subindex}
>
<Image
className="step_item-img"
src={
index === 1
? subitem.modeBanner
: subitem.productImg
}
/>
<View className="step_item-name">
{index === 1
? subitem.instrumentName
: subitem.productName}
</View>
<View className="step_item-operate">
{index === 1
? subitem.modeName
: subitem.introduce}
</View>
</View>
);
})}
</View>
</View>
);
})}
</View>
</PopupDrawer>
{!!info && (
<View className="careplan">
<View className="careplan_title">
<View className="title"></View>
@ -663,7 +838,7 @@ export default class Nursing extends Component<any, any> {
<Image
src={require("../../img/clock_in_upload/info.png")}
style={{ width: "30rpx", height: "30rpx" }}
onClick={() => this.setState({ isPromptShow: true })}
onClick={this.questionMark}
/>
<View className="out">
<View
@ -726,9 +901,7 @@ export default class Nursing extends Component<any, any> {
<Block>
<View className="integral">
<View className="title">
<Text>
: {reward.join("、")}
</Text>
<Text>: {prizeName}</Text>
<View
className={classnames("button", {
go: integralText === "已领奖",
@ -772,7 +945,7 @@ export default class Nursing extends Component<any, any> {
<Block>
<View className="integral">
<View className="title">
<Text>: {reward.join("、")}</Text>
<Text>: {prizeName}</Text>
<View
className={classnames("button", {
go: integralText === "已领奖",
@ -865,26 +1038,28 @@ export default class Nursing extends Component<any, any> {
<Text>
: {myPlanNextDay} {myPlanNextTime}
</Text>
<Picker
{/* <Picker
mode="time"
ref={this.PickerTimeProp}
disabled={isWarn}
defaultValue={myPlanNextTime}
onChange={this.changePlanNextTime}
onCancel={this.CancelPlanNextTime}
>
<Switch
color="#8ee2b1"
checked={isWarn}
onChange={this.changeSwitch}
/>
</Picker>
onCancel={this.cancelPlanNextTime}
onClick={this.clickPlanNextTime}
> */}
<Switch
color="#8ee2b1"
checked={isWarn}
onChange={this.changeSwitch}
/>
{/* </Picker> */}
</View>
</Block>
)}
</View>
</View>
</Block>
)}
)}
</Block>
</Block>
);
}

@ -74,7 +74,7 @@ export default class PopupDrawer extends Component<any, any> {
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}
>

@ -183,6 +183,8 @@ class Instrument extends Component<any, any> {
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("请求失败,尝试重新请求");

@ -431,7 +431,10 @@ class IotCarePlanFE200 extends Component<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
}
// 切换模式后, 需要重新设置计时器, 以防进行中的计时器
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
// 重连蓝牙初始化监听
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({

@ -159,6 +159,7 @@ class IotCarePlanFR200 extends Component<any, any> {
if (option.modeId) {
this.setState({ activeModeID: option.modeId });
}
if (option.GearData) {
this.setState({ GearData: option.GearData });
}
@ -198,7 +199,10 @@ class IotCarePlanFR200 extends Component<any, any> {
// 检测断线重连同步
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<any, any> {
isConnectionBlutoot: false, // 断开蓝牙
});
} else {
this.setDeviceSyncTime();
this.switchVideoPlay();
// this.setDeviceSyncTime();
// this.switchVideoPlay(); // 不需要强制播放视频,否则会超前一秒
}
Taro.hideLoading();
}, 5000);
@ -435,7 +439,10 @@ class IotCarePlanFR200 extends Component<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
}
// 切换模式后, 需要重新设置计时器, 以防进行中的计时器
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
);
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<any, any> {
}
/** 设置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<any, any> {
break;
case "nasolabialFold":
Allmun = 240;
break;
case "mandibularLine":
Allmun = 180;
break;
@ -2116,26 +2146,20 @@ class IotCarePlanFR200 extends Component<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
// 重连蓝牙初始化监听
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<any, any> {
}
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<any, any> {
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"

@ -91,6 +91,7 @@ class IotCarePlanWE200 extends Component<any, any> {
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<any, any> {
isSyncHistory = Taro.getStorageSync("isSyncHistory"); // 是否正在检查历史中: 用于断线重连
isForceJump = true; // 提交护理记录时,是否强制跳转: 用于断线重连
videoContext: any = null; //视频控制器
isEndShutdown: boolean = true; // 获取上报/提交数据时,是否关机仪器 false不关机 true关机
@ -211,7 +212,9 @@ class IotCarePlanWE200 extends Component<any, any> {
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<any, any> {
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<any, any> {
};
/** 检查时间是否达标仪器最低护理时间 */
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<any, any> {
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<any, any> {
};
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<any, any> {
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<any, any> {
WE200Function.pop.closeNotEnoughTime.call(this)
};
// 手动打开视频
handleClickVideo = () => {
// 开始播放
this.videoContext.play();
// 暂停播放
// videoRef.pause();
};
/** 完成护理提交:跳转护理报告页 */
goNursingPage = async (
modeType,
@ -583,16 +775,29 @@ class IotCarePlanWE200 extends Component<any, any> {
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<any, any> {
confirmButtonText="知道了"
data={ActiveModeItem?.openSourceData}
close={this.closeStepTips}
handleClickVideo={this.handleClickVideo}
/>
)
}
@ -794,11 +1000,11 @@ class IotCarePlanWE200 extends Component<any, any> {
<Video
className="video-or-image"
src={this.state.modeVideo}
autoplay
id="myVideo"
// autoplay
/>
)}
{/* <button onClick={this.handleClickVideo}>播放/暂停</button> */}
{/* Step2-运行中图片 */}
{this.state.isWorkImg && (
<View>
@ -859,6 +1065,7 @@ class IotCarePlanWE200 extends Component<any, any> {
</View>
<View className="line" />
<ElectricityView
// Electricity={4}
Electricity={this.state.matrixElectricity}
DeviceConnectStatus={1}
InstrumentType={'WE200'}

File diff suppressed because it is too large Load Diff

@ -12,13 +12,13 @@ let state = {
isgearImg:false, //挡位图片
gearUrl: "", //挡位图片Url
FacialCalculationData:5, //仪器护理脸部数据每5秒发送一次结果
// 公共-弹窗
transparentPopText:"", //透明弹窗内容
isFacialCalibration: false, //脸部对准--公共
PrepareSelect: false, //脸部对准--选中
PrepareSelect: [], //脸部对准--选中
isShowErrorTipsMembrane: false, //检测不同膜布弹窗
errorTipsMembrane: "", //检测不同膜布弹窗弹窗
@ -30,7 +30,11 @@ let state = {
// 仪器
initInstrument: false, //初始化仪器
initInstrumentGeartMO1:false, //获取仪器第一次mo1模式初始挡位
initInstrumentGeartMO2:false, //获取仪器第一次mo1模式初始挡位
IsWaterLightEssence:false, //官配妆效到达360秒时候弹窗防止有误差
currentAnswer: "",// 答题电流配方(结果)||眼雕大师结果
// mo1答题数据

@ -11,8 +11,6 @@ import React, {
useRef,
} from "react";
// import Echarts from "./components/Echart/index";
// import EchartFace from "./components/Echart_face/index";
import {
Block,
View,
@ -46,41 +44,23 @@ import Footer from "./components/Footer/WL200";
/* 本页组件 END */
import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
import { getBindInstrumentListApi } from "@/utils/carePlanApi";
import "./WL200.less";
import {
notifyBLECharacteristicValueChange,
sendCommand,
} from "@/utils/bluetoothWXAPI";
import {
deviceCommandSamples,
bleCommandSamples,
} from "@/components/bluetoot/connection/wl200";
import { sendCommand } from "@/utils/bluetoothWXAPI";
import { bleCommandSamples } from "@/components/bluetoot/connection/wl200";
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import commandMap from "@/utils/commandMap";
import { Popup } from "@antmjs/vantui";
import BluetoothContainer from "./components/Bluetoot/WL200";
// 组合模式:分别对应的是哪几个模式类型
// 黄光590nm
// 红光630nm
// 近红外光830nm
const MODE_WORKING_ENUM = {
STANDBY: "standby", // 待命
WORKING: "working", // 工作
PAUSE: "pause",
END: "end",
};
import WL200State from "./WL200State";
import WL200Function from "./WL200Function";
// import WL200Function from "./WL200Function";
class IotCarePlanWL200 extends Component<any, any> {
constructor(props) {
@ -107,8 +87,11 @@ class IotCarePlanWL200 extends Component<any, any> {
MixNursePro: 6,
MixNurse: 4,
ScalpCare: 6,
OilBalance: 3,
OilBalancePro: 6,
};
// 不涉及直接渲染的页面变量
videoContext: any = null;
deviceToolKitInstance: any = new DeviceToolKitWE100("WL200", "WL200");
isGearChangeIng: boolean = false; // 是否切换档/切换模式中
hearting: boolean = false; // 是否心跳中
@ -133,7 +116,12 @@ class IotCarePlanWL200 extends Component<any, any> {
ModeArray: string[] = ["all", "visor", "cabin", "yimeish"];
async onLoad() {
async onLoad(option) {
console.log(option, "option查看跳转过来的参数");
if (option?.modeId) {
this.setState({ activeModeID: option.modeId });
}
this.hadCheckReport = false;
// 保持屏幕常亮
Taro.setKeepScreenOn({
@ -145,9 +133,9 @@ class IotCarePlanWL200 extends Component<any, any> {
componentWillUnmount() {
this.hadCheckReport = false;
// 在这里执行你需要的清理工作,比如设置状态为初始状态
this.state = JSON.parse(JSON.stringify(WL200State));
this.bluetoothContainer = null;
// 在这里执行你需要的清理工作,比如设置状态为初始状态
this.state = JSON.parse(JSON.stringify(WL200State));
this.bluetoothContainer = null;
}
componentDidShow() {
@ -168,6 +156,10 @@ class IotCarePlanWL200 extends Component<any, any> {
this.hadCheckReport = false;
}
async onReady() {
this.videoContext = Taro.createVideoContext("wl200Video", this);
}
async initData() {
let obj = getStorageSync("instrument_detail");
if (obj) {
@ -199,7 +191,6 @@ class IotCarePlanWL200 extends Component<any, any> {
// 仅手机端初始化蓝牙
this.init();
}
setStorageSync("lastDevicesName", "WL200");
}
@ -209,13 +200,10 @@ class IotCarePlanWL200 extends Component<any, any> {
* @description
* */
GetBindInstrumentListApi = async () => {
WL200Function.PreparationPage.GetBindInstrumentListApi.call(this)
WL200Function.PreparationPage.GetBindInstrumentListApi.call(this);
};
async init() {
// 监听蓝牙连接状态改变
Taro.onBLEConnectionStateChange(this.listener);
this.bluetoothContainer = new BluetoothContainer(
@ -224,16 +212,15 @@ class IotCarePlanWL200 extends Component<any, any> {
this
);
this.bluetoothContainer.notifyBLECharacteristicValueChange();
}
// 断开链接触发
listener = (res) => {
WL200Function.Bluetooth.listener.call(this,res)
WL200Function.Bluetooth.listener.call(this, res);
};
GetModeList = async (id) => {
WL200Function.PreparationPage.GetModeList.call(this,id)
WL200Function.PreparationPage.GetModeList.call(this, id);
};
creartDom(modelist) {
@ -287,7 +274,11 @@ class IotCarePlanWL200 extends Component<any, any> {
* callback
*/
showCountdownFun(count = 3, callback: any = null) {
WL200Function.NursinControlFunction.showCountdownFun.call(this,count, callback)
WL200Function.NursinControlFunction.showCountdownFun.call(
this,
count,
callback
);
}
/** 点击切换护理模式,防止点击自己 */
@ -298,11 +289,18 @@ class IotCarePlanWL200 extends Component<any, any> {
/** 选中护理模式 */
modeCurrentFun = async (data, isNotCheck = false) => {
WL200Function.PreparationPage.modeCurrentFun.call(this,data, isNotCheck)
if (this.sendsTimer) clearTimeout(this.sendsTimer);
WL200Function.PreparationPage.modeCurrentFun.call(this, data, isNotCheck);
};
modeCurrentFunForce = async (data) => {
if (this.sendsTimer) clearTimeout(this.sendsTimer);
WL200Function.PreparationPage.modeCurrentFunForce.call(this, data);
};
/** 设备运行中切换模式 */
modeRuningChange() {
return WL200Function.PreparationPage.modeRuningChange.call(this)
return WL200Function.PreparationPage.modeRuningChange.call(this);
}
/** 切换护理模式 */
@ -324,12 +322,11 @@ class IotCarePlanWL200 extends Component<any, any> {
};
stepNext = () => {
WL200Function.NursinControlFunction.stepNext.call(this);
};
/** 开始护理按钮:点击开始,页面进行到下一步 */
onStartNurse = async () => {
WL200Function.Footer.onStartNurse.call(this)
WL200Function.Footer.onStartNurse.call(this);
};
/**
@ -342,22 +339,19 @@ class IotCarePlanWL200 extends Component<any, any> {
/** 切换光照 */
onSwitchChange = async () => {
WL200Function.Footer.onSwitchChange.call(this)
WL200Function.Footer.onSwitchChange.call(this);
};
/**
* @name
*/
openStepTips = () => {
WL200Function.pop.openStepTips.call(this)
WL200Function.pop.openStepTips.call(this);
};
closeStepTips = (data) => {
WL200Function.pop.closeStepTips.call(this, data);
};
/**监听关机事件*/
onEndDevice = () => {
WL200Function.NursinControlFunction.onEndDevice.call(this);
@ -365,19 +359,23 @@ class IotCarePlanWL200 extends Component<any, any> {
/** 同步设备运行信息:运行时间 */
updateDeviceSyncData = (newData, jsonStatus) => {
WL200Function.NursinControlFunction.updateDeviceSyncData.call(this,newData, jsonStatus);
WL200Function.NursinControlFunction.updateDeviceSyncData.call(
this,
newData,
jsonStatus
);
};
// 页面同步护理剩余时间
renderDeviceStatus = {
renderWorkTime: (jsonStatus) => {
WL200Function.NursinControlFunction.renderWorkTime.call(this,jsonStatus,);
WL200Function.NursinControlFunction.renderWorkTime.call(this, jsonStatus);
},
};
// 仪器开始倒计时
setLoadingTips(time) {
WL200Function.NursinControlFunction.setLoadingTips.call(this,time);
WL200Function.NursinControlFunction.setLoadingTips.call(this, time);
}
/**
@ -385,25 +383,30 @@ class IotCarePlanWL200 extends Component<any, any> {
* params
*/
judgementWorkStatus(nWorkStatus, nWorkMode) {
WL200Function.NursinControlFunction.judgementWorkStatus.call(this,nWorkStatus, nWorkMode)
WL200Function.NursinControlFunction.judgementWorkStatus.call(
this,
nWorkStatus,
nWorkMode
);
}
// 重置并同步计时器
resetTimer = () => {
WL200Function.NursinControlFunction.resetTimer.call(this)
// WL200Function.NursinControlFunction.resetTimer.call(this);
WL200Function.NursinControlFunction.resetTimer.bind(this)();
};
/**
* @name
* @params type switch
*/
onNursingTap(type = "") {
WL200Function.NursinControlFunction.onNursingTap.call(this,type)
WL200Function.NursinControlFunction.onNursingTap.call(this, type);
}
/** @name 结束护理并关机 */
endNurseFun = async () => {
WL200Function.NursinControlFunction.endNurseFun.call(this)
WL200Function.NursinControlFunction.endNurseFun.call(this);
};
/** 检查时间是否达标仪器最低护理时间 */
@ -438,19 +441,21 @@ class IotCarePlanWL200 extends Component<any, any> {
});
}, 3000);
}
/** 获取小程序本地缓存的历史记录 */
getWL200NursingHistory() {
WL200Function.LocalStorageOfData.getWL200NursingHistory.call(this)
WL200Function.LocalStorageOfData.getWL200NursingHistory.call(this);
}
/** 设置WL200护理历史 */
setWL200NursingHistory = (jsonStatus: any) => {
WL200Function.LocalStorageOfData.setWL200NursingHistory.call(this,jsonStatus)
WL200Function.LocalStorageOfData.setWL200NursingHistory.call(
this,
jsonStatus
);
};
/** 更新WL200护理历史运行时间 */
updateWL200NursingHistory = (data: any = null) => {
WL200Function.LocalStorageOfData.updateWL200NursingHistory.call(this,data)
WL200Function.LocalStorageOfData.updateWL200NursingHistory.call(this, data);
};
/**
* @name WL200
@ -459,18 +464,22 @@ class IotCarePlanWL200 extends Component<any, any> {
*
*/
rmWL200NursingHistory = () => {
WL200Function.LocalStorageOfData.rmWL200NursingHistory.call(this)
WL200Function.LocalStorageOfData.rmWL200NursingHistory.call(this);
};
/** 提交护理记录 */
PostNursingLogClock = async (data: any = null, isJump = true) => {
WL200Function.NursinControlFunction.PostNursingLogClock.call(this,data,isJump)
WL200Function.NursinControlFunction.PostNursingLogClock.call(
this,
data,
isJump
);
};
/*** 护理记录 END ***/
//蓝牙断开连接处理
bluetoothDisconnectProcessing() {
WL200Function.Bluetooth.bluetoothDisconnectProcessing.call(this)
WL200Function.Bluetooth.bluetoothDisconnectProcessing.call(this);
}
/** 获取护理时间组合 */
@ -585,12 +594,12 @@ class IotCarePlanWL200 extends Component<any, any> {
// 护理的错误提示
showTips(ctx) {
WL200Function.pop.showTips.call(this,ctx)
WL200Function.pop.showTips.call(this, ctx);
}
/** 结束护理弹窗 */
onEndPlan = async () => {
WL200Function.Footer.onEndPlan.call(this);
WL200Function.Footer.onEndPlan.call(this);
};
confirmEndBtn = () => {
WL200Function.pop.confirmEndBtn.call(this);
@ -602,7 +611,7 @@ class IotCarePlanWL200 extends Component<any, any> {
// 打开通用错误弹窗
openErrorTipsText = (str) => {
WL200Function.pop.openErrorTipsText.call(this,str);
WL200Function.pop.openErrorTipsText.call(this, str);
};
// 关闭通用错误弹窗
closeErrorTipsText = () => {
@ -616,7 +625,7 @@ class IotCarePlanWL200 extends Component<any, any> {
/** 完成护理提交:跳转护理报告页 */
goFaceReport = (id) => {
WL200Function.NursinControlFunction.goFaceReport.call(this,id);
WL200Function.NursinControlFunction.goFaceReport.call(this, id);
};
// 完成配对
@ -662,7 +671,6 @@ class IotCarePlanWL200 extends Component<any, any> {
footerIsDisabled = () => {
// 舱体是否连接状态
let { isStandStatus } = this.state;
if (this.tempModeCurrent) {
let isCanClick = isStandStatus
? this.tempModeCurrent?.isCabinMode === 1
@ -684,12 +692,17 @@ class IotCarePlanWL200 extends Component<any, any> {
return true;
};
handleClickVideo = () => {
let videoRef = Taro.createVideoContext("myVideo");
handleVideoPlay = () => {
// 如果弹窗打开,则不允许播放视频
if (this.state.isShowStepTips) return;
// 开始播放
videoRef.play();
// 暂停播放
videoRef.pause();
this.videoContext.play();
};
handleVideoPause = () => {
// 暂停要比开始晚100毫秒否则视频会自动播放
setTimeout(() => {
this.videoContext.pause();
}, 300);
};
customBack = () => {
@ -703,8 +716,6 @@ class IotCarePlanWL200 extends Component<any, any> {
WL200Function.pop.onModeLockClose.call(this);
};
render() {
let {
title,
@ -727,7 +738,6 @@ class IotCarePlanWL200 extends Component<any, any> {
isShowCountdown,
countdown,
Electricity,
isMuted,
matrixElectricity,
errorTips,
isEndCarePlan,
@ -738,7 +748,6 @@ class IotCarePlanWL200 extends Component<any, any> {
isNotEnoughTime,
isShowNursingSuccess,
currentDevice,
isConnectionBlutoot,
isShowTipsSave,
isFirstTipShow,
nurseInfo,
@ -805,6 +814,7 @@ class IotCarePlanWL200 extends Component<any, any> {
activeModeID={SwitchActiveModeID}
isPop
isShowNurse={isShowNurse}
isShowClassTitle={true}
ModeList={ModeList}
ModeType={ModeType}
onEmit={this.switchModeCurrentFun}
@ -891,7 +901,7 @@ class IotCarePlanWL200 extends Component<any, any> {
<ConnectionBluetoot
deviceInfo={currentDevice}
close={this.connectionClose}
isDisconnect={!isConnectionBlutoot}
isDisconnect={true}
offlineChange={() => {}}
pairingChange={this.pairingChange}
upgradeFun={() => {}}
@ -916,11 +926,10 @@ class IotCarePlanWL200 extends Component<any, any> {
<Video
className="video-or-image"
src={ActiveModeItem.modeVideo}
loop
autoplay
id="myVideo"
loop={!isShowStepTips}
id="wl200Video"
enableProgressGesture={false}
muted={isMuted}
autoplay={false}
/>
)}
{/* <button onClick={this.handleClickVideo}>播放/暂停</button> */}
@ -983,6 +992,7 @@ class IotCarePlanWL200 extends Component<any, any> {
activeModeID={activeModeID}
isPop={false}
isShowNurse={isShowNurse}
isShowClassTitle={false}
ModeList={ModeList}
ModeType={ModeType}
onEmit={this.modeCurrentFunClick}
@ -995,6 +1005,7 @@ class IotCarePlanWL200 extends Component<any, any> {
activeModeID={activeModeID}
isPop={false}
isShowNurse={isShowNurse}
isShowClassTitle={true}
ModeList={ModeList}
ModeType={ModeType}
onEmit={this.modeCurrentFunClick}

File diff suppressed because it is too large Load Diff

@ -88,12 +88,13 @@ export default class BluetoothContainer {
// }
if (jsonStatus.workMode !== "moistureTest") {
// 非档位切换期间才生效
if (!this.that.isGearChangeIng) {
if (!this.that.isGearChangeIng && !this.that.isEndMode) {
this.that.isGearChangeIng = false;
// this.that.isChangeModeFlag = false;
this.that.switchVideoPlay();
this.that.closeTips();
// 断线重连或模式已运行时间为零,则直接开始
if (this.that.elapsedTime === 0) {
if (this.that.elapsedTime === 0 || !this.that.currentTimeTimer) {
this.that.resetTimer()
}
}
@ -121,7 +122,11 @@ export default class BluetoothContainer {
// }
if (jsonStatus.workMode !== "moistureTest") {
this.that.switchVideoPause();
// 促渗模式:精华促渗不自动清除错误提示(提示补充精华)
if (this.that.currentTimeTimer) {
clearInterval(this.that.currentTimeTimer);
this.that.currentTimeTimer = null;
}
// 精华促渗不自动清除错误提示(提示补充精华)
if (BaseModeType.includes(jsonStatus.workMode)) {
this.that.showTips("请把设备紧贴肌肤,继续护理!");
} else if (ActiveModeItem?.modeType === "moistureTest") {
@ -213,28 +218,29 @@ export default class BluetoothContainer {
}
// 2.判断工作状态是否与选中仪器一致
// 判断基础版眼部和基础版脸部,禁止设备切换模式
// 判断且仅判断,当前与响应皆为基础版眼部和基础版脸部,禁止设备切换模式
if (currentModeType !== jsonStatus?.workMode) {
if (jsonStatus?.workMode === "eyes" || jsonStatus?.workMode === "face") {
let sendParams = {
...fr200DeviceControlCommand.work,
workMode: currentModeType, // 使用模式
workStatus: this.that.workStatus,
}
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
sendParams as any
);
console.info(`禁止设备切换模式 强制切换回来`, sendParams);
if (currentModeType === "face" || currentModeType === "eyes") {
if (jsonStatus?.workMode === "eyes" || jsonStatus?.workMode === "face") {
let sendParams = {
...fr200DeviceControlCommand.work,
workMode: currentModeType, // 使用模式
workStatus: this.that.workStatus,
}
const pauseArrayBuffer = this.deviceToolKitInstance?.toBleCommand(
sendParams as any
);
console.info(`禁止设备切换模式 强制切换回来`, sendParams);
sendCommand({
value: pauseArrayBuffer,
}).then(() => {
console.info(`发送工作指令成功 参数为 =>`, sendParams);
});
sendCommand({
value: pauseArrayBuffer,
}).then(() => {
console.info(`发送工作指令成功 参数为 =>`, sendParams);
});
}
}
}
if (jsonStatus?.workMode === currentModeType) {
console.log("this.that.isRuning", this.that.isRuning);
// 判断设备是否在运行中(护理中)
// 仅当设备模式与小程序是否一致,才允许更改设备运行时间
if (this.that.isRuning) {

@ -216,6 +216,7 @@ export default class BluetoothContainer {
* @description
* */
workByPatitionSet: (workMode = '', gearTakeEffectOffline = true, partitionStatus = [{ gear: 1 }, { gear: 1 }, { gear: 1 }, { gear: 1 }],workStatus='working') => {
let sendParams: any = {
...WE200DeviceControlCommand.workByPatitionSet,
workMode: workMode, // 使用模式
@ -467,6 +468,101 @@ export default class BluetoothContainer {
MembraneType: id
})
}
/** @name 护理页面 */
async NursingPage (jsonStatus) {
let { isShowNurse, isStopNurse, initInstrument, checkeModeType,initInstrumentGeartMO2,initInstrumentGeartMO1 } = this.that.state;
this.that.setState({
// isWorkImg: true, //运行中的图片打开
isFooterBtnDisabled: false, //不禁用
isError: false //面膜线连接有误图片
});
this.that.closeTips()
console.log(isStopNurse, '查看初始化', initInstrument);
// 当面膜线连接时候初始化
// isStopNurse=false的时候说明当前属于正在运行中模式
// initInstrument代表第一次进入需要当面膜线已经连接成功时候让他自动切换成工作中
if (isStopNurse && !initInstrument) {
console.log('面膜线连接成功进来次数');
// 仪器挡位,优先获取仪器挡位
let WE200NursingHistoryInstrumentGear = Taro.getStorageSync(
"WE200NursingHistoryInstrumentGear" + checkeModeType
);
// 本地挡位
let WE200NursingHistoryGear = Taro.getStorageSync(
"WE200NursingHistoryGear" + checkeModeType
);
// 当他本地,与仪器录入功能挡位没有的情况下在选择本机仪器挡位
if (!WE200NursingHistoryInstrumentGear || !WE200NursingHistoryGear) {
// 只有私人定制和眼雕大师默认的是仪器挡位
if (checkeModeType === "ShapeBeautyEssence") {
let gearData =await this.that.SetGear(jsonStatus.partitionStatus,1,"gear")
// let gearData = [
// { name: "额头", forehead: jsonStatus.partitionStatus[0].gear, Total: 10 },
// { name: "左脸颊", forehead: jsonStatus.partitionStatus[1].gear, Total: 10 },
// { name: "右脸颊", forehead: jsonStatus.partitionStatus[2].gear, Total: 10 },
// { name: "下颌线", forehead: jsonStatus.partitionStatus[3].gear, Total: 10 },
// ];
this.that.setState({
gearData
});
}
if (checkeModeType === "EyeCarving_Custom") {
let gearData =await this.that.SetGear(jsonStatus.partitionStatus,2,"gear")
// let gearData = [
// { name: "额头", forehead: jsonStatus.partitionStatus[0].gear, Total: 10 },
// { name: "左脸颊", forehead: jsonStatus.partitionStatus[1].gear, Total: 10 },
// { name: "右脸颊", forehead: jsonStatus.partitionStatus[2].gear, Total: 10 },
// ];
this.that.setState({
gearData
});
}
}
// 启动运行中
this.that.onSwitchChange()
// 不再进入
this.that.setState({
initInstrument:true
})
}
}
// 获取仪器上初始化挡位
GetInitializeInstrumentGear(jsonStatus){
// let { initInstrumentGeartMO2,initInstrumentGeartMO1 } = this.that.state;
let initInstrumentGeartMO1 = Taro.getStorageSync("initInstrumentGeartMO1");
let initInstrumentGeartMO2 = Taro.getStorageSync("initInstrumentGeartMO2");
// 获取仪器第一次mo1模式初始挡位获取仪器第一次mo2模式初始挡位
if(!initInstrumentGeartMO1 && jsonStatus?.membraneType === "m01"){
let gear:any =[]
jsonStatus.partitionStatus.forEach(e =>{
gear.push(e.gear)
})
Taro.setStorageSync("initInstrumentGeartMO1", gear)
}else if(!initInstrumentGeartMO2 && jsonStatus?.membraneType === "m02"){
let gear:any =[]
jsonStatus.partitionStatus.forEach(e =>{
gear.push(e.gear)
})
Taro.setStorageSync("initInstrumentGeartMO2", gear)
}
}
DetectingDifferentMembraneCloth(jsonStatus){
console.log(jsonStatus?.membraneType, 'jsonStatus?.membraneType', this.that.state.MembraneType);
// 判断当前面膜线是否是当前选择的膜布
// MembraneType=1代表mo1
if (jsonStatus?.membraneType === "m01" && this.that.state.MembraneType !== 1) {
this.openErrorTipsMembrane(jsonStatus?.membraneType, 1)
} else if (jsonStatus?.membraneType === "m02" && this.that.state.MembraneType !== 2) {
this.openErrorTipsMembrane(jsonStatus?.membraneType, 2)
}
}
// 工作状态改变的相应
/** @name 设备响应:待机 */
private syncStandby(jsonStatus) {
@ -624,7 +720,7 @@ export default class BluetoothContainer {
characteristicsuuid1: this.bluetoothInfo.characteristicsuuid1,
characteristicsuuid0: this.bluetoothInfo.characteristicsuuid0,
}).then((res) => {
Taro.onBLECharacteristicValueChange((value) => {
Taro.onBLECharacteristicValueChange(async(value) => {
console.log("Taro.onBLECharacteristicValueChange value", value)
const jsonStatus: any = this.deviceToolKitInstance.toJsonStatus(value.value);
console.log("onBLECharacteristicValueChange 订阅改变:", jsonStatus);
@ -685,67 +781,13 @@ export default class BluetoothContainer {
}
// 判断他面膜线是否连接好
if (jsonStatus.isCloseToSkin) {
let { isShowNurse, isStopNurse, initInstrument, checkeModeType } = this.that.state;
let { isShowNurse } = this.that.state;
await this.GetInitializeInstrumentGear(jsonStatus)
//面膜戴好并贴脸了
// 护理页面时候才需要调用 isShowNurse代表是护理页
if (isShowNurse) {
this.that.setState({
// isWorkImg: true, //运行中的图片打开
isFooterBtnDisabled: false, //不禁用
isError: false //面膜线连接有误图片
});
this.that.closeTips()
console.log(isStopNurse, '查看初始化', initInstrument);
// 当面膜线连接时候初始化
// isStopNurse=false的时候说明当前属于正在运行中模式
// initInstrument代表第一次进入需要当面膜线已经连接成功时候让他自动切换成工作中
if (isStopNurse && !initInstrument) {
console.log('面膜线连接成功进来次数');
// 仪器挡位,优先获取仪器挡位
let WE200NursingHistoryInstrumentGear = Taro.getStorageSync(
"WE200NursingHistoryInstrumentGear" + checkeModeType
);
// 本地挡位
let WE200NursingHistoryGear = Taro.getStorageSync(
"WE200NursingHistoryGear" + checkeModeType
);
// 当他本地,与仪器录入功能挡位没有的情况下在选择本机仪器挡位
if (!WE200NursingHistoryInstrumentGear || !WE200NursingHistoryGear) {
// 只有私人定制和眼雕大师默认的是仪器挡位
if (checkeModeType === "ShapeBeautyEssence") {
let gearData = [
{ name: "额头", forehead: jsonStatus.partitionStatus[0].gear, Total: 10 },
{ name: "左脸颊", forehead: jsonStatus.partitionStatus[1].gear, Total: 10 },
{ name: "右脸颊", forehead: jsonStatus.partitionStatus[2].gear, Total: 10 },
{ name: "下颚线", forehead: jsonStatus.partitionStatus[3].gear, Total: 10 },
];
this.that.setState({
gearData
});
}
if (checkeModeType === "EyeCarving_Custom") {
let gearData = [
{ name: "额头", forehead: jsonStatus.partitionStatus[0].gear, Total: 10 },
{ name: "左脸颊", forehead: jsonStatus.partitionStatus[1].gear, Total: 10 },
{ name: "右脸颊", forehead: jsonStatus.partitionStatus[2].gear, Total: 10 },
];
// jsonStatus.partitionStatus.length === 4 && gearData.push(
// { name: "下颚线", forehead: jsonStatus.partitionStatus[3].gear, Total: 10 }
// )
this.that.setState({
gearData
});
}
}
// 启动运行中
this.that.onSwitchChange()
// 不再进入
}
await this.NursingPage(jsonStatus)
}
} else {
//面膜没戴好或没贴脸 isShowNurse代表是护理页
let { isShowNurse, isStopNurse } = this.that.state
@ -766,16 +808,9 @@ export default class BluetoothContainer {
}
}
}
console.log(jsonStatus?.membraneType, 'jsonStatus?.membraneType', this.that.state.MembraneType);
// 判断当前面膜线是否是当前选择的膜布
// MembraneType=1代表mo1
if (jsonStatus?.membraneType === "m01" && this.that.state.MembraneType !== 1) {
this.openErrorTipsMembrane(jsonStatus?.membraneType, 1)
} else if (jsonStatus?.membraneType === "m02" && this.that.state.MembraneType !== 2) {
this.openErrorTipsMembrane(jsonStatus?.membraneType, 2)
}
// 检测不同膜布
this.DetectingDifferentMembraneCloth(jsonStatus)
if (jsonStatus.battery) {
// 防止抖动

@ -1,23 +1,25 @@
import Taro from "@tarojs/taro";
import { throttle } from "lodash";
import {
notifyBLECharacteristicValueChange,
sendCommand,
} from "@/utils/bluetoothWXAPI";
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
const MODE_WORKING_ENUM = {
STANDBY: "standby", // 待命
WORKING: "working", // 工作
PAUSE: "pause",
END: "end",
};
import dayjs from "dayjs";
import { debounce } from "lodash";
import {
deviceCommandSamples,
bleCommandSamples,
} from "@/components/bluetoot/connection/wl200";
notifyBLECharacteristicValueChange,
sendCommand,
} from "@/utils/bluetoothWXAPI";
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
const MODE_WORKING_ENUM = {
STANDBY: "standby", // 待命
WORKING: "working", // 工作
PAUSE: "pause",
END: "end",
};
import dayjs from "dayjs";
import { debounce } from "lodash";
import {
deviceCommandSamples,
bleCommandSamples,
} from "@/components/bluetoot/connection/wl200";
import { getStorageSync } from "@/utils/traoAPI";
/**
* @name
* @description
@ -34,8 +36,7 @@ export default class BluetoothContainer {
this.that = that;
}
notifyBLECharacteristicValueChange(){
notifyBLECharacteristicValueChange() {
notifyBLECharacteristicValueChange({
deviceId: this.bluetoothInfo.deviceId,
servicesuuid: this.bluetoothInfo.servicesuuid,
@ -46,10 +47,7 @@ export default class BluetoothContainer {
const jsonStatus: any = this.deviceToolKitInstance.toJsonStatus(
value.value
);
console.log(
"onBLECharacteristicValueChange jsonStatus => ",
jsonStatus
);
console.log("蓝牙监听到变化 =>", jsonStatus);
if (!jsonStatus || jsonStatus == null) {
return;
}
@ -76,74 +74,122 @@ export default class BluetoothContainer {
break;
//设备主动上报给小程序的指令 一般是工作状态改变
case "DeviceStatusSync":
console.log(
"设备主动上报给小程序的指令 一般是工作状态改变",
jsonStatus
);
console.log("设备主动上报给小程序的指令", jsonStatus);
const { ActiveModeItem, isConnectShow, isConnectionBlutoot, facialMaskConnectStatus } = this.that.state;
this.that.workJsonStatus = jsonStatus;
this.that.workStatus = jsonStatus.workStatus;
setTimeout(() => console.log("this.workStatus", this.that.workStatus));
this.that.setState({
Electricity: jsonStatus.battery,
// fr200Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery,
});
console.log("this.workStatus", this.that.workStatus);
if (jsonStatus.battery) {
this.that.setState({
Electricity: jsonStatus.battery,
matrixElectricity: jsonStatus.matrixBattery,
});
}
// 判断设备主动上报的关机事件
// // 判断设备主动上报的关机事件:如果关机则提前终止判断
// if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
// // 判断id是否一致, 一致的话则生成护理报表, 并提示
// if (jsonStatus.id == this.that.WL200NursingHistory?.id) {
// // 只有倒计时还在继续,才强制结束
// setTimeout(() => {
// if (
// this.that.currentTimeTimer &&
// this.that.state.facialMaskConnectStatus == 1
// ) {
// console.log("设备返回end强制结束");
// clearInterval(this.that.currentTimeTimer);
// this.that.setState({
// ModeStepIndex: 0,
// facialMaskConnectStatus: 0, // 倒计时结束会关机,逻辑预先关机
// });
// this.that.endNurseFun(); // 自动结束护理,并自动跳转报告页
// }
// }, 1000);
// }
// return;
// }
// 如果运行过程中主动关机,则识别为蓝牙断开
if (jsonStatus.workStatus === MODE_WORKING_ENUM.END) {
// 判断id是否一致, 一致的话则生成护理报表, 并提示
if (jsonStatus.id == this.that.WL200NursingHistory?.id) {
// 只有倒计时还在继续,才强制结束
setTimeout(() => {
if (
this.that.currentTimeTimer &&
this.that.state.facialMaskConnectStatus == 1
) {
console.log("设备返回end强制结束");
clearInterval(this.that.currentTimeTimer);
this.that.setState({
ModeStepIndex: 0,
facialMaskConnectStatus: 0, // 倒计时结束会关机,逻辑预先关机
});
this.that.endNurseFun(); // 自动结束护理,并自动跳转报告页
}
}, 1000);
if (
facialMaskConnectStatus === 1
) {
if (this.that.currentTimeTimer) {
clearInterval(this.that.currentTimeTimer);
this.that.currentTimeTimer = true;
}
// Taro.offBLECharacteristicValueChange((res) => {
// console.log("offBLECharacteristicValueChange", res);
// });
this.that.setState({
facialMaskConnectStatus: 0, // 蓝牙已断开
isConnectShow: true
});
}
return;
}
if (
jsonStatus?.workMode === this.that.state.ActiveModeItem.modeType ||
jsonStatus.workStatus !== "end"
) {
this.that.setState({
workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
});
// 蓝牙断线重连-设备重启:特殊重连逻辑
// 当断开弹窗打开,并且重连成功,不进行设备上报回调
if (isConnectShow) {
console.log("蓝牙断线重连-设备重启jsonStatus", jsonStatus)
if (ActiveModeItem) {
if (jsonStatus?.workMode) {
// 仅重连,控制设备开始倒计时
this.that.judgementWorkStatus(
MODE_WORKING_ENUM.WORKING,
ActiveModeItem?.modeType
);
} else {
// 蓝牙断线重连-设备重启:回到准备页面,选中对应模式
this.that.setState({
isShowNurse: false,
isStopNurse: true
})
setTimeout(() => {
this.that.modeCurrentFun(ActiveModeItem);
}, 500)
}
}
}
// 判断是否在step == 2(护理中)
// 仅当设备模式与小程序是否一致,才允许更改设备运行时间
// 判断当前模式是否存在,防止附属设备断开或突然连上
if (jsonStatus?.workMode) {
// 判断是否当前模式,否则不进行设备上报回调
if (
this.that.state.facialMaskConnectStatus === 1 &&
this.that.state.step == 2 &&
jsonStatus.workStatus !== MODE_WORKING_ENUM.END
jsonStatus?.workMode !== ActiveModeItem.modeType ||
jsonStatus.workStatus !== "end"
) {
this.that.updateDeviceSyncData(
{
totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
},
jsonStatus
);
this.that.setState({
workMode: jsonStatus?.workMode, // 仅当设备上报模式与小程序一致时,才允许改变小程序变量缓存
});
// 判断是否在step == 2(护理中)
// 仅当设备模式与小程序是否一致,才允许更改设备运行时间
if (
this.that.state.facialMaskConnectStatus === 1 &&
this.that.state.step == 2 &&
jsonStatus.workStatus !== MODE_WORKING_ENUM.END
) {
this.that.updateDeviceSyncData(
{
totalWorkingMinutes: jsonStatus.totalWorkingMinutes,
totalWorkingSeconds: jsonStatus.totalWorkingSeconds,
},
jsonStatus
);
}
}
}
// 判断是否在step == 2(护理中)
// 仅当设备模式与小程序是否一致,如果不一致则提前关闭倒计时
if (
jsonStatus.workMode === MODE_WORKING_ENUM.WORKING &&
this.that.state.step == 2
) {
const { ActiveModeItem } = this.that.state;
const item = ActiveModeItem;
if (jsonStatus.workMode !== item.modeType) {
if (this.that.loadingTipsTimer) clearTimeout(this.that.loadingTipsTimer);
@ -153,6 +199,19 @@ export default class BluetoothContainer {
});
}
}
// 判断是否设备强制更换模式
if (jsonStatus?.workMode && ActiveModeItem.modeType !== jsonStatus?.workMode && jsonStatus?.workStatus === 'setting') {
if (this.that.state.ModeList.length) {
let modeItem = this.that.state.ModeList.find(item => item.modeType === jsonStatus.workMode);
if (modeItem) {
// 强制更换模式
setTimeout(() => {
this.that.modeCurrentFunForce(modeItem);
}, 50)
}
}
}
break;
//设备信息查询返回
case "InfoQuery":
@ -196,10 +255,10 @@ export default class BluetoothContainer {
console.log("当前面罩报告 currentMaskReportInfo", jsonStatus);
if (!this.that.hadCheckReport) {
this.that.hadCheckReport = true;
this.checkInstrumentRecord(jsonStatus);
this.that.hadCheckReport = true;
this.checkInstrumentRecord(jsonStatus);
} else {
this.that.setWL200NursingHistory(jsonStatus);
this.that.setWL200NursingHistory(jsonStatus);
}
break;
@ -242,7 +301,7 @@ export default class BluetoothContainer {
}, 500);
});
};
/** 蓝牙相关 */
switchBLEMatch = (jsonStatus: any) => {
console.log("蓝牙相关", jsonStatus);
@ -254,6 +313,7 @@ export default class BluetoothContainer {
console.log("设备配对成功");
this.that.setState({
facialMaskConnectStatus: 1,
isConnectionBlutoot: true
});
}
break;
@ -265,7 +325,7 @@ export default class BluetoothContainer {
case "WL200":
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
} else {
this.that.setState({
this.that.setState({
facialMaskConnectStatus: 0, // 蓝牙断开
isFooterBtnDisabled: true, // 蓝牙断开所以不可点击
});
@ -281,9 +341,10 @@ export default class BluetoothContainer {
// 附属设备是否连接支架
case "Stand":
if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
console.log("舱体支架连接");
if (!this.that.state.isStandStatus && this.that.state.step === 2) {
// 断开连接直接暂停
console.log("舱体支架连接", ActiveModeItem, this.that.state.step);
if (this.that.state.step === 2) {
clearInterval(this.that.currentTimeTimer);
// 断开和连接都直接暂停
this.that.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
ActiveModeItem?.modeType
@ -294,20 +355,22 @@ export default class BluetoothContainer {
this.that.setState({
isStandStatus: true,
isStopNurse: true,
});
if (ActiveModeItem.isCabinMode === 0) {
if (ActiveModeItem.isCabinMode === 0) { // 如果当前模式不是舱体模式,则记录暂停时间
this.that.showTips(`检测到面罩仍和舱体连接中,请分离后切换`);
// 设备断开时,给定一个断开时间
ActiveModeItem.breakTimeStr = this.that.state.currentTime;
ActiveModeItem["breakTimeStr"] = this.that.state.currentTime;
this.that.setState({
isStopNurse: true,
ActiveModeItem,
});
}
} else {
console.log("舱体支架断开连接");
if (this.that.state.isStandStatus && this.that.state.step === 2) {
// 1.断开连接直接暂停
// this.that.onEmitErrorTips();
console.log("舱体支架断开连接", ActiveModeItem, this.that.state.step);
if (this.that.state.step === 2) {
// 断开和连接都暂停
clearInterval(this.that.currentTimeTimer);
this.that.judgementWorkStatus(
MODE_WORKING_ENUM.PAUSE,
ActiveModeItem?.modeType
@ -322,25 +385,40 @@ export default class BluetoothContainer {
isStopNurse: true,
ActiveModeItem,
});
// 断开舱体:如果当前模式不是舱体模式,则同步已运行时间
if (ActiveModeItem.isCabinMode === 1) {
// 断开舱体:如果当前模式是舱体模式,则记录断开时间
this.that.showTips(`检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源`);
ActiveModeItem["breakTimeStr"] = this.that.state.currentTime;
this.that.setState({
ActiveModeItem,
});
}
setTimeout(() => {
this.that.onEmitErrorTips();
}, 500);
}
setTimeout(() => {
this.that.footerIsDisabled();
}, 100);
break;
default:
console.log("监听到到设备连接状态改变 this.footerIsDisabled()");
setTimeout(() => {
this.that.onEmitErrorTips();
}, 500);
this.that.footerIsDisabled(); // 判断底部运行按钮是否可点击
break;
}
break;
// 小程序主动问主机,现在链接了哪些附属设备,这时候主机给小程序的回复消息
// 首次连接成功时,也会进入,需要判断是否一开始就连接舱体
// 不能注释掉查询附属设备
case "QueryMatchStatus":
console.log("QueryMatchStatus 设备回复小程序", jsonStatus);
const isStandDevice = jsonStatus?.subDeviceList?.includes("Stand");
if (isStandDevice) {
this.that.setState({
this.that.setState({
isStandStatus: true,
});
setTimeout(() => {
@ -366,15 +444,15 @@ export default class BluetoothContainer {
}
}
};
/** @name 检测并控制工作状态 */
/** @name 检测并控制工作状态 */
handleWorkStatus = (isBtnClick: boolean, workStatus) => {
const { facialMaskConnectStatus, isStandStatus, ActiveModeItem } =
this.that.state;
let newWorkStatus =
workStatus ||
(this.that.workStatus == MODE_WORKING_ENUM.WORKING ? "pause" : "working");
console.log(isBtnClick,'isBtnClick',newWorkStatus);
console.log(isBtnClick, 'isBtnClick', newWorkStatus);
if (isBtnClick && newWorkStatus == "working") {
// 舱体模式
if (ActiveModeItem.isCabinMode === 1 && !isStandStatus) {
@ -421,39 +499,38 @@ export default class BluetoothContainer {
});
};
/**
* @title
* @description
* 1.
*
* 2.
*
* 3.
*
* 4.-//
* 4-1.ID
* 4-2.ID
*
* 5.-
*
*
* */
/**
* @title
* @description
* 1.
*
* 2.
*
* 3.
*
* 4.-//
* 4-1.ID
* 4-2.ID
*
* 5.-
*
*
* */
checkInstrumentRecord = async (jsonStatus: any) => {
console.log("检查护理记录");
console.log("检查护理记录", jsonStatus);
if (!jsonStatus.id) return;
let { currentDevice, ModeList } = this.that.state;
await sleep(1);
// 1.判断是否同步护理记录
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) {
this.that.setState({ isShowHistoryMsg: false });
Taro.removeStorageSync("isSyncHistory");
} else {
Taro.removeStorageSync("WL200NursingHistory");
return;
}
// 1.判断是否同步护理记录
let isSyncHistory = Taro.getStorageSync("isSyncHistory");
if (isSyncHistory) {
this.that.setState({ isShowHistoryMsg: false });
Taro.removeStorageSync("isSyncHistory");
} else {
// Taro.removeStorageSync("WL200NursingHistory");
}
// 判断工作模式:如果是舱体模式,则判断舱体状态
if (this.that.workJsonStatus.workMode) {
@ -503,7 +580,7 @@ if (isSyncHistory) {
minSecToS(recordModeItem.modeTimeStr) -
minSecToS(WL200NursingHistory.currentTime);
this.that.elapsedTime =
this.that.elapsedTime =
this.that.elapsedTime > historyElapsedTime
? this.that.elapsedTime
: historyElapsedTime;
@ -525,6 +602,7 @@ if (isSyncHistory) {
// 护理时间不足
this.that.setState({ isNotEnoughTime: true });
this.that.rmWL200NursingHistory();
this.that.bluetoothContainer.handleWorkStatus(false, "end");
return;
}
@ -543,7 +621,7 @@ if (isSyncHistory) {
};
let res: any = await this.that.PostNursingLogClock(params);
console.log("res", res);
} else {
// ID不一致同步异常统一提交一分钟
let params = {
@ -555,7 +633,7 @@ if (isSyncHistory) {
};
let res: any = await this.that.PostNursingLogClock(params);
console.log("res", res);
}
} else {
// 5.判断设备状态-运行中
@ -579,8 +657,8 @@ if (isSyncHistory) {
nursingTime: WL200NursingHistory.ActiveModeItem.modeTime,
};
let res: any = await this.that.PostNursingLogClock(params);
console.log("res", res);
console.log("运行时间>=模式时间,强制提交报告", res);
return;
}
// 未结束,赋值已运行时间,继续运行
@ -614,9 +692,6 @@ if (isSyncHistory) {
this.that.footerIsDisabled();
}, 300);
setTimeout(() => {
console.log("isStopNurse", this.that.state.isStopNurse);
}, 1000);
} else {
console.log("id不一致, 设备运行中或暂停");
let params = {
@ -628,20 +703,19 @@ if (isSyncHistory) {
};
let res: any = await this.that.PostNursingLogClock(params);
console.log("res", res);
console.log("id不一致 强制提交报告", res);
this.that.rmWL200NursingHistory();
}
}
};
// 发送心跳包
sendsideRemind = (
// 发送心跳包
sendsideRemind = (
workMode,
totalWorkingMinutes,
totalWorkingSeconds,
isForce = false
isForce = false,
workStatus = ''
) => {
console.log("sendsideRemind");
// 如果挡位或模式切换中,则过两秒再进行心跳
if (!isForce) {
// 是否换挡中
@ -664,8 +738,9 @@ if (isSyncHistory) {
totalWorkingMinutes: totalWorkingMinutes,
totalWorkingSeconds: totalWorkingSeconds,
workMode: workMode,
workStatus: this.that.workStatus,
workStatus: workStatus || this.that.workStatus,
};
console.log("设备与小程序sendParams", sendParams)
let pauseArrayBuffer = this.deviceToolKitInstance.toBleCommand(
sendParams as any
);
@ -676,5 +751,4 @@ if (isSyncHistory) {
this.that.hearting = false;
});
};
}

@ -17,7 +17,7 @@ function Index({ Electricity, DeviceConnectStatus, InstrumentType }: Props) {
<Block>
<View className="item" style={InstrumentType ==='WE200' ? {padding:"0 21px" } : {}}>
<View className="label" style={InstrumentType ==='WE200' ? { width: 'unset' } : {}}></View>
<View className="label" style={InstrumentType ==='WE200' ? { width: '100rpx' } : {}}></View>
<View className="value flex aitems">
{Electricity >= 4 && (
<Block>

@ -9,17 +9,38 @@
width:100%;font-weight:bold;min-height:109px;margin-top:8px;margin-bottom:19rpx;
}
.container{
margin-top: 50rpx;
word-break: break-all;
// min-height: 240rpx;
height: 180rpx;
overflow-y:auto
// overflow: auto;
overflow-y: auto;
/* font-size: 26rpx; */
font-weight: 400;
}
.Checkbox {
margin-top: 47rpx;
display: flex;
align-items: center;
justify-content: center;
}
.buttonName{
margin-top: 25rpx;
margin-bottom: 14rpx;
background-color: #010101;
margin: auto;
border-radius: 53rpx;
color: #ffff;
overflow: hidden;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
padding: 32rpx 47rpx;
}
.center {
width: 100%;
height: 700rpx;
// background-color: red;
border-radius: 15rpx;
height:600rpx;margin:auto;/* background:red; */overflow:hidden;border:16px;
}
.title {
font-weight: bold;

@ -11,7 +11,7 @@ import {
ScrollView,
} from "@tarojs/components";
import { Popup, Checkbox, CheckboxGroup, Steps, Slider } from "@antmjs/vantui";
import { Popup, Checkbox, CheckboxGroup,Radio, Steps, Slider } from "@antmjs/vantui";
import "@/components/popup/popup.less";
import "@/components/popup/popup-alert.less";
@ -85,7 +85,7 @@ class FacialCalibration extends Component<any, any> {
}
</View>
<View className="center"
style="height:600rpx;width:90%;margin:auto;/* background:red; */overflow:hidden;border:16px;"
// style=""
>
{" "}
<Image
@ -109,35 +109,38 @@ class FacialCalibration extends Component<any, any> {
?.counterpointCalibrationData?.promptContent
} */}
</View>
<View className="popbtnbox aitems jcenter">
<View >
<View
className="text1"
style="text-align:center;margin-top:25px;margin-bottom:14px;width:260rpx;background-color:#010101;margin:auto;height:100rpx;line-height:100rpx;border-radius: 37px;color:#ffff;"
className="buttonName"
onClick={() => {
FacialCalibrationConfirm();
}}
>
{
<View>
{
counterpointCalibrationData
?.counterpointCalibrationData?.buttonName
}
</View>
</View>
<View
className="text2 "
style="text-align:center;font-size:13px;color:#dadada;margin-top: 26px;display:flex;padding:0 71px;"
onClick={() => {
FacialCalibrationSelect();
}}
className="Checkbox "
>
<View className="Radio">
{PrepareSelect && (
<View className="select-point"></View>
)}
</View>
<CheckboxGroup
value={PrepareSelect}
onChange={(e) => {
FacialCalibrationSelect(e);
}}
>
<Checkbox name="勾选" iconSize="15px" checkedColor="#010101"> <View className="titleName"></View> </Checkbox>
</CheckboxGroup>
</View>
</View>
</View>

@ -10,6 +10,7 @@ interface Props {
ModeList: any;
ModeType: string; // all visor cabin yimeish
isShowNurse: boolean; // 是否已进入护理详情页
isShowClassTitle: boolean; // 是否显示分类标题
isPop: boolean; // 是否弹窗
onEmit: Function; // 每次点击item回调事件和数据给父组件
onEmitShowAll: Function; // 打开弹窗按钮
@ -17,6 +18,7 @@ interface Props {
}
function Index({
isShowNurse,
isShowClassTitle,
isPop,
ModeList,
ModeType,
@ -66,7 +68,9 @@ function Index({
scrollIntoView={ModeID} // itemID自动滚动到该元素位置
>
<View className="mode-list">
<View className="mode-item-title"></View>
{isShowClassTitle && (
<View className="mode-item-title"></View>
)}
{VisorList.map((item: any, index: any) => {
return (
<View
@ -141,7 +145,9 @@ function Index({
scrollIntoView={ModeID}
>
<View className="mode-list">
<View className="mode-item-title"></View>
{isShowClassTitle && (
<View className="mode-item-title"></View>
)}
{CabinList.map((item: any, index: any) => {
return (
<View
@ -202,6 +208,9 @@ function Index({
</View>
);
})}
{!isPop && (
<View style="width:120rpx;min-width:120rpx;height:40rpx;display:flex"></View>
)}
</View>
</ScrollView>
)}
@ -214,7 +223,9 @@ function Index({
scrollIntoView={ModeID}
>
<View className="mode-list">
<View className="mode-item-title"></View>
{isShowClassTitle && (
<View className="mode-item-title"></View>
)}
{YimeishList.map((item: any, index: any) => {
return (
<View
@ -275,6 +286,9 @@ function Index({
</View>
);
})}
{!isPop && (
<View style="width:120rpx;min-width:120rpx;height:40rpx;display:flex"></View>
)}
</View>
</ScrollView>
)}

@ -239,8 +239,8 @@ export default class Activity extends Component<any, any> {
joinPlan ? "care_attend disable" : "care_attend "
}
>
{item.joinStatus === -1 && <Text></Text>}
{item.joinStatus === 0 && <Text></Text>}
{item.joinStatus === -1 && <Text></Text>}
{item.joinStatus === 0 && <Text></Text>}
{item.joinStatus === 1 && <Text></Text>}
{item.joinStatus === 2 && <Text></Text>}
{item.joinStatus === 3 && <Text></Text>}

@ -1,7 +1,7 @@
import classnames from "classnames";
import dayjs from "dayjs";
import Taro from "@tarojs/taro";
import { Component } from "react";
import React, { Component, LegacyRef } from "react";
import {
Block,
View,
@ -59,7 +59,7 @@ import {
// 我的护理模块
import Nursing from "@/components/nursing/nursing";
import { getIndexCarePlanListApi } from "@/utils/carePlanApi";
import { getIndexCarePlanListApi, listCalendarApi } from "@/utils/carePlanApi";
// css引入
import "taro-ui/rn/style/components/calendar.scss";
@ -75,8 +75,17 @@ import {
// const log = require("@/utils/log");
let MembraneClothOne = [
"DiyFacial",
"DiyWater",
"WaterLightEssence",
"ShapeBeautyEssence",
];
let MembraneClothTwo = ["PreMakeup_Custom", "EyeCarving_Custom"];
class Index extends Component<any, any> {
onModeLockClose: any;
nursing: LegacyRef<Nursing> | undefined;
constructor(props) {
super(props);
this.state = {
@ -85,72 +94,7 @@ class Index extends Component<any, any> {
isCommonError: false, // 是否显示通用错误提示
commonErrorText: [], // 通用错误提示
WeCurrent: [
{
Checkbox: [],
SliderVlue: 1,
text1: " 强效提拉额肌,淡化抬头纹",
text2: "密集水光灌注,胶原直达肌底",
titleSlogan: "请选择额头区域的护理目标(可多选)",
},
{
Checkbox: [],
SliderVlue: 1,
text1: " 强效提拉额肌,淡化抬头纹",
text2: "密集水光灌注,胶原直达肌底",
titleSlogan: "请选择脸颊区域的护理目标(可多选)",
},
{
Checkbox: [],
SliderVlue: 1,
text1: " 强效提拉轮廓,淡化木偶纹",
text2: "密集水光灌注,胶原直达肌底",
titleSlogan: "请选择下颌线区域的护理目标(可多选)",
},
{
Checkbox: [],
SliderVlue: 1,
titleSlogan: "请选择额头区域的护理目标(可多选)",
},
{
Checkbox: [],
SliderVlue: 1,
titleSlogan: "请选择额头区域的护理目标(可多选)",
},
{
Checkbox: [],
SliderVlue: 1,
titleSlogan: "请选择额头区域的护理目标(可多选)",
},
],
WeEyeCarving: [
{
Checkbox: [],
titleSlogan: "请选择额头区域的护理目标(可多选)",
ChekboxList: [
"鱼尾纹",
"眼周松弛",
"眼下纹",
"浮肿",
"黑眼圈",
"眼周疲惫",
"上眼皮下垂",
"眼袋",
"眼角下垂",
"泪沟",
"眼廓下榻",
"鱼尾纹",
],
},
{
Checkbox: [],
titleSlogan: "请选择您当前眼周的衰老状态",
SliderVlue: 1,
},
],
WeEyeCurrentPage: 1,
WeCurrentPage: 1,
NursingPlan: "",
isModeLockWE: false,
showEquipment: false, // 扫码绑定设备弹窗
@ -178,13 +122,15 @@ class Index extends Component<any, any> {
weekinfo: undefined,
// 日历
currentDate: dayjs().format("YYYY-MM-DD"),
// 日历-护理计划:已完成日期
calendarComplete: [
dayjs().subtract(1, "day").format("YYYY-MM-DD"),
dayjs().subtract(3, "day").format("YYYY-MM-DD"),
// dayjs().subtract(1, "day").format("YYYY-MM-DD"),
// dayjs().subtract(3, "day").format("YYYY-MM-DD"),
],
// 日历-护理计划:未完成日期
calendarInComplete: [
dayjs().add(1, "day").format("YYYY-MM-DD"),
dayjs().add(8, "day").format("YYYY-MM-DD"),
// dayjs().add(1, "day").format("YYYY-MM-DD"),
// dayjs().add(8, "day").format("YYYY-MM-DD"),
],
// 横幅轮播
bannerList: [],
@ -245,10 +191,10 @@ class Index extends Component<any, any> {
/** 护理计划 */
joinPlan: null, // 参与的计划
isjoinPlanShow: null,
carePlanList: [], // 护理计划列表
/** 护理计划 END */
};
this.nursing = React.createRef(); // 我的护理子组件
}
async onLoad(options) {
@ -462,7 +408,7 @@ class Index extends Component<any, any> {
await this.bindingInstrumentList(); // 获取已绑定设备
await this.unbindingInstrumentInfoList(); // 获取未绑定设备
await this.getInstrumentInfoBySerial(); // 扫码序列号查询:注册后才调用,因为扫码未注册直接跳转注册页
await this.getCarePlanInfo(); // 获取护理计划
await Promise.all([this.getCarePlanInfo(), this.getListCalendar()]); // 获取护理计划与日历数据
console.log("this.props.isShowIndexFlag", this.props.isShowIndexFlag);
if (!this.props.isShowIndexFlag) {
@ -488,11 +434,6 @@ class Index extends Component<any, any> {
this.props.setIndexFlag(false);
});
}
// 详情页点击前往护理 在主页执行
const item = Taro.getStorageSync("prepareData");
Taro.setStorageSync("prepareData", "");
if (item) this.goNursing(item);
}
};
@ -650,38 +591,6 @@ class Index extends Component<any, any> {
bannerSwiperchange() {}
// 模拟弹窗
handlepopup = () => {};
// 复选框
handlepopupCheck = (e, type) => {
if (type === "PrivateMode") {
let WeCurrent = this.state.WeCurrent;
let WeCurrentPage = this.state.WeCurrentPage;
WeCurrent[WeCurrentPage - 1].Checkbox = [...e.detail];
this.setState({ WeCurrent });
} else {
let WeEyeCarving = this.state.WeEyeCarving;
let WeEyeCurrentPage = this.state.WeEyeCurrentPage;
WeEyeCarving[WeEyeCurrentPage - 1].Checkbox = [...e.detail];
this.setState({ WeEyeCarving });
}
};
// 进度条
handleSteps = (e) => {
let WeCurrent = this.state.WeCurrent;
let WeCurrentPage = this.state.WeCurrentPage;
WeCurrent[WeCurrentPage - 1].activeinde = e.detail;
// console.log(e,'查看选择');
this.setState({ WeCurrent });
};
// 上一步
PreviousStep = () => {
let WeCurrentPage = this.state.WeCurrentPage;
if (WeCurrentPage !== 1) {
WeCurrentPage = WeCurrentPage - 1;
this.setState({
WeCurrentPage,
});
}
};
// textOnclk = () => {
// let { isNursingPlanReport } = this.state;
@ -781,6 +690,9 @@ class Index extends Component<any, any> {
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);
// 如果是扫码进入,直接跳转到注册登录页.
@ -808,6 +720,9 @@ class Index extends Component<any, any> {
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("请求失败,尝试重新请求");
@ -1033,7 +948,8 @@ class Index extends Component<any, any> {
};
// 跳转仪器介绍页
goNursing = async (item) => {
// NursingPlan='护理计划'代表用来跳转到指定模式
goNursing = async (item, NursingPlan = "") => {
console.log("connectInstrument", item);
// 仅开发者工具调试使用
@ -1043,6 +959,7 @@ class Index extends Component<any, any> {
this.setState(
{
connectInstrument: item,
NursingPlan: NursingPlan,
},
async () => {
if (item.model === "WE200") {
@ -1067,7 +984,7 @@ class Index extends Component<any, any> {
// 移动端真正逻辑
if (item.status === 0) {
setStorageSync("instrument_detail", item);
this.setState({ connectInstrument: item });
this.setState({ connectInstrument: item, NursingPlan: NursingPlan });
setTimeout(() => this.bindBlockLeft());
} else {
this.openCommonError([
@ -1126,6 +1043,7 @@ class Index extends Component<any, any> {
*/
pairingChange = (e) => {
if (!this.state.isConnectShow) return;
let { connectInstrument, NursingPlan } = this.state;
let currentModel = this.state.connectInstrument.model;
console.log("===epairingChange===》", e, currentModel);
@ -1138,12 +1056,31 @@ class Index extends Component<any, any> {
}
setTimeout(() => {
if (currentModel === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else if (currentModel === "FE200") {
go("/moduleIOT/pages/iotCarePlan/FE200"); // 画页面直接跳转
if (NursingPlan === "护理计划") {
if (currentModel === "FR200") {
go(
"/moduleIOT/pages/iotCarePlan/FR200?modeId=" +
connectInstrument.modeId
); // 画页面直接跳转
} else if (currentModel === "FE200") {
go(
"/moduleIOT/pages/iotCarePlan/FE200?modeId=" +
connectInstrument.modeId
); // 画页面直接跳转
} else {
go(
"/moduleIOT/pages/iotCarePlan/WL200?modeId=" +
connectInstrument.modeId
); // 画页面直接跳转
}
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
if (currentModel === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else if (currentModel === "FE200") {
go("/moduleIOT/pages/iotCarePlan/FE200"); // 画页面直接跳转
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
}
}
}, 100);
// WE200不自动关闭其余仪器跳转后自动关闭连接弹窗
@ -1152,18 +1089,41 @@ class Index extends Component<any, any> {
// 开发者工具跳转函数
async goIot() {
if (this.state.connectInstrument.name.indexOf("WE200") > -1) {
go("/moduleIOT/pages/iotCarePlan/WE200");
return;
}
if (this.state.connectInstrument.model === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else if (this.state.connectInstrument.model === "FE200") {
go("/moduleIOT/pages/iotCarePlan/FE200"); // 画页面直接跳转
let { connectInstrument, NursingPlan } = this.state;
if (NursingPlan === "护理计划") {
if (this.state.connectInstrument.name.indexOf("WE200") > -1) {
go("/moduleIOT/pages/iotCarePlan/WE200");
return;
}
if (this.state.connectInstrument.model === "FR200") {
go(
"/moduleIOT/pages/iotCarePlan/FR200?modeId=" +
connectInstrument.modeId
); // 画页面直接跳转
} else if (this.state.connectInstrument.model === "FE200") {
go(
"/moduleIOT/pages/iotCarePlan/FE200?modeId=" +
connectInstrument.modeId
); // 画页面直接跳转
} else {
go(
"/moduleIOT/pages/iotCarePlan/WL200?modeId=" +
connectInstrument.modeId
); // 画页面直接跳转
}
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
if (this.state.connectInstrument.name.indexOf("WE200") > -1) {
go("/moduleIOT/pages/iotCarePlan/WE200");
return;
}
if (this.state.connectInstrument.model === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else if (this.state.connectInstrument.model === "FE200") {
go("/moduleIOT/pages/iotCarePlan/FE200"); // 画页面直接跳转
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
}
}
// return;
}
goTest() {
@ -1239,6 +1199,8 @@ class Index extends Component<any, any> {
isShowVersionUpgradFinish: true, // 升级介绍
versionUpgradFinishNodes: nodes,
});
Taro.removeStorageSync("WE200SelectMode1"); //完成升级后删除之前的记忆模式
Taro.removeStorageSync("WE200SelectMode2");
};
// 升级失败
we200UpgradeErrorFun = () => {
@ -1421,7 +1383,7 @@ class Index extends Component<any, any> {
});
};
openMembraneList = async () => {
let { connectInstrument, MembraneClothList } = this.state;
let { connectInstrument, MembraneClothList, NursingPlan } = this.state;
// Taro.showLoading({
// title: "请求中...",
// mask: true,
@ -1429,12 +1391,13 @@ class Index extends Component<any, any> {
// this.GetMembraneList(connectInstrument.id);
// Taro.hideLoading();
// 获取连接状态用于判断膜布是否连接连接膜布是M01还是M02
let curJson = getStorageSync("curBluetootDeviceStatusSync");
if (curJson.isCloseToSkin) {
// WE200已连接膜布逻辑判断
// 已连接且存在对应膜布,取第一个
let membraneType = curJson.membraneType.toUpperCase();
if (NursingPlan == "护理计划") {
let membraneType;
if (MembraneClothOne.includes(connectInstrument.modeType)) {
membraneType = "M01";
} else {
membraneType = "M02";
}
let item = MembraneClothList.find((item) => item.code === membraneType);
if (item) {
this.setState({
@ -1447,13 +1410,33 @@ class Index extends Component<any, any> {
this.notConnectMembrane();
}
} else {
this.notConnectMembrane();
// 获取连接状态用于判断膜布是否连接连接膜布是M01还是M02
let curJson = getStorageSync("curBluetootDeviceStatusSync");
if (curJson.isCloseToSkin) {
// WE200已连接膜布逻辑判断
// 已连接且存在对应膜布,取第一个
let membraneType = curJson.membraneType.toUpperCase();
let item = MembraneClothList.find((item) => item.code === membraneType);
if (item) {
this.setState({
checkedMembraneCloth: item.id,
});
setTimeout(() => {
this.confirmMembraneList();
}, 10);
} else {
this.notConnectMembrane();
}
} else {
this.notConnectMembrane();
}
}
};
// 未连接膜布逻辑判断
notConnectMembrane() {
let { MembraneClothList } = this.state;
let { MembraneClothList, NursingPlan } = this.state;
// WE200未连接膜布逻辑判断
// 且膜布列表>2时打开弹窗
if (MembraneClothList.length > 1) {
@ -1466,7 +1449,20 @@ class Index extends Component<any, any> {
this.confirmMembraneList();
}, 10);
} else {
msg("暂无膜布");
// WE200未连接膜布逻辑判断
// 且膜布列表>2时打开弹窗
if (MembraneClothList.length > 1) {
this.setState({ isMembrane: true, isConnectShow: false });
} else if (MembraneClothList.length === 1) {
this.setState({
checkedMembraneCloth: MembraneClothList[0].id,
});
setTimeout(() => {
this.confirmMembraneList();
}, 10);
} else {
msg("暂无膜布");
}
}
}
@ -1506,24 +1502,43 @@ class Index extends Component<any, any> {
}
};
// 查询当前月份的护理任务列表
getListCalendar = async () => {
const date = dayjs().format("YYYY-MM");
const res = await listCalendarApi({ date });
if (res.data.code !== 200) return;
console.log(res);
const calendarComplete = res.data.data
.filter((item) => item.status)
.map((item) => item.startTime);
const calendarInComplete = res.data.data
.filter((item) => !item.status)
.map((item) => item.startTime);
this.setState({ calendarComplete, calendarInComplete });
};
// 获取首页用户护理计划列表
getCarePlanInfo = async () => {
const res = await getIndexCarePlanListApi();
console.log(res, "首页护理计划数据");
if (res.data.code === 200) {
let joinPlan = null; // 用户参与的计划
const carePlanList = res.data.data; // 护理计划列表
const index = carePlanList.findIndex(
let carePlanList = res.data.data; // 护理计划列表
const joinPlan = carePlanList.find((item) => item.joinStatus === 1); // 用户参与中的计划
const isJoinPlan = carePlanList.find(
(item) => item.joinStatus === 1 || item.joinStatus === 2
);
if (index > -1) {
// 找到参与中或待审核的计划 排到列表最前
[joinPlan] = carePlanList.splice(index, 1);
carePlanList.unshift(joinPlan);
carePlanList.slice(0, 8); // 保留前8个计划
}
this.setState({ joinPlan, carePlanList, isjoinPlanShow: true });
); // 用户存在参与中或待审核的计划(不能参加其他计划)
Taro.setStorageSync("isJoinPlan", !!isJoinPlan);
carePlanList = carePlanList.slice(0, 8); // 保留前8个计划
this.setState({ joinPlan, carePlanList });
}
// 获取我的护理模块数据
const nursingRef = this.nursing as any;
nursingRef.current.getPlanNowProgress();
// 详情页点击前往护理 在主页执行
const item = Taro.getStorageSync("prepareData");
// 获取到数据后置空 避免重复执行
Taro.setStorageSync("prepareData", "");
if (item) nursingRef.current.isGoToPlan(item);
};
// 跳转护理计划页面
@ -1556,8 +1571,7 @@ class Index extends Component<any, any> {
isNotRegister,
isShowSiteSwiper,
isDev,
WeCurrent,
WeCurrentPage,
bannerList,
bannerCurrent,
// 绑定弹窗
@ -1588,7 +1602,6 @@ class Index extends Component<any, any> {
isShowReConnectDeviceRecordWE200,
// 护理计划
joinPlan,
isjoinPlanShow,
carePlanList,
} = this.state;
@ -1960,7 +1973,10 @@ class Index extends Component<any, any> {
{/* 我的护理 */}
<Block>
{isjoinPlanShow && <Nursing goNursing={this.goNursing} />}
{/* {isjoinPlanShow && (
<Nursing ref={this.nursing} goNursing={this.goNursing} />
)} */}
<Nursing ref={this.nursing} goNursing={this.goNursing} />
</Block>
{/* 护理计划 */}
@ -1997,11 +2013,11 @@ class Index extends Component<any, any> {
disable: joinPlan,
})}
>
{item.joinStatus === -1 && (
<Text style={{ color: "#ccc" }}></Text>
)}
{item.joinStatus === -1 && <Text></Text>}
{item.joinStatus === 0 && <Text></Text>}
{item.joinStatus === 1 && <Text></Text>}
{item.joinStatus === 1 && (
<Text style={{ color: "#000" }}></Text>
)}
{item.joinStatus === 2 && <Text></Text>}
{item.joinStatus === 3 && <Text></Text>}
{item.joinStatus === 4 && <Text></Text>}

@ -118,9 +118,12 @@ class Initiate extends Component<any, any> {
const { data } = await WCUserLogin({ code });
Taro.hideLoading();
if (data.code === 200) {
console.log("用户信息", data.data);
Taro.setStorageSync("userId", data.data.id);
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);
setTimeout(() => {

@ -3,6 +3,7 @@ import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress, Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import { showModal } from "@/utils/traoAPI";
import PopupAlert from "@/components/popup/popup-alert";
import {
Block,
@ -35,6 +36,7 @@ export default class Index extends Component<any, any> {
updateTime: "",
show: false,
clockStatistics: [],
cantClock: false,
punchInInfo: {
clockImageList: [],
clockContent: "",
@ -63,21 +65,31 @@ export default class Index extends Component<any, any> {
// 打开/关闭弹窗
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 });
}
// 查询用户护理记录的当月统计信息
async getStatistics(nursingId, instrumentId) {
let {instrumentModel} =this.state
let { instrumentModel } = this.state
let data = {};
let res;
if (nursingId != null) {
if (instrumentModel == 'FR200') {
data["nursingId"] = nursingId;
res = await InstrumentInfo.apiNursingLog.getStatisticsFace(data);
} else if(instrumentModel == 'WL200') {
} else if (instrumentModel == 'WL200') {
data["instrumentId"] = instrumentId;
res = await InstrumentInfo.apiNursingLog.getStatistics(data);
}else if(instrumentModel == 'FE200') {
} else if (instrumentModel == 'FE200') {
data["nursingId"] = nursingId;
res = await InstrumentInfo.apiNursingLog.getFe200CurrentMonth(data);
}
@ -105,7 +117,7 @@ export default class Index extends Component<any, any> {
//WL200数据
data = { instrumentId };
res = await InstrumentInfo.apiNursingLog.getRecord(data);
}else if (instrumentModel == 'FE200') {
} else if (instrumentModel == 'FE200') {
res = await InstrumentInfo.apiNursingLog.getRecordNewFe200(data);
}
res1.data.data.nursingTime = this.getTime(res1.data.data.nursingTime);
@ -113,7 +125,7 @@ export default class Index extends Component<any, any> {
let recordData = res1.data.data;
let percentage = recordData.completionPercentage;
recordData.completionPercentage = percentage >= 1 ? 100 : parseFloat((percentage * 100).toFixed(0));
this.setState({ recordData });
if (res.data.code === 200) {
@ -159,6 +171,9 @@ export default class Index extends Component<any, any> {
});
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({
@ -270,6 +285,9 @@ export default class Index extends Component<any, any> {
punchInInfo.clockImageList.splice(i, 1);
this.setState({ punchInInfo });
}
closeAlert = () => {
this.setState({ cantClock: false });
};
async getRouteId() {
let punchInInfo = this.state.punchInInfo;
const searchParams = new URLSearchParams(window.location.search);
@ -304,7 +322,7 @@ export default class Index extends Component<any, any> {
Taro.switchTab({ url: "/pages/index/index" });
};
onUnload() {
if(this.state.reportShow){
if (this.state.reportShow) {
Taro.switchTab({ url: "/pages/index/index" });
}
// 监听页面卸载,移除侧滑事件监听
@ -312,10 +330,10 @@ export default class Index extends Component<any, any> {
async onLoad(options) {
console.log(options, "查看传过来的参数");
this.setState({ updateTime: options?.date });
if(options?.instrumentModel){
if (options?.instrumentModel) {
this.setState({ instrumentModel: options?.instrumentModel })
}
setTimeout(() => {
if (options?.report) {
let Bool = JSON.parse(options?.report);
@ -353,6 +371,7 @@ export default class Index extends Component<any, any> {
monthTime,
reportShow,
instrumentModel,
cantClock
} = this.state;
return (
<Block>
@ -403,19 +422,19 @@ export default class Index extends Component<any, any> {
</View>
</View>
{instrumentModel === "WL200" && (
<View className="progress">
<Progress
percentage={recordData.completionPercentage}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{recordData.completionPercentage}%
</View>
<View className="progress">
<Progress
percentage={recordData.completionPercentage}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{recordData.completionPercentage}%
</View>
)}
</View>
)}
</View>
</View>
</View>
@ -447,19 +466,19 @@ export default class Index extends Component<any, any> {
</View>
</View>
{instrumentModel === "WL200" && (
<View className="progress">
<Progress
percentage={item.completionPercentage}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{item.completionPercentage}%
</View>
<View className="progress">
<Progress
percentage={item.completionPercentage}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{item.completionPercentage}%
</View>
)}
</View>
)}
</View>
</View>
</View>
@ -524,7 +543,7 @@ export default class Index extends Component<any, any> {
<Textarea
placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;"
placeholder="请记录一下今天的护理心得吧"
maxlength={119}
maxlength={120}
onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent}
></Textarea>
@ -540,6 +559,16 @@ export default class Index extends Component<any, any> {
</View>
</View>
</Popup>
<PopupAlert
isShow={cantClock}
isClose
title="提示"
content="您已被限制打卡,请联系微信小助理"
confirmButtonText="确定"
textAlgin="center"
close={this.closeAlert}
confirm={this.closeAlert}
/>
</Block>
);
}

@ -49,11 +49,13 @@ export default class Index extends Component<any, any> {
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<any, any> {
// 打开/关闭弹窗
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<any, any> {
});
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<any, any> {
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<any, any> {
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<any, any> {
monthTime,
reportShow,
EchartsData,
cantClock
} = this.state;
return (
<Block>
<Navbar isBack titleSlot='护理报告'
isCustomBack={reportShow}
customBack={this.customBack}
isCustomBack={reportShow}
customBack={this.customBack}
></Navbar>
<View className='statistic m-x-30 flex aitems'>
<View className='statistic_item'>
@ -420,9 +477,10 @@ export default class Index extends Component<any, any> {
</View>
</View>
<View className='main_title'>-{recordData.modeName}</View>
<View className='eacharts'>
<View className='eacharts'>
<EchartsForm EchartsData={EchartsData}></EchartsForm>
</View>
</View>
<View className='bottom-title'>
<View className='text-title'>
@ -505,7 +563,7 @@ export default class Index extends Component<any, any> {
<Textarea
placeholderStyle='color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;'
placeholder='请记录一下今天的护理心得吧'
maxlength={119}
maxlength={120}
onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent}
></Textarea>
@ -521,6 +579,16 @@ export default class Index extends Component<any, any> {
</View>
</View>
</Popup>
<PopupAlert
isShow={cantClock}
isClose
title="提示"
content="您已被限制打卡,请联系微信小助理"
confirmButtonText="确定"
textAlgin="center"
close={this.closeAlert}
confirm={this.closeAlert}
/>
</Block>
);
}

@ -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<any, any> {
reportPageImg: '',
InputText1: '',
InputText2: '',
isCircle:false //显示环形进度条
isCircle: false, //显示环形进度条
cantClock: false,
};
}
@ -57,7 +60,8 @@ export default class Index extends Component<any, any> {
componentWillUnmount() {
Taro.eventCenter.off('SetInstrumentGear');
Taro.removeStorageSync("WE200BluetoothConnectivity");
}
}
// 查询用户护理记录的当月统计信息
async getStatistics(id) {
@ -87,6 +91,9 @@ export default class Index extends Component<any, any> {
});
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<any, any> {
// 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<any, any> {
}
}
// 获取护理时间
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<any, any> {
}
// 录入是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<any, any> {
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<any, any> {
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<any, any> {
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<any, any> {
} 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<any, any> {
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<any, any> {
}, 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<any, any> {
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<any, any> {
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<any, any> {
currentAnswer,
reportPageImg,
InputText1,
InputText2
InputText2,
cantClock
} = this.state;
return (
<Block>
<Navbar isBack titleSlot='护理报告'
isCustomBack={isInstrumentCare}
@ -491,20 +516,20 @@ export default class Index extends Component<any, any> {
<View className="text">{modeName}</View>
<View className="text">{nursingTime} </View>
<View className="text">
<Progress
// percentage={
// recordData.completionPercentage * 100 > 100
// ? 100
// : recordData.completionPercentage * 100
// }
percentage={percentage}
strokeWidth='11'
color='linearGradient(to right, #eecda1, #ffe9c7) !important'
/>
<Progress
// percentage={
// recordData.completionPercentage * 100 > 100
// ? 100
// : recordData.completionPercentage * 100
// }
percentage={percentage}
strokeWidth='11'
color='linearGradient(to right, #eecda1, #ffe9c7) !important'
/>
<View className="percent">{percentage}%</View>
</View>
{ isInstrumentCare&& modeKey === 'ShapeBeautyEssence' && <View className="text">{currentAnswer}</View>}
{ isInstrumentCare&& modeKey === 'EyeCarving_Custom' && <View className="text">{currentAnswer}</View>}
{isInstrumentCare && modeKey === 'ShapeBeautyEssence' && <View className="text">{currentAnswer}</View>}
{isInstrumentCare && modeKey === 'EyeCarving_Custom' && <View className="text">{currentAnswer}</View>}
{/* <View className="text">电流配方A1B1C1</View> */}
@ -515,9 +540,9 @@ export default class Index extends Component<any, any> {
<View className="title">{InputText1}</View>
<View className="subtitle">:{InputText2}</View>
</View>
{this.state.isCircle && isEnterReset && <View className="box_right_Circle"> <Circle value={100} speed={100} color="#fce4bd" size={70} text="100%" /></View>}
{!this.state.isCircle && isEnterReset && <View className="box_right" onClick={this.enterReset.bind(this, false)}></View>}
{this.state.isCircle && isEnterReset && <View className="box_right_Circle"> <Circle value={100} speed={100} color="#fce4bd" size={70} text="100%" /></View>}
{!this.state.isCircle && isEnterReset && <View className="box_right" onClick={this.enterReset.bind(this, false)}></View>}
</View>
) : (
<View className="note_box">
@ -525,9 +550,9 @@ export default class Index extends Component<any, any> {
<View className="title">/,</View>
<View className="subtitle">:/</View>
</View>
{this.state.isCircle && !isEnterReset && <View className="box_right_Circle"> <Circle value={100} speed={100} color="#fce4bd" size={70} text="100%" /></View>}
{!this.state.isCircle && !isEnterReset && <View className="box_right" onClick={this.enterReset.bind(this, true)}></View>}
{this.state.isCircle && !isEnterReset && <View className="box_right_Circle"> <Circle value={100} speed={100} color="#fce4bd" size={70} text="100%" /></View>}
{!this.state.isCircle && !isEnterReset && <View className="box_right" onClick={this.enterReset.bind(this, true)}></View>}
</View>
)
)}
@ -535,7 +560,7 @@ export default class Index extends Component<any, any> {
</View>
{modeKey == "WaterLightEssence" && <View style="font-size:25rpx;color: #a1a1a1;">
*:线,
*:线,
</View>}
</View>
{isInstrumentCare ? (
@ -597,7 +622,7 @@ export default class Index extends Component<any, any> {
<Textarea
placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;"
placeholder="请记录一下今天的护理心得吧"
maxlength={119}
maxlength={120}
onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent}
></Textarea>
@ -613,8 +638,18 @@ export default class Index extends Component<any, any> {
</View>
</View>
</Popup>
<PopupAlert
isShow={cantClock}
isClose
title="提示"
content="您已被限制打卡,请联系微信小助理"
confirmButtonText="确定"
textAlgin="center"
close={this.closeAlert}
confirm={this.closeAlert}
/>
</Block>
);
}
}

@ -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<any, any> {
},
navigationBarHeight: "",
statusBarHeight: "",
cantClock:false,
};
}
@ -192,6 +194,17 @@ export default class Recording extends Component<any, any> {
};
// 打开/关闭弹窗
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<any, any> {
});
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<any, any> {
delta: 1,
});
}
closeAlert = () => {
this.setState({ cantClock: false });
};
setStatusBar() {
Taro.getSystemInfoAsync({
success: (res) => {
@ -593,6 +611,7 @@ export default class Recording extends Component<any, any> {
statusBarHeight,
startYear,
endYear,
cantClock
} = this.state;
const statusBarHeightRpx = statusBarHeight * 2;
const navigationBarHeightRpx = navigationBarHeight * 2;
@ -953,7 +972,7 @@ export default class Recording extends Component<any, any> {
<Textarea
placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;"
placeholder="请记录一下今天的护理心得吧"
maxlength={119}
maxlength={120}
onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent}
></Textarea>
@ -969,6 +988,16 @@ export default class Recording extends Component<any, any> {
</View>
</View>
</Popup>
<PopupAlert
isShow={cantClock}
isClose
title="提示"
content="您已被限制打卡,请联系微信小助理"
confirmButtonText="确定"
textAlgin="center"
close={this.closeAlert}
confirm={this.closeAlert}
/>
</Block>
);
}

@ -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 功能

@ -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) => {

@ -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;
};

Loading…
Cancel
Save