diff --git a/src/instrument/pages/instrument/intro.less b/src/instrument/pages/instrument/intro.less index 298b952..c6d4157 100644 --- a/src/instrument/pages/instrument/intro.less +++ b/src/instrument/pages/instrument/intro.less @@ -1,109 +1,122 @@ -.footer { - position: fixed; - bottom: 0; - background: #fff; - flex-direction: column; - width: 100%; - padding-bottom: 30rpx; - // padding-bottom: env(safe-area-inset-bottom); -} +.intro { + .intro-main { + position: relative; + overflow: hidden; + } + .footer { + position: fixed; + bottom: 0; + background: #fff; + flex-direction: column; + width: 100%; + padding-bottom: 30rpx; + // padding-bottom: env(safe-area-inset-bottom); + } -.footer .btn { - width: 690rpx; - height: 90rpx; - background: #000; - border-radius: 45rpx; - text-align: center; - line-height: 90rpx; - font-size: 32rpx; - font-family: PingFang SC; - font-weight: bold; - color: #ffffff; -} + .footer .btn { + width: 690rpx; + height: 90rpx; + background: #000; + border-radius: 45rpx; + text-align: center; + line-height: 90rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #ffffff; + } -.footer .text { - background: transparent; - font-size: 32rpx; - font-family: PingFang SC; - font-weight: bold; - color: #000000; -} + .footer .text { + background: transparent; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + } -.main { - height: 100vh; - text-align: center; - margin-top: 34rpx; - padding-bottom: calc(env(safe-area-inset-bottom) + 180rpx); -} + .main { + height: 100vh; + text-align: center; + margin-top: 34rpx; + // padding-bottom: calc(env(safe-area-inset-bottom) + 180rpx); + } -.cover { - display: block; // 消除默认间距 - width: 660rpx; - height: 922rpx; - border-radius: 50rpx; -} + .cover { + display: block; // 消除默认间距 + width: 660rpx; + height: 922rpx; + border-radius: 50rpx; + margin: 0 auto; + } -.content { - display: block; // 消除默认间距 - width: 660rpx; - // height: 474rpx; - height: 488rpx; - background: linear-gradient(rgba(204, 204, 204, 0.4), #fff); - border-radius: 50rpx; - margin-top: 7rpx; -} + .content { + display: block; // 消除默认间距 + width: 660rpx; + // height: 474rpx; + height: 488rpx; + background: linear-gradient(rgba(204, 204, 204, 0.4), #fff); + border-radius: 50rpx; + margin: 0 auto; + margin-top: 7rpx; + } -.title { - font-size: 48rpx; - font-family: PingFang SC; - font-weight: 500; - color: #000; - text-align: center; - padding-bottom: 30rpx; - padding-top: 84rpx; -} + .title { + font-size: 48rpx; + font-family: PingFang SC; + font-weight: 500; + color: #000; + text-align: center; + padding-bottom: 30rpx; + padding-top: 84rpx; + } -.text { - font-size: 26rpx; - font-weight: 500; - color: #666; -} + .text { + font-size: 26rpx; + font-weight: 500; + color: #666; + } -// .indicator { -// position: absolute; -// left: 50%; -// top: 960rpx; -// transform: translate(-50%, -50%); -// width: 120rpx; -// height: 1rpx; -// background: #ccc; -// } + // .indicator { + // position: absolute; + // left: 50%; + // top: 960rpx; + // transform: translate(-50%, -50%); + // width: 120rpx; + // height: 1rpx; + // background: #ccc; + // } -// .dot { -// height: 100%; -// background: #000; -// transition-property: all; -// transition-duration: 0.8s; -// } -.indicator { - position: absolute; - left: 50%; - top: 960rpx; - transform: translate(-50%, -50%); - display: inline-flex; - width: 360rpx; - height: 1px; - background: transparent; - .dot { + // .dot { + // height: 100%; + // background: #000; + // transition-property: all; + // transition-duration: 0.8s; + // } + .indicator { + position: absolute; + left: 50%; + // top: 960rpx; + top: 990rpx; + transform: translate(-50%, -50%); display: inline-flex; - flex: 1; - height: 100%; - background: #f2f2f2; - transition-duration: 0.5s; - margin-right: 4rpx; - transition: all 0.6s ease-in-out 0.1s; - } - .bg-show { - background: #000; + width: 360rpx; + height: 1px; + background: transparent; + .dot { + display: inline-flex; + flex: 1; + height: 100%; + background: #f2f2f2; + transition-duration: 0.5s; + margin-right: 4rpx; + transition: all 0.6s ease-in-out 0.1s; + } + .only-dot { + width: 120rpx; + margin: 0 auto; + } + .bg-show { + background: #000; + } } } diff --git a/src/instrument/pages/instrument/intro.tsx b/src/instrument/pages/instrument/intro.tsx index 5186a7b..f152e7f 100644 --- a/src/instrument/pages/instrument/intro.tsx +++ b/src/instrument/pages/instrument/intro.tsx @@ -37,6 +37,7 @@ class Intro extends Component { super(props); this.state = { name: "仪器介绍页", + navHeight: 0, current: 0, instrument: {}, introList: [], @@ -61,7 +62,9 @@ class Intro extends Component { } $instance = Taro.getCurrentInstance(); - async onLoad() {} + async onLoad() { + this.setStatusBar(); + } componentDidMount() { let strObj = getStorageSync("instrument_detail"); if (strObj) { @@ -82,13 +85,32 @@ class Intro extends Component { componentDidHide() {} + setStatusBar() { + Taro.getSystemInfoAsync({ + success: (res) => { + const statusBarHeight = res.statusBarHeight || 0; + // 获取微信胶囊的位置信息 width,height,top,right,left,bottom + const custom = Taro.getMenuButtonBoundingClientRect(); + // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2 + const navigationBarHeight = + custom.height + (custom.top - statusBarHeight) * 2; + // 总体高度 = 状态栏高度 + 导航栏高度 + const navHeight = (navigationBarHeight + statusBarHeight) * 2; + + this.setState({ + navHeight, + }); + }, + }); + } + async initData() {} - onChange(event) { + onChange = (event) => { console.info("onchange", event); - // const current = event.detail.current; - // this.setState({ current }); - } + const current = event.detail.current; + this.setState({ current }); + }; // 获取设备信息 getInstrumentInfo = async (id) => { @@ -329,6 +351,7 @@ class Intro extends Component { isShowVersionUpgrading, isShowVersionUpgradFinish, versionUpgradFinishNodes, + navHeight, } = this.state; return ( @@ -425,62 +448,81 @@ class Intro extends Component { /> {/* IOT相关弹窗 END */} - - + - {introList.map((item: any, index: number) => { - return ( - - {item.fileType === "video" ? ( - - ); - })} - - - {introList.length && ( - - {introList.map((_item, index) => { + 1 ? "32rpx" : "0px"} + nextMargin={introList.length > 1 ? "32rpx" : "0px"} + > + {introList.map((item: any, index: number) => { return ( - + + {item.fileType === "video" ? ( + ); })} - - )} - - - - - 马上护理 + + + {introList.length > 1 && ( + + {introList.map((_item, index) => { + return ( + + ); + })} + + )} + {introList.length === 1 && ( + + {introList.map((_item, index) => { + return ( + + ); + })} + + )} - - 暂不护理 + + + + 马上护理 + + + 暂不护理 + diff --git a/src/instrument/pages/instrument_manage/index.less b/src/instrument/pages/instrument_manage/index.less index 0eb86ad..eb43bfe 100644 --- a/src/instrument/pages/instrument_manage/index.less +++ b/src/instrument/pages/instrument_manage/index.less @@ -15,6 +15,7 @@ page { .un_bind_list { width: 100%; white-space: nowrap; + box-sizing: border-box; // margin-left: 37rpx; } @@ -24,6 +25,7 @@ page { .bind_list { height: 650rpx; + .wrapper { display: inline-block; position: relative; @@ -83,13 +85,16 @@ page { } } } - .backColer{ + .backColer { background: linear-gradient(to bottom, #e3e3e3, #f8f8f8); height: 211rpx; padding: 0rpx 0rpx; border-radius: 50px; + box-sizing: border-box; } .bind_cont { + box-sizing: border-box; + overflow: hidden; .title { text-align: center; font-size: 36rpx; diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index f0ca9ae..19c376d 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -231,13 +231,17 @@ class IotCarePlanFR200 extends Component { /** FR200模式类型:名称 */ ModeTypeArray: string[] = [ "all", - "Base", - "Zone", - "Permeation", - "Sensitive", - "Intelligence", + "base", + "eyes", + "zone", + "permeation", + "sensitive", + "intelligence", ]; + /** 基础版:脸部/眼部 */ + BaseModeType: string[] = ["face", "eyes"]; + async onLoad() { // 保持屏幕常亮 Taro.setKeepScreenOn({ @@ -493,7 +497,7 @@ class IotCarePlanFR200 extends Component { return false; } - if (this.isRuning === true && this.state.DeviceConnectStatus == 1) { + if (this.isRuning && this.state.DeviceConnectStatus == 1) { // 提示切换护理模式 if (this.isCheckNurseTime()) { // 满足时间条件,提示是否保存部分护理记录 @@ -753,13 +757,15 @@ class IotCarePlanFR200 extends Component { this.state.DeviceConnectStatus === 1 && jsonStatus.workStatus !== MODE_WORKING_ENUM.END ) { - this.updateDeviceSyncData( - { - totalWorkingMinutes: jsonStatus.totalWorkingMinutes, - totalWorkingSeconds: jsonStatus.totalWorkingSeconds, - }, - jsonStatus - ); + // 水分测试手动检测时间,不自动计算倒计时 + if (jsonStatus?.workMode !== "moistureTest") + this.updateDeviceSyncData( + { + totalWorkingMinutes: jsonStatus.totalWorkingMinutes, + totalWorkingSeconds: jsonStatus.totalWorkingSeconds, + }, + jsonStatus + ); } } } @@ -800,7 +806,7 @@ class IotCarePlanFR200 extends Component { // 仅当设备模式与小程序是否一致,才允许更改设备运行时间 if ( this.state.DeviceConnectStatus === 1 && - this.isRuning == 2 && + this.isRuning && jsonStatus.workStatus !== MODE_WORKING_ENUM.END ) { this.updateDeviceSyncData( @@ -927,7 +933,7 @@ class IotCarePlanFR200 extends Component { if ( sceneTime > totalTime && - this.isRuning === true && + this.isRuning && this.state.DeviceConnectStatus == 1 ) { // 界面倒计时同步设备时间 @@ -972,7 +978,7 @@ class IotCarePlanFR200 extends Component { * params 工作状态 工作模式 响应状态 */ judgementWorkStatus(nWorkStatus, nWorkMode) { - const { workMode, ActiveModeItem, ModeList } = this.state; + const { ActiveModeItem, ModeList } = this.state; const opts: any = {}; // ActiveModeItem let nowModeItem; @@ -999,25 +1005,18 @@ class IotCarePlanFR200 extends Component { this.setState({ isShowCountdown: false, }); - if (nowModeItem?.isCabinMode && this.isRuning === true) { - opts.currentTime = nowCurrentTime; - } else if (!nowModeItem?.isCabinMode && this.isRuning === true) { - // fix: 启动非支架模式倒计时时,连上支架,仪器的状态变为standby - this.isRuning === false; - } }, setting: () => { - // that.data.hadShowBreakTips = false; this.setState({ hadShowBreakTips: false, }); - if (this.isRuning === false && !ActiveModeItem.isCabinMode) { + if (!this.isRuning && !ActiveModeItem.isCabinMode) { this.isRuning = true; this.setState({ title: "正在护理", isStopNurse: false, }); - } else if (this.isRuning === false && ActiveModeItem.isCabinMode) { + } else if (!this.isRuning && ActiveModeItem.isCabinMode) { this.isRuning = true; // this.setState({ // title: "正在护理", @@ -1196,11 +1195,20 @@ class IotCarePlanFR200 extends Component { } } - const sendParams = { + let sendParams: any = { ...deviceCommandSamples.pause, workMode: ActiveModeItem.modeType, // 使用模式 workStatus: newWorkStatus, }; + + // 水分测试需要特殊处理 + if (ActiveModeItem.modeType === "moistureTest") { + sendParams.testStatus = "standby"; // 切换为准备 + if (isBtnClick) { + sendParams.testStatus = "start"; // 点击开始再开始 + } + } + console.log("准备发送自定义或工作指令", ActiveModeItem, sendParams); const pauseArrayBuffer = deviceToolKitInstance.toBleCommand( sendParams as any diff --git a/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx index 375a443..48eb98d 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/ModeList/FR200.tsx @@ -57,7 +57,7 @@ function Index({ )} {BaseList.length > 0 && - (ModeType === "all" || ModeType === "Base" || isPop) && ( + (ModeType === "all" || ModeType === "base" || isPop) && ( { return ( )} {ZoneList.length > 0 && - (ModeType === "all" || ModeType === "Zone" || isPop) && ( + (ModeType === "all" || ModeType === "zone" || isPop) && ( { return ( 0 && - (ModeType === "all" || ModeType === "Permeation" || isPop) && ( + (ModeType === "all" || ModeType === "permeation" || isPop) && ( { return ( 0 && - (ModeType === "all" || ModeType === "Sensitive" || isPop) && ( + (ModeType === "all" || ModeType === "sensitive" || isPop) && ( { return ( 0 && - (ModeType === "all" || ModeType === "Intelligence" || isPop) && ( + (ModeType === "all" || ModeType === "intelligence" || isPop) && ( { return ( { { 查看积分详情 - {/* - - - - 我的设备 - - - - - {userInfo.devicesNum} - 查看绑定设备详情 - - - - - 我的积分 - - - - - {userInfo.credit} - 查看积分详情 - - */} + {lastDay} 过期积分: {userInfo.expireCredit} diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index a667d79..64f9047 100644 --- a/src/recoding/pages/recording/recording.tsx +++ b/src/recoding/pages/recording/recording.tsx @@ -32,7 +32,7 @@ export default class Recording extends Component { this.state = { name: "护理历程", current: 0, - ViewAddInstrument: false, //用来记录有没有添加设备 + ViewAddInstrument: false, //用来记录有没有添加设备 array: [1, 2, 3, 4, 5], recordList: [], bindingInstrumentList: [], @@ -64,9 +64,9 @@ export default class Recording extends Component { }; } - componentDidMount() { } + componentDidMount() {} - componentWillUnmount() { } + componentWillUnmount() {} // 格式化时间 getTime(time) { const hour = time.slice(0, 2); @@ -88,20 +88,17 @@ export default class Recording extends Component { } // 获取护理历程 async getRecord(id) { - let data = {}; if (id != null) { data["instrumentId"] = id; } let res = await InstrumentInfo.apiNursingLog.getRecord(data); - console.log(res, '查看你获取护理历程'); - + console.log(res, "查看你获取护理历程"); if (res.data.code === 200) { res.data.rows.map((item) => { item.nursingTime = this.getTime(item.nursingTime); - let createTime = getdates(item.createTime) - + let createTime = getdates(item.createTime); item.createTime = createTime && createTime.replace(/-/g, "."); }); @@ -144,7 +141,6 @@ export default class Recording extends Component { let res = await InstrumentInfo.apiClock.getClockStatistics({ year }); if (res.data.code === 200) { - res.data.data.reverse(); if (res.data.data.length > 0) { res.data.data.map((item, index) => { @@ -184,7 +180,9 @@ export default class Recording extends Component { // 文本框输入文字 handleTextareaInput = (e) => { const punchInInfo = this.state.punchInInfo; - this.setState({ punchInInfo: { ...punchInInfo, clockContent: e.detail.value } }); + this.setState({ + punchInInfo: { ...punchInInfo, clockContent: e.detail.value }, + }); }; // 打开/关闭弹窗 setShow(show: boolean) { @@ -194,7 +192,7 @@ export default class Recording extends Component { onChangeProduct(id) { this.setState({ curIndex: id }); this.getRecord(id); - this.addLog(); + // this.addLog(); } // 展开收起 onChangeMore(id, year, month) { @@ -223,8 +221,7 @@ export default class Recording extends Component { if (item.id === id) { item.detail = res.data.data; item.detail.map((obj) => { - - let updateTime = getdates(obj.updateTime) + let updateTime = getdates(obj.updateTime); obj.updateTime = updateTime && updateTime.replace(/-/g, "."); }); @@ -234,51 +231,47 @@ export default class Recording extends Component { } } async DayTime() { - let storedData = Taro.getStorageSync('DayTime') + let storedData = Taro.getStorageSync("DayTime"); const day = new Date(); if (storedData === undefined || storedData === "") { - this.setState({ - clockShow: false - }) - + clockShow: false, + }); } else { - const storedDate = new Date(storedData); const currentDate = new Date(day.toISOString()); - const isSameDate = storedDate.toDateString() === currentDate.toDateString(); + const isSameDate = + storedDate.toDateString() === currentDate.toDateString(); if (isSameDate) { this.setState({ - clockShow: true - }) + clockShow: true, + }); } else { this.setState({ - clockShow: false - }) + clockShow: false, + }); } } - - } async onLoad(options) { const ViewAddInstrument = options.param; this.setState({ - ViewAddInstrument: ViewAddInstrument - }) + ViewAddInstrument: ViewAddInstrument, + }); this.getRecord(null); this.getBindingInstrumentList(); this.getLatestClockRecord(); this.getClockStatistics(); - this.DayTime() + this.DayTime(); } - componentDidShow() { } + componentDidShow() {} - componentDidHide() { } + componentDidHide() {} - async initData() { } + async initData() {} // 选择年份 onChangeYear(event) { this.setState({ year: event.detail.value }); @@ -294,18 +287,18 @@ export default class Recording extends Component { }; // 跳转到护理报告 toReport(id, recordId, item) { - console.log(item, '查看类型', item.jumpType); - item.jumpType = 1 + console.log(item, "查看类型", item.jumpType); + item.jumpType = 1; switch (item.jumpType) { case 1: this.One(item); break; case 2: - - this.two(item); break; + this.two(item); + break; case 3: - - this.three(item); break; + this.three(item); + break; default: this.AllDevice(item); } @@ -314,26 +307,30 @@ export default class Recording extends Component { } // 打开第一种类型 One = async (item) => { - console.log('打开第一种类型', item); - let report = false - go("/recoding/pages/face_report_one/face_report_one?id=" + item.id + "&recordId=" + item.recordId + "&report=" + report); - } + console.log("打开第一种类型", item); + let report = false; + go( + "/recoding/pages/face_report_one/face_report_one?id=" + + item.id + + "&recordId=" + + item.recordId + + "&report=" + + report + ); + }; // 打开第二种类型 two = async (item) => { - console.log('打开第二种类型', item); - - } + console.log("打开第二种类型", item); + }; // 打开第二种类型 three = async (item) => { - console.log('打开第二种类型', item); - - } + console.log("打开第二种类型", item); + }; // 打开其他类型 AllDevice = async (item) => { - console.log('打开其他类型', item); + console.log("打开其他类型", item); go("/pages/face_report_AllDevice/face_report_AllDevice"); - - } + }; // 上传图片 handleChooseImage() { Taro.chooseMedia({ @@ -390,14 +387,13 @@ export default class Recording extends Component { t2: "您已完成今日打卡", btn1show: false, }).then(() => { - let data = new Date - Taro.setStorageSync('DayTime', data.toISOString()) + let data = new Date(); + Taro.setStorageSync("DayTime", data.toISOString()); this.setState({ - clockShow: true - }) + clockShow: true, + }); this.getClockStatistics(); this.setShow(false); - }); }); } @@ -427,8 +423,8 @@ export default class Recording extends Component { return ( - - + + { {current === 0 && ( - + { onClick={this.onChangeProduct.bind(this, item.id)} > - 画质抗老射频仪 + 画质抗老射频仪 ))} @@ -479,17 +475,17 @@ export default class Recording extends Component { {current === 0 && recordList.length === 0 && ( - + - 暂无数据 + 暂无数据 )} {current === 0 && ( - + {/* @@ -516,12 +512,12 @@ export default class Recording extends Component { */} - + {recordList.map((item: any, index: any) => ( - - - - {item.createTime} + + + + {item.createTime} { {item.instrumentType === 2 && ( 回看报告 )} - + - - {item.instrumentName} - - 模式:{item.modeName} - + + {item.instrumentName} + + 模式:{item.modeName} + 护理时间:{item.nursingTime} @@ -570,7 +566,7 @@ export default class Recording extends Component { )} {current === 1 && ( - + {/* { > 暂无数据 */} - - - - 年度打卡统计 + + + + 年度打卡统计 - + {year}年 - + {monthTime.map((item) => ( - + {item.time > 0 && ( - {item.time}天 + {item.time}天 )} - {item.month} + {item.month} ))} - - + + {clockStatistics.map((item) => ( - - - + + + {item.year}年{item.month}月 { item.month )} > - + {" "} {!item.isMore ? "展开更多" : "收起更多"} @@ -641,49 +637,51 @@ export default class Recording extends Component { ? "rotate(180deg)" : "rotate(0deg)", }} - className='more_icon' + className="more_icon" src={require("@/img/arrow-down.png")} - mode='widthFix' + mode="widthFix" > - - - - {item.clockNum} - 本月打卡天数 + + + + {item.clockNum} + 本月打卡天数 - - + + {(item.percentage * 100).toFixed(2)}% - 超越花至用户 + 超越花至用户 - + {item.isMore && item.detail && ( {item.detail.map((obj) => ( - - - + + + {obj.updateTime} - + {obj.clockImg.map((img) => ( ))} - + {/* 小紫弹智能射频仪、花至抗老射频仪PRO{" "} */} - {obj.instrumentName === null ? "" : obj.instrumentName} + {obj.instrumentName === null + ? "" + : obj.instrumentName} - + {obj.clockContent} @@ -697,79 +695,76 @@ export default class Recording extends Component { )} - { - !clockShow && ViewAddInstrument === "true" && ( - - - 前往打卡 - - {/* + {!clockShow && ViewAddInstrument === "true" && ( + + + 前往打卡 + + {/* 跳过 > */} - - ) - } + + )} this.setState({ show: false })}> - + - 今日打卡 - + 今日打卡 + 本月您已打卡 - {clockStatistics[0]?.clockNum}{" "} + {clockStatistics[0]?.clockNum}{" "} 天,超越 - + {(clockStatistics[0]?.percentage * 100).toFixed(1)}% 花至用户 - + {punchInInfo.clockImageList.map((item, index) => ( - - + + ))} {punchInInfo.clockImageList.length < 3 && ( )} - - + + - + {"(" + (punchInInfo.clockContent.length || 0) + "/120)"} - - + + 确认提交 diff --git a/src/utils/request.js b/src/utils/request.js index 888e69c..2adf0de 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -42,6 +42,14 @@ export const Ajax = (params) => { } return new Promise((reslove, reject) => { let token = getStorageSync("token"); + if (!token) { + // 如果不存在token,且请求的接口不是登录,则重新登录 + console.log("params", params); + if (params.url.indexOf("/user/login") === -1) { + loginReload(params); + return; + } + } Taro.request({ url: domain + params.url, method: params.method || "GET",