diff --git a/src/components/popup/popup-step-tips.tsx b/src/components/popup/popup-step-tips.tsx index 6af9936..5014d39 100644 --- a/src/components/popup/popup-step-tips.tsx +++ b/src/components/popup/popup-step-tips.tsx @@ -123,7 +123,7 @@ export default class PopupStepTips extends Component { "margin-samll": isLarge, })} > - {data[current].openTitle} + {data.length > 0 ? data[current].openTitle : "暂无数据"} {/* {title && ( { Taro.getSystemInfo({ success: (res) => { console.log("getSystemInfo", res); - this.setState({ isConnectShow: true }); let { locationEnabled, locationAuthorized, bluetoothEnabled } = res; if (!locationEnabled || !locationAuthorized) { showModal({ @@ -618,7 +617,7 @@ class Index extends Component { }); } else { // 打开连接弹窗 - this.setState({ isConnectShow: true }); + this.connectionOpen(); } }, }); @@ -628,11 +627,12 @@ class Index extends Component { /** * WE100,WL200配对完成回调 */ - async pairingChange(e) { + pairingChange = (e) => { console.log("===epairingChange===》", e); go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 - // return; - } + + this.connectionClose(); + }; async goIot() { go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 @@ -746,14 +746,15 @@ class Index extends Component { console.log(offlinelist); }; - connectionClose = async (data) => { - console.log("connectionClose", data); - this.setState({ isConnectShow: false }); + connectionOpen = async () => { + this.setState({ isConnectShow: true }); }; - connectionConfirm = async (data) => { - console.log("connectionConfirm", data); + connectionClose = async () => { this.setState({ isConnectShow: false }); }; + connectionConfirm = async () => { + this.connectionClose(); + }; /*蓝牙 END*/ render() { diff --git a/src/pages/instrument/instrument.tsx b/src/pages/instrument/instrument.tsx index 9ffe827..1e82ee1 100644 --- a/src/pages/instrument/instrument.tsx +++ b/src/pages/instrument/instrument.tsx @@ -343,10 +343,9 @@ export default class Instrument extends Component { }); Taro.hideLoading(); if (res.data.code === 200) { - // this.setState({ isVisibleBinding: false }); this.binding(); } else if (res.data.code === 204) { - this.setState({ isBindingCheckError: false }); + this.setState({ isBindingCheckError: true }); } else { this.setState({ isBindingError: true }); } diff --git a/src/pages/iotCarePlan/components/ElectricityView/index.tsx b/src/pages/iotCarePlan/components/ElectricityView/index.tsx new file mode 100644 index 0000000..0afc8fa --- /dev/null +++ b/src/pages/iotCarePlan/components/ElectricityView/index.tsx @@ -0,0 +1,119 @@ +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 { + Electricity: any; + matrixElectricity: any; + facialMaskConnectStatus: any; +} +function Index({ + Electricity, + matrixElectricity, + facialMaskConnectStatus, +}: Props) { + return ( + + + + WE200电量 : + + {matrixElectricity >= 4 && ( + + + + + + + )} + {matrixElectricity === 3 && ( + + + + + + + )} + {matrixElectricity === 2 && ( + + + + + + + )} + {matrixElectricity === 1 && ( + + + + + + + )} + {matrixElectricity === 0 && ( + + + + + + + )} + + + {facialMaskConnectStatus === 1 && ( + + + 面罩电量 : + + {Electricity >= 4 && ( + + + + + + + )} + {Electricity === 3 && ( + + + + + + + )} + {Electricity === 2 && ( + + + + + + + )} + {Electricity === 1 && ( + + + + + + + )} + {Electricity === 0 && ( + + + + + + + )} + + + + )} + + + ); +} + +export default Index; diff --git a/src/pages/iotCarePlan/components/ModeList/index.tsx b/src/pages/iotCarePlan/components/ModeList/index.tsx index 5fc4718..332d204 100644 --- a/src/pages/iotCarePlan/components/ModeList/index.tsx +++ b/src/pages/iotCarePlan/components/ModeList/index.tsx @@ -5,51 +5,55 @@ import { useState, useEffect } from "react"; import "./index.less"; interface Props { + ModeID: any; + activeModeID: any; ModeList: any; ModeType: string; // all visor cabin yimeish ActiveModeItem: any; isShowNurse: boolean; // 是否已进入护理详情页 + isPop: boolean; // 是否弹窗 onEmit: Function; // 每次点击item,回调事件和数据给父组件 + onEmitShowAll: Function; // 打开弹窗按钮 } function Index({ + isShowNurse, + isPop, ModeList, ModeType, - isShowNurse, ActiveModeItem, + ModeID, + activeModeID, onEmit, + onEmitShowAll, }: 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 [ModeID, setModeID] = useState("mode_" + ActiveModeItem.id); + // const [activeModeID, setactiveModeID] = useState(ActiveModeItem.id); 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); + }; + + const showAll = () => { + onEmitShowAll(); }; return ( - {ModeList.length > 0 && isShowNurse && ( - + {!isPop && ModeList.length > 0 && isShowNurse && ( + 全部模式 )} {VisorList.length > 0 && - (ModeType === "all" || ModeType === "visor") && ( + (ModeType === "all" || ModeType === "visor" || isPop) && ( @@ -85,19 +89,21 @@ function Index({ {item.modeName} - {item.modeTime} + + {item.modeTimeStr} + - {activeID === item.id && ( + {activeModeID === item.id && ( )} - {activeID === item.id && ( + {activeModeID === item.id && ( @@ -110,7 +116,7 @@ function Index({ )} {CabinList.length > 0 && - (ModeType === "all" || ModeType === "cabin") && ( + (ModeType === "all" || ModeType === "cabin" || isPop) && ( {item.modeName} - {item.modeTime} + + {item.modeTimeStr} + - {activeID === item.id && ( + {activeModeID === item.id && ( )} - {activeID === item.id && ( + {activeModeID === item.id && ( @@ -162,7 +170,7 @@ function Index({ )} {YimeishList.length > 0 && - (ModeType === "all" || ModeType === "yimeish") && ( + (ModeType === "all" || ModeType === "yimeish" || isPop) && ( {item.modeName} - {item.modeTime} + + {item.modeTimeStr} + - {activeID === item.id && ( + {activeModeID === item.id && ( )} - {activeID === item.id && ( + {activeModeID === item.id && ( diff --git a/src/pages/iotCarePlan/iotCarePlan.less b/src/pages/iotCarePlan/iotCarePlan.less index 2272662..10d3207 100644 --- a/src/pages/iotCarePlan/iotCarePlan.less +++ b/src/pages/iotCarePlan/iotCarePlan.less @@ -30,23 +30,46 @@ .video-or-image { display: block; width: 690rpx; - height: 690rpx; + height: 640rpx; border-radius: 30rpx; } .iot-device { width: 690rpx; - height: 100rpx; + height: 150rpx; display: flex; align-items: center; - .item { - flex: 1; - display: flex; - align-items: center; - justify-content: center; + justify-content: center; + .device-time { + font-size: 26rpx; + color: #000; + font-weight: 400; + .time { + font-size: 30rpx; + font-weight: 800; + } + } + .line { + width: 1rpx; height: 50rpx; + background: #dddddd; + margin-left: 69rpx; + margin-right: 60rpx; } - .border-right { - border-right: 1px solid #ddd; + .electricity-box { + display: flex; + flex-direction: column; + .item { + display: flex; + align-items: center; + justify-content: left; + height: 50rpx; + .label { + width: 154rpx; + font-size: 26rpx; + color: #000; + margin-right: 14rpx; + } + } } } .msg-tips { diff --git a/src/pages/iotCarePlan/iotCarePlan.tsx b/src/pages/iotCarePlan/iotCarePlan.tsx index b3ab138..ec2e5af 100644 --- a/src/pages/iotCarePlan/iotCarePlan.tsx +++ b/src/pages/iotCarePlan/iotCarePlan.tsx @@ -25,6 +25,7 @@ import PopupConfirm from "@/components/popup/popup-confirm"; /* 公共组件 END */ /* 本页组件 */ +import ElectricityView from "./components/ElectricityView/index"; import ModeListView from "./components/ModeList/index"; import ModeContent from "./components/ModeContent/index"; import Footer from "./components/Footer"; @@ -46,12 +47,10 @@ import { bleCommandSamples, } from "@/components/bluetoot/connection/test"; import { - hourMinSecToS, - minSecToS, s_to_s, s_to_m, + minSecToS, s_to_ms, - s_to_hms, isNeedToUpdate, } from "@/utils/util"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; @@ -59,6 +58,7 @@ import commandMap from "@/utils/commandMap"; const deviceToolKitInstanceWE100 = new DeviceToolKitWE100("WE100", "M01"); const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200"); +let currentTimeTimer: any = null; // 当前项目时间定时器 let CountdownTimer: any = null; let timer: any = null; let checkVersionTimeout: any = null; @@ -84,22 +84,6 @@ const WORK_MODE_NAME_ENUM = { 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", -}; - // 组合模式:分别对应的是哪几个模式类型 // 黄光590nm // 红光630nm @@ -121,21 +105,6 @@ const WORK_MODE_Chinese_NAME = { 头皮护理: "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", // 工作 @@ -159,7 +128,6 @@ let CountDownTime = { ScalpCare: 6, }; -let KeepCheckingLink = true; let DeviceSyncData = { totalWorkingMinutes: 0, totalWorkingSeconds: 0, @@ -173,6 +141,10 @@ class IotCarePlan extends Component { name: "iotCarePlan", title: "美容仪名字", // 页面标题 instrument: "WE200", + currentDevice: { + name: "", + model: "", + }, // 当前设备 /** 连接设备 */ hasVersion: false, // 是否已查询到版本号 @@ -183,18 +155,10 @@ class IotCarePlan extends Component { isStandStatus: false, // 支架开启状态(支架就是舱体) facialMaskConnectStatus: 0, // 面罩连接状态 0未连接 1已连接 workStatus: "", // 工作状态 - Electricity: 0, // WL200电量 - matrixElectricity: 0, // matrix电量 + Electricity: 4, // WL200电量 + matrixElectricity: 4, // WE200发箍电量 workMode: "", //当前模式 - showCombinationModeDialog: false, // 组合模式弹窗 - combinationModeList: [], // 可选的组合模式列表 - combinationList: [], // 选择的组合模式列表 - combinationModeInfo: {}, // 组合模式缓存的信息 - originCombinationList: [], // 原始组合模式列表 - originCombinationModeInfo: {}, // 原始组合模式缓存的信息 - isCurrentModeCombination: false, // 当前模式是否是组合模式 - isSendModeCombination: false, // 当前是否在发送组合模式 gear: { gear: 1 }, currentShowDialog: "", @@ -206,11 +170,6 @@ class IotCarePlan extends Component { duration: 0, // 视频总时长 hadShowBreakTips: false, // 是否展示过支架断开提示 popupType: "", // enoughTimePopup: 时间达标提示, endPopup: 结束弹窗 - customModeData: { - hadCustom: false, - hadSetCustom: false, // 是否设置过 -- 代码逻辑使用 - setCustomSuc: false, // 是否设置成功 -- 页面需要用于判断 - }, // 自定义模式判断 /** 连接设备 End */ @@ -222,11 +181,23 @@ class IotCarePlan extends Component { errorTips: "", // 错误提示 // 模式列表 + isSwitchActiveMode: false, // 是否显示弹窗切换模式 ModeList: [], ModeType: "all", // all visor面罩 cabin舱体 yimeish医美 modeClass: "", // 1面罩 2舱体 3医美 ActiveModeItem: {}, // 当前选中模式 + SwitchActiveModeItem: {}, // 切换选中模式 + ModeID: "mode_", // 模式KEY + activeModeID: "", // 当前选中模式ID:用于高亮 ModeStepIndex: 0, // 当前护理功效步骤:每个步骤时间不定,所以时间另外计算,根据步骤显示 + ModeStepTimeArray: [], // 护理功效时间步骤,用于切换显示GIF + currentServiceData: { + // 当前展示的开启暂停GIF: 因为时间判断不方便,所以单独领出来 + startSource: "", + stopSource: "", + }, + // 模式组合 + isCombineSuccess: false, // 组合模式是否设置成功 // 倒计时 isShowCountdown: false, // 倒计时弹窗 @@ -237,7 +208,7 @@ class IotCarePlan extends Component { // 最后执行步骤位置 endPlace: "", - currentTime: "00:01:00", + currentTime: "01:00", }; } @@ -266,6 +237,11 @@ class IotCarePlan extends Component { let objStr = getStorageSync("instrument_detail"); if (objStr) { let info = JSON.parse(objStr); + + this.setState({ + currentDevice: info, + }); + this.GetModeList(info.id); console.log("info"); @@ -340,42 +316,13 @@ class IotCarePlan extends Component { ModeList: res.data.data, }); - setTimeout(() => { - console.log("ActiveModeItem", this.state.ActiveModeItem); - }); + this.modeCurrentFun(res.data.data[0]); } else { this.setState({ ModeList: res.data.data }); } } }; - /** 开始护理按钮:点击开始,页面进行到下一步 */ - onStartNurse = async () => { - this.stepNext(); - return; - let { isConnectionBlutoot } = this.state; - if (isConnectionBlutoot) { - this.stepNext(); - } else { - // todo 提示未连接蓝牙 - } - }; - /** 切换光照 */ - onSwitchChange = async () => { - // todo - let { isStopNurse } = this.state; - if (isStopNurse) { - // 开始光照逻辑 - this.showCountdownFun(3, () => {}); - this.handleWorkStatus(false, MODE_WORKING_ENUM.WORKING); - } else { - // 暂停光照逻辑 - this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE); - } - this.setState({ - isStopNurse: !isStopNurse, - }); - }; /** * 倒计时弹窗 * param 重置倒计时 @@ -406,9 +353,69 @@ class IotCarePlan extends Component { }, 0); } + /** 选中护理模式 */ modeCurrentFun = async (data) => { - console.log("modeCurrentFun", data); - this.setState({ ActiveModeItem: data }); + let currentServiceData = { + startSource: "", + stopSource: "", + }; + if (data.serviceData.length) { + currentServiceData = data.serviceData[0]; + } + + let currentTime = data.modeTimeStr; + this.setState({ + ActiveModeItem: data, + activeModeID: data.id, + ModeID: "mode_" + data.id, + currentServiceData, + ModeStepIndex: 0, + currentTime, + }); + + setTimeout(() => { + // 设置时间组合 + if (data.serviceData.length > 0) { + this.setServiceTimeData(); + } + // 存在组合模式时,设置组合模式 + if (data.combineData.length > 0) { + this.setCustomMaskData(); + } + }); + }; + /** 切换护理模式 */ + switchModeCurrentFun = async (data) => { + this.setState({ + SwitchActiveModeItem: data, + activeModeID: data.id, + ModeID: "mode_" + data.id, + }); + }; + // 打开模式切换弹窗 + openModeSwitch = () => { + console.log("openModeSwitch"); + this.setState({ + isSwitchActiveMode: true, + }); + }; + // 取消并关闭切换护理模式弹窗 + cancelModeSwitchBtn = () => { + this.setState({ + isSwitchActiveMode: false, + }); + }; + // 弹窗确定切换护理模式 + confirmModeSwitchBtn = () => { + let { SwitchActiveModeItem } = this.state; + let modeArray = ["all", "visor", "cabin", "yimeish"]; + this.setState({ + ModeType: modeArray[SwitchActiveModeItem.modeClass], + }); + setTimeout(() => { + this.modeCurrentFun(SwitchActiveModeItem); + this.cancelModeSwitchBtn(); + }, 100); }; stepNext = () => { @@ -421,10 +428,37 @@ class IotCarePlan extends Component { isStopNurse: true, isStandStatus: this.state.ActiveModeItem.isCabinMode === 1, workStatus: "pause", + step: 2, }); this.handleWorkStatus(false, MODE_WORKING_ENUM.STANDBY); }; + /** 开始护理按钮:点击开始,页面进行到下一步 */ + onStartNurse = async () => { + this.stepNext(); + return; + let { isConnectionBlutoot } = this.state; + if (isConnectionBlutoot) { + this.stepNext(); + } else { + // todo 提示未连接蓝牙 + } + }; + /** 切换光照 */ + onSwitchChange = async () => { + // todo + let { isStopNurse } = this.state; + if (isStopNurse) { + // 开始光照逻辑 + this.onNursingTap(); + } else { + // 暂停光照逻辑 + this.handleWorkStatus(false, MODE_WORKING_ENUM.PAUSE); + } + this.setState({ + isStopNurse: !isStopNurse, + }); + }; closeStepTips = (data) => { if (data.isLocal) { @@ -448,15 +482,13 @@ class IotCarePlan extends Component { case "BleStatusSync": switch (jsonStatus.connectMessage?.deviceName) { case "WL200": + console.log( + "BleStatusSync 附属设备状态主动上报,这种指令是主机主动上报某个附属设备断开或者连上", + jsonStatus.connectMessage?.connectType == "CONNECTED" + ); if (jsonStatus.connectMessage?.connectType == "CONNECTED") { // 已连接WL200 this.setState({ isConnectionBlutoot: true }); - if ( - !this.state.customModeData.setCustomSuc && - !this.state.customModeData.hadSetCustom - ) { - this.setCustomMaskData(); - } // 附属设备连接成功,如何区分是哪个设备? this.setState({ @@ -474,6 +506,7 @@ class IotCarePlan extends Component { // WL200连接失败 // deviceToolKitInstance = deviceToolKitInstanceWE100; // // TODO 护理中(step==2)时, 如果断开, 可能需要暂停 + console.log("WL200连接失败或断开"); this.setState({ facialMaskConnectStatus: 0, }); @@ -509,32 +542,13 @@ class IotCarePlan extends Component { } 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( - // `检测到舱体未连接成功,请确认面罩开机后与舱体连接,并接通舱体电源` - // ); - - // 连上面罩后, 设置自定义模式 -- 不在这里设置自定义模式 - if ( - this.state.ActiveModeItem && - isConnectedMask && - !this.state.customModeData.setCustomSuc && - !this.state.customModeData.hadSetCustom && - this.state.ActiveModeItem.isCustomMode - ) { - this.setCustomMaskData(); + if (isConnectedMask) { + this.setState({ + isConnectionBlutoot: true, + facialMaskConnectStatus: 1, + }); } + // 连上面罩后, 获取仪器记录, 与缓存信息对比, // if ( // isConnectedMask && @@ -595,17 +609,9 @@ class IotCarePlan extends Component { case "DeviceControl": console.log("小程序控制设备,给设备发送指令", jsonStatus); - // if ( - // jsonStatus.responseStatus == "OK" && - // this.state.isSendModeCombination - // ) { - // // 发送启动指令 - // this.startCombinationMode(); - // setTimeout(() => { // console.log("currentTime", this.state.currentTime); // }); - // } break; //设备主动上报给小程序的指令 一般是工作状态改变 case "DeviceStatusSync": @@ -615,17 +621,11 @@ class IotCarePlan extends Component { ); this.setState({ Electricity: jsonStatus.battery, - fr200Electricity: jsonStatus.battery, + // fr200Electricity: jsonStatus.battery, matrixElectricity: jsonStatus.matrixBattery, workStatus: jsonStatus.workStatus, workMode: jsonStatus?.workMode, }); - // this.setState({ - // fr200Electricity: jsonStatus.battery, - // matrixElectricity: jsonStatus.matrixBattery, - // workStatus: jsonStatus.workStatus, - // workMode: jsonStatus?.workMode, - // }); // 判断是否在step == 2(护理中) if ( this.state.step == 2 && @@ -640,48 +640,35 @@ class IotCarePlan extends Component { ); } - if (jsonStatus.workMode && this.state.step == 2) { + if ( + jsonStatus.workMode === MODE_WORKING_ENUM.WORKING && + this.state.step == 2 + ) { const { ActiveModeItem } = this.state; const item = ActiveModeItem; - if ( - jsonStatus.workMode !== WORK_MODE_ENGLISH_NAME[item.model_type] - ) { + if (jsonStatus.workMode !== item.modeType) { clearTimeout(loadingTipsTimer); this.setState({ isShowCountdown: false, }); } } - - // 根据工作状态:执行逻辑 - - // 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(">>>>>>>>>>>>>>>自定义模式>>>>>>>>>>>>>>>"); console.log( "InfoQuery customModeSet responseStatus=====>", jsonStatus ); - let { customModeData } = this.state; if (jsonStatus.responseStatus == "OK") { - customModeData.setCustomSuc = true; - this.setState({ - customModeData, - }); console.log("设置成功自定义模式"); - } else { - customModeData.hadSetCustom = false; - customModeData.setCustomSuc = false; this.setState({ - customModeData, + isCombineSuccess: true, }); } break; @@ -691,6 +678,7 @@ class IotCarePlan extends Component { "InfoQuery customModeInfo responseStatus=====>", jsonStatus ); + break; case "versionInfo": console.log( @@ -709,7 +697,7 @@ class IotCarePlan extends Component { break; // 当前报告 case "currentMaskReportInfo": - console.log("currentMaskReportInfo", jsonStatus); + console.log("当前面罩报告 currentMaskReportInfo", jsonStatus); // if (!this.state.hadCheckReport) { // this.state.hadCheckReport = true; // that.checkInstrumentRecord(jsonStatus); @@ -802,21 +790,6 @@ class IotCarePlan extends Component { } }; - // 发送启动组合模式指令 - startCombinationMode() { - const jsonCommand = { - commandType: "DeviceControl", - workStatus: "working", - workMode: "MaskCustom", - }; - let commandBuffer = deviceToolKitInstance.toBleCommand(jsonCommand as any); - sendCommand({ - value: commandBuffer, - }).then(() => { - console.info("发送启动组合模式指令成功 参数为 =>", jsonCommand); - }); - } - //待完善,以后同步设备数据到小程序的事件,在这个事件里判断是否需要更新页面(是否需要触发setData) updateDeviceSyncData = (newData, jsonStatus) => { DeviceSyncData = { @@ -832,31 +805,38 @@ class IotCarePlan extends Component { renderDeviceStatus = { renderWorkTime: (jsonStatus) => { const { totalWorkingMinutes, totalWorkingSeconds } = DeviceSyncData; - const { ActiveModeItem, currentTime } = this.state; + let { ActiveModeItem, currentTime } = this.state; const totalTime = totalWorkingMinutes * 60 + totalWorkingSeconds; console.log("仪器上报的已经运行的总秒数", totalTime); console.log("时间校准频率,默认5秒一次", TIME_CALIBRATION_FREQUENCY); //对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准 const currentScene = ActiveModeItem; // 获取当前的场景 - let sceneTime = hourMinSecToS(currentScene.modeTime); // 场景时间 + let sceneTime = minSecToS(currentScene.modeTimeStr); // 场景时间 + + console.log("场景时间 sceneTime", sceneTime); + console.log("当前显示时间 currentTime", currentTime); + console.log("设备运行时间 totalTime", totalTime); + console.log(" this.state.step", this.state.step); + console.log("sceneTime > totalTime", sceneTime > totalTime); + + // 更新界面倒计时 + this.resetTimer(); - const timeRemaining = sceneTime - hourMinSecToS(currentTime); // 小程序上已运行的总秒数 if ( - Math.abs(timeRemaining - totalTime) >= 0 && + sceneTime > totalTime && this.state.step == 2 && this.state.facialMaskConnectStatus == 1 ) { - this.resetTimer(); + // 界面倒计时同步设备时间 const t = sceneTime - totalTime; // 场景时间 - 已运行时间 = 剩余时间 - let { ActiveModeItem } = this.state; - ActiveModeItem.seconds = t; //修复时间跳变的问题 this.setState({ - currentTime: s_to_hms(t), - ActiveModeItem, + currentTime: s_to_ms(t), + }); + } else { + this.setState({ + currentTime: "00:00", + endPlace: "report", }); - } - - if (Math.abs(timeRemaining - totalTime) < 0) { this.judgementWorkStatus( MODE_WORKING_ENUM.END, jsonStatus.workMode, @@ -922,13 +902,6 @@ class IotCarePlan extends Component { // fix: 启动非支架模式倒计时时,连上支架,仪器的状态变为standby opts.step = 1; } - if (loadingTipsTimer) { - clearTimeout(loadingTipsTimer); - } - // 本来用于更新时间的,但是产生了 ID1000367 bug,先移除 - // if (nowModeItem) { - // opts.currentTime = nowModeItem.time; - // } }, setting: () => { // that.data.hadShowBreakTips = false; @@ -980,6 +953,7 @@ class IotCarePlan extends Component { }); }, pause: () => { + clearInterval(currentTimeTimer); this.setState({ isShowCountdown: false, }); @@ -994,22 +968,13 @@ class IotCarePlan extends Component { end: () => { // 仪器返回护理结束, 支架模式不需要了 // if (modeItem.isStandMode) { - // that.onPauseTap(); + // this.onPauseTap(); // } // 已进入了报告阶段, 防止重复进入, 主要防止在手动点击结束护理接收到仪器消息 - if (this.state.endPlace) return; - // 获取仪器运行时间,更新currentTime, 判断仪器返回时间正常的情况下 - const { totalWorkingSeconds, totalWorkingMinutes } = jsonStatus; - if (totalWorkingSeconds != 0 || totalWorkingMinutes != 0) { - const sceneTime = hourMinSecToS(ActiveModeItem.modeTime); // 模式的总时长 - const runTime = totalWorkingMinutes * 60 + totalWorkingSeconds; //仪器运行时长 - const timeRemaining = sceneTime - runTime; // 剩余未运行时间 - this.setState({ - currentTime: s_to_hms(timeRemaining), - }); - } + console.log("END 护理结束"); + clearInterval(currentTimeTimer); + this.endnursing(true); - // this.rmWL200NursingHistory(this.state.WL200NursingHistory); }, }; statusF[nWorkStatus] && statusF[nWorkStatus](); @@ -1023,34 +988,7 @@ class IotCarePlan extends Component { * 1.是否跳转 2.数据 * */ saveNurseReport = async (isJump = true, from) => { - // const { isStandStatus, standInfo, ActiveModeItem, options } = this.state; - // const currentScene = ActiveModeItem; - // let sceneTime = minSecToS(currentScene.time); - // const timeRemaining = sceneTime - minSecToS(this.state.currentTime); - // const form = { - // second: timeRemaining, - // screne_id: currentScene.screne_id, - // screne_name: currentScene.screne_name, - // instrument_id: options?.devId, - // report: JSON.stringify({ - // positionRatio: Math.floor((timeRemaining / sceneTime) * 100), - // }), - // }; - // // log.info(commandMap.WL200Command, '保存护理报告saveNurseReport', '来自方法from:' + from, '护理时间timeRemaining:'+timeRemaining); - // console.log("timeRemaining=>", timeRemaining); - // console.log("currentScene=>", currentScene); - // console.log("form=>", form); - // // const { data } = await UserNursingLogAdd(form) - // // // 清除缓存 - // // that.rmWL200NursingHistory(that.data.WL200NursingHistory, true); - // // if (data.code == 200 && isJump) { - // // that.setData({ - // // showNurseSuccess: true - // // }); - // // setTimeout(()=>{ - // // wx.redirectTo({ url: `/pages/MatrixWL200/pages/nursingRecord/nursingRecord?instrument_id=${options?.devId}&id=${data.data}` }) - // // }, 2000); - // // } + this.endNurseFun(); }; /** @@ -1060,7 +998,7 @@ class IotCarePlan extends Component { endnursing = (isAuto) => { if (isAuto == true) { // 仪器自动上报完成, 直接上报并跳转报告页 - clearInterval(timer); + clearInterval(currentTimeTimer); const isEnough = this.checkTime(); if (isEnough && !this.state.endPlace) { this.setState({ @@ -1068,43 +1006,12 @@ class IotCarePlan extends Component { }); this.saveNurseReport(true, "endnursing"); } - // this.handleTimeCheck(that.endNurseFun) } else { // 手动点击结束, 弹出弹窗, 看看是否需要结束 this.onEndPlan(); } }; - // 设置自定义模式数据 - setCustomModeData() { - // const { ActiveModeItem, currentTime } = this.state; - // const modeItem = ActiveModeItem; - // const group = modeItem.group; - // if (group.length == 1) return; // 只有1项不用管 - // let inTimeScopeIndex = -1; // 选择的index - // group.forEach((item, index) => { - // let startMinute = item.scope[0]; - // let endMinute = item.scope[1]; - // let targetMinute = currentTime.split(":")[0]; - // let targetSecond = currentTime.split(":")[1]; - // const isInTime = this.isInTimeScope( - // startMinute, - // endMinute, - // targetMinute, - // targetSecond - // ); - // if (isInTime) inTimeScopeIndex = index; - // }); - // if (modeItem.timeScopeIndex !== inTimeScopeIndex) { - // // this.setState({ - // // [`basicModeList[${modelActiveIndex}].timeScopeIndex`]: inTimeScopeIndex, - // // [`basicModeList[${modelActiveIndex}].desc`]: group[inTimeScopeIndex].desc, - // // [`basicModeList[${modelActiveIndex}].technique`]: group[inTimeScopeIndex].technique, - // // [`basicModeList[${modelActiveIndex}].pause_img`]: group[inTimeScopeIndex].pause_img, - // // [`basicModeList[${modelActiveIndex}].running_img`]: group[inTimeScopeIndex].running_img, - // // }) - // } - } isInTimeScope(start, end, targetMinute, targetSecond) { const startTime = dayjs().set("minute", start).set("second", 0); const endTime = dayjs().set("minute", end).set("second", 0); @@ -1123,54 +1030,80 @@ class IotCarePlan extends Component { } // 重置计时器 - resetTimer() { + resetTimer = () => { // 切换模式后, 需要重新设置计时器, 以防进行中的计时器 - timer && clearInterval(timer); - timer = setInterval(() => { + currentTimeTimer && clearInterval(currentTimeTimer); + currentTimeTimer = setInterval(() => { + let { + workStatus, + step, + facialMaskConnectStatus, + currentTime, + ModeStepTimeArray, + ModeStepIndex, + ActiveModeItem, + } = this.state; if ( - this.state.workStatus == MODE_WORKING_ENUM.WORKING && - this.state.step == 2 && - this.state.facialMaskConnectStatus == 1 + workStatus == MODE_WORKING_ENUM.WORKING && + step == 2 && + facialMaskConnectStatus == 1 ) { - /*if(that.data.workMode !== WORK_MODE_NAME_ENUM.POWERFULSOOTHING){*/ - let currentSeconds; - if (this.state.isCurrentModeCombination) { - // 组合模式逻辑 - // that.data.combinationModeInfo.seconds -= 1; - // that.setData({ - // currentTime: s_to_ms(that.data.combinationModeInfo.seconds) - // }) - // currentSeconds = that.data.combinationModeInfo.seconds - } else { - const { ActiveModeItem, currentTime } = this.state; - currentSeconds = hourMinSecToS(currentTime); + let totalSeconds = minSecToS(ActiveModeItem.modeTimeStr); + let currentSeconds = minSecToS(currentTime); + let checkTime = totalSeconds - currentSeconds; + console.log("设备已运行多少秒", checkTime); + console.log("ModeStepTimeArray", ModeStepTimeArray); + if (currentSeconds >= 1) { this.setState({ - currentTime: s_to_hms(--currentSeconds), + currentTime: s_to_ms(--currentSeconds), }); - console.log(ActiveModeItem.isCustomMode); - if (ActiveModeItem.isCustomMode) { - this.setCustomModeData(); + + let length = ModeStepTimeArray.length; + if (length) { + // 模式多个步骤节点切换 + + // 已运行时间达到下一节点时,切换 + if (checkTime > ModeStepTimeArray[ModeStepIndex]) { + // 已运行时间达到下一节点,步骤切换时更新 + if (ModeStepIndex < length) { + let index = ModeStepIndex + 1; // 提前步骤+1 + let currentServiceData = { + startSource: "", + stopSource: "", + }; + let serviceLength = ActiveModeItem.serviceData.length; + if (serviceLength > index) { + currentServiceData = ActiveModeItem.serviceData[index]; + } + + console.log("********************"); + console.log("********************"); + console.log( + "仅在时间达到下一步,步骤切换时更新currentServiceData", + currentServiceData + ); + + this.setState({ + ModeStepIndex: index, + currentServiceData, + }); + } + } } + } else { + clearInterval(currentTimeTimer); + this.setState({ + currentTime: "00:00", + endPlace: "report", + ModeStepIndex: 0, + }); + this.saveNurseReport(true, "setTimer"); // 保存护理计划,并且结束 } - if (currentSeconds <= 0) { - clearInterval(timer); - // 统一接收仪器结束指令 - // that.data.endPlace = 'report'; - // that.saveNurseReport(true, 'setTimer'); - } - /*} else { - that.data.standInfo.seconds -= 1; - that.setData({ currentTime: s_to_ms(that.data.standInfo.seconds) }) - if(that.data.standInfo.seconds <= 0){ - clearInterval(timer); - this.showNurseSuccessDialog() - } - }*/ } }, 1000); - } + }; - // 工作状态 + // 检测并控制工作状态 handleWorkStatus = (isBtnClick: boolean, workStatus) => { const { facialMaskConnectStatus, isStandStatus, ActiveModeItem } = this.state; @@ -1189,13 +1122,24 @@ class IotCarePlan extends Component { } // 非舱体模式 if (!ActiveModeItem.isCabinMode && facialMaskConnectStatus != 1) { + console.log("facialMaskConnectStatus", facialMaskConnectStatus); this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴"); return; } } + + // // 工作状态,开始组合模式 + // if ( + // this.state.ActiveModeItem.combineData.length && + // this.state.workStatus == MODE_WORKING_ENUM.WORKING + // ) { + // this.startCombinationMode(); + // } + const sendParams = { ...deviceCommandSamples.pause, - workMode: WORK_MODE_Chinese_NAME[ActiveModeItem.modeName], // 使用模式 + workMode: ActiveModeItem.modeType, // 使用模式 + // workMode: "MaskCustom", workStatus: newWorkStatus, }; const pauseArrayBuffer = deviceToolKitInstance.toBleCommand( @@ -1247,7 +1191,7 @@ class IotCarePlan extends Component { console.info( commandMap.WL200Command, "点击开始护理按钮", - `当前模式: ${ActiveModeItem}`, + `当前模式: ${ActiveModeItem.modeType}`, `当前面罩状态:${facialMaskConnectStatus}`, `当前仪器模式:${workStatus}` ); @@ -1260,14 +1204,7 @@ class IotCarePlan extends Component { ); if (facialMaskConnectStatus != 1) { - this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴"); - return; - } - if ( - workStatus !== MODE_WORKING_ENUM.WORKING && - workStatus !== MODE_WORKING_ENUM.STANDBY && - workStatus !== MODE_WORKING_ENUM.PAUSE - ) { + console.log("facialMaskConnectStatus 开始处", facialMaskConnectStatus); this.showTips("检测到面罩未连接成功,请确认面罩开机并佩戴"); return; } @@ -1281,52 +1218,61 @@ class IotCarePlan extends Component { this.showTips(`检测到面罩仍和舱体连接中,请分离后切换`); return; } - if (modelActiveItem.isCustomMode && !customModeData.setCustomSuc) { + if ( + ActiveModeItem.modeType === "MaskCustom" && + !this.state.isCombineSuccess + ) { this.showTips(`${modelActiveItem.modeName}模式设置失败,请联系小助手`); return; } // 开始执行护理 - this.handleWorkStatus(false, MODE_WORKING_ENUM.WORKING); + this.handleWorkStatus(true, MODE_WORKING_ENUM.WORKING); + this.showCountdownFun(3, () => {}); // 倒计时弹窗 } // 结束护理? endNurseFun() { - // this.handleWorkStatus(false, "end"); - setTimeout(() => { - //TODO IOS关闭蓝牙太快导致关机指令没发出去,暂时这么解决 - const isEnough = this.checkTime(); - if (!isEnough) { - Taro.showModal({ - title: "提示", - content: "护理时间不足,请重新连接护理", - showCancel: false, - success: (res) => { - if (!this.state.endPlace || this.state.endPlace !== "report") { - // back(); - console.log("back"); - } - // this.state.innerAudioContext.destroy(); - Taro.closeBluetoothAdapter(); - }, - }); - } else { - if (!this.state.endPlace || this.state.endPlace !== "report") { - // back(); - console.log("back"); - } - // this.state.innerAudioContext.destroy(); - Taro.closeBluetoothAdapter(); - } - }, 500); + this.handleWorkStatus(false, "end"); + this.PostNursingLogClock(); + // setTimeout(() => { + // //TODO IOS关闭蓝牙太快导致关机指令没发出去,暂时这么解决 + // const isEnough = this.checkTime(); + // if (!isEnough) { + // Taro.showModal({ + // title: "提示", + // content: "护理时间不足,请重新连接护理", + // showCancel: false, + // success: (res) => { + // if (!this.state.endPlace || this.state.endPlace !== "report") { + // // back(); + // console.log("back"); + // } + // // this.state.innerAudioContext.destroy(); + // Taro.closeBluetoothAdapter(); + // }, + // }); + // } else { + // if (!this.state.endPlace || this.state.endPlace !== "report") { + // // back(); + // console.log("back"); + // } + // // this.state.innerAudioContext.destroy(); + // Taro.closeBluetoothAdapter(); + // } + // }, 500); } // 检查时间是否达标 checkTime() { - const { curDeviceInfo, ActiveModeItem } = this.state; + const { currentDevice, ActiveModeItem } = this.state; const currentScene = ActiveModeItem; - let sceneTime = hourMinSecToS(currentScene.modeTime); - const timeRemaining = sceneTime - hourMinSecToS(this.state.currentTime); - if (timeRemaining >= Number(curDeviceInfo?.nursingTime) * 60) { + let sceneTime = minSecToS(currentScene.modeTimeStr); + const timeRemaining = sceneTime - minSecToS(this.state.currentTime); // 当前模式已运行时间 + + let nursingTimeStr = currentDevice?.nursingTimeStr; + let nursingTime = nursingTimeStr ? minSecToS(nursingTimeStr) : 60; // 设备生成护理记录至少需要运行时间 + + if (timeRemaining >= nursingTime) { return true; } else { return false; @@ -1334,14 +1280,7 @@ class IotCarePlan extends Component { } // 删除WL200护理历史 - rmWL200NursingHistory(WL200NursingHistory, hard = false) { - // const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory"); - // if (nowWL200NursingHistory.id == WL200NursingHistory.id) { - // Taro.removeStorageSync("WL200NursingHistory"); - // } else if (hard) { - // Taro.removeStorageSync("WL200NursingHistory"); - // } - } + rmWL200NursingHistory(WL200NursingHistory, hard = false) {} //蓝牙断开连接处理 bluetoothDisconnectProcessing() { @@ -1355,40 +1294,127 @@ class IotCarePlan extends Component { } } + // 获取护理时间组合 + getServiceTimeData() { + const { ActiveModeItem } = this.state; + let serviceData = ActiveModeItem.serviceData.map((item) => { + // let totalWorkingMinutes = parseInt(item.modeTimeStr.split(":")[0]); // 仅分钟数 + // let totalWorkingSeconds = parseInt(item.modeTimeStr.split(":")[1]); // 仅秒数 + let totalWorkingMinutes = 1; // 仅分钟数 + let totalWorkingSeconds = 0; // 仅秒数 + return { + totalWorkingMinutes, + totalWorkingSeconds, + }; + }); + console.log( + "组合时间ServiceTimeData", + serviceData, + ActiveModeItem.serviceData + ); + return serviceData; + } + // 设置护理时间组合 + setServiceTimeData() { + let ServiceTimeData = this.getServiceTimeData(); + + // 组合时间 + let ModeStepTimeArray: any = []; + ServiceTimeData.reduce((old, cur) => { + let curTime = cur.totalWorkingMinutes * 60 + cur.totalWorkingSeconds; + let newTotalWorkingMinutes = cur.totalWorkingMinutes; + let newTotalWorkingSeconds = cur.totalWorkingSeconds; + if (old) { + newTotalWorkingMinutes += old.totalWorkingMinutes; + newTotalWorkingSeconds += old.totalWorkingSeconds; + + let oldTime = old.totalWorkingMinutes * 60 + old.totalWorkingSeconds; + let value = oldTime + curTime; + console.log("value", value); + ModeStepTimeArray.push(value); + return { + totalWorkingMinutes: newTotalWorkingMinutes, + totalWorkingSeconds: newTotalWorkingSeconds, + }; + } + console.log("curTime", curTime); + ModeStepTimeArray.push(curTime); + return { + totalWorkingMinutes: newTotalWorkingMinutes, + totalWorkingSeconds: newTotalWorkingSeconds, + }; + }, null); + this.setState({ + ModeStepTimeArray: ModeStepTimeArray, + ModeStepIndex: 0, // 每次切换组合模式,重置组合步骤 + }); + console.log("组合时间ModeStepTimeArray", ModeStepTimeArray); + } /* 组合模式 */ + // 获取自定义组合模式原数组 + getOriginModesArray = () => { + const { ModeList, ActiveModeItem } = this.state; + const combineIds = ActiveModeItem.combineData.map( + (item) => item.combineModeId + ); + let modesArray = ModeList.filter((item) => combineIds.includes(item.id)); + return modesArray; + }; + // 获取自定义组合模式数组 + getCustomModesArray = () => { + const { ModeList, ActiveModeItem } = this.state; + const combineIds = ActiveModeItem.combineData.map( + (item) => item.combineModeId + ); + let modesArray = ModeList.filter((item) => + combineIds.includes(item.id) + ).map((item) => { + let totalWorkingMinutes = parseInt(item.modeTimeStr.split(":")[0]); // 仅分钟数 + let totalWorkingSeconds = parseInt(item.modeTimeStr.split(":")[1]); // 仅秒数 + return { + workMode: item.modeType, + totalWorkingMinutes, + totalWorkingSeconds, + }; + }); + return modesArray; + }; setCustomMaskData() { console.log("================"); console.log("setCustomMaskData"); console.log("================"); - const { customModeData, ActiveModeItem } = this.state; - const customItem = ActiveModeItem; - if (!customItem.isCustomMode) { - let { customModeData } = this.state; - customModeData.hadSetCustom = false; - customModeData.setCustomSuc = false; - this.setState({ - customModeData, - }); - return; - } - if ( - !customModeData.setCustomSuc && - customItem && - !customModeData.hadSetCustom - ) { - this.state.customModeData.hadSetCustom = true; - // 设置组 - let customModeSetCommand = customItem.customModeSetCommand; - console.log("自定义模式:", customModeSetCommand); - // log.info('自定义模式:', customModeSetCommand); - let commandBuffer = - deviceToolKitInstanceWL200.toBleCommand(customModeSetCommand); - sendCommand({ - value: commandBuffer, - }).then((res) => { - console.info("发送切换组合模式指令成功", res); - }); - } + + // modesArray 发送组合模式数组指令到设备存储 + let modesArray = this.getCustomModesArray(); + console.log("组合模式modesArray", modesArray); + + let customModeSetCommand = { + commandType: "InfoQuery", + infoQueryType: "customModeSet", + modesArray, + }; + let commandBuffer = deviceToolKitInstance.toBleCommand( + customModeSetCommand as any + ); + sendCommand({ + value: commandBuffer, + }).then((res) => { + console.info("发送切换组合模式指令成功", res); + }); + } + // 发送启动组合模式指令 + startCombinationMode() { + const jsonCommand = { + commandType: "DeviceControl", + workStatus: "working", + workMode: "MaskCustom", + }; + let commandBuffer = deviceToolKitInstance.toBleCommand(jsonCommand as any); + sendCommand({ + value: commandBuffer, + }).then(() => { + console.info("发送启动组合模式指令成功 参数为 =>", jsonCommand); + }); } // 护理的错误提示 @@ -1412,6 +1438,7 @@ class IotCarePlan extends Component { }); }; confirmEndBtn = () => { + this.endNurseFun(); this.cancelEndBtn(); }; cancelEndBtn = () => { @@ -1421,24 +1448,47 @@ class IotCarePlan extends Component { }; /** 弹窗 END*/ + /** 护理记录 */ + // apiClock + PostNursingLogClock = async () => { + let { currentDevice, ActiveModeItem } = this.state; + let params = { + instrumentId: currentDevice.id, + instrumentName: currentDevice.name, + modeId: ActiveModeItem.id, + modeName: ActiveModeItem.modeName, + nursingTime: ActiveModeItem.modeTime, + }; + let res: any = await InstrumentInfo.apiNursingLog.addLog(params); + console.log("PostNursingLogClock", res); + }; + /** 护理记录 End */ + render() { let { name, title, isShowStepTips, - ModeList, - ModeType, isConnectionBlutoot, isShowNurse, isStopNurse, + ModeList, + ModeType, + currentServiceData, ActiveModeItem, + SwitchActiveModeItem, + isSwitchActiveMode, + ModeID, + activeModeID, isShowCountdown, countdown, ModeStepIndex, Electricity, + matrixElectricity, errorTips, isEndCarePlan, currentTime, + facialMaskConnectStatus, } = this.state; return ( @@ -1458,6 +1508,31 @@ class IotCarePlan extends Component { close={this.cancelEndBtn} confirm={this.confirmEndBtn} /> + + } + textAlgin="center" + cancelButtonText="取消" + confirmButtonText="确定" + close={this.cancelModeSwitchBtn} + confirm={this.confirmModeSwitchBtn} + /> + {ActiveModeItem.openSourceData && ( { {isStopNurse ? ( ) : ( )} @@ -1515,64 +1586,32 @@ class IotCarePlan extends Component { - - 护理时间:{currentTime} - - WE200电量: - - {Electricity >= 4 && ( - - - - - - - )} - {Electricity === 3 && ( - - - - - - - )} - {Electricity === 2 && ( - - - - - - - )} - {Electricity === 1 && ( - - - - - - - )} - {Electricity === 0 && ( - - - - - - - )} - + + 护理时间: + {currentTime} + + + {ModeList.length > 0 && ( )} diff --git a/src/utils/request.js b/src/utils/request.js index f94f0a9..a9943e7 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -59,14 +59,14 @@ export const Ajax = (params) => { return; } - if (res.statusCode !== 200) { - Taro.showModal({ - title: "提示", - content: String("错误码:" + res.statusCode), - showCancel: false, - }); - return false; - } + // if (res.statusCode !== 200) { + // Taro.showModal({ + // title: "提示", + // content: String("错误码:" + res.statusCode), + // showCancel: false, + // }); + // return false; + // } if (res.data.code === 500) { let msg = "系统异常,请联系管理人员";