临时提交

master
blak-kong 2 years ago
parent 3369f37266
commit f3d8949cc8

@ -24,7 +24,7 @@ class App extends Component<PropsWithChildren> {
return;
}
go("/pages/iotCarePlan/iotCarePlan");
// go("/pages/iotCarePlan/iotCarePlan");
// go("/pages/instrument_clickin_upload/index");
// go("/pages/instrument/intro");
// Taro.switchTab({

@ -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);
}
}

@ -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<any, any> {
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 (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
{isClose && (
<View
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
)}
<View className={classnames("common-box", "countdown-box")}>
<View
className={classnames("common-popup-title", "countdown-title")}
>
</View>
<View className="common-popup-content-box">
<View
className={classnames(
"common-popup-content",
"countdown-content"
)}
>
<View className="countdown-popup-loading">
<View className="ui-loading__bg">
<View className="ui-loading"></View>
</View>
{countdown >= 0 && (
<View className="countdown-popup-loading-time">
{countdown}
</View>
)}
</View>
</View>
</View>
</View>
</Popup>
</Block>
);
}
}

@ -484,6 +484,7 @@ class Index extends Component<any, any> {
}
};
/** 查询是否可以绑定 */
isBindingSerial = async () => {
Taro.showLoading({
title: "请求中...",
@ -503,7 +504,7 @@ class Index extends Component<any, any> {
}
Taro.hideLoading();
};
// 绑定仪器
/** 调用接口绑定仪器 */
bindingInstrument = async () => {
Taro.showLoading({
title: "请求中...",

@ -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 (
<Block>
<View className="footer">
{!isShowNurse && (
<Block>
{isConnectionBlutoot ? (
<View className="btn" onClick={onStartNurse}>
</View>
) : (
<View className="btn btn-disable" onClick={onStartNurse}>
</View>
)}
</Block>
)}
{isShowNurse && (
<View className="switch-btn-box" onClick={onSwitchChange}>
<View className="btn-item border-right">
{isStopNurse ? (
<Block>
<Image
className="btn-icon"
src={require("../../../../img/iot/pause_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text"></Text>
</Block>
) : (
<Block>
<Image
className="btn-icon"
src={require("../../../../img/iot/start_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text"></Text>
</Block>
)}
</View>
<View className="btn-item" onClick={onEndPlan}>
<Image
className="btn-icon"
src={require("../../../../img/iot/over_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text"></Text>
</View>
</View>
)}
</View>
</Block>
);
}
export default Index;

@ -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;
}
}
}
}

@ -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 (
<Block>
{isShowNurse && (
<View className="modelInfo-box">
<View className="modelInfo-line is-effect">
<View className="modelInfo-title"></View>
<View className="modelInfo-effect">{ActiveModeItem.modeDesc}</View>
</View>
<View className="modelInfo-line">
<View className="modelInfo-title"></View>
<View className="modelInfo-light-box">
{ActiveModeItem.combineData.map((item) => {
return (
<View className="modelInfo-light-item" key={item.id}>
<View
className="modelInfo-light-color"
style={{
backgroundColor: ModeColor[item.technologyInfo],
}}
></View>
<View className="modelInfo-light-colorname">
{item.effectContent}({item.technologyInfo})
</View>
</View>
);
})}
</View>
</View>
</View>
)}
</Block>
);
}
export default Index;

@ -7,22 +7,23 @@ import "./index.less";
interface Props {
ModeList: any;
ModeType: string; // all visor cabin yimeish
ActiveModeItem: any;
onEmit: Function; // 每次点击item回调事件和数据给父组件
}
function Index({ ModeList, ModeType, onEmit }: Props) {
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<any>("");
const [activeID, setActiveID] = useState<any>("");
const [ModeID, setModeID] = useState<any>("mode_" + ActiveModeItem.id);
const [activeID, setActiveID] = useState<any>(ActiveModeItem.id);
console.log("ModeID", ModeID, activeID);
const yimeishClick = (item) => {
onEmit(item);
useEffect(() => {
setActiveID(item.id);
setModeID("mode_" + item.id);
});
setActiveID(item.id);
setModeID("mode_" + item.id);
};
const cabinClick = (item) => {

@ -20,10 +20,13 @@ import { connect } from "react-redux";
/* 公共组件 */
import Navbar from "@/components/navbar/navbar";
import PopupCountdown from "@/components/popup/popup-countdown";
/* 公共组件 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";
@ -41,9 +44,14 @@ class IotCarePlan extends Component<any, any> {
isStopNurse: false, // 是否暂停护理
isEndNurse: false, // 是否结束护理
// 模式列表
ModeList: [],
ModeType: "all", // all visor cabin yimeish
activeModeItem: {}, // 当前选中模式
ActiveModeItem: {}, // 当前选中模式
// 倒计时
isShowCountdown: false,
countdown: 6,
};
}
@ -72,7 +80,18 @@ class IotCarePlan extends Component<any, any> {
};
let res = await InstrumentInfo.modeInfoList(params);
if (res.data.code === 200) {
this.setState({ ModeList: res.data.data });
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 });
}
}
};
@ -81,20 +100,37 @@ class IotCarePlan extends Component<any, any> {
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 });
this.setState({ ActiveModeItem: data });
};
stepNext = () => {
// //0未定义全部 1面罩模式 2舱体模式 3医美术后
let modeArray = ["all", "visor", "cabin", "yimeish"];
let modeClass = this.state.activeModeItem.modeClass;
let modeClass = this.state.ActiveModeItem.modeClass;
this.setState({ ModeType: modeArray[modeClass] });
this.setState({ isShowNurse: true });
};
render() {
@ -106,10 +142,14 @@ class IotCarePlan extends Component<any, any> {
isConnectionBlutoot,
isShowNurse,
isStopNurse,
ActiveModeItem,
isShowCountdown,
countdown,
} = this.state;
return (
<Block>
<Navbar titleSlot="美容仪名字" isBack={true} />
<PopupCountdown isShow={isShowCountdown} countdown={countdown} />
<View>
<View className="iot-main">
<View className="banner-box">
@ -128,7 +168,20 @@ class IotCarePlan extends Component<any, any> {
/>
)}
</View>
<Video className="video-or-image" src="" />
<View>
{!isShowNurse && (
<Video
className="video-or-image"
src={ActiveModeItem.modeVideo}
/>
)}
{/* { isShowNurse && <Image
className="video-or-image"
src={ActiveModeItem.modeVideo}
/> } */}
</View>
<View className="iot-device">
<View className="item border-right">
<Text>10:00</Text>
@ -144,77 +197,29 @@ class IotCarePlan extends Component<any, any> {
</View>
</View>
<ModeListView
ModeList={ModeList}
ModeType={ModeType}
onEmit={this.modeCurrentFun}
{ModeList.length > 0 && (
<ModeListView
ModeList={ModeList}
ModeType={ModeType}
ActiveModeItem={ActiveModeItem}
onEmit={this.modeCurrentFun}
/>
)}
<ModeContent
isShowNurse={isShowNurse}
ActiveModeItem={ActiveModeItem}
/>
</View>
{isShowNurse && (
<View className="modelInfo-box">
<View className="modelInfo-line is-effect">
<View className="modelInfo-title"></View>
<View className="modelInfo-effect">
{/* {{basicModeList[modelActiveIndex].desc}} */}
</View>
</View>
<View className="modelInfo-line">
<View className="modelInfo-title"></View>
<View className="modelInfo-light-box">
<View className="modelInfo-light-item">
<View className="modelInfo-light-color"></View>
<View className="modelInfo-light-colorname"></View>
</View>
</View>
</View>
</View>
)}
<View className="footer">
{!isShowNurse && (
<Block>
{isConnectionBlutoot ? (
<View className="btn" onClick={this.onStartNurse}>
</View>
) : (
<View className="btn btn-disable" onClick={this.onStartNurse}>
</View>
)}
</Block>
)}
{isShowNurse && (
<View className="switch-btn-box">
<View className="btn-item border-right">
{isStopNurse ? (
<Image
className="btn-icon"
src={require("../../img/iot/pause_nurse.png")}
mode="aspectFill"
/>
) : (
<Image
className="btn-icon"
src={require("../../img/iot/start_nurse.png")}
mode="aspectFill"
/>
)}
<Text className="btn-text"></Text>
</View>
<View className="btn-item">
<Image
className="btn-icon"
src={require("../../img/iot/over_nurse.png")}
mode="aspectFill"
/>
<Text className="btn-text"></Text>
</View>
</View>
)}
</View>
<Footer
isConnectionBlutoot={isConnectionBlutoot}
isShowNurse={isShowNurse}
isStopNurse={isStopNurse}
onEmitStartNurse={this.onStartNurse}
onEmitSwitchChange={this.onSwitchChange}
onEmitEndPlan={this.onEndPlan}
/>
</View>
</Block>
);

@ -282,7 +282,7 @@ class User extends Component<any, any> {
<Image src="/img/my_right.png" mode="aspectFill" />
</View>
</View>
<View className="num">{count}</View>
<View className="num">{userInfo.devicesNum}</View>
<View className="txt"></View>
</View>
<View

@ -22,6 +22,7 @@ const userInfoReducer = createSlice({
credit: 0, // 积分
expireCredit: 0, // 过期积分
integralText: "",
devicesNum: 0, // 绑定设备数量
},
reducers: {
setMobile(state, { payload }) {
@ -50,6 +51,7 @@ const userInfoReducer = createSlice({
state.credit = payload.credit || 0;
state.expireCredit = payload.expireCredit || 0;
state.integralText = payload.integralText || "";
state.devicesNum = payload.devicesNum || 0;
Taro.setStorageSync("mobile", state.mobile);
// Taro.setStorageSync("token", state.token);
@ -70,6 +72,7 @@ const userInfoReducer = createSlice({
state.credit = payload.credit || 0;
state.expireCredit = payload.expireCredit || 0;
state.integralText = payload.integralText || "";
state.devicesNum = payload.devicesNum || 0;
Taro.setStorageSync("mobile", state.mobile);
// 设置token和过期时间

Loading…
Cancel
Save