解决冲突

master
qsj 2 years ago
commit b2f8a48528

@ -1 +1,5 @@
@import url(./WL200.less);
.show {
display: none;
}

@ -3,16 +3,15 @@ import dayjs from "dayjs";
import classnames from "classnames";
import { debounce } from "lodash";
// eslint-disable-next-line import/no-named-as-default
import React, {
Component,
PropsWithChildren,
useEffect,
useState,
} from "react";
import Echarts from "./components/Echart/index";
import Gears from "./components/Gears/index";
/*** redux ***/
import { connect } from "react-redux";
/*** redux end ***/
import {
Block,
View,
@ -23,9 +22,27 @@ import {
Button,
} from "@tarojs/components";
/*** redux ***/
import { connect } from "react-redux";
/*** redux end ***/
import {
notifyBLECharacteristicValueChange,
sendCommand,
} from "@/utils/bluetoothWXAPI";
import {
deviceCommandSamples,
bleCommandSamples,
} from "@/components/bluetoot/connection/wl200";
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
// import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import {
DeviceToolKit as DeviceToolKitWM,
TResponseFromDevice as TResponseFromDeviceWM,
} from "@flossom-npm/iot-translater";
import commandMap from "@/utils/commandMap";
import { Popup } from "@antmjs/vantui";
import { fr200BleCommand } from "@/components/bluetoot/connection/fr200";
import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
/* 公共组件 */
import Navbar from "@/components/navbar/navbar";
@ -45,28 +62,13 @@ import Footer from "./components/Footer/FR200";
import WaterTest from "./components/WaterTest/index";
/* 本页组件 END */
import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
import Echarts from "./components/Echart";
import Gears from "./components/Gears";
import "./FR200.less";
import {
notifyBLECharacteristicValueChange,
sendCommand,
} from "@/utils/bluetoothWXAPI";
import {
deviceCommandSamples,
bleCommandSamples,
} from "@/components/bluetoot/connection/wl200";
import { minSecToS, s_to_ms, s_to_hms, sleep, s_to_s } from "@/utils/util";
// import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import {
DeviceToolKit as DeviceToolKitWM,
TResponseFromDevice as TResponseFromDeviceWM,
} from "@flossom-npm/iot-translater";
import commandMap from "@/utils/commandMap";
import { Popup } from "@antmjs/vantui";
import { fr200BleCommand } from "@/components/bluetoot/connection/fr200";
const deviceToolKitInstanceFR200 = new DeviceToolKitWM("FR200");
let deviceToolKitInstance = deviceToolKitInstanceFR200;
@ -220,6 +222,9 @@ class IotCarePlanFR200 extends Component<any, any> {
// isFirstEntryMode: false, // 模式首次打开
isShowHistoryMsg: false, // 是否显示正在同步历史
showEcharts: false,
echartsData: '' //传给echarts图表的数据
};
}
@ -272,10 +277,11 @@ class IotCarePlanFR200 extends Component<any, any> {
this.initData();
this.getInstrumentClockSummary();
this.getInstrumentClockDetail();
}
componentDidMount() {}
componentDidMount() { }
componentWillUnmount() {}
componentWillUnmount() { }
componentDidShow() {
console.log("页面显示了");
@ -423,6 +429,10 @@ class IotCarePlanFR200 extends Component<any, any> {
this.modeCurrentFun(res.data.data[0]);
}, 100);
}
let res1 = res.data.data.find(e => e.id == this.state.activeModeID)
setTimeout(() => {
this.modeCurrentFun(res1);
}, 100);
} else {
this.setState({ ModeList: [] });
}
@ -501,6 +511,15 @@ class IotCarePlanFR200 extends Component<any, any> {
currentWorkModeType,
});
setTimeout(() => {
// 设置时间组合
if (data.serviceData.length > 0) {
this.setServiceTimeData();
}
});
// 开发中,暂时允许直接切换
// 每次切换模式时清空一下历史数据
this.changeItemUpdateFR200NursingHistory();
@ -672,9 +691,27 @@ class IotCarePlanFR200 extends Component<any, any> {
this.showTips("检测到您的设备没有紧贴肌肤,请紧贴肌肤后重新尝试");
});
};
look() {
let that = this
// this.setState({ showEcharts: !this.state.showEcharts });
let stop = 0
let time = setInterval(function () {
stop++
let random = Math.random();
that.setState({ echartsData: random })
if (stop >= 20) {
clearInterval(time)
}
}, 1000)
}
updata() {
}
// 绘制能量图
drawProwerPicture() {}
drawProwerPicture() { }
/** 切换光照 */
onSwitchChange = async () => {
@ -1675,6 +1712,7 @@ class IotCarePlanFR200 extends Component<any, any> {
console.log("保存setFR200NursingHistory");
};
/** 更新WL200护理历史运行时间 */
updateFR200NursingHistory = (data: any = null, jsonStatus = null) => {
this.FR200NursingHistory = Taro.getStorageSync("FR200NursingHistory");
@ -1692,6 +1730,8 @@ class IotCarePlanFR200 extends Component<any, any> {
if (!params.dataArray) params.dataArray = [];
params.dataArray.push(jsonStatus);
params.jsonStatus = jsonStatus;
}
}
Taro.setStorageSync("FR200NursingHistory", params);
@ -1700,7 +1740,7 @@ class IotCarePlanFR200 extends Component<any, any> {
// 基础模式可在这里调用函数更新图标Echarts
// 最新一条数据jsonStatus
// 注意事项只拿working状态
// todo
// todo
} else {
this.setFR200NursingHistory(jsonStatus);
}
@ -2011,11 +2051,11 @@ class IotCarePlanFR200 extends Component<any, any> {
let report = true;
go(
"/recoding/pages/face_report_one/face_report_one?id=" +
id +
"&report=" +
report +
"&obj=" +
JSON.stringify(obj)
id +
"&report=" +
report +
"&obj=" +
JSON.stringify(obj)
);
} else if ("moistureTest" === nursingData.workMode) {
console.log("水分测试");
@ -2027,6 +2067,10 @@ class IotCarePlanFR200 extends Component<any, any> {
"&report=" +
report
);
// go(
// "/recoding/pages/face_report/face_report?id=" +
// this.state.currentDevice.id
// );
}
};
@ -2177,6 +2221,10 @@ class IotCarePlanFR200 extends Component<any, any> {
isShowHistoryMsg,
isModeLock,
TestModeStepIndex,
showEcharts,
echartsData,
isShowReReadRecordConnect,
currentServiceData
} = this.state;
return (
@ -2192,19 +2240,19 @@ class IotCarePlanFR200 extends Component<any, any> {
<PopupAlert
isShow={isModeLock}
zIndex={10020}
myClassName="level-up"
title="提示"
content="该模式即将上线,敬请期待"
confirmButtonText="我知道了"
textAlgin="center"
myClassName='level-up'
title='提示'
content='该模式即将上线,敬请期待'
confirmButtonText='我知道了'
textAlgin='center'
close={this.onModeLockClose}
confirm={this.onModeLockClose}
/>
<PopupInstrumentUploadTips
isShow={isFirstTipShow}
zIndex={10020}
myClassName="level-up"
title="打卡介绍"
myClassName='level-up'
title='打卡介绍'
data={nurseInfo}
close={this.onTipShowClose}
confirm={this.onTipShowClose}
@ -2216,11 +2264,11 @@ class IotCarePlanFR200 extends Component<any, any> {
isLarge
isClose
isShow={isEndCarePlan}
title="提示"
content="是否结束护理"
textAlgin="center"
cancelButtonText="取消"
confirmButtonText="确定"
title='提示'
content='是否结束护理'
textAlgin='center'
cancelButtonText='取消'
confirmButtonText='确定'
close={this.cancelEndBtn}
confirm={this.confirmEndBtn}
/>
@ -2228,7 +2276,7 @@ class IotCarePlanFR200 extends Component<any, any> {
isLarge
isClose
isShow={isSwitchActiveMode}
title="护理模式切换"
title='护理模式切换'
content={
<ModeListView
ModeID={ModeID}
@ -2242,9 +2290,9 @@ class IotCarePlanFR200 extends Component<any, any> {
onModeLockOpen={this.onModeLockOpen}
/>
}
textAlgin="center"
cancelButtonText="取消"
confirmButtonText="确定"
textAlgin='center'
cancelButtonText='取消'
confirmButtonText='确定'
close={this.cancelModeSwitchBtn}
confirm={this.confirmModeSwitchBtn}
/>
@ -2254,7 +2302,7 @@ class IotCarePlanFR200 extends Component<any, any> {
isShow={isShowStepTips}
isLarge
isFirstEntry={false}
confirmButtonText="知道了"
confirmButtonText='知道了'
data={ActiveModeItem.openSourceData}
close={this.closeStepTips}
/>
@ -2263,10 +2311,10 @@ class IotCarePlanFR200 extends Component<any, any> {
<PopupAlert
isShow={isNotEnoughTime}
isClose
title="提示"
content="您的本次护理时间不足,请重新护理"
confirmButtonText="确认"
textAlgin="center"
title='提示'
content='您的本次护理时间不足,请重新护理'
confirmButtonText='确认'
textAlgin='center'
close={this.closeNotEnoughTime}
confirm={this.closeNotEnoughTime}
/>
@ -2275,11 +2323,11 @@ class IotCarePlanFR200 extends Component<any, any> {
isShow={isShowErrorTipsText}
isClose
zIndex={10020}
myClassName="level-up"
title="提示"
myClassName='level-up'
title='提示'
content={errorTipsText}
confirmButtonText="知道了"
textAlgin="center"
confirmButtonText='知道了'
textAlgin='center'
close={this.closeErrorTipsText}
confirm={this.closeErrorTipsText}
/>
@ -2288,17 +2336,17 @@ class IotCarePlanFR200 extends Component<any, any> {
isShow={isShowTipsSave}
isClose
zIndex={10020}
myClassName="level-up"
title="提示"
myClassName='level-up'
title='提示'
content={
<Block>
<View></View>
<View></View>
</Block>
}
cancelButtonText="取消"
confirmButtonText="确认"
textAlgin="center"
cancelButtonText='取消'
confirmButtonText='确认'
textAlgin='center'
close={this.closeTipsSave}
cancel={this.cancelTipsSave}
confirm={this.confirmTipsSave}
@ -2307,11 +2355,11 @@ class IotCarePlanFR200 extends Component<any, any> {
<PopupStatus
isShow={isShowNursingSuccess}
isClose
title="您已结束本次护理"
type="success"
content="正在上传护理记录……"
confirmButtonText="知道了"
textAlgin="center"
title='您已结束本次护理'
type='success'
content='正在上传护理记录……'
confirmButtonText='知道了'
textAlgin='center'
close={() => {
/*不需要做处理*/
}}
@ -2322,57 +2370,69 @@ class IotCarePlanFR200 extends Component<any, any> {
deviceInfo={currentDevice}
close={this.connectionClose}
isDisconnect={!isConnectionBlutoot}
offlineChange={() => {}}
offlineChange={() => { }}
pairingChange={this.pairingChange}
upgradeFun={() => {}}
upgradeFun={() => { }}
/>
)}
<Popup
show={isShowHistoryMsg}
className="custom-popup"
className='custom-popup'
overlay={false}
>
<View className="sync-history-msg">...</View>
<View className='sync-history-msg'>...</View>
</Popup>
</View>
<View>
<View className="iot-main">
<View className="banner-box">
<View className='iot-main'>
<View className='banner-box'>
<View>
<Video
className="video-or-image"
src={ActiveModeItem.modeVideo}
loop
id="myVideo"
objectFit="cover"
enablePlayGesture
showFullscreenBtn={false}
onLoadedMetaData={this.GetVideosTime}
/>
{!isShowNurse && (
<Video
className='video-or-image'
src={ActiveModeItem.modeVideo}
loop
/>
)}
{isShowNurse && (
<Block>
{isStopNurse ? (
<Image
className='video-or-image'
src={currentServiceData.stopSource}
/>
) : (
<Image
className='video-or-image'
src={currentServiceData.startSource}
/>
)}
</Block>
)}
{errorTips && (
<Block>
<View className="msg-tips">
<View className='msg-tips'>
<Image
className="msg-tips-img"
className='msg-tips-img'
src={require("@/img/tips.png")}
/>
<View className="msg-tips-content">{errorTips}</View>
<View className='msg-tips-content'>{errorTips}</View>
</View>
</Block>
)}
</View>
<View className="iot-device">
<View className="item">
<Text className="device-time">
<View className='iot-device'>
<View className='item'>
<Text className='device-time'>
<Text className="time">{currentTime}</Text>
<Text className='time'>{currentTime}</Text>
</Text>
</View>
<View className="line" />
<View className='line' />
<ElectricityView
Electricity={Electricity}
matrixElectricity={matrixElectricity}
@ -2394,25 +2454,22 @@ class IotCarePlanFR200 extends Component<any, any> {
onModeLockOpen={this.onModeLockOpen}
/>
)}
<button onClick={this.look.bind(this)} >echarts </button>
<button onClick={this.updata.bind(this)} > </button>
<View className={classnames({ 'show': showEcharts })}><Echarts data={echartsData} ></Echarts></View>
{/* {(ActiveModeItem.modeType === "face" ||
ActiveModeItem.modeType === "eyes") && (
<Block>
<Echarts></Echarts>
</Block>
)} */}
{/* <View style="display:none;">
<Echarts></Echarts>
</View> */}
ActiveModeItem.modeType === "eyes") && <Echarts></Echarts>} */}
{(ActiveModeItem.modeType === "maskPenetration" ||
ActiveModeItem.modeType === "essence") && (
<Gears
onEmitMinus={this.handleMinus}
onEmitAdd={this.handleAdd}
GearData={GearData}
></Gears>
)}
<Gears
onEmitMinus={this.handleMinus}
onEmitAdd={this.handleAdd}
GearData={GearData}
></Gears>
)}
{ActiveModeItem.modeType === "moistureTest" && (
<WaterTest

@ -1,13 +1,41 @@
.box {
width: 690rpx;
height: 320rpx;
margin: 28rpx auto;
margin: 28rpx auto 150rpx;
background-color: #fff;
border-radius: 30rpx;
padding: 35rpx 25rpx 25rpx 35rpx;
box-sizing: border-box;
position: relative;
}
.fullscreen {
position: fixed;
top: 450rpx;
left: -450rpx;
right: 0;
bottom: 0;
width: 100vh;
height: 100vw;
z-index: 9999;
background-color: rgba(0, 0, 0, 0.5); /* 背景色 */
transform: rotate(90deg);
// animation: rotate 0s linear;
}
@keyframes rotate {
from {
width: 690rpx;
height: 320rpx;
transform: rotate(0deg);
}
to {
width: 100vh;
height: 100vw;
transform: rotate(0deg);
}
}
.box_background {
position: absolute;
top: 0;
@ -29,6 +57,7 @@
position: absolute;
top: 32rpx;
right: 26rpx;
z-index: 2;
}
.line {
margin: 0 0 6rpx 35rpx;

@ -2,25 +2,23 @@ import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Block, View, Image, Text, Input } from "@tarojs/components";
import { Popup, Progress, Slider } from "@antmjs/vantui";
import { useRef } from "react";
import { useEffect, useRef, useState, useCallback } from "react";
import Echarts, { EChartOption, EchartsHandle } from "taro-react-echarts";
import echarts from "@/utils/echarts.min.js";
import "./index.less";
interface Props {
Electricity: any;
matrixElectricity: any;
facialMaskConnectStatus: any;
data: any
}
function Index() {
function Index({ data }: Props) {
const buttonRef = useRef(null);
const echartsRef = useRef<EchartsHandle>(null);
const option: EChartOption = {
const [options, setOptions] = useState({
animation: false,
grid: {
// 让图表占满容器
top: "28rpx",
@ -258,14 +256,82 @@ function Index() {
},
},
],
};
})
const level = [8, 7, 6, 5, 4, 3, 2];
const full = () => {
let box = document.getElementById("box");
box?.classList.add('fullscreen')
}
const [newOptions, setNewOptions] = useState(options)
const [newData, setNewData] = useState(0)
const full = useCallback(() => {
// let box = document.getElementById("box");
// box?.classList.add('fullscreen')
let stop = 0
// let time = setInterval(function () {
// stop++
let option = JSON.parse(JSON.stringify(options))
let num = Math.floor(Math.random() * 9)
let count = 0
options.series.map(item => {
if (item.type === 'line') {
item.data.splice(0, 1)
item.data.push(num)
}
if (item.type === 'bar') {
count++
item.data.splice(0, 1)
if (count <= num) {
item.data.push(1)
} else {
item.data.push(0)
}
}
})
console.log(option);
// 更新图表数据
setNewOptions(option)
// if (stop > 20) {
// clearInterval(time)
// }
// }, 1000)
}, [data])
useEffect(() => {
setOptions(newOptions)
}, [newOptions]);
useEffect(() => {
setNewData(data)
}, [data]);
useEffect(() => {
let option = JSON.parse(JSON.stringify(options))
let num = Math.floor(newData * 9)
let count = 0
options.series.map(item => {
if (item.type === 'line') {
item.data.splice(0, 1)
item.data.push(num)
}
if (item.type === 'bar') {
count++
item.data.splice(0, 1)
if (count <= num) {
item.data.push(1)
} else {
item.data.push(0)
}
}
})
console.log(option, data);
// 更新图表数据
setNewOptions(option)
}, [newData])
// 当 someProp 变化时执行
// const quanping = () => {
// T.setPageOrientation({
// orientation: "portrait",
@ -278,20 +344,21 @@ function Index() {
// },
return (
<Block>
<View id='box' className='box'>
<Echarts
force-use-old-canvas='false'
echarts={echarts}
option={option}
option={options}
ref={echartsRef}
// isPage={false}
// style自定义设置echarts宽高
style={{ width: "630rpx", height: "260rpx", zIndex: 1 }}
/>
<View className='box_background'>
<Image className='full' src={require("@/img/full-scran.png")} onClick={full}></Image>
<Image className='full' ref={buttonRef} src={require("@/img/full-scran.png")} onClick={full}></Image>
<View className='power'></View>
{level.map((item) => (
<View className='line' key={item}>

@ -1,5 +1,7 @@
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { go } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import Taro from "@tarojs/taro";
@ -12,7 +14,6 @@ import { setMobile } from "@/store/features/userInfo";
import Navbar from "@/components/navbar/navbar";
import Echarts from "./Echarts/index";
import "./moisture_test_report.less";
import { go } from "@/utils/traoAPI";
class MoistureTestReport extends Component<any, any> {
constructor(props) {
@ -34,6 +35,7 @@ class MoistureTestReport extends Component<any, any> {
rightFace: 0
}
},
instrumentId: 0,
isClock: false,
xinde: '',
imglist: [],
@ -72,9 +74,19 @@ class MoistureTestReport extends Component<any, any> {
reportData.shuifenGear.rightFace = gear
}
})
this.setState({ reportData, modeId: option.modeId });
this.setState({ reportData, modeId: option.modeId, instrumentId: option.id });
this.moistureTest()
}
async initData() { }
async moistureTest() {
let data = {
queryDate: this.state.reportData.curDate,
instrumentId: this.state.instrumentId
}
let res = await InstrumentInfo.fr200.moistureTest(data);
}
toIndex() {
Taro.reLaunch({ url: "/pages/index/index" });
}
@ -83,7 +95,7 @@ class MoistureTestReport extends Component<any, any> {
}
render() {
let { name, imgUrl, reportData, reportData1, isClock, xinde, imglist, id, show, modeId } = this.state
let { name, imgUrl, reportData, reportData1, isClock, xinde, imglist, id, show, modeId, instrumentId } = this.state
const getStatusData = (level) => {
var bgCssData = {

@ -299,8 +299,8 @@ export default class Recording extends Component<any, any> {
setStorageSync("instrument_detail", instrument);
}
})
if ([1,2,3,4,5].includes(item.jumpType)) {
if ([1, 2, 3, 4, 5].includes(item.jumpType)) {
this.One(item);
} else if (item.jumpType === 0) {
this.two(item);
@ -309,20 +309,20 @@ export default class Recording extends Component<any, any> {
} else {
this.AllDevice(item);
}
// let report =false
// go("/pages/face_report/face_report?id=" + id + "&recordId=" + recordId+ "&report=" + report );
}
// 打开第一种类型
One = async (item) => {
let report = false;
let nursingData=JSON.parse(item.nursingData)
let obj ={
modeName:item.modeName,
data:nursingData
}
console.log("打开第一种类型", item,obj);
// let nursingData = JSON.parse(item.nursingData)
// let obj = {
// modeName: item.modeName,
// data: nursingData
// }
// console.log("打开第一种类型", item, obj);
go(
"/recoding/pages/face_report_one/face_report_one?id=" +
item.id +
@ -344,7 +344,7 @@ export default class Recording extends Component<any, any> {
};
// 打开第三种类型
three = async (item) => {
go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}`);
go(`/recoding/pages/moisture_test_report/moisture_test_report?data=${item.nursingData}&date=${item.createTime}&modeId=${item.modeId}&id=${item.instrumentId}`);
};
// 打开其他类型
AllDevice = async (item) => {

@ -437,6 +437,15 @@ export const InstrumentInfo = {
});
},
},
fr200:{
// 查询用户FR200水分报告护理记录
moistureTest: (data) => {
return Ajax({
url: "/nursingLog/record/fr200/moistureTest" + paramsToUrlQueryString(data),
method: "get",
});
},
}
};
//localhost:9204/instrument/getInstrumentInfoBySerial

Loading…
Cancel
Save