diff --git a/src/app.tsx b/src/app.tsx index 4ea6abf..f8e1d69 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,7 +24,7 @@ class App extends Component { return; } - // go("/pages/iotCarePlan/iotCarePlan"); + go("/pages/iotCarePlan/iotCarePlan"); // go("/pages/instrument_clickin_upload/index"); // go("/pages/instrument/intro"); // Taro.switchTab({ 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/pages/iotCarePlan/components/ModeList/index.less b/src/pages/iotCarePlan/components/ModeList/index.less index db7e5bd..73a4d67 100644 --- a/src/pages/iotCarePlan/components/ModeList/index.less +++ b/src/pages/iotCarePlan/components/ModeList/index.less @@ -1,8 +1,40 @@ +.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-bottom: 20rpx; + margin-top: 20rpx; background-color: #f2f2f2; border-radius: 30rpx; box-sizing: border-box; @@ -46,6 +78,7 @@ margin-bottom: 4rpx; font-size: 26rpx; text-align: center; + font-weight: bold; } .mode-info-time { margin-bottom: 4rpx; @@ -81,7 +114,7 @@ margin-left: 20rpx; } .mode-item-active { - min-width: 300rpx; + // min-width: 300rpx; padding-right: 11rpx; background: linear-gradient(90deg, #efdcc2 0%, #fff2df 100%); } diff --git a/src/pages/iotCarePlan/components/ModeList/index.tsx b/src/pages/iotCarePlan/components/ModeList/index.tsx index 0aa2a38..d1d4f0c 100644 --- a/src/pages/iotCarePlan/components/ModeList/index.tsx +++ b/src/pages/iotCarePlan/components/ModeList/index.tsx @@ -1,103 +1,188 @@ 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 { - // link: string; - // children?: any; ModeList: any; + ModeType: string; // all visor cabin yimeish + onEmit: Function; // 每次点击item,回调事件和数据给父组件 } - -let scrollIntoView = "0"; - -function Index({ ModeList }: any) { +function Index({ ModeList, ModeType, 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(""); + const [activeID, setActiveID] = useState(""); + + const yimeishClick = (item) => { + onEmit(item); + useEffect(() => { + 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 ( - {VisorList.length > 0 && ( - - - 面罩模式 - {VisorList.map((item: any, index: any) => { - return ( - - - {item.modeName} - {item.modeDesc} - - - - - - - - - ); - })} + + {ModeList.length > 0 && ModeType !== "all" && ( + + 全部模式 + - - )} - {CabinList.length > 0 && ( - - - 舱体模式 - {CabinList.map((item: any, index: any) => { - return ( - - - {item.title} - {item.time} - - + )} + {VisorList.length > 0 && + (ModeType === "all" || ModeType === "visor") && ( + + + 面罩模式 + {VisorList.map((item: any, index: any) => { + return ( + + + {item.modeName} + {item.modeTime} + + {activeID === item.id && ( + + )} + + + + {activeID === item.id && ( + + + + )} - - - - - - ); - })} - - - )} + ); + })} + + + )} + {CabinList.length > 0 && + (ModeType === "all" || ModeType === "cabin") && ( + + + 舱体模式 + {CabinList.map((item: any, index: any) => { + return ( + + + {item.modeName} + {item.modeTime} + + {activeID === item.id && ( + + )} + + - {YimeishList.length > 0 && ( - - - 医美术后 - {YimeishList.map((item: any, index: any) => { - return ( - - - {item.title} - {item.time} - - + {activeID === item.id && ( + + + + )} - - - - - - ); - })} - - - )} + ); + })} + + + )} + + {YimeishList.length > 0 && + (ModeType === "all" || ModeType === "yimeish") && ( + + + 医美术后 + {YimeishList.map((item: any, index: any) => { + return ( + + + {item.modeName} + {item.modeTime} + + {activeID === item.id && ( + + )} + + + + {activeID === item.id && ( + + + + )} + + ); + })} + + + )} + ); } diff --git a/src/pages/iotCarePlan/iotCarePlan.less b/src/pages/iotCarePlan/iotCarePlan.less index c38ba08..271c249 100644 --- a/src/pages/iotCarePlan/iotCarePlan.less +++ b/src/pages/iotCarePlan/iotCarePlan.less @@ -2,6 +2,7 @@ padding: 20rpx 30rpx; background: #f8f8f8; box-sizing: border-box; + min-height: calc(100vh - 180rpx); .banner-box { position: relative; display: block; @@ -53,3 +54,105 @@ // 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 index 94ff5a5..a2b9f5c 100644 --- a/src/pages/iotCarePlan/iotCarePlan.tsx +++ b/src/pages/iotCarePlan/iotCarePlan.tsx @@ -35,9 +35,15 @@ class IotCarePlan extends Component { super(props); this.state = { name: "iotCarePlan", - musicStatus: false, // 声音播放状态 + isMusicPlay: false, // 声音播放状态 + isConnectionBlutoot: false, // 是否已连接蓝牙 + isShowNurse: false, // 是否开始并显示护理 + isStopNurse: false, // 是否暂停护理 + isEndNurse: false, // 是否结束护理 ModeList: [], + ModeType: "all", // all visor cabin yimeish + activeModeItem: {}, // 当前选中模式 }; } @@ -70,25 +76,54 @@ class IotCarePlan extends Component { } }; + changeMusicStatus = () => { + let { isMusicPlay } = this.state; + this.setState({ isMusicPlay: !isMusicPlay }); + }; + + onStartNurse = async () => { + this.stepNext(); + }; + + 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] }); + }; + render() { - let { name, musicStatus, ModeList } = this.state; + let { + name, + isMusicPlay, + ModeList, + ModeType, + isConnectionBlutoot, + isShowNurse, + isStopNurse, + } = this.state; return ( - - {musicStatus ? ( + + {isMusicPlay ? ( ) : ( )} @@ -99,12 +134,86 @@ class IotCarePlan extends Component { 护理时间:10:00 - WE200电量 + WE200电量: + + + + + - + + + + {isShowNurse && ( + + + 模式功效 + + {/* {{basicModeList[modelActiveIndex].desc}} */} + + + + 当前输出技术 + + + + + + + + + )} + + + {!isShowNurse && ( + + {isConnectionBlutoot ? ( + + 开始护理 + + ) : ( + + 开始护理 + + )} + + )} + {isShowNurse && ( + + + {isStopNurse ? ( + + ) : ( + + )} + + 暂停光照 + + + + 结束护理 + + + )}