diff --git a/package.json b/package.json index 1c4804b..115d2ad 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "author": "", "dependencies": { "@antmjs/vantui": "^3.2.2", - "@flossom-npm/iot-translater": "^1.0.14", - "@flossom-npm/iot-translater-we100": "^1.0.74", + "@flossom-npm/iot-translater": "^1.0.8", + "@flossom-npm/iot-translater-we100": "^1.0.66", "@reduxjs/toolkit": "^2.0.1", "@taroify/core": "^0.1.1-alpha.8", "@tarojs/components": "3.6.19", @@ -65,6 +65,7 @@ }, "devDependencies": { "@babel/core": "^7.8.0", + "@babel/runtime": "^7.7.7", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5", "@tarojs/cli": "3.6.19", "@tarojs/taro-loader": "3.6.19", @@ -86,11 +87,10 @@ "react-refresh": "^0.11.0", "stylelint": "9.3.0", "taro-plugin-compiler-optimization": "^1.0.4", + "terser-webpack-plugin": "^5.3.9", "thread-loader": "^4.0.2", "ts-node": "^10.9.1", "typescript": "^4.1.0", - "webpack": "^5.78.0", - "terser-webpack-plugin": "^5.3.9", - "@babel/runtime": "^7.7.7" + "webpack": "^5.78.0" } } diff --git a/src/app.config.ts b/src/app.config.ts index 1387ae3..a3ad8a5 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -17,6 +17,7 @@ export default defineAppConfig({ "pages/instrument_manage/index", "pages/instrument_detail/index", "pages/instrumentClickinUpload/index", + "pages/iotCarePlan/iotCarePlan", 'pages/privacyPolicy/privacyPolicy', 'pages/userPolicy/userPolicy', 'pages/about/about', @@ -28,6 +29,7 @@ export default defineAppConfig({ 'pages/template/template', 'pages/face_report/face_report', "pages/connection_help/connection_help", + "pages/errorpage/errorpage", ], "tabBar": { "custom": true, diff --git a/src/app.tsx b/src/app.tsx index 6d26623..610524b 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -8,7 +8,7 @@ import "./app.less"; import { Provider } from "react-redux"; import store from "./store"; -import './iconfont/iconfont.css' +import "./iconfont/iconfont.css"; import "taro-ui/rn/style/components/icon.scss"; import { go } from "./utils/traoAPI"; @@ -24,6 +24,7 @@ class App extends Component { return; } + // go("/pages/iotCarePlan/iotCarePlan"); // go("/pages/instrument_clickin_upload/index"); // go("/pages/instrument/intro"); // Taro.switchTab({ diff --git a/src/components/bluetoot/InstrumentTypeEnum.js b/src/components/bluetoot/InstrumentTypeEnum.js index 48bd86a..eef976a 100644 --- a/src/components/bluetoot/InstrumentTypeEnum.js +++ b/src/components/bluetoot/InstrumentTypeEnum.js @@ -1,10 +1,16 @@ const InstrumentTypeEnum = { //仪器类型 - FR200: 1, - MATRIX: 2, - WL200: 3, - FR380: 4, - FR390: 5, - M01: 6, + // FR200: 1, + // MATRIX: 2, + // WL200: 3, + // FR380: 4, + // FR390: 5, + // M01: 6, + FR200: "FR200", + MATRIX: "MATRIX", + WL200: "WL200", + FR380: "FR380", + FR390: "FR390", + M01: "M01", }; export default InstrumentTypeEnum; diff --git a/src/components/bluetoot/connection/index.tsx b/src/components/bluetoot/connection/index.tsx index 4b1eb5d..91e6a77 100644 --- a/src/components/bluetoot/connection/index.tsx +++ b/src/components/bluetoot/connection/index.tsx @@ -8,7 +8,10 @@ import DeviceConnectPopup from "../device-connection-popup/device-connection-pop /*** redux ***/ import { connect } from "react-redux"; -import { setBluetoothInfo } from "../../../store/features/deviceInfo"; +import { + setBluetoothInfo, + setDeviceId, +} from "../../../store/features/deviceInfo"; /*** redux end ***/ import { @@ -47,7 +50,7 @@ import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater import { showModal, msg } from "@/utils/traoAPI"; // const { InstrumentTypeEnum, OtaDeviceTypeEnum } = app.globalData; -import InstrumentTypeEnum from "../instrumentTypeEnum"; +import InstrumentTypeEnum from "../InstrumentTypeEnum"; import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum"; let isGetVersionTimer: any = null; @@ -67,7 +70,7 @@ let searchBluetootTimersNum = 0; // 搜索蓝牙秒数 let connectionTimer: any = null; // 连接蓝牙定时器 let connectionTimerNum = 0; -let sendPairingTimer: any = null; +let sendPairingTimer: any = null; // 发送配对 import "./index.less"; @@ -143,7 +146,7 @@ class ConnectionBluetoot extends Component { /** 开始连接 */ connection() { this.setState({ - isConnection: true, + isConnection: false, }); //初始化 蓝牙连接 this.bluetoothInit(); @@ -210,7 +213,7 @@ class ConnectionBluetoot extends Component { openBluetoothAdapter() { openBluetoothAdapter() .then((res) => { - console.info("openBluetoothAdapter res value =>", res); + console.log("openBluetoothAdapter res value =>", res); let { errno, errMsg } = res; if (errno == 0) { this.startBluetoothDevicesDiscovery(); @@ -233,7 +236,7 @@ class ConnectionBluetoot extends Component { this.close(); }); } else { - console.info("openBluetoothAdapter err value => ", err); + console.log("openBluetoothAdapter err value => ", err); this.failErrorCode(errno, errMsg); } }); @@ -295,7 +298,9 @@ class ConnectionBluetoot extends Component { // }; // let type = this.props.yiqiInfo.model || "FR200"; let type = "WE200"; - // console.info('搜索到到蓝牙设备 value => ', item.devices[0]?.name) + // this.props.yiqiInfo.model = type; + console.log("this.props.yiqiInfo.model", this.props.yiqiInfo.model); + console.info("搜索到到蓝牙设备 value => ", item.devices[0]?.name); for (let i = 0; i < item.devices.length; i++) { if ( item.devices[i].connectable && @@ -304,12 +309,18 @@ class ConnectionBluetoot extends Component { : item.devices[i].name ).indexOf(`${type}`) !== -1 ) { - console.info("连接的设备信息", item.devices[i], type); + console.log("连接的设备信息", item.devices[i], type); + let params = { + deviceId: item.devices[i].deviceId, + }; + this.props.setDeviceId(params); - clearInterval(searchBluetootTimers); - Taro.stopBluetoothDevicesDiscovery(); //停止搜索蓝牙 - // app.globalData.deviceInfo.deviceId = item.devices[i].deviceId; - this.createBLEConnection(); + setTimeout(() => { + clearInterval(searchBluetootTimers); + Taro.stopBluetoothDevicesDiscovery(); //停止搜索蓝牙 + // app.globalData.deviceInfo.deviceId = item.devices[i].deviceId; + this.createBLEConnection(); + }, 10); break; } } @@ -319,21 +330,23 @@ class ConnectionBluetoot extends Component { /** 5.新建蓝牙连接 */ async createBLEConnection() { console.log("========新建蓝牙连接========"); + this.setState({ isConnection: true }); // 开始蓝牙连接 try { await closeBLEConnection(this.props.bluetoothInfo.deviceId); } catch (e) {} clearTimeout(connectionTimer); const { yiqiInfo: deviceInfo } = this.props; + console.log( + "this.props.bluetoothInfo.deviceId", + this.props.bluetoothInfo.deviceId + ); /*********开始主动连接*******/ createBLEConnection(this.props.bluetoothInfo.deviceId) .then((res) => { + console.log("createBLEConnection", res); let { errno, errMsg } = res; if (errno == 0) { - if ( - deviceInfo.type == InstrumentTypeEnum.FR200 || - deviceInfo.type == InstrumentTypeEnum.FR380 || - deviceInfo.type == InstrumentTypeEnum.FR390 - ) { + if (deviceInfo.model === "WL200") { this.setState({ connectionStatus: true, }); @@ -358,24 +371,35 @@ class ConnectionBluetoot extends Component { /** 6.获取蓝牙特征值 */ getBLEDeviceServices() { + console.log("========6.获取蓝牙特征值========"); getBLEDeviceServices(this.props.bluetoothInfo.deviceId) .then((res) => { - let bluetoothInfo = this.props.bluetoothInfo; - bluetoothInfo.servicesuuid = res.servicesuuid; - bluetoothInfo.characteristicsuuid1 = res.characteristicsuuid1; - bluetoothInfo.characteristicsuuid0 = res.characteristicsuuid0; - this.props.setBluetoothInfo(bluetoothInfo); - this.notifyBLECharacteristicValueChange(); + console.log("特征值", res); + let params = { + deviceId: this.props.bluetoothInfo.deviceId, + servicesuuid: res.servicesuuid, + characteristicsuuid1: res.characteristicsuuid1, + characteristicsuuid0: res.characteristicsuuid0, + }; + + console.log("getBLEDeviceServices", params); + // 获取并修改蓝牙特征值 + this.props.setBluetoothInfo(params); + + setTimeout(() => { + this.notifyBLECharacteristicValueChange(); + }, 10); }) .catch((err) => { let { errno, errMsg } = err; - console.info("getBLEDeviceServices error =>", err); + console.log("getBLEDeviceServices error =>", err); this.failErrorCode(errno, errMsg); }); } /** 7.通知BLE特征值更改 */ notifyBLECharacteristicValueChange() { + console.log("7.通知BLE特征值更改"); const { yiqiInfo: deviceInfo } = this.props; const bluetoothInfo = this.props.bluetoothInfo; notifyBLECharacteristicValueChange({ @@ -387,240 +411,147 @@ class ConnectionBluetoot extends Component { .then((ress) => { let { errno, errMsg } = ress; if (errno == 0) { + // 订阅特征码变化 Taro.onBLECharacteristicValueChange((value) => { - console.info("onBLECharacteristicValueChange value => ", value); + // 配对成功进入? + console.log("onBLECharacteristicValueChange value => ", value); let str = ab2hex(value.value); //转为16进制字符串 + console.log("转为16进制字符串 str", str); let connectionStatus = [ - InstrumentTypeEnum.FR200, - InstrumentTypeEnum.WL200, - InstrumentTypeEnum.FR380, - InstrumentTypeEnum.FR390, - InstrumentTypeEnum.M01, - ].includes(Number(deviceInfo.type)); - const isFRDevice = [ - InstrumentTypeEnum.FR200, - InstrumentTypeEnum.FR380, - InstrumentTypeEnum.FR390, - ].includes(Number(deviceInfo.type)); - if (isFRDevice) { - this.setState({ - connectionStatus, - }); - log.info( - commandMap.reciviedBLECommand, - `仪器类型: ${deviceInfo.type}`, - value - ); - filterBleData(str).forEach((item) => { - console.log("设备响应数据===》", item); - if (item.indexOf(`dbf0a8010155`) !== -1) { - //配对成功 - log.info("蓝牙配对成功"); - clearInterval(sendPairingTimer); - this.setState({ islian: true }); - - console.log("获取设备版本号"); - this.sendGetVersion(); - sendgetversionTimer = setInterval(() => { - this.sendGetVersion(); - }, 1000); - } + "FR200", + "WL200", + "FR380", + "FR390", + "M01", + ].includes(deviceInfo.model); - if (item.indexOf("dbf0a0030b") !== -1) { - // 版本号获取成功 - clearInterval(sendgetversionTimer); - let v1 = String(hex2int(str.substring(10, 12))).padStart( - 2, - "0" - ); - let v2 = String(hex2int(str.substring(12, 14))).padStart( - 2, - "0" - ); - let v3 = String(hex2int(str.substring(14, 16))).padStart( - 2, - "0" - ); - let versionInfo = { - v1, - v2, - v3, - version: `${v1}${v2}${v3}`, - }; - this.setState({ versionInfo }); - console.log("版本号:" + versionInfo.version); - log.info( - commandMap.versionInfoCG, - `connection_guide, ${deviceInfo.type}:${versionInfo.version}` - ); - if ( - deviceInfo.type == InstrumentTypeEnum.FR380 || - deviceInfo.type == InstrumentTypeEnum.FR390 - ) { - console.log("跳转护理页"); - // this.triggerEvent("offlineChange", this.state); - this.offlineChange(this.state); - } else { - if (this.state.isgetoffline) { - // 获取离线记录 - console.log("获取离线记录(总)"); - this.sendofflistSummary(); - } else { - console.log("跳转护理页"); - // that.triggerEvent("offlineChange", this.state); - this.offlineChange(this.state); - } - } - } - - if (item.indexOf("dbf0a0020b") !== -1) { - //离线护理记录(总)获取成功 - // 先获取记录总条数,再获取详细 - console.log("获取离线记录总条数====>", item); - log.info( - commandMap.finishOfflineData, - `接收到总的离线记录=》${item}` - ); - // this.state.offlineDataindex = - // 7 || Number(item.substring(24, 2)); - let offlineDataindex = 7 || Number(item.substring(24, 2)); - this.setState({ offlineDataindex }); - if (this.state.offlineDataindex > 0) { - this.sendofflist(); - } else { - // this.triggerEvent("offlineChange", that.data); - this.offlineChange(this.state); - } - } - if (item.indexOf("dbf0a00211") !== -1) { - //设备响应离线护理记录(细) - log.info( - commandMap.finishOfflineData, - "接收到详细离线记录, 准备进入sendofflist" - ); - this.sendOfflistPost(str); - this.sendofflist(); - } - - if (item.indexOf("dbf0a001006dde") !== -1) { - // 同步时间 - // that.sendAsyncTime() - } - }); - } else { - let jsonStatus: any = null; - let querySubDeviceArrayBuffer; - if (deviceInfo.type == InstrumentTypeEnum.WL200) { - // querySubDeviceArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(bleCommandSamples.querySubDevice); - // jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(value.value); - jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); - querySubDeviceArrayBuffer = - deviceToolKitInstanceM01.toBleCommand( - bleCommandSamples.querySubDevice as any - ); // todo - } else if (deviceInfo.type == InstrumentTypeEnum.M01) { - jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); - querySubDeviceArrayBuffer = - deviceToolKitInstanceM01.toBleCommand( - bleCommandSamples.querySubDevice as any - ); - } - log.info( - commandMap.reciviedBLECommand, - `仪器类型: ${deviceInfo.type}`, - jsonStatus + let jsonStatus: any = null; + let querySubDeviceArrayBuffer; + if (deviceInfo.model == "WL200") { + // querySubDeviceArrayBuffer = + // deviceToolKitInstanceWL200.toBleCommand( + // bleCommandSamples.querySubDevice as any + // ); + // jsonStatus = deviceToolKitInstanceWL200.toJsonStatus( + // value.value + // ); + jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); + querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand( + bleCommandSamples.querySubDevice as any + ); // todo + } else if (deviceInfo.model == "M01") { + jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); + querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand( + bleCommandSamples.querySubDevice as any ); - if (jsonStatus?.commandType === "BleMatch") { - switch (jsonStatus?.bleCommandType) { - case "SendMatchCode": - if (jsonStatus.matchedSuccess) { - console.log("蓝牙配对成功"); - clearInterval(sendPairingTimer); - if (overTimer) clearTimeout(overTimer); - if (this.state.connectionSuccess) return; - this.setState({ - connectionSuccess: true, - connectionStatus, - }); - // 暂时不需要查询是否连接子设备, 直接进入查询版本信息 - this.detectVersionUpdate(); - /*if(deviceInfo.type == instrumentTypeEnum.M01) { + } + // log.info( + // commandMap.reciviedBLECommand, + // `仪器模式: ${deviceInfo.model}`, + // jsonStatus + // ); + console.log( + commandMap.reciviedBLECommand, + `仪器模式: ${deviceInfo.model}`, + jsonStatus + ); + console.log("jsonStatus", jsonStatus); + if (jsonStatus?.commandType === "BleMatch") { + switch (jsonStatus?.bleCommandType) { + case "SendMatchCode": + if (jsonStatus.matchedSuccess) { + console.log("BleMatch蓝牙配对成功"); + clearInterval(sendPairingTimer); + if (overTimer) clearTimeout(overTimer); + this.setState({ + connectionSuccess: true, + connectionStatus, + islian: true, // 不需要离线记录,但暂未完全删除这部分逻辑,所以直接设为true + }); + + this.pairingChange(this.state); // 临时添加,用于跳转 + // this.detectVersionUpdate(); // 获取升级信息 + // todo 连接成功需删除离线记录,暂时未缓存离线记录 + if (this.state.connectionSuccess) return; + // 暂时不需要查询是否连接子设备, 直接进入查询版本信息 + // this.detectVersionUpdate(); + /*if(deviceInfo.type == instrumentTypeEnum.M01) { this.detectVersionUpdate() } else { this.sendQuerySubDevice(querySubDeviceArrayBuffer) }*/ + } + break; + case "BleStatusSync": + if (jsonStatus.connectMessage?.connectType == "CONNECTED") { + switch (jsonStatus.connectMessage?.deviceName) { + case OtaDeviceTypeEnum.WE100: + case OtaDeviceTypeEnum.FACIALMASK: + console.log("面膜连上了 value => ", jsonStatus); + this.detectVersionUpdate(); + break; + case OtaDeviceTypeEnum.WL200: + console.log("面罩连上了 value => ", jsonStatus); + this.detectVersionUpdate(); + break; + default: + break; } - break; - case "BleStatusSync": - if (jsonStatus.connectMessage?.connectType == "CONNECTED") { - switch (jsonStatus.connectMessage?.deviceName) { - case OtaDeviceTypeEnum.WE100: - case OtaDeviceTypeEnum.FACIALMASK: - console.log("面膜连上了 value => ", jsonStatus); - this.detectVersionUpdate(); - break; - case OtaDeviceTypeEnum.WL200: - console.log("面罩连上了 value => ", jsonStatus); - this.detectVersionUpdate(); - break; - default: - break; - } - } - console.info("BleStatusSync value => ", jsonStatus); - break; - case "QueryMatchStatus": - console.info("QueryMatchStatus value => ", jsonStatus); - break; - default: - break; - } - } else if (jsonStatus?.commandType === "InfoQuery") { - switch (jsonStatus.infoQueryType) { - case "versionInfo": - if (this.state.hasVersionInfo) return; - clearTimeout(isGetVersionTimer); - this.setState({ - hasVersionInfo: true, // 已返回版本信息 - connectionStatus: true, - subDeviceConnectedStatus: true, - synchronousStatus: true, - }); - const deviceVersionNo = jsonStatus.versionNo; - const latestVersionNo = deviceInfo.iot_versions; - // const isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo) - // 判断是否需要升级 - // M01和WL200 不需要在这里进行蓝牙更新 - // if (isNeedToUpdateBl) { - // const pages = getCurrentPages(); - // const matchPageList = [{ - // route: 'pages/MatrixWL200/pages/index/index' - // },{ - // route: 'pages/MatrixM01/pages/index/index' - // }]; - // const hadOpen = checkSameKey(pages, matchPageList, 'route'); - // if (!hadOpen) { - // this.triggerEvent("pairingChange", { deviceVersionNo }); - this.pairingChange({ deviceVersionNo }); - // } - // } else { - // this.sendSyncRecording() - // } - break; - case "offlineClockSummary": - clearTimeout(isGetSyncRecordingTimer); - if (this.state.hasSyncRecord) return; - this.setState({ - hasSyncRecord: true, - synchronousStatus: true, - }); - console.info("offlineClockSummary value =>", jsonStatus); - // this.triggerEvent("pairingChange", this.state); - this.pairingChange(this.state); - // TODO 查询离线记录结果 - default: - break; - } + } + console.log("BleStatusSync value => ", jsonStatus); + break; + case "QueryMatchStatus": + console.log("QueryMatchStatus value => ", jsonStatus); + break; + default: + break; + } + } else if (jsonStatus?.commandType === "InfoQuery") { + console.log("查询版本信息", jsonStatus); + switch (jsonStatus.infoQueryType) { + case "versionInfo": + if (this.state.hasVersionInfo) return; + clearTimeout(isGetVersionTimer); + this.setState({ + hasVersionInfo: true, // 已返回版本信息 + connectionStatus: true, + subDeviceConnectedStatus: true, + synchronousStatus: true, + }); + const deviceVersionNo = jsonStatus.versionNo; + const latestVersionNo = deviceInfo.iot_versions; + // const isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo) + // 判断是否需要升级 + // M01和WL200 不需要在这里进行蓝牙更新 + // if (isNeedToUpdateBl) { + // const pages = getCurrentPages(); + // const matchPageList = [{ + // route: 'pages/MatrixWL200/pages/index/index' + // },{ + // route: 'pages/MatrixM01/pages/index/index' + // }]; + // const hadOpen = checkSameKey(pages, matchPageList, 'route'); + // if (!hadOpen) { + // this.triggerEvent("pairingChange", { deviceVersionNo }); + this.pairingChange({ deviceVersionNo }); + // } + // } else { + // this.sendSyncRecording() + // } + break; + case "offlineClockSummary": + clearTimeout(isGetSyncRecordingTimer); + if (this.state.hasSyncRecord) return; + this.setState({ + hasSyncRecord: true, + synchronousStatus: true, + }); + console.log("offlineClockSummary value =>", jsonStatus); + // this.triggerEvent("pairingChange", this.state); + this.pairingChange(this.state); + // TODO 查询离线记录结果 + default: + break; } } }); @@ -632,23 +563,21 @@ class ConnectionBluetoot extends Component { * type3 we100 * type4 FR380 */ - console.log("发送配对码"); - if (deviceInfo.type == InstrumentTypeEnum.FR200) { + console.log("发送配对码", deviceInfo.model); + if (deviceInfo.model == "FR200") { if (sendPairingTimer) clearInterval(sendPairingTimer); sendPairingTimer = setInterval(() => { this.sendPairingSignal(); }, 1000); - } else if ( - deviceInfo.type == InstrumentTypeEnum.WL200 || - deviceInfo.type == InstrumentTypeEnum.M01 - ) { + } else if (deviceInfo.model == "WL200" || deviceInfo.model == "M01") { if (sendPairingTimer) clearInterval(sendPairingTimer); sendPairingTimer = setInterval(() => { + console.log("test WL200"); this.sendPairingSignal(); }, 1000); } else if ( - deviceInfo.type == InstrumentTypeEnum.FR380 || - deviceInfo.type == InstrumentTypeEnum.FR390 + deviceInfo.model == "FR380" || + deviceInfo.model == "FR390" ) { if (sendPairingTimer) clearInterval(sendPairingTimer); sendPairingTimer = setInterval(() => { @@ -659,7 +588,7 @@ class ConnectionBluetoot extends Component { overTimer = setTimeout(() => { if (this.state.islian) { console.log("超时跳转护理页"); - log.info("超时跳转护理页"); + // log.info("超时跳转护理页"); // 已配对成功,其它操作导致超时未跳转则直接跳转 // this.triggerEvent("offlineChange", this.state); this.offlineChange(this.state); @@ -682,12 +611,9 @@ class ConnectionBluetoot extends Component { // 8.发送指令:获取仪器版本号 sendGetVersion() { const { yiqiInfo: deviceInfo } = this.props; - const isFRDevice = [ - InstrumentTypeEnum.FR200, - InstrumentTypeEnum.FR380, - InstrumentTypeEnum.FR390, - ].includes(Number(deviceInfo.type)); - log.info(commandMap.sendVersionCommand, `仪器:${deviceInfo.type}`); + const isFRDevice = ["FR200", "FR380", "FR390"].includes(deviceInfo.model); + // log.info(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`); + console.log(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`); if (isFRDevice) { writeBLECharacteristicValue({ //发送获取仪器版本号 @@ -701,7 +627,7 @@ class ConnectionBluetoot extends Component { // const otaDeviceType = deviceInfo.type == instrumentTypeEnum.WL200 ? OtaDeviceTypeEnum.WL200 : OtaDeviceTypeEnum.WE100; // 通过发箍连 都用we100 const otaDeviceType = - deviceInfo.type == InstrumentTypeEnum.WL200 + deviceInfo.model == InstrumentTypeEnum.WL200 ? OtaDeviceTypeEnum.WE100 : OtaDeviceTypeEnum.WE100; const versionCommand = { @@ -710,7 +636,7 @@ class ConnectionBluetoot extends Component { otaDeviceType, }; const value = - deviceInfo.type == InstrumentTypeEnum.WL200 + deviceInfo.model == InstrumentTypeEnum.WL200 ? deviceToolKitInstanceM01.toBleCommand(versionCommand as any) : deviceToolKitInstanceM01.toBleCommand(versionCommand as any); // const value = deviceInfo.type == instrumentTypeEnum.WL200 ? deviceToolKitInstanceWL200.toBleCommand(versionCommand) : deviceToolKitInstanceM01.toBleCommand(versionCommand); @@ -723,7 +649,7 @@ class ConnectionBluetoot extends Component { // log.info() if (this.state.offlineDataindex == this.state.offlineDataList.length) { console.log("离线记录获取完成"); - log.info(commandMap.finishOfflineData, this.state.offlineDataList); + // log.info(commandMap.finishOfflineData, this.state.offlineDataList); /**** * 发送同步时间 * ****/ @@ -738,7 +664,7 @@ class ConnectionBluetoot extends Component { return false; } console.log("发送获取离线记录(细)指令"); - log.info(commandMap.finishOfflineData, "发送获取离线记录(细)指令"); + // log.info(commandMap.finishOfflineData, "发送获取离线记录(细)指令"); writeBLECharacteristicValue({ //发送获取离线记录 deviceId: this.props.bluetoothInfo.deviceId, @@ -753,7 +679,7 @@ class ConnectionBluetoot extends Component { let str = "DBF0A00200"; console.log("发送离线记录汇总指令 ==》", str); this.setState({ offlineDataList: [] }); // 置空重查离线记录 - log.info(commandMap.finishOfflineData, `发送获取离线记录(总)指令`); + // log.info(commandMap.finishOfflineData, `发送获取离线记录(总)指令`); writeBLECharacteristicValue({ //发送获取离线记录 deviceId: this.props.bluetoothInfo.deviceId, @@ -764,18 +690,26 @@ class ConnectionBluetoot extends Component { }); } + /** 9.发送配对码 */ sendPairingSignal() { + console.log("9.发送配对码 sendPairingSignal"); const { yiqiInfo: deviceInfo } = this.props; - log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.type}发送匹配码`); + // log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`); + console.log(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`); let matchArrayBuffer: any = null; - switch (deviceInfo.type) { + switch (deviceInfo.model) { case InstrumentTypeEnum.FR200: matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand( bleCommandSamples.match as any ); break; case InstrumentTypeEnum.WL200: - matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand( + // console.log("WL200无法配对,只能用M01"); + console.log("正在发送WL200", bleCommandSamples.match); + // matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand( + // bleCommandSamples.match as any + // ); + matchArrayBuffer = deviceToolKitInstanceM01.toBleCommand( bleCommandSamples.match as any ); break; @@ -805,15 +739,17 @@ class ConnectionBluetoot extends Component { default: break; } - if (matchArrayBuffer) - sendCommand({ value: matchArrayBuffer }) - .then(() => {}) - .catch((e) => { - // 下发配对指令失败,走重连操作 - clearInterval(sendPairingTimer); - // wx.closeBLEConnection(); - this.createBLEConnection(); - }); + if (matchArrayBuffer) console.log("matchArrayBuffer", matchArrayBuffer); + sendCommand({ value: matchArrayBuffer }) + .then((res) => { + console.log("matchArrayBuffer res", res); + }) + .catch((e) => { + // 下发配对指令失败,走重连操作 + clearInterval(sendPairingTimer); + // wx.closeBLEConnection(); + this.createBLEConnection(); + }); } /** 发送记录 */ @@ -891,7 +827,7 @@ class ConnectionBluetoot extends Component { errorCode(errno, errMsg) { clearInterval(searchBluetootTimers); clearInterval(sendgetversionTimer); - console.info("errorCode err => ", errno, errMsg); + // console.info("errorCode err => ", errno, errMsg); if (errno == 10001 || errno == 10009) { let t2 = errno == 10001 @@ -965,10 +901,11 @@ class ConnectionBluetoot extends Component { } failErrorCode(errno, errMsg) { - console.info("failErrorCode err => ", errno, errMsg); + console.log("failErrorCode err => ", errno, errMsg); clearInterval(searchBluetootTimers); clearInterval(sendgetversionTimer); - log.info("连接仪器失败", errno, errMsg); + // log.info("连接仪器失败", errno, errMsg); + console.log("连接仪器失败", errno, errMsg); let errorText = ""; switch (errno) { case 1500101: @@ -1071,6 +1008,8 @@ class ConnectionBluetoot extends Component { // this.sendSyncRecording() // }, 5000); } + + /** 发送同步记录 */ sendSyncRecording() { const { yiqiInfo: deviceInfo } = this.props; const versionCommand = { @@ -1078,7 +1017,7 @@ class ConnectionBluetoot extends Component { infoQueryType: "offlineClockSummary", }; const value = - deviceInfo.type == InstrumentTypeEnum.WL200 + deviceInfo.model == InstrumentTypeEnum.WL200 ? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any) : deviceToolKitInstanceM01.toBleCommand(versionCommand as any); sendCommand({ value }).then(); @@ -1100,6 +1039,11 @@ class ConnectionBluetoot extends Component { this.props.confirm("confirm"); }; + onReconnect = () => { + console.log("onReconnect"); + // this.props.confirm("confirm"); + }; + pairingChange = (data) => { this.props.pairingChange(data); }; @@ -1109,17 +1053,21 @@ class ConnectionBluetoot extends Component { }; render() { - let { name, isConnection, connectionStatus } = this.state; + let { name, isConnection, connectionStatus, connectionSuccess, error } = + this.state; let { yiqiInfo } = this.props; return ( {name} @@ -1135,5 +1083,8 @@ const mapDispatchToProps = (dispatch) => ({ setBluetoothInfo(data) { dispatch(setBluetoothInfo(data)); }, + setDeviceId(data) { + dispatch(setDeviceId(data)); + }, }); export default connect(mapStateToProps, mapDispatchToProps)(ConnectionBluetoot); diff --git a/src/components/bluetoot/connection/test.js b/src/components/bluetoot/connection/test.js index 6e2df78..0c6ec0f 100644 --- a/src/components/bluetoot/connection/test.js +++ b/src/components/bluetoot/connection/test.js @@ -1,66 +1,66 @@ /**蓝牙命令合集*/ export const bleCommandSamples = { - /**发送配对码*/ - match: { - commandType: "BleMatch", - bleCommandType: "SendMatchCode", - }, - /**查询附属设备的配对状态*/ - querySubDevice: { - commandType: "BleMatch", - bleCommandType: "QueryMatchStatus", - }, - /**查询设备状态指令*/ - queryDeviceStatus: { - commandType: "DeviceStatusSync", - deviceSyncCommandType: 'queryDeviceStatus' - }, - /**查询版本指令*/ - queryDeviceVersionStatus: { - commandType: "InfoQuery", - infoQueryType: 'versionInfo', - otaDeviceType: '' - }, - /**查询当前记录*/ - queryCurrentMaskReportInfo: { - commandType: "InfoQuery", - infoQueryType: 'currentMaskReportInfo' - } + /**发送配对码*/ + match: { + commandType: "BleMatch", + bleCommandType: "SendMatchCode", + }, + /**查询附属设备的配对状态*/ + querySubDevice: { + commandType: "BleMatch", + bleCommandType: "QueryMatchStatus", + }, + /**查询设备状态指令*/ + queryDeviceStatus: { + commandType: "DeviceStatusSync", + deviceSyncCommandType: "queryDeviceStatus", + }, + /**查询版本指令*/ + queryDeviceVersionStatus: { + commandType: "InfoQuery", + infoQueryType: "versionInfo", + otaDeviceType: "", + }, + /**查询当前记录*/ + queryCurrentMaskReportInfo: { + commandType: "InfoQuery", + infoQueryType: "currentMaskReportInfo", + }, }; /**控制设备命令合集*/ export const deviceCommandSamples = { - /**控制设备暂停 pause暂停 working启动 end关闭*/ - pause:{ - commandType: "DeviceControl", - workStatus: "pause", - }, - standby:{ - commandType: "DeviceControl", - workStatus: "standby", - }, - end:{ - commandType: "DeviceControl", - workStatus: "end", - }, - /* - * powerfulSoothing 强效舒缓 01 - * Stability 维稳维护 02 - * Brighten 均色提亮 03 - * FirmSkin 紧致淡纹 04 - * Custom 自定义模式 05 - * WaterLightEssence 水光精华模式 11 - * ShapeBeautyEssence 塑颜精华模式 12 - * DiyFacial DIY面膜模式 13 - * FacialMaskCustom 面膜定制模式 1A - */ - work:{ - commandType: "DeviceControl", - workStatus: "working", - workMode: "", - }, - gear:{ - commandType: "DeviceControl", - partitionStatus: [{gear: 1},{gear: 1},{gear: 1},{gear: 1},] - } + /**控制设备暂停 pause暂停 working启动 end关闭*/ + pause: { + commandType: "DeviceControl", + workStatus: "pause", + }, + standby: { + commandType: "DeviceControl", + workStatus: "standby", + }, + end: { + commandType: "DeviceControl", + workStatus: "end", + }, + /* + * powerfulSoothing 强效舒缓 01 + * Stability 维稳维护 02 + * Brighten 均色提亮 03 + * FirmSkin 紧致淡纹 04 + * Custom 自定义模式 05 + * WaterLightEssence 水光精华模式 11 + * ShapeBeautyEssence 塑颜精华模式 12 + * DiyFacial DIY面膜模式 13 + * FacialMaskCustom 面膜定制模式 1A + */ + work: { + commandType: "DeviceControl", + workStatus: "working", + workMode: "", + }, + gear: { + commandType: "DeviceControl", + partitionStatus: [{ gear: 1 }, { gear: 1 }, { gear: 1 }, { gear: 1 }], + }, }; diff --git a/src/components/bluetoot/device-connection-popup/device-connection-popup.less b/src/components/bluetoot/device-connection-popup/device-connection-popup.less index a30d7f1..2d6f098 100644 --- a/src/components/bluetoot/device-connection-popup/device-connection-popup.less +++ b/src/components/bluetoot/device-connection-popup/device-connection-popup.less @@ -1,4 +1,11 @@ -.site-popup-content-box { +.common-box { + width: 670rpx; + box-sizing: border-box; +} +.device-connection-box { + height: 1150rpx; +} +.device-popup-content-box { margin: 0; } // .van-popup { @@ -33,17 +40,6 @@ box-sizing: border-box; } -.upload-tips-common-box { - padding: 50rpx 20rpx 44rpx 20rpx; - .tips-message { - margin-top: 30rpx; - text-align: center; - font-size: 28rpx; - line-height: 45rpx; - color: #666; - } -} - .popup-btn-one { display: flex; margin-top: 60rpx; @@ -62,3 +58,65 @@ font-family: PingFang SC; } } + +.block, +.block2 { + display: flex; + align-items: center; + position: relative; + width: 100%; + box-sizing: border-box; + display: flex; + // column-gap: 30rpx; + // padding-top: 10px; + margin: 0 auto 10px; + text-align: center; + .icon { + /* margin-top: 5rpx; */ + width: 36rpx; + min-width: 36rpx; + height: 36rpx; + image { + width: 100%; + height: 100%; + vertical-align: middle; + } + } +} +.block { + margin-top: 80rpx; +} +.block2 { + margin-top: 40rpx; +} + +.images, +.videos { + display: block; + width: 600rpx; + height: 600rpx; + border-radius: 30rpx; + // width: 100%; + // height: 100%; + overflow: hidden; +} + +.error-block { + display: block; + text-align: center; + color: #030000; + .tip1 { + margin-top: 80rpx; + font-size: 28rpx; + font-weight: 400; + } + .tip2 { + margin-top: 40rpx; + font-size: 28rpx; + font-weight: 400; + } +} + +.device-popup-btns { + margin-top: 60rpx; +} diff --git a/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx b/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx index 953791c..15bd8bb 100644 --- a/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx +++ b/src/components/bluetoot/device-connection-popup/device-connection-popup.tsx @@ -30,7 +30,6 @@ export default class DeviceConnectPopup extends Component { super(props); this.state = { name: "蓝牙提示弹窗", - current: 0, toRight: false, isClick: false, }; @@ -60,14 +59,32 @@ export default class DeviceConnectPopup extends Component { this.props.confirm(); }; + onReconnect = () => { + this.props.reconnect(); + }; + onClickStop = (e) => { e.stopPropagation(); }; + isImage = (url) => { + if (url) { + if (url.includes(".mp4")) { + return false; + } + } + return true; + }; + render() { - let { isShow, data, isLarge, title, connectionStatus, isConnection } = - this.props; - let { current } = this.state; + let { + isShow, + data, + // connectionStatus, + isConnection, + connectionSuccess, + error, + } = this.props; return ( @@ -84,72 +101,123 @@ export default class DeviceConnectPopup extends Component { className="at-icon at-icon-close site-close" onClick={this.onClose} > - - - {data.bluetoothConnectingTitle} - - - ); diff --git a/src/components/popup/popup-countdown.less b/src/components/popup/popup-countdown.less new file mode 100644 index 0000000..5b33adf --- /dev/null +++ b/src/components/popup/popup-countdown.less @@ -0,0 +1,79 @@ +.countdown-box { + width: 400rpx; + height: 400rpx; + padding: 0; + .countdown-title { + margin-top: 52rpx; + margin-bottom: 60rpx; + font-size: 36rpx; + font-family: PingFang SC; + font-weight: bold; + color: #030000; + line-height: 60rpx; + } + .countdown-content { + display: flex; + justify-content: center; + } +} + +.countdown-popup-loading { + position: relative; +} + +.countdown-popup-loading-time { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 50rpx; + height: 50rpx; + line-height: 50rpx; + margin: auto; + font-size: 54rpx; + text-align: center; + color: #ecf0f3; + font-weight: bold; +} + +.ui-loading__bg { + position: relative; + width: 160rpx; + height: 160rpx; + border-radius: 50%; + background-color: #ecf0f3; + /* background-image: conic-gradient(#3CACFF 100%,#000 0%); */ +} +.ui-loading__bg::before { + content: ""; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + width: 140rpx; + height: 140rpx; + border-radius: 50%; + background-color: #fff; +} + +.ui-loading { + position: absolute; + width: 160rpx; + height: 160rpx; + border-radius: 50%; + background: transparent; + box-sizing: border-box; + border: 10rpx solid #3cacff; + clip-path: polygon(0% 0%, 25% 0%, 50% 50%, 0% 25%); + animation: rotate 1s linear infinite; +} + +@keyframes rotate { + from { + transform: rotateZ(0deg); + } + to { + transform: rotateZ(360deg); + } +} diff --git a/src/components/popup/popup-countdown.tsx b/src/components/popup/popup-countdown.tsx new file mode 100644 index 0000000..4b93551 --- /dev/null +++ b/src/components/popup/popup-countdown.tsx @@ -0,0 +1,96 @@ +import classnames from "classnames"; +import { Component } from "react"; + +import { Block, View, PageMeta } from "@tarojs/components"; + +import { Popup } from "@antmjs/vantui"; + +import "./popup.less"; +import "./popup-countdown.less"; + +/** props + * isShow 是否显示 + * isClose 右上角关闭图标 + * type: 1注册 + * @confirm 关闭回调 + */ +export default class PopupCountdown extends Component { + constructor(props) { + super(props); + this.state = { + name: "倒计时", + }; + } + + async onLoad() {} + componentDidMount() {} + + componentWillUnmount() {} + + componentDidShow() {} + + componentDidHide() {} + + async initData() {} + + onClose = () => { + this.props.close(); + }; + + onConfirm = () => { + this.props.confirm(); + }; + + onClickStop = (e) => { + e.stopPropagation(); + }; + + render() { + let { isShow, isClose, countdown } = this.props; + return ( + + + + {isClose && ( + + )} + + + 启动倒计时 + + + + + + + + {countdown >= 0 && ( + + {countdown} + + )} + + + + + + + ); + } +} diff --git a/src/components/popup/popup-instrument-upload-tips.tsx b/src/components/popup/popup-instrument-upload-tips.tsx index f29a017..35c6abc 100644 --- a/src/components/popup/popup-instrument-upload-tips.tsx +++ b/src/components/popup/popup-instrument-upload-tips.tsx @@ -153,12 +153,7 @@ export default class PopupInstrumentUploadTips extends Component { mode="aspectFit" > - - {item.message} - {item.message} - {item.message} - {item.message} - + {item.message} ); })} diff --git a/src/components/popup/popup-step-tips.less b/src/components/popup/popup-step-tips.less new file mode 100644 index 0000000..804bad4 --- /dev/null +++ b/src/components/popup/popup-step-tips.less @@ -0,0 +1,98 @@ +.step-popup-content-box { + margin: 0; +} +.step-absolutely { + width: 600rpx; + height: 720rpx; + text-align: left; + margin: 0 auto; +} +.step-img { + display: block; + width: 600rpx; + height: 600rpx; + border-radius: 30rpx; +} +// .van-popup { +// background-color: transparent; +// } +.site-close { + position: absolute; + right: 36rpx; + top: 36rpx; + color: #fff; + font-size: 36rpx; + z-index: 100009; + background-color: #ababab; + border-radius: 50%; + padding: 8rpx; + box-sizing: border-box; +} + +.step-popup-btn { + position: absolute; + bottom: 100rpx; + left: calc(50% - 120rpx); + width: 240rpx; + height: 70rpx; + line-height: 70rpx; + font-size: 28rpx; + text-align: center; + border: 1rpx solid #000; + border-radius: 40rpx; + background-color: #000; + color: #fff; + box-sizing: border-box; +} + +.step-tips-common-box { + padding: 50rpx 35rpx 74rpx 35rpx; + .tips-message { + margin-top: 70rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: #030000; + line-height: 60rpx; + } +} + +.popup-btn-one { + display: flex; + margin-top: 60rpx; + justify-content: center; + .popup-btn { + width: 270rpx; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; + font-weight: 500; + text-align: center; + border: 1rpx solid #000; + border-radius: 45rpx; + color: #fff; + background-color: #000; + font-family: PingFang SC; + } +} + +.setp-footer-btn { + display: flex; + justify-content: center; + align-items: center; + text-align: center; + height: 30rpx; + // padding: 10rpx; + margin-top: 50rpx; + .checked { + width: 30rpx; + height: 30rpx; + margin-right: 26rpx; + } + .text { + font-family: PingFang SC; + font-size: 28rpx; + color: #666; + font-weight: 400; + } +} diff --git a/src/components/popup/popup-step-tips.tsx b/src/components/popup/popup-step-tips.tsx new file mode 100644 index 0000000..6af9936 --- /dev/null +++ b/src/components/popup/popup-step-tips.tsx @@ -0,0 +1,214 @@ +import classnames from "classnames"; +import Taro from "@tarojs/taro"; +import { Component } from "react"; + +import { + Block, + View, + Image, + Text, + Button, + PageMeta, + Swiper, + SwiperItem, +} from "@tarojs/components"; + +import { Popup } from "@antmjs/vantui"; + +import "./popup.less"; +import "./popup-step-tips.less"; +import "./fade.css"; + +import { go } from "../../utils/traoAPI"; + +/** props + * isLarge 是否大尺寸 + * isShow 是否显示 + * data 数据 + * title 动态标题 + * confirmButtonText 确定关闭按钮 + * @confirm 关闭回调 + * ***/ +export default class PopupStepTips extends Component { + constructor(props) { + super(props); + this.state = { + name: "步骤介绍弹窗", // 当前IOT使用 + current: 0, + isLocal: false, // 是否缓存关闭,以后不再显示准备步骤 + }; + } + + async onLoad() {} + componentDidMount() {} + + componentWillUnmount() {} + + componentDidShow() {} + + componentDidHide() {} + + initData = () => { + if (this.props.siteData) { + let arr = JSON.parse(JSON.stringify(this.props.siteData)); + this.setState({ siteList: arr }); + } + }; + + onClose = () => { + let { isLocal } = this.state; + this.props.close({ isLocal }); + }; + + onClickStop = (e) => { + e.stopPropagation(); + }; + + // onChange(event) { + // const current = event.detail.current; + // const { current: curCurrent } = this.state; + // const { siteData } = this.props; + // if (curCurrent + 2 === siteData.length && current + 1 === siteData.length) { + // this.setState({ toRight: true }); + // } + // this.setState({ current }); + // } + + onPrev = async () => { + let { current } = this.state; + this.setState({ current: current - 1 }); + }; + onNext = async () => { + let { current } = this.state; + + if (current === this.props.data.length) { + this.onClose(); + } else { + this.setState({ current: current + 1 }); + } + }; + + onChangeLocal = () => { + let { isLocal } = this.state; + this.setState({ isLocal: !isLocal }); + }; + + render() { + let { isShow, data, isLarge, title, content, confirmButtonText } = + this.props; + let { current, isLocal } = this.state; + + return ( + + + + + + + {data[current].openTitle} + + {/* {title && ( + + {title} + + )} */} + + + {data.map((item, index) => { + return ( + + + + + {item.openContent} + + ); + })} + + + + + {data.length === 1 && ( + + + + )} + {data.length > 1 && current === 0 && ( + + + + )} + {data.length > 1 && ( + + + + + )} + + + + {isLocal ? ( + + ) : ( + + )} + + 以后不再提示准备步骤 + + + + + ); + } +} diff --git a/src/img/iot/mode-switch.png b/src/img/iot/mode-switch.png new file mode 100644 index 0000000..5aee737 Binary files /dev/null and b/src/img/iot/mode-switch.png differ diff --git a/src/img/mute_icon.png b/src/img/iot/mute_icon.png similarity index 100% rename from src/img/mute_icon.png rename to src/img/iot/mute_icon.png diff --git a/src/img/over_nurse.png b/src/img/iot/over_nurse.png similarity index 100% rename from src/img/over_nurse.png rename to src/img/iot/over_nurse.png diff --git a/src/img/pause_nurse.png b/src/img/iot/pause_nurse.png similarity index 100% rename from src/img/pause_nurse.png rename to src/img/iot/pause_nurse.png diff --git a/src/img/start_nurse.png b/src/img/iot/start_nurse.png similarity index 100% rename from src/img/start_nurse.png rename to src/img/iot/start_nurse.png diff --git a/src/img/start_nurse_off.png b/src/img/iot/start_nurse_off.png similarity index 100% rename from src/img/start_nurse_off.png rename to src/img/iot/start_nurse_off.png diff --git a/src/img/volume_icon.png b/src/img/iot/volume_icon.png similarity index 100% rename from src/img/volume_icon.png rename to src/img/iot/volume_icon.png diff --git a/src/img/welcome/no-checked.png b/src/img/welcome/no-checked.png new file mode 100644 index 0000000..703e0c8 Binary files /dev/null and b/src/img/welcome/no-checked.png differ diff --git a/src/pages/errorpage/error.txt b/src/pages/errorpage/error.txt deleted file mode 100644 index 3f5e700..0000000 --- a/src/pages/errorpage/error.txt +++ /dev/null @@ -1,2 +0,0 @@ -错误类型收集 -MiniProgramError 页面跳转错误 \ No newline at end of file diff --git a/src/pages/errorpage/errorpage.js b/src/pages/errorpage/errorpage.js deleted file mode 100644 index 04e6a32..0000000 --- a/src/pages/errorpage/errorpage.js +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: "模板页", -}); diff --git a/src/pages/errorpage/errorpage.tsx b/src/pages/errorpage/errorpage.tsx index 8a3202c..22686b6 100644 --- a/src/pages/errorpage/errorpage.tsx +++ b/src/pages/errorpage/errorpage.tsx @@ -8,7 +8,7 @@ import Navbar from "../../components/navbar/navbar"; import "./errorpage.less"; -export default class Index extends Component { +export default class ErrorPage extends Component { constructor(props) { super(props); this.state = { @@ -31,7 +31,7 @@ export default class Index extends Component { return ( - + 网络出错,再试一次看看 diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index d9dcbab..f598ffc 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -484,6 +484,7 @@ class Index extends Component { } }; + /** 查询是否可以绑定 */ isBindingSerial = async () => { Taro.showLoading({ title: "请求中...", @@ -503,7 +504,7 @@ class Index extends Component { } Taro.hideLoading(); }; - // 绑定仪器 + /** 调用接口绑定仪器 */ bindingInstrument = async () => { Taro.showLoading({ title: "请求中...", @@ -573,35 +574,28 @@ class Index extends Component { goNursing = (item) => { console.log("goNursing", item); setStorageSync("instrument_detail", JSON.stringify(item)); - // setStorageSync("connectInstrument", JSON.stringify(item)); - - // this.setState({ instrument_detail: item }); - // this.setState({ connectInstrument: item }); - // setTimeout(() => this.bindBlockLeft()); - // isConnectShow - setTimeout(() => { - go("/pages/instrumentClickinUpload/index?id=" + item.id); - }, 10); - // go("/pages/instrument/intro?id=" + item.id); + this.setState({ connectInstrument: item }); + setTimeout(() => this.bindBlockLeft()); }; /* 扫码进入逻辑 */ /** 蓝牙逻辑 */ bindBlockLeft() { - console.log("this.state.userinfo", this.state.userinfo); - if (!this.state.userinfo.mobile) { + if (!this.state.isRegisterBoolean) { //未注册授权 this.alertRegister(); return false; } if (this.state.connectInstrument.type === 1) { //非IOT + setTimeout(() => { + go("/pages/instrumentClickinUpload/index"); + }, 10); } else { Taro.getSystemInfo({ success: (res) => { console.log("getSystemInfo", res); this.setState({ isConnectShow: true }); - return; let { locationEnabled, locationAuthorized, bluetoothEnabled } = res; if (!locationEnabled || !locationAuthorized) { showModal({ @@ -630,97 +624,18 @@ class Index extends Component { * WE100,WL200配对完成回调 */ async pairingChange(e) { - console.log("epairingChange", e); - return; - const { connectInstrument } = this.state; - let latestVersionNo, isNeedToUpdateBl; - //当前版本号 - const deviceVersionNo = e.detail.deviceVersionNo; - console.info("配对完成回调", e, deviceVersionNo); - //最新版本号 - latestVersionNo = connectInstrument.iot_versions; - //TODO 这些信息需要放在WL200的接口里,现在没有。 暂时的方案,如果是WL200 需要查WE200的相关信息 - if (connectInstrument.type == instrumentTypeEnum.WL200) { - this.pureData.mianmo_id = app.globalData.bindinfo.mianmo_id; - const { data: resData } = await InstrumentInfo({ - id: this.pureData.mianmo_id, - }); - // if (resData) {} - // const mianmo_item = this.data.instruments.find(item=>{ - // return this.pureData.mianmo_id == item.id; - // }) - // if (mianmo_item) { - // const {iot_versions,type} = mianmo_item - // this.pureData.mianmo_iot_versions = iot_versions; - // this.pureData.mianmo_type = type; - // latestVersionNo = iot_versions - // } - // const {data: resData} = await UserInstrumentInfo({id: this.pureData.mianmo_id}); - if (resData.code == 200) { - const { data } = resData; - const { iot_versions, type } = data.info; - this.pureData.mianmo_iot_versions = iot_versions; - this.pureData.mianmo_type = type; - latestVersionNo = iot_versions; - } - isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo); - console.log( - `设备版本号: ${deviceVersionNo}`, - `后台版本号: ${latestVersionNo}`, - `是否需要升级: ${isNeedToUpdateBl}` - ); - // 2023.11.29 18:00 经与黄工讨论, 后续版本暂时都需要进行强更 - // this.gotoOta(); - // return - if (isNeedToUpdateBl) { - this.gotoOta(); - return; - this.setData({ - params: "offlineDialog", - offlineDialogType: 2, - otaDeviceName: "skinpilot", - }); - return; - } - go(`/pages/MatrixWL200/pages/index/index?devId=${connectInstrument.id}`); - this.setData({ - params: "", - }); - } else if (connectInstrument.type == instrumentTypeEnum.M01) { - isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo); - console.log( - `设备版本号: ${deviceVersionNo}`, - `后台版本号: ${latestVersionNo}`, - `是否需要升级: ${isNeedToUpdateBl}` - ); - if (isNeedToUpdateBl) { - // 2023.11.17 22:00 经与黄工讨论, 后续版本暂时都需要进行强更 - this.gotoOta(); - return; - this.setData({ - params: "offlineDialog", - offlineDialogType: 2, - otaDeviceName: "skinpilot", - offlineDialogForce: 1, - }); - return; - } - go( - `/pages/MatrixM01/pages/index/index?devId=${this.data.connectInstrument.id}` - ); - // this.setData({ - // params: "", - // }); - } + console.log("===epairingChange===》", e); + go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 + // return; } //连接完成时数据的回调 offlineChange = async (e) => { - const that = this; - log.info( - commandMap.versionInfoHome, - `offlineChange::e::${JSON.stringify(e)}` - ); + console.log("offlineChange", e); + // log.info( + // commandMap.versionInfoHome, + // `offlineChange::e::${JSON.stringify(e)}` + // ); //offlineDataList 离线数据 //versioninfo 版本号 let { offlineDataList, versionInfo } = e.detail; @@ -819,196 +734,6 @@ class Index extends Component { } }); console.log(offlinelist); - let nowyear = new Date().getFullYear(); - let nowmonth = String(new Date().getMonth() + 1).padStart(2, "0"); - let nowday = String(new Date().getDate()).padStart(2, "0"); - // await IOTHistorySynchronization({ - // //把离线数据同步到后台 - // instrument_id: app.globalData.bindid, - // clock_times: offlinelist, - // }); - // offlinelist.map((item, index) => { - // // console.log(new Date(item.clock_day.replace(/-/g,'/')).getTime()) - // if (item.clock_day == `${nowyear}-${nowmonth}-${nowday}`) { - // //今日有离线护理 弹出 检测到您今天已进行护理,是否跳过护理直接前往打卡,或选择继续进行护理 - // if (item.second >= this.data.connectInstrument.times * 60) { - // console.log("今日有离线护理"); - // let screneList2 = { - // lianbuobj: { - // fen: String(s_to_h(item.model_face_use)).padStart("2", 0), - // miao: String(s_to_s(item.model_face_use)).padStart("2", 0), - // total: item.model_face_use, - // }, - // yanbuobj: { - // fen: String(s_to_h(item.model_eye_use)).padStart("2", 0), - // miao: String(s_to_s(item.model_eye_use)).padStart("2", 0), - // total: item.model_eye_use, - // }, - // ledobj: { - // fen: 0, - // miao: 0, - // total: 0, - // }, - // }; - // this.setData({ - // screneList2, - // }); - - // let screneList3 = { - // second: item.second, //总秒 - // screne_id: "", //场景id - // screne_name: "离线记录", //场景名称 - // model_face_ward: item.model_face_ward, //脸部场景档位 - // model_face_use: item.model_face_use, //脸部场景使用时长 - // model_face_type: "", //脸部模式类型 - // model_eye_ward: item.model_eye_ward, //眼部场景档位 - // model_eye_use: item.model_eye_use, //眼部场景使用时长 - // model_eye_type: "", //眼部模式类型 - // }; - - // /** - // * 如果今天有打过卡,需要累加 - // */ - // // if (this.data?.todayclockin?.id) { - // // screneList3.second += this.data.todayclockin.clock_info[0].second - // // screneList3.model_face_use += this.data.todayclockin.clock_info[0].model_face_use - // // screneList3.model_eye_use += this.data.todayclockin.clock_info[0].model_eye_use - // // } - // // - // // console.log(this.data.todayclockin) - // this.setData({ - // screneList3, - // }); - // console.log(this.data.screneList3, "2222222222222222222"); - - // this.setData({ - // params: "offlineDialog", - // offlineDialogType: 1, - // todayofflineData: item, - // }); - // } - // } - // }); - - // if (this.data.params == "connection_guide") { - // // this.setData({ - // // params: 'offlineDialog', - // // offlineDialogType:2 - // // }) - // console.log("设备版本号" + versioninfo.version); - // console.log("后台版本号" + this.data.connectInstrument.iot_versions); - // log.info( - // commandMap.versionInfoHome, - // `设备版本号: ${versioninfo.version}` - // ); - // log.info( - // commandMap.versionInfoHome, - // `后台版本号: ${that.data.connectInstrument.iot_versions}` - // ); - // console.log( - // "后台版本号H" + - // Number(this.data.connectInstrument.iot_versions.substring(0, 2)) + - // "版本号H" + - // Number(String(versioninfo.v1).padStart("2", 0)) - // ); - // log.info( - // commandMap.versionInfoHome, - // `后台版本号H: ${Number( - // that.data.connectInstrument.iot_versions.substring(0, 2) - // )} ,版本号H: ${Number(String(versioninfo.v1).padStart("2", 0))}` - // ); - // console.log( - // "后台版本号M" + - // Number(this.data.connectInstrument.iot_versions.substring(2, 4)) + - // "版本号M" + - // Number(String(versioninfo.v2).padStart("2", 0)) - // ); - // log.info( - // commandMap.versionInfoHome, - // "后台版本号M" + - // Number(this.data.connectInstrument.iot_versions.substring(2, 4)) + - // "版本号M" + - // Number(String(versioninfo.v2).padStart("2", 0)) - // ); - // console.log( - // "后台版本号L" + - // Number(this.data.connectInstrument.iot_versions.substring(4, 6)) + - // "版本号L" + - // Number(String(versioninfo.v3).padStart("2", 0)) - // ); - // log.info( - // commandMap.versionInfoHome, - // "后台版本号L" + - // Number(this.data.connectInstrument.iot_versions.substring(4, 6)) + - // "版本号L" + - // Number(String(versioninfo.v3).padStart("2", 0)) - // ); - // //这是有问题的固件,强制升级 - // if ( - // versioninfo.v1 == "01" && - // versioninfo.v2 == "02" && - // versioninfo.v3 == "00" - // ) { - // this.gotoOta(); - // return; - // } - // if ( - // this.data.connectInstrument.iot_versions.substring(0, 2) == - // versioninfo.v1 - // ) { - // if ( - // Number(this.data.connectInstrument.iot_versions.substring(2, 4)) > - // Number(versioninfo.v2) - // ) { - // this.setData({ - // params: "offlineDialog", - // offlineDialogType: 2, - // otaDeviceName: "设备", - // }); - // } else if ( - // Number(this.data.connectInstrument.iot_versions.substring(2, 4)) == - // Number(versioninfo.v2) - // ) { - // if ( - // Number(this.data.connectInstrument.iot_versions.substring(4, 6)) > - // Number(versioninfo.v3) - // ) { - // this.setData({ - // params: "offlineDialog", - // offlineDialogType: 2, - // otaDeviceName: "设备", - // }); - // } else { - // this.setData({ - // params: "", - // }); - // go( - // "/pages/nursing/nursing?id=&iid=" + - // app.globalData.bindid + - // `&type=fr200&version=${versioninfo?.version}` - // ); - // } - // } else { - // this.setData({ - // params: "", - // }); - // go( - // "/pages/nursing/nursing?id=&iid=" + - // app.globalData.bindid + - // `&type=fr200&version=${versioninfo?.version}` - // ); - // } - // } else { - // this.setData({ - // params: "", - // }); - // go( - // "/pages/nursing/nursing?id=&iid=" + - // app.globalData.bindid + - // `&type=fr200&version=${versioninfo?.version}` - // ); - // } - // } }; connectionClose = async (data) => { @@ -1131,6 +856,8 @@ class Index extends Component { yiqiInfo={connectInstrument} close={this.connectionClose} confirm={this.connectionConfirm} + offlineChange={this.offlineChange} + pairingChange={this.pairingChange} /> )} {/* */} diff --git a/src/pages/instrument_detail/index.tsx b/src/pages/instrument_detail/index.tsx index e3f63f6..ab0a57b 100644 --- a/src/pages/instrument_detail/index.tsx +++ b/src/pages/instrument_detail/index.tsx @@ -1,6 +1,8 @@ import Taro from "@tarojs/taro"; import classnames from "classnames"; +import dayjs from "dayjs"; + import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Block, View, Text, Image, Input, Button } from "@tarojs/components"; import Navbar from "../../components/navbar/navbar"; @@ -43,7 +45,11 @@ export default class InstrumentDetail extends Component { instrumentId: id, }); if (res.data.code === 200) { - this.setState({ info: res.data.data }); + let info = res.data.data; + info.bindingDateTime = dayjs(info.bindingDateTime).format( + "YYYY-MM-DD hh:mm:ss" + ); + this.setState({ info: info }); } }; @@ -96,7 +102,7 @@ export default class InstrumentDetail extends Component { type="text" disabled={true} placeholder-style="color:#000000;font-size:28rpx;font-weight: 500;" - placeholder={info.updateTime} + placeholder={info.bindingDateTime} /> diff --git a/src/pages/iotCarePlan/components/Footer/index.less b/src/pages/iotCarePlan/components/Footer/index.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/iotCarePlan/components/Footer/index.tsx b/src/pages/iotCarePlan/components/Footer/index.tsx new file mode 100644 index 0000000..b380f92 --- /dev/null +++ b/src/pages/iotCarePlan/components/Footer/index.tsx @@ -0,0 +1,90 @@ +import Taro from "@tarojs/taro"; +import classnames from "classnames"; +import { Block, View, Image, Text } from "@tarojs/components"; +import { useState, useEffect } from "react"; +import "./index.less"; + +interface Props { + isConnectionBlutoot: boolean; + isShowNurse: boolean; + isStopNurse: boolean; + onEmitStartNurse: Function; // 每次点击item,回调事件和数据给父组件 + onEmitSwitchChange: Function; + onEmitEndPlan: Function; +} +function Index({ + isConnectionBlutoot, + isShowNurse, + isStopNurse, + onEmitStartNurse, + onEmitSwitchChange, + onEmitEndPlan, +}: Props) { + const onStartNurse = () => { + onEmitStartNurse(); + }; + + const onSwitchChange = () => { + onEmitSwitchChange(); + }; + + const onEndPlan = () => { + onEmitEndPlan(); + }; + + return ( + + + {!isShowNurse && ( + + {isConnectionBlutoot ? ( + + 开始护理 + + ) : ( + + 开始护理 + + )} + + )} + {isShowNurse && ( + + + {isStopNurse ? ( + + + 暂停光照 + + ) : ( + + + 开始光照 + + )} + + + + + 结束护理 + + + )} + + + ); +} + +export default Index; diff --git a/src/pages/iotCarePlan/components/ModeContent/index.less b/src/pages/iotCarePlan/components/ModeContent/index.less new file mode 100644 index 0000000..a991d6f --- /dev/null +++ b/src/pages/iotCarePlan/components/ModeContent/index.less @@ -0,0 +1,57 @@ +.modelInfo-box { + width: 690rpx; + margin: 26rpx auto 0; + padding: 37rpx 35rpx; + background-color: #fff; + box-sizing: border-box; + border-radius: 30rpx; + overflow: visible; + margin-bottom: 150rpx; + .modelInfo-line { + margin-bottom: 50rpx; + &:last-child { + margin-bottom: 0; + .modelInfo-title { + margin-bottom: 6rpx; + } + } + .modelInfo-title { + margin-bottom: 24rpx; + font-size: 28rpx; + font-weight: bold; + line-height: 1; + color: #000; + } + + .modelInfo-effect { + font-size: 26rpx; + line-height: 1; + color: #000; + } + + .modelInfo-light-box { + display: flex; + flex-wrap: wrap; + .modelInfo-light-item { + display: flex; + align-items: center; + margin-right: 40rpx; + margin-top: 20rpx; + /*margin-bottom: 20rpx;*/ + } + + .modelInfo-light-color { + width: 12rpx; + height: 12rpx; + margin-right: 10rpx; + background-color: #f2c95b; + border-radius: 50%; + } + + .modelInfo-light-colorname { + font-size: 26rpx; + line-height: 1; + } + } + } +} diff --git a/src/pages/iotCarePlan/components/ModeContent/index.tsx b/src/pages/iotCarePlan/components/ModeContent/index.tsx new file mode 100644 index 0000000..e34cf02 --- /dev/null +++ b/src/pages/iotCarePlan/components/ModeContent/index.tsx @@ -0,0 +1,51 @@ +import Taro from "@tarojs/taro"; +import classnames from "classnames"; +import { Block, View, ScrollView, Image } from "@tarojs/components"; +import { useState, useEffect } from "react"; +import "./index.less"; + +interface Props { + isShowNurse: boolean; + ActiveModeItem: any; +} +function Index({ isShowNurse, ActiveModeItem }: Props) { + const ModeColor = { + "590nm": "#CF231D", + "630nm": "#CF231D", + "830nm": "#9C1D17", + }; + return ( + + {isShowNurse && ( + + + 模式功效 + {ActiveModeItem.modeDesc} + + + 当前输出技术 + + {ActiveModeItem.combineData.map((item) => { + return ( + + + + {item.effectContent}({item.technologyInfo}) + + + ); + })} + + + + )} + + ); +} + +export default Index; diff --git a/src/pages/iotCarePlan/components/ModeList/index.less b/src/pages/iotCarePlan/components/ModeList/index.less new file mode 100644 index 0000000..a0ade45 --- /dev/null +++ b/src/pages/iotCarePlan/components/ModeList/index.less @@ -0,0 +1,157 @@ +.mode-list-main { + position: relative; + font-family: PingFang SC; + .change-all-mode-btn { + position: absolute; + top: 10rpx; + right: -30rpx; + width: 140rpx; + height: 160rpx; + background-color: #fff; + border-radius: 30rpx 0rpx 0rpx 30rpx; + box-shadow: 1rpx 2rpx 16rpx 2rpx rgba(97, 97, 97, 0.1); + text-align: center; + // align-items: center; + z-index: 20; + box-sizing: border-box; + .title { + font-size: 26rpx; + text-align: center; + font-weight: bold; + text-align: center; + margin-top: 33rpx; + } + .icon { + display: block; + width: 36rpx; + height: 36rpx; + margin: 0 auto; + margin-top: 26rpx; + } + } +} +.mode-list-box { + width: 100%; + height: 180rpx; + padding: 10rpx 26rpx; + margin-top: 20rpx; + background-color: #f2f2f2; + border-radius: 30rpx; + box-sizing: border-box; + &:last-child { + margin-bottom: 0; + } + .mode-list { + display: flex; + align-items: center; + + .mode-item-title { + display: flex; + align-items: center; + justify-content: center; + width: 110rpx; + min-width: 110rpx; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + margin-right: 20rpx; + } + .mode-item { + position: relative; + display: flex; + min-width: 140rpx; + height: 160rpx; + align-items: center; + margin-bottom: 20rpx; + background-color: #fff; + border-radius: 20rpx; + /*padding: 17rpx 18rpx;*/ + box-sizing: border-box; + transition: all 0.3s; + flex-shrink: 0; + overflow: hidden; + .new { + display: none; + position: absolute; + left: 0; + top: 0; + width: 48rpx; + height: 24rpx; + font-size: 16rpx; + font-family: PingFang SC; + font-weight: bold; + color: #ffffff; + text-align: center; + background-color: #eb5858; + border-radius: 15rpx 10rpx 12rpx 0rpx; + z-index: 20; + } + .is-new { + display: block; + } + .mode-info { + min-width: 140rpx; + padding-left: 10rpx; + padding-right: 10rpx; + .mode-info-title { + margin-bottom: 4rpx; + font-size: 26rpx; + text-align: center; + font-weight: bold; + } + .mode-info-time { + margin-bottom: 4rpx; + text-align: center; + color: #666666; + font-size: 24rpx; + } + .mode-info-select { + display: flex; + align-items: center; + justify-content: center; + width: 30rpx; + height: 30rpx; + margin: 10rpx auto 0; + border: 3rpx solid #f1f1f1; + border-radius: 50%; + box-sizing: border-box; + &.is-select { + background-color: #fff; + border: none; + } + } + + .mode-info-select-point { + width: 14rpx; + height: 14rpx; + background-color: #000000; + border-radius: 50%; + } + } + } + .mode-item + .mode-item { + margin-left: 20rpx; + } + .mode-item-active { + // min-width: 300rpx; + padding-right: 11rpx; + background: linear-gradient(90deg, #efdcc2 0%, #fff2df 100%); + } + + .mode-pic { + width: 140rpx; + height: 140rpx; + /*margin-left: 20rpx;*/ + background-color: #f1f1f1; + border-radius: 20rpx; + overflow: hidden; + } + + .mode-pic image { + width: 100%; + height: 100%; + vertical-align: middle; + } + } +} diff --git a/src/pages/iotCarePlan/components/ModeList/index.tsx b/src/pages/iotCarePlan/components/ModeList/index.tsx new file mode 100644 index 0000000..b5ce7a6 --- /dev/null +++ b/src/pages/iotCarePlan/components/ModeList/index.tsx @@ -0,0 +1,212 @@ +import Taro from "@tarojs/taro"; +import classnames from "classnames"; +import { Block, View, ScrollView, Image } from "@tarojs/components"; +import { useState, useEffect } from "react"; +import "./index.less"; + +interface Props { + ModeList: any; + ModeType: string; // all visor cabin yimeish + ActiveModeItem: any; + onEmit: Function; // 每次点击item,回调事件和数据给父组件 +} +function Index({ ModeList, ModeType, ActiveModeItem, onEmit }: Props) { + let VisorList = ModeList.filter((item) => item.modeClass === 1); // 面罩模式 + let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式 + let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后 + + const [ModeID, setModeID] = useState("mode_" + ActiveModeItem.id); + const [activeID, setActiveID] = useState(ActiveModeItem.id); + + console.log("ModeID", ModeID, activeID); + + const yimeishClick = (item) => { + onEmit(item); + setActiveID(item.id); + setModeID("mode_" + item.id); + }; + + const cabinClick = (item) => { + onEmit(item); + setActiveID(item.id); + setModeID("mode_" + item.id); + }; + + const visorClick = (item) => { + onEmit(item); + setActiveID(item.id); + setModeID("mode_" + item.id); + }; + + return ( + + + {ModeList.length > 0 && ModeType !== "all" && ( + + 全部模式 + + + )} + {VisorList.length > 0 && + (ModeType === "all" || ModeType === "visor") && ( + + + 面罩模式 + {VisorList.map((item: any, index: any) => { + return ( + + + NEW + + + {item.modeName} + {item.modeTime} + + {activeID === item.id && ( + + )} + + + + {activeID === item.id && ( + + + + )} + + ); + })} + + + )} + {CabinList.length > 0 && + (ModeType === "all" || ModeType === "cabin") && ( + + + 舱体模式 + {CabinList.map((item: any, index: any) => { + return ( + + + NEW + + + {item.modeName} + {item.modeTime} + + {activeID === item.id && ( + + )} + + + + {activeID === item.id && ( + + + + )} + + ); + })} + + + )} + + {YimeishList.length > 0 && + (ModeType === "all" || ModeType === "yimeish") && ( + + + 医美术后 + {YimeishList.map((item: any, index: any) => { + return ( + + + NEW + + + {item.modeName} + {item.modeTime} + + {activeID === item.id && ( + + )} + + + + {activeID === item.id && ( + + + + )} + + ); + })} + + + )} + + + ); +} + +export default Index; diff --git a/src/pages/iotCarePlan/iotCarePlan.less b/src/pages/iotCarePlan/iotCarePlan.less new file mode 100644 index 0000000..271c249 --- /dev/null +++ b/src/pages/iotCarePlan/iotCarePlan.less @@ -0,0 +1,158 @@ +.iot-main { + padding: 20rpx 30rpx; + background: #f8f8f8; + box-sizing: border-box; + min-height: calc(100vh - 180rpx); + .banner-box { + position: relative; + display: block; + width: 690rpx; + height: 790rpx; + background-color: #fff; + border-radius: 30rpx; + .music-btn { + position: absolute; + top: 17rpx; + right: 17rpx; + width: 54rpx; + height: 54rpx; + background: #f8f8f8; + border-radius: 50%; + z-index: 10; + display: flex; + justify-content: center; + align-items: center; + .music-btn_icon { + width: 54rpx; + height: 54rpx; + } + } + .video-or-image { + display: block; + width: 690rpx; + height: 690rpx; + border-radius: 30rpx; + } + .iot-device { + width: 690rpx; + height: 100rpx; + display: flex; + align-items: center; + .item { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + height: 50rpx; + } + .border-right { + border-right: 1px solid #ddd; + } + } + } + .mode-box { + // background-color: #fff; + } +} + +.iot-btn-start { + width: 690rpx; + height: 90rpx; + line-height: 90rpx; + text-align: center; + color: #fff; + font-size: 32rpx; + background-color: #ccc; + border-radius: 45rpx; + &.is-connect { + background-color: #000; + } +} + +.footer { + position: fixed; + bottom: 0; + z-index: 99; + display: flex; + align-items: baseline; + width: 100%; + height: 153rpx; + background: #ffffff; + box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21); + padding-bottom: env(safe-area-inset-bottom); + box-sizing: border-box; + .btn { + width: 690rpx; + height: 90rpx; + background: #000; + border-radius: 45rpx; + color: #fff; + line-height: 90rpx; + text-align: center; + margin: 21rpx 49rpx 42rpx 30rpx; + font-size: 32rpx; + } + + .text { + display: flex; + align-items: center; + font-size: 32rpx; + font-weight: bold; + color: #000; + } + + .btn-disable { + background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */ + color: #fff !important; /* 设置按钮文字颜色为白色 */ + border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */ + } + + .switch-btn-box { + width: 100vw; + display: flex; + align-items: center; + margin-top: 34rpx; + .btn-item { + height: 70rpx; + display: flex; + flex: 1; + align-items: center; + justify-content: center; + .btn-icon { + width: 36rpx; + height: 36rpx; + margin-right: 18rpx; + } + .btn-text { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #000000; + } + } + .border-right { + border-right: 1px solid #ddd; + } + } +} + +.battery_icon { + width: 8rpx; + height: 20rpx; + border-radius: 5rpx; + & + .battery_icon { + margin-left: 8rpx; + } +} + +.v1 { + background: linear-gradient(0deg, #efdcc2 0%, #fff2df 100%); +} + +.v2 { + background: #f8f8f8; +} + +.v3 { + background: linear-gradient(0deg, #ff4646, #ff6b6b, #f86f6f, #ff9494); +} diff --git a/src/pages/iotCarePlan/iotCarePlan.tsx b/src/pages/iotCarePlan/iotCarePlan.tsx new file mode 100644 index 0000000..07ab8b9 --- /dev/null +++ b/src/pages/iotCarePlan/iotCarePlan.tsx @@ -0,0 +1,823 @@ +import Taro from "@tarojs/taro"; +import classnames from "classnames"; + +import { Component, PropsWithChildren, useEffect, useState } from "react"; +import { + Block, + View, + Text, + Image, + Video, + Input, + Button, +} from "@tarojs/components"; + +/*** redux ***/ +import { connect } from "react-redux"; +/*** redux end ***/ + +/* 公共组件 */ +import Navbar from "@/components/navbar/navbar"; +import PopupCountdown from "@/components/popup/popup-countdown"; +import PopupStepTips from "@/components/popup/popup-step-tips"; +/* 公共组件 END */ + +/* 本页组件 */ +import ModeListView from "./components/ModeList/index"; +import ModeContent from "./components/ModeContent/index"; +import Footer from "./components/Footer"; +/* 本页组件 END */ + +import { getStorageSync, setStorageSync } from "@/utils/traoAPI"; +import { InstrumentInfo } from "@/utils/Interface"; +import "./iotCarePlan.less"; + +// import log from "@/utils/log"; +// log.info("123456info", 123456, { sdfasdf: 123 }); + +import { + notifyBLECharacteristicValueChange, + sendCommand, +} from "@/utils/bluetoothWXAPI"; +import { + deviceCommandSamples, + bleCommandSamples, +} from "@/components/bluetoot/connection/test"; +import { + minSecToS, + s_to_h, + s_to_hs, + s_to_s, + isNeedToUpdate, +} from "@/utils/util"; +import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; +import commandMap from "@/utils/commandMap"; +const deviceToolKitInstanceWE100 = new DeviceToolKitWE100("WE100", "M01"); +const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200"); + +let timer: any = null; +let checkVersionTimeout: any = null; +let showTipsTimer: any = null; +let loadingTipsTimer: any = null; // 蓝牙连接提示 +let switchModeStatus = "free"; // 用于标记是否在切换模式中, free: 空闲, switching: 切换中 +//时间校准频率,每多少秒校准一次 +const TIME_CALIBRATION_FREQUENCY = 5; + +const WORK_MODE_NAME_ENUM = { + POWERFULSOOTHING: "powerfulSoothing", + STABILITY: "Stability", + BRIGHTEN: "Brighten", + FIRMSKIN: "FirmSkin", + MaskCustom: "MaskCustom", + BrightenStand: "BrightenStand", + FirmSkinStand: "FirmSkinStand", + SmallpoxSoothingPro: "SmallpoxSoothingPro", + SmallpoxSoothing: "SmallpoxSoothing", + MixNursePro: "MixNursePro", + MixNurse: "MixNurse", + ScalpCare: "ScalpCare", +}; + +const WORK_MODE_ENGLISH_NAME = { + 6: "powerfulSoothing", + 7: "Stability", + 8: "Brighten", + 9: "FirmSkin", + MaskCustom: "MaskCustom", + 21: "BrightenStand", + 22: "FirmSkinStand", + 23: "SmallpoxSoothingPro", + 24: "SmallpoxSoothing", + 25: "MixNursePro", + 26: "MixNurse", + 27: "ScalpCare", +}; + +const WORK_MODE_TYPE = { + powerfulSoothing: 6, + Stability: 7, + Brighten: 8, + FirmSkin: 9, + MaskCustom: "MaskCustom", + BrightenStand: 21, + FirmSkinStand: 22, + SmallpoxSoothingPro: 23, + SmallpoxSoothing: 24, + MixNursePro: 25, + MixNurse: 26, + ScalpCare: 27, +}; + +const MODE_WORKING_ENUM = { + STANDBY: "standby", + WORKING: "working", + PAUSE: "pause", + END: "end", +}; + +const countDownTime = { + powerfulSoothing: 6, + Stability: 4, + Brighten: 4, + FirmSkin: 4, + MaskCustom: 6, + BrightenStand: 6, + FirmSkinStand: 6, + SmallpoxSoothingPro: 6, + SmallpoxSoothing: 4, + MixNursePro: 6, + MixNurse: 4, + ScalpCare: 6, +}; + +const keepCheckingLink = true; +const deviceSyncData = { + totalWorkingMinutes: 0, + totalWorkingSeconds: 0, +}; +let deviceToolKitInstance = deviceToolKitInstanceWE100; // we100 + +class IotCarePlan extends Component { + constructor(props) { + super(props); + this.state = { + name: "iotCarePlan", + + /** 连接设备 */ + hasVersion: false, // 是否已查询到版本号 + curDeviceInfo: {}, // 当前设备信息 + basicModeList: [], //模式列表 + modelActiveIndex: 0, //模式下标 + sliderProgress: 22, + isStandStatus: false, //支架开启状态 + workStatus: "", //工作状态 + Electricity: 0, //fr200电量 + matrixElectricity: 0, //matrix电量 + workMode: "", //当前模式 + showCombinationModeDialog: false, // 组合模式弹窗 + combinationModeList: [], // 可选的组合模式列表 + combinationList: [], // 选择的组合模式列表 + combinationModeInfo: {}, // 组合模式缓存的信息 + originCombinationList: [], // 原始组合模式列表 + originCombinationModeInfo: {}, // 原始组合模式缓存的信息 + isCurrentModeCombination: false, // 当前模式是否是组合模式 + isSendModeCombination: false, // 当前是否在发送组合模式 + gear: { gear: 1 }, + currentShowDialog: "", + // countdown: 3, // 倒计时 + step: 1, // 1:选择模式并播放视频, 2:护理中 + facialMaskConnectStatus: 0, // 面膜连接状态 + errorTips: "", + checkedMaskVersion: false, //是否检查过固件版本了 + askedOta: false, //询问过用户是否需要OTA + showVideoPlayBtn: true, // 视频播放按钮 + duration: 0, // 视频总时长 + hadShowBreakTips: false, // 是否展示过支架断开提示 + popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗 + safeAreaBottom: 0, + video_guide: "", // 指导视频 + wl200CustomMode: [], // wl200所有的自定义模式 + joinModeId: 0, + todayMode: 0, // 今日场景id + customModeData: { + hadCustom: false, + hadSetCustom: false, // 是否设置过 -- 代码逻辑使用 + setCustomSuc: false, // 是否设置成功 -- 页面需要用于判断 + }, // 自定义模式判断 + + /** 连接设备 End */ + + isMusicPlay: false, // 声音播放状态 + isShowStepTips: false, // 是否显示介绍步骤弹窗 + isConnectionBlutoot: false, // 是否已连接蓝牙 + isShowNurse: false, // 是否开始并显示护理 + isStopNurse: false, // 是否暂停护理 + isEndNurse: false, // 是否结束护理 + + // 模式列表 + ModeList: [], + ModeType: "all", // all visor cabin yimeish + ActiveModeItem: {}, // 当前选中模式 + ModeStepIndex: 0, // 当前护理功效步骤:每个步骤时间不定,所以时间另外计算,根据步骤显示 + + // 倒计时 + isShowCountdown: false, + countdown: 6, + }; + } + + async onLoad() { + // 保持屏幕常亮 + Taro.setKeepScreenOn({ + keepScreenOn: true, + }); + } + componentDidMount() {} + + componentWillUnmount() {} + + componentDidShow() { + this.initData(); + } + + componentDidHide() {} + + async initData() { + let objStr = getStorageSync("instrument_detail"); + if (objStr) { + let info = JSON.parse(objStr); + this.GetModeList(info.id); + console.log("info"); + + // 如果不存在设备模式值,则判断为首次进入,弹窗提示 + let isFirstEntry = getStorageSync("isFirstEntry_" + info.model); + if (!isFirstEntry) { + // this.setState({ isShowStepTips: true }); + } + } + + // 初始化蓝牙 + this.init(); + } + + async init() { + // 查询自定义设备指令 + const queryInstructionParams = { + commandType: "InfoQuery", + infoQueryType: "customModeInfo", + }; + let commandBuffer = deviceToolKitInstance.toBleCommand( + queryInstructionParams as any + ); + sendCommand({ value: commandBuffer }).then((res) => { + console.log( + "查询自定义组合模式指令发送成功 参数为=>", + queryInstructionParams + ); + }); + Taro.onBLEConnectionStateChange(this.listener); + await this.notifyBLECharacteristicValueChange(); + } + listener = (res) => { + console.log("listener res", res); + if (res?.connected) return; + Taro.offBLECharacteristicValueChange((res) => { + console.log("offBLECharacteristicValueChange", res); + }); + clearTimeout(loadingTipsTimer); + // this.setState({ + // startSettingCountDown: false + // }) + console.log(commandMap.WL200Command, "监听到蓝牙断开, 打开断开提示"); + // 显示蓝牙断开弹窗 + // this.setState({ + // workStatus: "", + // currentShowDialog: "connection_break", + // }); + }; + + GetModeList = async (id) => { + let params = { + instrumentId: id, + }; + let res = await InstrumentInfo.modeInfoList(params); + if (res.data.code === 200) { + if (res.data.data.length > 0) { + this.setState({ + ActiveModeItem: res.data.data[0], + ModeList: res.data.data, + }); + + setTimeout(() => { + console.log("ActiveModeItem", this.state.ActiveModeItem); + }); + } else { + this.setState({ ModeList: res.data.data }); + } + } + }; + + changeMusicStatus = () => { + let { isMusicPlay } = this.state; + this.setState({ isMusicPlay: !isMusicPlay }); + }; + + // 开始护理按钮:点击开始,页面进行到下一步 + onStartNurse = async () => { + this.stepNext(); + return; + let { isConnectionBlutoot } = this.state; + if (isConnectionBlutoot) { + this.stepNext(); + } else { + // todo 提示未连接蓝牙 + } + }; + onSwitchChange = async () => { + // todo + let { isStopNurse } = this.state; + this.setState({ isStopNurse: !isStopNurse }); + }; + onEndPlan = async () => { + // todo + }; + + modeCurrentFun = async (data) => { + console.log("modeCurrentFun", data); + this.setState({ ActiveModeItem: data }); + }; + + stepNext = () => { + // //0未定义(全部) 1面罩模式 2舱体模式 3医美术后 + let modeArray = ["all", "visor", "cabin", "yimeish"]; + let modeClass = this.state.ActiveModeItem.modeClass; + this.setState({ ModeType: modeArray[modeClass] }); + this.setState({ isShowNurse: true }); + }; + + closeStepTips = (data) => { + if (data.isLocal) { + setStorageSync("isFirstEntry_" + this.state.ActiveModeItem.model, true); // 关闭首次进入弹窗 + } + this.setState({ isShowStepTips: false }); + }; + + /** 蓝牙相关 */ + + notifyBLECharacteristicValueChange = () => { + console.log("notifyBLECharacteristicValueChange deviceInfo 参数为=>"); + const bluetoothInfo = this.props.bluetoothInfo; + notifyBLECharacteristicValueChange({ + deviceId: bluetoothInfo.deviceId, + servicesuuid: bluetoothInfo.servicesuuid, + characteristicsuuid1: bluetoothInfo.characteristicsuuid1, + characteristicsuuid0: bluetoothInfo.characteristicsuuid0, + }).then((res) => { + Taro.onBLECharacteristicValueChange((value) => { + const jsonStatus: any = deviceToolKitInstance.toJsonStatus(value.value); + // end 和 endWork 都是护理结束, endWork不关机, end 关机, 对小程序而已处理流程都一样 + console.log( + "onBLECharacteristicValueChange jsonStatus => ", + jsonStatus + ); + // log.info(commandMap.WL200Command, 'onBLECharacteristicValueChange jsonStatus =>', jsonStatus); + if (!jsonStatus || jsonStatus == null) { + return; + } + if (jsonStatus.workStatus && jsonStatus.workStatus == "endWork") { + jsonStatus.workStatus = "end"; + console.log(jsonStatus.workStatus, "改了状态了"); + } + switch (jsonStatus?.commandType) { + //蓝牙相关指令 + case "BleMatch": + switch (jsonStatus.bleCommandType) { + //如果设备配对链接发送配对码的时候,设备应答小程序配对码是否正确。 + case "SendMatchCode": + if (jsonStatus.matchedSuccess) { + // msg('配对成功') + console.log("配对成功"); + // log.info(commandMap.WL200Command, "配对成功"); + } + break; + //附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上了 + case "BleStatusSync": + switch (jsonStatus.connectMessage?.deviceName) { + case "WL200": + if (jsonStatus.connectMessage?.connectType == "CONNECTED") { + // if ( + // !that.data.customModeData.setCustomSuc && + // !that.data.customModeData.hadSetCustom + // ) { + // that.setCustomMaskData(); + // } + // that.setData({ + // facialMaskConnectStatus: 1, + // }); + // this.deviceToolKitInstance = deviceToolKitInstanceWL200; + // console.log( + // "checkedMaskVersion", + // this.data.checkedMaskVersion + // ); + // if (!this.data.checkedMaskVersion) { + // this.checkVersion(); + // } + } else { + // deviceToolKitInstance = deviceToolKitInstanceWE100; + // // TODO 护理中(step==2)时, 如果断开, 可能需要暂停 + // that.setData({ + // facialMaskConnectStatus: 0, + // }); + } + break; + case "Stand": + // that.setData({ + // isStandStatus: + // jsonStatus.connectMessage?.connectType == "CONNECTED", + // }); + + break; + default: + break; + } + break; + //小程序主动问主机,现在链接了哪些附属设备,这时候主机给小程序的回复消息 + case "QueryMatchStatus": + const isStandDevice = + jsonStatus?.subDeviceList?.includes("Stand") || false; + const isConnectedMask = + jsonStatus?.subDeviceList?.includes("WL200") || false; + deviceToolKitInstance = isConnectedMask + ? deviceToolKitInstanceWL200 + : deviceToolKitInstanceWE100; + console.log(isConnectedMask, "更改成功deviceToolKitInstance"); + // if (!this.state.checkedMaskVersion && isConnectedMask) { + // this.checkVersion(); + // } + console.log("支架是否链接", isStandDevice); + console.log("面罩是否链接", isConnectedMask); + //这里bug 先注释掉 bug是拔掉支架之后启动面罩工作就会一直弹 + // let { basicModeList, modelActiveIndex } = that.data; + // if ( + // that.data.step == 2 && + // !isStandDevice && + // basicModeList[modelActiveIndex].isStandMode && + // !that.data.hadShowBreakTips + // ) { + // that.data.hadShowBreakTips = true; + // that.onPauseTap(); + // that.standVideoContext.seek(0); + // // that.showTips('检测到支架未连接成功,请确认面罩开机后与支架连接,并接通支架电源'); + // that.showTips( + // `检测到${that.data.deviceChineseName.WL200Stand}未连接成功,请确认面罩开机后与${that.data.deviceChineseName.WL200Stand}连接,并接通${that.data.deviceChineseName.WL200Stand}电源` + // ); + } + // 连上面罩后, 设置自定义模式 -- 不在这里设置自定义模式 + // if ( + // isConnectedMask && + // !that.data.customModeData.setCustomSuc && + // !that.data.customModeData.hadSetCustom && + // basicModeList[modelActiveIndex].isCustomMode + // ) { + // that.setCustomMaskData(); + // } + // 连上面罩后, 获取仪器记录, 与缓存信息对比, + // if ( + // isConnectedMask && + // !this.state.hadGotInstrumentHistoryData + // ) { + // // 如果不延时, 无法获取到仪器状态 + // const queryDeviceArrayBuffer = + // deviceToolKitInstance.toBleCommand( + // bleCommandSamples.queryDeviceStatus as any + // ); + // console.log("发送查询设备指令"); + // sendCommand({ + // value: queryDeviceArrayBuffer, + // }); + // // 打开ota页面需要关闭 + // // that.data.getInstrumentHistoryDataTimer = setTimeout(() => { + // // that.getInstrumentHistoryData(); + // // }, 3000); + // } + // this.setData({ + // isStandStatus: isStandDevice, + // facialMaskConnectStatus: `${isConnectedMask ? 1 : 0}`, + // // currentTime: this.data.standInfo.currentTime + // }); + break; + + case "DeviceControl": + console.log("设备控制,给设备发送指令", jsonStatus); + if ( + jsonStatus.responseStatus == "OK" && + this.state.isSendModeCombination + ) { + // 发送启动指令 + // this.startCombinationMode() + // const totalTime = this.data.combinationList.reduce((total, item) => { + // return total + minSecToS(item.time) + // }, 0) + // that.setData({ + // showCombinationModeDialog: false, + // combinationModeInfo: { + // time: s_to_hs(totalTime), + // seconds: totalTime, + // }, + // modelActiveIndex: -1, + // currentTime: s_to_hs(totalTime), + // isCurrentModeCombination: true, + // isSendModeCombination: false, + // }) + } + break; + //设备主动上报给小程序的指令 一般是工作状态改变 + case "DeviceStatusSync": + console.log( + "设备主动上报给小程序的指令 一般是工作状态改变", + jsonStatus + ); + this.setState({ + Electricity: jsonStatus.battery, + matrixElectricity: jsonStatus.matrixBattery, + workStatus: jsonStatus.workStatus, + workMode: jsonStatus?.workMode, + }); + // that.setData({ + // fr200Electricity: jsonStatus.battery, + // matrixElectricity: jsonStatus.matrixBattery, + // workStatus: jsonStatus.workStatus, + // workMode: jsonStatus?.workMode, + // }); + // 判断是否在step == 2(护理中) + // if ( + // that.data.step == 2 && + // jsonStatus.workStatus != MODE_WORKING_ENUM.END + // ) { + // that.updateDeviceSyncData({ + // totalWorkingMinutes: jsonStatus.totalWorkingMinutes, + // totalWorkingSeconds: jsonStatus.totalWorkingSeconds, + // }); + // } + // if (jsonStatus.workMode && that.data.step == 2) { + // const { basicModeList, modelActiveIndex } = that.data; + // const item = basicModeList[modelActiveIndex]; + // if ( + // jsonStatus.workMode != WORK_MODE_ENGLISH_NAME[item.model_type] + // ) { + // clearTimeout(loadingTipsTimer); + // that.data.startSettingCountDown = false; + // } + // } + // // 我忘记了为啥要这样传参... 埋坑了... + // this.judgementWorkStatus( + // jsonStatus.workStatus, + // jsonStatus.workMode, + // jsonStatus + // ); + if (jsonStatus.workMode && this.state.step == 2) { + // this.judgementModel(jsonStatus.workMode); + // that.data.startSettingCountDown = false; + } + break; + //设备信息查询返回 + case "InfoQuery": + switch (jsonStatus.infoQueryType) { + case "customModeSet": + console.log( + "responseStatus=====>", + jsonStatus.responseStatus, + 1 + ); + console.log( + "responseStatus=====>", + jsonStatus.responseStatus, + 2 + ); + console.log( + "responseStatus=====>", + jsonStatus.responseStatus, + 3 + ); + // if (jsonStatus.responseStatus == "OK") { + // that.setData({ + // "customModeData.setCustomSuc": true, + // }); + // console.log("设置成功自定义模式"); + // } else { + // that.setData({ + // "customModeData.hadSetCustom": false, + // "customModeData.setCustomSuc": false, + // }); + // } + break; + case "customModeInfo": + break; + case "versionInfo": + if (jsonStatus.versionNo) { + // 清理计时器 + // if (checkVersionTimeout) clearTimeout(checkVersionTimeout); + // if (that.data.hasVersion) return; + // that.setData({ + // hasVersion: true, + // }); + // this.checkOta(jsonStatus.versionNo); + } + break; + // 当前报告 + case "currentMaskReportInfo": + console.log("currentMaskReportInfo", jsonStatus); + // if (!that.data.hadCheckReport) { + // that.data.hadCheckReport = true; + // that.checkInstrumentRecord(jsonStatus); + // } else { + // that.setWL200NursingHistory(jsonStatus); + // } + + break; + default: + break; + } + break; + // default: + // break; + } + }); + + /** + * 延迟500毫秒获取附属设备状态 + */ + const querySubDeviceArrayBuffer = deviceToolKitInstance.toBleCommand({ + ...bleCommandSamples.querySubDevice, + queryType: "WL200", + } as any); + setTimeout(() => { + console.log("发送查询指令"); + sendCommand({ + value: querySubDeviceArrayBuffer, + }); + }, 500); + + /** + * 延迟500毫秒获取设备电量 + */ + const queryDeviceArrayBuffer = deviceToolKitInstance.toBleCommand( + bleCommandSamples.queryDeviceStatus as any + ); + setTimeout(() => { + console.log("发送查询设备指令"); + sendCommand({ + value: queryDeviceArrayBuffer, + }); + }, 500); + }); + }; + + render() { + let { + name, + isMusicPlay, + isShowStepTips, + ModeList, + ModeType, + isConnectionBlutoot, + isShowNurse, + isStopNurse, + ActiveModeItem, + isShowCountdown, + countdown, + ModeStepIndex, + Electricity, + } = this.state; + return ( + + + + {ActiveModeItem.openSourceData && ( + + )} + + + + + + {isMusicPlay ? ( + + ) : ( + + )} + + + {!isShowNurse && ( + + + + + 护理时间:10:00 + + + WE200电量: + + {Electricity === 4 && ( + + + + + + + )} + {Electricity === 3 && ( + + + + + + + )} + {Electricity === 2 && ( + + + + + + + )} + {Electricity === 1 && ( + + + + + + + )} + {Electricity === 1 && ( + + + + + + + )} + + + + + + {ModeList.length > 0 && ( + + )} + + + + +