diff --git a/src/app.tsx b/src/app.tsx index fbadf61..0e4335e 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -27,8 +27,8 @@ class App extends Component { // 每次进入小程序,删除可能残留的同步状态 Taro.removeStorageSync("isSyncHistory"); - // go("/pages/instrument_clickin_upload/index"); - // go("/pages/instrument/intro"); + // go("/instrument/pages/instrument_clickin_upload/index"); + // go("/instrument/pages/instrument/intro"); // Taro.switchTab({ // url: "/pages/user/user", // }); diff --git a/src/instrument/pages/instrument/instrument.tsx b/src/instrument/pages/instrument/instrument.tsx index b9fb4de..bf0c88e 100644 --- a/src/instrument/pages/instrument/instrument.tsx +++ b/src/instrument/pages/instrument/instrument.tsx @@ -371,7 +371,7 @@ export default class Instrument extends Component { msg("绑定成功"); setTimeout(() => { setStorageSync("instrument_detail", JSON.stringify(channelInfo)); - go("/pages/instrument/intro?id=" + channelInfo.id); + go("/instrument/pages/instrument/intro?id=" + channelInfo.id); }, 1000); } else if (res.data.code === 202) { this.changeBindBox(); @@ -403,7 +403,7 @@ export default class Instrument extends Component { msg("绑定成功"); setStorageSync("instrument_detail", JSON.stringify(channelInfo)); setTimeout(() => { - go("/pages/instrument/intro?id=" + channelInfo.id); + go("/instrument/pages/instrument/intro?id=" + channelInfo.id); }, 1000); } else if (res.data.code === 202) { this.changeBindBox(); @@ -529,7 +529,7 @@ export default class Instrument extends Component { confirm={this.closeDev} /> */} { /> - - - 仪器绑定 - + + + 仪器绑定 + 请参考图片指引,扫描或输入产品序列号 - 完成花至美容仪绑定 + 完成花至美容仪绑定 - + {inputType === 1 ? ( - - - + + + 需要绑定的仪器 @@ -624,10 +624,10 @@ export default class Instrument extends Component { {equipmentList.length > 0 && equipmentList.map((item, index) => { @@ -641,11 +641,11 @@ export default class Instrument extends Component { onClick={this.onSelectChange.bind(this, item)} > - {item.name} + {item.name} ); })} @@ -659,8 +659,8 @@ export default class Instrument extends Component { )} - - + + { onClick={this.onTabTap.bind(this, 1)} > 手写输入绑定 - + {channelInfo.isScanCode === 1 && ( { onClick={this.onTabTap.bind(this, 2)} > 扫码绑定 - + )} @@ -686,38 +686,38 @@ export default class Instrument extends Component { {inputType == 1 && ( - - - - + + + + 填写序列号 * - - 查看序列号位置 + + 查看序列号位置 - + - - - + + + 上传序列号照片 * @@ -725,20 +725,20 @@ export default class Instrument extends Component { {channelInfo.serialImage && ( )} {!channelInfo.serialImage && ( )} @@ -748,10 +748,10 @@ export default class Instrument extends Component { )} - + {inputType == 1 && ( 确认绑定 @@ -759,9 +759,9 @@ export default class Instrument extends Component { )} {inputType == 2 && ( - + 扫码绑定 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..6fbad48 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) => { @@ -152,7 +174,7 @@ class Intro extends Component { if (this.state.connectInstrument.type === 1) { //非IOT setTimeout(() => { - go("/pages/instrumentClickinUpload/index"); + go("/instrument/pages/instrumentClickinUpload/index"); }, 10); } else { Taro.getSystemInfo({ @@ -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/instrument/pages/instrument_manage/index.tsx b/src/instrument/pages/instrument_manage/index.tsx index b48b52c..1586ece 100644 --- a/src/instrument/pages/instrument_manage/index.tsx +++ b/src/instrument/pages/instrument_manage/index.tsx @@ -92,17 +92,17 @@ export default class InstrumentManage extends Component { setStorageSync("instrument_detail", item); let bindid = item.id; - go("/pages/instrument/intro?id=" + bindid); + go("/instrument/pages/instrument/intro?id=" + bindid); }; goBind = (item) => { let bindid = item.id; - go("/pages/instrument/instrument?isOnly=true&id=" + bindid); // 只显示当前仪器内容 + go("/instrument/pages/instrument/instrument?isOnly=true&id=" + bindid); // 只显示当前仪器内容 }; goBindInfo = (item) => { // let bindid = item.id; setStorageSync("instrument_detail", item); - go("/pages/instrument_detail/index"); + go("/instrument/pages/instrument_detail/index"); }; lesgobuy = (item) => { diff --git a/src/moduleIOT/pages/iotCarePlan/FR200.tsx b/src/moduleIOT/pages/iotCarePlan/FR200.tsx index 672d120..8ba0614 100644 --- a/src/moduleIOT/pages/iotCarePlan/FR200.tsx +++ b/src/moduleIOT/pages/iotCarePlan/FR200.tsx @@ -707,13 +707,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({ @@ -969,7 +973,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()) { // 满足时间条件,提示是否保存部分护理记录 @@ -1229,13 +1233,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 + ); } } } @@ -1276,7 +1282,7 @@ class IotCarePlanFR200 extends Component { // 仅当设备模式与小程序是否一致,才允许更改设备运行时间 if ( this.state.DeviceConnectStatus === 1 && - this.isRuning == 2 && + this.isRuning && jsonStatus.workStatus !== MODE_WORKING_ENUM.END ) { this.updateDeviceSyncData( @@ -1403,7 +1409,7 @@ class IotCarePlanFR200 extends Component { if ( sceneTime > totalTime && - this.isRuning === true && + this.isRuning && this.state.DeviceConnectStatus == 1 ) { // 界面倒计时同步设备时间 @@ -1448,7 +1454,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; @@ -1475,25 +1481,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: "正在护理", @@ -1672,11 +1671,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 @@ -2037,6 +2045,7 @@ class IotCarePlanFR200 extends Component { this.setFR200NursingHistory(jsonStatus); } }; + // 改变模式时,清空dataArray,防止数据无限叠加 changeItemUpdateFR200NursingHistory() { this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); if (this.FR200NursingHistory) { @@ -2052,15 +2061,11 @@ class IotCarePlanFR200 extends Component { */ rmFR200NursingHistory = (FR200NursingHistory, hard = false) => { const nowFR200NursingHistory = Taro.getStorageSync("FR200NursingHistory"); - - Taro.setStorageSync("FR200Echart", nowFR200NursingHistory); // 临时保存用于观看和调试 - if (nowFR200NursingHistory.id == FR200NursingHistory.id) { - Taro.removeStorageSync("FR200NursingHistory"); - this.FR200NursingHistory.id = ""; - } else if (hard) { - Taro.removeStorageSync("FR200NursingHistory"); - this.FR200NursingHistory.id = ""; + if (nowFR200NursingHistory) { + Taro.setStorageSync("FR200Echart", nowFR200NursingHistory); // 临时保存用于观看和调试 } + + Taro.removeStorageSync("FR200NursingHistory"); }; // todoPromise = () => { diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx index 42dacc4..cb7e993 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart/index.tsx @@ -14,10 +14,13 @@ interface Props { facialMaskConnectStatus: any; } + + function Index() { + const echartsRef = useRef(null); const option: EChartOption = { - + grid: { // 让图表占满容器 top: "28rpx", @@ -25,6 +28,13 @@ function Index() { right: "28rpx", bottom: "17rpx", }, + // legend: { + // itemStyle: { + // decal: { + // rotation: 90 + // } + // } + // }, xAxis: { // name: '', // nameGap: 5, @@ -251,12 +261,28 @@ function Index() { }; const level = [8, 7, 6, 5, 4, 3, 2]; + const full = () => { + let box = document.getElementById("box"); + box?.classList.add('fullscreen') + } + + // const quanping = () => { + // T.setPageOrientation({ + // orientation: "portrait", + // }); + + + // // taro.setPageOrientation({ + // // orientation: "landscape", + // // }); + + // }, return ( - + - + 实时能量 {level.map((item) => ( @@ -279,7 +305,7 @@ function Index() { 时间 - + ); } diff --git a/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx b/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx index 7420ae2..145ea9b 100644 --- a/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx +++ b/src/moduleIOT/pages/iotCarePlan/components/Echart_face/index.tsx @@ -9,48 +9,48 @@ import echarts from "@/utils/echarts.min.js"; import "./index.less"; interface Props { - Electricity: any; - matrixElectricity: any; - facialMaskConnectStatus: any; + Electricity: any; + matrixElectricity: any; + facialMaskConnectStatus: any; } function Index() { - - const echartsRef = useRef(null); - function generateColorArray(startColor, endColor, steps) { - var startRGB = hexToRgb(startColor); - var endRGB = hexToRgb(endColor); - var colors = []; - for (var i = 0; i < steps; i++) { - var r = interpolate(startRGB.r, endRGB.r, steps, i); - var g = interpolate(startRGB.g, endRGB.g, steps, i); - var b = interpolate(startRGB.b, endRGB.b, steps, i); - colors.push(rgbToHex(r, g, b)); + + const echartsRef = useRef(null); + function generateColorArray(startColor, endColor, steps) { + var startRGB = hexToRgb(startColor); + var endRGB = hexToRgb(endColor); + var colors = []; + for (var i = 0; i < steps; i++) { + var r = interpolate(startRGB.r, endRGB.r, steps, i); + var g = interpolate(startRGB.g, endRGB.g, steps, i); + var b = interpolate(startRGB.b, endRGB.b, steps, i); + colors.push(rgbToHex(r, g, b)); + } + return colors; } - return colors; -} -function hexToRgb(hex) { - var bigint = parseInt(hex.slice(1), 16); - var r = (bigint >> 16) & 255; - var g = (bigint >> 8) & 255; - var b = bigint & 255; - return { r: r, g: g, b: b }; -} + function hexToRgb(hex) { + var bigint = parseInt(hex.slice(1), 16); + var r = (bigint >> 16) & 255; + var g = (bigint >> 8) & 255; + var b = bigint & 255; + return { r: r, g: g, b: b }; + } -function rgbToHex(r, g, b) { - return ( - "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1) - ); -} + function rgbToHex(r, g, b) { + return ( + "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1) + ); + } -function interpolate(start, end, steps, count) { - return start + ((end - start) / steps) * count; -} + function interpolate(start, end, steps, count) { + return start + ((end - start) / steps) * count; + } -const startColor = "#FFFF00"; // 黄色 -const endColor = "#FF0000"; // 红色 -const steps = 80; // 80个颜色 + const startColor = "#FFFF00"; // 黄色 + const endColor = "#FF0000"; // 红色 + const steps = 80; // 80个颜色 const colors = generateColorArray(startColor, endColor, steps); @@ -98,274 +98,82 @@ const seriesData = [ color: '#999999', // 文字颜色 fontSize: 8 // 文字大小 }, - }, - axisTick: { - // alignWithLabel: true, - show: false, - interval: 9, - }, - // axisLine: { - // show: false, - // }, - }, - yAxis: [ - { - min: 0, - max: 80, - splitNumber: 10, - axisLabel: { - formatter: function (value, index) { - const num = value / 10 + 1 - return num === 9 ? '' : num + '级'; - }, - textStyle: { + }, + axisTick: { + // alignWithLabel: true, + show: false, + interval: 9, + }, + // axisLine: { + // show: false, + // }, + }, + yAxis: [ + { + min: 0, + max: 80, + splitNumber: 10, + axisLabel: { + formatter: function (value, index) { + const num = value / 10 + 1 + return num === 9 ? '' : num + '级'; + }, + textStyle: { color: '#999999', // 文字颜色 fontSize: 8 // 文字大小 }, - }, - type: "value", - splitLine: { + }, + type: "value", + splitLine: { lineStyle: { - color: ["#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#fff"], - type:'dashed' - }, - } - }, - ], - series: [ + color: ["#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#ccc", "#fff"], + type: 'dashed' + }, + } + }, + ], + series: [ - { - barCategoryGap:'0%', - data: seriesData, - type: "bar", - // barWidth: 15, - gapWidth: "0%", - itemStyle: { - normal: { - color: function (params) { - var value = params.data; - return new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: colors[parseInt(value)], // 红色 - }, - { - offset: 1, - color: colors[0], // 黄色 - }, - ]);; - }, - }, - }, - }, - ], - }; - // const option: EChartOption = { - // grid: { - // // 让图表占满容器 - // top: "28rpx", - // left: "18rpx", - // right: "28rpx", - // bottom: "17rpx", - // }, - // xAxis: [ - // { - // type: 'category', - // axisTick: { show: false }, - // data: ['2012', '2013', '2014', '2015', '2016'], - // axisLine: { - // show: false, - // }, - // axisLabel: { - // show: false, - // }, - - // } - // ], - // yAxis: { - // type: "value", - // min: 0, - // max: 8, - // splitNumber: 8, - // splitLine: { - // show: false, - // // lineStyle: { - // // color: "#cccccc", - // // type: [4, 2], - // // dashOffset: 4, - // // }, - // }, - // axisLine: { - // show: false, - // }, - // axisLabel: { - // show: false, - // }, - // axisTick: { - // show: false, - // }, - // }, - - // series: [ - // { barCategoryGap:'0%', - // name: 'Forest', - // type: 'bar', - // barGap: 0, - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'Steppe', - // type: 'bar', - // // label: labelOption, - // emphasis: { - // focus: 'series' - // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'Desert', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'Wetland', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'demo1', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'demo2', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'demo3', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'demo4', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { barCategoryGap:'0%', - // name: 'demo5', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // }, - // { - // color:'red', - // barCategoryGap:'0%', - // name: 'demo6', - // type: 'bar', - // // label: labelOption, - // // emphasis: { - // // focus: 'series' - // // }, - // data: [2, 4, 4, 5, 7] - // } - // ] - // // grid: { - // // // 让图表占满容器 - // // top: "28rpx", - // // left: "18rpx", - // // right: "28rpx", - // // bottom: "17rpx", - // // }, - // // xAxis: { - // // type: 'category', - // // // data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - // // show: false, - // // // axisLine: { - // // // show: false, - // // // }, - - // // }, - // // yAxis: { - // // type: "value", - // // min: 0, - // // max: 50, - // // splitNumber: 10, - // // splitLine: { - // // show: false, - // // // lineStyle: { - // // // color: "#cccccc", - // // // type: [4, 2], - // // // dashOffset: 4, - // // // }, - // // }, - // // axisLine: { - // // show: false, - // // }, - // // axisLabel: { - // // show: false, - // // }, - // // axisTick: { - // // show: false, - // // }, - // // }, - // // series: [ - // // { - // // data: [1, 6, 3, 4, 7, 6, 0,8, 0, 10, 11, 12, 13, 14,15, 16, 17, 18, 19, 20, 21,22, 23, 24, 25, 26, 27, 28,29, 30, 31, 32, 33, 34, 35,36], - // // type: 'bar', - // // barWidth:30, //设置柱子的宽度 - // // barGap:'100%', - // // barCategoryGap:'0%', - // // } - // // ] - // }; + { + barCategoryGap: '0%', + data: seriesData, + type: "bar", + // barWidth: 15, + gapWidth: "0%", + itemStyle: { + normal: { + color: function (params) { + var value = params.data; + return new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: colors[parseInt(value)], // 红色 + }, + { + offset: 1, + color: colors[0], // 黄色 + }, + ]);; + }, + }, + }, + }, + ], + }; + let arr = [2, 3, 4, 5, 6, 7] + return ( + + - const level = [8, 7, 6, 5, 4, 3, 2]; - let arr =[2,3,4,5,6,7] - return ( - - - - {/* + {/* */} - - - ); + + + ); } export default Index; 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 ( { return ( {name} - 待开发 + 请先绑定仪器 ); } diff --git a/src/pages/detect/detect.tsx b/src/pages/detect/detect.tsx index 73b9a75..dca2502 100644 --- a/src/pages/detect/detect.tsx +++ b/src/pages/detect/detect.tsx @@ -44,7 +44,7 @@ export default class Detect extends Component { return ( {name} - 待开发 + 请先绑定仪器 ); } diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index ebd2d01..e8a47d1 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -420,7 +420,7 @@ class Index extends Component { }; GetSiteAddTag = async (id) => { - go("/recoding/pages/moisture_test_report/moisture_test_report") + go("/recoding/pages/moisture_test_report/moisture_test_report"); let res = await GetSiteAddTag(id); if (res.data.code === 200) { console.log("点击自动上报,不需要逻辑处理"); @@ -441,7 +441,7 @@ class Index extends Component { msg("您已绑定所有设备"); return; } - go("/pages/instrument/instrument"); + go("/instrument/pages/instrument/instrument"); } }; @@ -493,7 +493,7 @@ class Index extends Component { const { url } = e.currentTarget.dataset; if (this.isRegister()) { - if (url === "/pages/instrument/instrument") { + if (url === "/instrument/pages/instrument/instrument") { let { data } = await InstrumentInfo.unbindingInstrumentInfoList(); console.log(data, "查看未绑定设备"); if (data.data.length === 0) { @@ -781,7 +781,7 @@ class Index extends Component { if (res.data.code === 200) { console.log("res.data.data", res.data.data); if (res.data.data.length > 0) { - go("/pages/instrument/intro??customBack=true&id=" + id); + go("/instrument/pages/instrument/intro??customBack=true&id=" + id); } else { this.bindingInstrumentList(); } @@ -840,8 +840,6 @@ class Index extends Component { // 跳转仪器介绍页 goNursing = (item) => { - console.log(item, "查看item"); - // 仅开发者工具调试使用 const platform = Taro.getSystemInfoSync().platform; setStorageSync("instrument_detail", item); @@ -851,7 +849,14 @@ class Index extends Component { if (platform === "devtools") { setStorageSync("instrument_detail", item); this.setState({ connectInstrument: item }); - setTimeout(() => this.goIot()); + if (item.type === 1) { + //非IOT + setTimeout(() => { + go("/instrument/pages/instrumentClickinUpload/index"); + }, 10); + } else { + setTimeout(() => this.goIot()); + } return; } @@ -879,7 +884,7 @@ class Index extends Component { if (this.state.connectInstrument.type === 1) { //非IOT setTimeout(() => { - go("/pages/instrumentClickinUpload/index"); + go("/instrument/pages/instrumentClickinUpload/index"); }, 10); } else { Taro.getSystemInfo({ @@ -1353,7 +1358,7 @@ class Index extends Component { 前往护理 { { 查看积分详情 - {/* - - - - 我的设备 - - - - - {userInfo.devicesNum} - 查看绑定设备详情 - - - - - 我的积分 - - - - - {userInfo.credit} - 查看积分详情 - - */} + {lastDay} 过期积分: {userInfo.expireCredit} diff --git a/src/pages/userInfo/userInfo.tsx b/src/pages/userInfo/userInfo.tsx index 7eb84b7..ecd42ff 100644 --- a/src/pages/userInfo/userInfo.tsx +++ b/src/pages/userInfo/userInfo.tsx @@ -267,7 +267,7 @@ class UserInfo extends Component { } let isInstrumentJump = Taro.getStorageSync("isInstrumentJump"); if (isInstrumentJump === "true") { - go("/pages/instrument/instrument"); + go("/instrument/pages/instrument/instrument"); } else { Taro.switchTab({ url: "/pages/user/user", diff --git a/src/recoding/pages/recording/recording.tsx b/src/recoding/pages/recording/recording.tsx index a667d79..246bb8c 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,9 @@ 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 = obj.updateTime + ? getdates(obj.updateTime) + : getdates(obj.createTime); obj.updateTime = updateTime && updateTime.replace(/-/g, "."); }); @@ -234,51 +233,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 +289,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; - case 3: - - this.three(item); break; + this.two(item); + break; + case 6: + this.three(item); + break; default: this.AllDevice(item); } @@ -314,26 +309,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); - - } + go("/recoding/pages/moisture_test_report/moisture_test_report"); + }; // 打开其他类型 AllDevice = async (item) => { - console.log('打开其他类型', item); + console.log("打开其他类型", item); go("/pages/face_report_AllDevice/face_report_AllDevice"); - - } + }; // 上传图片 handleChooseImage() { Taro.chooseMedia({ @@ -390,14 +389,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 +425,8 @@ export default class Recording extends Component { return ( - - + + { {current === 0 && ( - + { onClick={this.onChangeProduct.bind(this, item.id)} > - 画质抗老射频仪 + {item.name} ))} @@ -479,17 +477,17 @@ export default class Recording extends Component { {current === 0 && recordList.length === 0 && ( - + - 暂无数据 + 暂无数据 )} {current === 0 && ( - + {/* @@ -516,12 +514,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 +568,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 +639,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 +697,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",