非iot设备的lock状态

master
blak-kong 2 years ago
parent b9563350a5
commit 29b59c23f2

@ -586,6 +586,10 @@ class Index extends Component<any, any> {
this.alertRegister();
return false;
}
setTimeout(() => {
go("/pages/instrumentClickinUpload/index");
}, 10);
return;
if (this.state.connectInstrument.type === 1) {
//非IOT
setTimeout(() => {

@ -217,6 +217,11 @@ page {
height: 100%;
flex-direction: column;
width: 134rpx;
.icon {
width: 30rpx;
height: 30rpx;
margin-top: 15rpx;
}
}
}
.info1_img {
@ -253,7 +258,7 @@ page {
background-color: #fff;
border-color: #fff;
align-items: center;
justify-content: center;
justify-content: center;
}
.quan2 {
border-radius: 50%;

@ -26,7 +26,6 @@ import { setStorageSync, getStorageSync, msg } from "@/utils/traoAPI";
import "./index.less";
export default class InstrumentClickInUpload extends Component<any, any> {
constructor(props) {
super(props);
@ -90,7 +89,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
}
const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get('id');
const id = searchParams.get("id");
setTimeout(() => {
this.firstNurseInfo();
@ -303,113 +302,119 @@ export default class InstrumentClickInUpload extends Component<any, any> {
} = this.state;
return (
<Block>
<Navbar titleSlot='打卡上传' isBack />
<Navbar titleSlot="打卡上传" isBack />
<Canvas
style='height: 0'
id='compressImage'
canvasId='compressImage'
type='2d'
style="height: 0"
id="compressImage"
canvasId="compressImage"
type="2d"
></Canvas>
<PopupAlert
isShow={isModeLock}
title='提示'
content='该模式即将上线,敬请期待'
confirmButtonText='知道了'
textAlgin='center'
title="提示"
content="该模式即将上线,敬请期待"
confirmButtonText="知道了"
textAlgin="center"
isClose={false}
close={this.onModeLockClose}
confirm={this.onModeLockClose}
/>
<PopupInstrumentUploadTips
isShow={isTipShow}
title='打卡介绍'
title="打卡介绍"
data={nurseInfo}
close={this.onTipShowClose}
confirm={this.onTipShowClose}
/>
<View className='infobox1 flex aitems jcenter'>
<View className='img'>
<View className="infobox1 flex aitems jcenter">
<View className="img">
<Video
src={currentInfo.modeVideo}
id='myVideo'
id="myVideo"
enableProgressGesture={false}
controls
// autoplay={false}
direction={0}
loop={false}
showMuteBtn
referrerPolicy='origin'
referrerPolicy="origin"
onTimeUpdate={this.videoBindTimeUpdate}
onEnded={this.videoEnded}
onPause={this.videoPause}
onPlay={this.videoPlay}
showCenterPlayBtn={false}
onLoadedMetaData={this.videoLoadedMetaData}
style='width: 100%; height: 100%;border-radius: 30rpx;'
style="width: 100%; height: 100%;border-radius: 30rpx;"
/>
{showVideoPlayBtn && (
<View className='video-cover'>
<View className="video-cover">
<Image
className='video-cover-icon'
className="video-cover-icon"
src={require("../../img/fr200/play.png")}
onClick={this.onPlayTap}
></Image>
{duration && (
<View className='video-cover-time'>{duration}</View>
<View className="video-cover-time">{duration}</View>
)}
</View>
)}
</View>
</View>
<View className='infobox3'>
<View className="infobox3">
<ScrollView
style='white-space: nowrap; height: 100%;'
style="white-space: nowrap; height: 100%;"
scroll-x
scroll-left={scrollleft}
>
{modeInfo.map((item, index) => {
return (
<View
className='info1'
className="info1"
onClick={this.bindMoshi.bind(this, index)}
key={index}
>
<View
className='flex aitems modebox'
style={{height: '100%', background: zkmoshiindex == index ?'linear-gradient(90deg, #EFDCC2, #FFF2DF)': ''}}
className="flex aitems modebox"
style={{
height: "100%",
background:
zkmoshiindex == index
? "linear-gradient(90deg, #EFDCC2, #FFF2DF)"
: "",
}}
>
<View className='block1'>
<View className="block1">
<View
className='block1_1 flex aitems '
style='min-width: 80rpx'
className="block1_1 flex aitems "
style="min-width: 80rpx"
>
<View className='tip1'>{item.modeName}</View>
<View className='tip2'>{item.modeDesc}</View>
<View className="tip1">{item.modeName}</View>
<View className="tip2">{item.modeDesc}</View>
{!item.lock && zkmoshiindex !== index && (
<View className='quan1'></View>
<View className="quan1"></View>
)}
{!item.lock && zkmoshiindex == index && (
<View className='quan1 is-select flex aitems jcenter'>
<View className='quan2'></View>
<View className="quan1 is-select flex aitems jcenter">
<View className="quan2"></View>
</View>
)}
{item.lock && (
<View className='icon'>
<View className="icon">
<Image
src='/img/fr200/suo.png'
mode='aspectFill'
src={require("../../img/fr200/suo.png")}
mode="aspectFill"
></Image>
</View>
)}
</View>
</View>
{item.modeBanner && index == zkmoshiindex &&(
<View className='info1_img'>
<Image src={item.modeBanner} mode='aspectFill' />
{item.modeBanner && index == zkmoshiindex && (
<View className="info1_img">
<Image src={item.modeBanner} mode="aspectFill" />
</View>
)}
</View>
@ -419,32 +424,32 @@ export default class InstrumentClickInUpload extends Component<any, any> {
</ScrollView>
</View>
<View className='infobox2'>
<View className='infobox2_info'>
<View className='info4'>
<View className='upload_header flex aitems sb'>
<View className='upload_title'></View>
<View className='icon' onClick={this.onTipShowOpen}>
<View className="infobox2">
<View className="infobox2_info">
<View className="info4">
<View className="upload_header flex aitems sb">
<View className="upload_title"></View>
<View className="icon" onClick={this.onTipShowOpen}>
<Image
src={require("../../img/clock_in_upload/info.png")}
mode='aspectFill'
mode="aspectFill"
></Image>
</View>
</View>
<View className='imgbox flex aitems'>
<View className="imgbox flex aitems">
{punchInInfo.clockImageList.length > 0 &&
punchInInfo.clockImageList.map((item, index) => {
return (
<View className='img' key={"clickin_" + index}>
<View className="img" key={"clickin_" + index}>
<Image src={item}></Image>
<View
className='close flex aitems jcenter'
data-index='{{index}}'
className="close flex aitems jcenter"
data-index={index}
onClick={this.handleDeleteImage}
>
<Image
src={require("../../img/fr200/close_white.png")}
mode='widthFix'
mode="widthFix"
></Image>
</View>
</View>
@ -453,23 +458,23 @@ export default class InstrumentClickInUpload extends Component<any, any> {
{punchInInfo.clockImageList.length < 3 && (
<View
className='img2 flex aitems jcenter'
className="img2 flex aitems jcenter"
onClick={this.handleChooseImage}
>
<Image
src={require("../../img/fr200/add-Image.png")}
mode='aspectFill'
mode="aspectFill"
></Image>
</View>
)}
</View>
<View className='content'>
<View className="content">
<Textarea
placeholder-className='placeholder'
placeholder-className="placeholder"
maxlength={100}
onInput={this.handleTextareaInput}
value={punchInInfo.clockContent}
placeholder='请记录一下今天打卡的心得吧~'
placeholder="请记录一下今天打卡的心得吧~"
></Textarea>
{/* {tipshow && (
<View className="Textarea">
@ -478,7 +483,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
: "请记录一下今天打卡的心得吧~"}
</View>
)} */}
<View className='tips-num'>
<View className="tips-num">
{punchInInfo.clockContent.length}/100
</View>
</View>
@ -486,16 +491,16 @@ export default class InstrumentClickInUpload extends Component<any, any> {
</View>
</View>
<View style='height: 150rpx'></View>
<View style="height: 150rpx"></View>
{!isSubmit && (
<View className='confirm_btn flex aitems' onClick={this.handleSubmit}>
<View className='btn'></View>
<View className="confirm_btn flex aitems" onClick={this.handleSubmit}>
<View className="btn"></View>
</View>
)}
{isSubmit && (
<View className='confirm_btn flex aitems'>
<View className='btn'></View>
<View className="confirm_btn flex aitems">
<View className="btn"></View>
</View>
)}
</Block>

@ -46,10 +46,12 @@ import {
bleCommandSamples,
} from "@/components/bluetoot/connection/test";
import {
hourMinSecToS,
minSecToS,
s_to_h,
s_to_hs,
s_to_s,
s_to_m,
s_to_ms,
s_to_hms,
isNeedToUpdate,
} from "@/utils/util";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
@ -97,12 +99,18 @@ const WORK_MODE_ENGLISH_NAME = {
26: "MixNurse",
27: "ScalpCare",
};
// 组合模式:分别对应的是哪几个模式类型
// 黄光590nm
// 红光630nm
// 近红外光830nm
// 模式类型中文名
const WORK_MODE_Chinese_NAME = {
: "powerfulSoothing",
: "Stability",
: "Brighten",
: "FirmSkin",
: "Stability", // 黄光?近红外光?
: "Brighten", // 黄光?近红外光?
: "FirmSkin", // 黄光?近红外光?
: "MaskCustom",
Pro: "BrightenStand",
Pro: "FirmSkinStand",
@ -173,7 +181,7 @@ class IotCarePlan extends Component<any, any> {
modelActiveIndex: 0, //模式下标
sliderProgress: 22,
isStandStatus: false, // 支架开启状态(支架就是舱体)
facialMaskConnectStatus: 0, // 面膜?暂时认为是面罩连接状态 0未连接 1已连接
facialMaskConnectStatus: 0, // 面罩连接状态 0未连接 1已连接
workStatus: "", // 工作状态
Electricity: 0, // WL200电量
matrixElectricity: 0, // matrix电量
@ -229,6 +237,7 @@ class IotCarePlan extends Component<any, any> {
// 最后执行步骤位置
endPlace: "",
currentTime: "00:01:00",
};
}
@ -586,36 +595,17 @@ class IotCarePlan extends Component<any, any> {
case "DeviceControl":
console.log("小程序控制设备,给设备发送指令", jsonStatus);
if (
jsonStatus.responseStatus == "OK" &&
this.state.isSendModeCombination
) {
// 发送启动指令
this.startCombinationMode();
// const totalTime = this.state.combinationList.reduce(
// (total, item) => {
// return total + minSecToS(item.time);
// },
// 0
// );
// 设备启动后小程序操作
// this.setState({
// showCombinationModeDialog: false,
// combinationModeInfo: {
// time: s_to_hs(totalTime),
// seconds: totalTime,
// },
// modelActiveIndex: -1,
// currentTime: s_to_hs(totalTime),
// isCurrentModeCombination: true,
// isSendModeCombination: false,
// });
setTimeout(() => {
console.log("currentTime", this.state.currentTime);
});
}
// if (
// jsonStatus.responseStatus == "OK" &&
// this.state.isSendModeCombination
// ) {
// // 发送启动指令
// this.startCombinationMode();
// setTimeout(() => {
// console.log("currentTime", this.state.currentTime);
// });
// }
break;
//设备主动上报给小程序的指令 一般是工作状态改变
case "DeviceStatusSync":
@ -846,20 +836,20 @@ class IotCarePlan extends Component<any, any> {
console.log("时间校准频率默认5秒一次", TIME_CALIBRATION_FREQUENCY);
//对比仪器上报运行的总秒数 和小程序页面运行的已经运行的总秒数,如果不一致就进行校准
const currentScene = ActiveModeItem; // 获取当前的场景
let sceneTime = minSecToS(currentScene.modeTime); // 场景时间
let sceneTime = hourMinSecToS(currentScene.modeTime); // 场景时间
const timeRemaining = sceneTime - minSecToS(currentTime); // 小程序上已运行的总秒数
const timeRemaining = sceneTime - hourMinSecToS(currentTime); // 小程序上已运行的总秒数
if (
Math.abs(timeRemaining - totalTime) >= 2 &&
this.state.step == 2 &&
this.state.facialMaskConnectStatus == 1
) {
this.setTimer();
this.resetTimer();
const t = sceneTime - totalTime; // 场景时间 - 已运行时间 = 剩余时间
let { ActiveModeItem } = this.state;
ActiveModeItem.seconds = t; //修复时间跳变的问题
this.setState({
currentTime: s_to_hs(t),
currentTime: s_to_hms(t),
ActiveModeItem,
});
}
@ -1002,11 +992,11 @@ class IotCarePlan extends Component<any, any> {
// 获取仪器运行时间,更新currentTime, 判断仪器返回时间正常的情况下
const { totalWorkingSeconds, totalWorkingMinutes } = jsonStatus;
if (totalWorkingSeconds != 0 || totalWorkingMinutes != 0) {
const sceneTime = minSecToS(ActiveModeItem.modeTime); // 模式的总时长
const sceneTime = hourMinSecToS(ActiveModeItem.modeTime); // 模式的总时长
const runTime = totalWorkingMinutes * 60 + totalWorkingSeconds; //仪器运行时长
const timeRemaining = sceneTime - runTime; // 剩余未运行时间
this.setState({
currentTime: s_to_hs(timeRemaining),
currentTime: s_to_hms(timeRemaining),
});
}
this.endnursing(null, true);
@ -1130,7 +1120,8 @@ class IotCarePlan extends Component<any, any> {
return inTime;
}
setTimer() {
// 重置计时器
resetTimer() {
// 切换模式后, 需要重新设置计时器, 以防进行中的计时器
timer && clearInterval(timer);
timer = setInterval(() => {
@ -1145,14 +1136,14 @@ class IotCarePlan extends Component<any, any> {
// 组合模式逻辑
// that.data.combinationModeInfo.seconds -= 1;
// that.setData({
// currentTime: s_to_hs(that.data.combinationModeInfo.seconds)
// currentTime: s_to_ms(that.data.combinationModeInfo.seconds)
// })
// currentSeconds = that.data.combinationModeInfo.seconds
} else {
const { ActiveModeItem, currentTime } = this.state;
currentSeconds = minSecToS(currentTime);
currentSeconds = hourMinSecToS(currentTime);
this.setState({
currentTime: s_to_hs(--currentSeconds),
currentTime: s_to_hms(--currentSeconds),
});
console.log(ActiveModeItem.isCustomMode);
if (ActiveModeItem.isCustomMode) {
@ -1167,7 +1158,7 @@ class IotCarePlan extends Component<any, any> {
}
/*} else {
that.data.standInfo.seconds -= 1;
that.setData({ currentTime: s_to_hs(that.data.standInfo.seconds) })
that.setData({ currentTime: s_to_ms(that.data.standInfo.seconds) })
if(that.data.standInfo.seconds <= 0){
clearInterval(timer);
this.showNurseSuccessDialog()
@ -1214,7 +1205,7 @@ class IotCarePlan extends Component<any, any> {
this.setState({
workStatus: newWorkStatus,
});
this.setTimer();
this.resetTimer();
console.info(
`handleWorkStatus 发送${newWorkStatus}指令成功 参数为 =>`,
sendParams
@ -1329,50 +1320,17 @@ class IotCarePlan extends Component<any, any> {
// 检查时间是否达标
checkTime() {
const { curDeviceInfo, workStatus, ActiveModeItem } = this.state;
const { curDeviceInfo, ActiveModeItem } = this.state;
const currentScene = ActiveModeItem;
let sceneTime = minSecToS(currentScene.time);
const timeRemaining = sceneTime - minSecToS(this.state.currentTime);
if (timeRemaining >= Number(curDeviceInfo?.times) * 60) {
let sceneTime = hourMinSecToS(currentScene.modeTime);
const timeRemaining = sceneTime - hourMinSecToS(this.state.currentTime);
if (timeRemaining >= Number(curDeviceInfo?.nursingTime) * 60) {
return true;
} else {
return false;
}
}
// 开始护理?
onPlayTap() {
const { ActiveModeItem, step } = this.state;
const modeItem = ActiveModeItem;
if (step == 1) {
this.state.videoContext.play();
this.setState({
showVideoPlayBtn: false,
});
} else if (modeItem.isStandMode && step == 2) {
this.setState({
standVideoContext: Taro.createVideoContext("standVideo"),
});
setTimeout(() => {
this.state.standVideoContext.play();
}, 100);
}
}
// 暂停护理?
onPauseTap() {
const { ActiveModeItem, step } = this.state;
const modeItem = ActiveModeItem;
if (step == 1) {
} else if (modeItem.isStandMode && step == 2) {
this.setState({
standVideoContext: Taro.createVideoContext("standVideo"),
});
setTimeout(() => {
this.state.standVideoContext.play();
}, 100);
}
}
// 删除WL200护理历史
rmWL200NursingHistory(WL200NursingHistory, hard = false) {
// const nowWL200NursingHistory = Taro.getStorageSync("WL200NursingHistory");
@ -1387,7 +1345,6 @@ class IotCarePlan extends Component<any, any> {
bluetoothDisconnectProcessing() {
clearInterval(timer);
Taro.offBLEConnectionStateChange(this.listener); // 需传入与监听时同一个的函数对象
// this.state.innerAudioContext.destroy();
Taro.offBLECharacteristicValueChange((res) => {
console.log("offBLECharacteristicValueChange", res);
});
@ -1432,6 +1389,7 @@ class IotCarePlan extends Component<any, any> {
}
}
// 护理的错误提示
showTips(ctx) {
if (!ctx) return;
if (showTipsTimer) clearTimeout(showTipsTimer);

@ -292,56 +292,69 @@ const ccrc8 = (str) => {
return (crc & 0xff).toString(16).padStart("2", 0);
};
/** 秒数转分秒,返回分秒 */
const s_to_hs = (s) => {
/** 秒数转分秒,返回分秒 */
const s_to_hms = (s) => {
//计算分钟
//算法将秒数除以60然后下舍入既得到分钟数
var m;
m = Math.floor(s / 60);
//算法将分钟除以60然后下舍入既得到小时数
var h;
h = Math.floor(s / 60);
h = Math.floor(m / 60);
//计算秒
//算法:取得秒%60的余数既得到秒数
s = s % 60;
//将变量转换为字符串
// 将变量强制类型转换为字符串
h += "";
m += "";
s += "";
//如果只有一位数前面增加一个0
h = h.length == 1 ? "0" + h : h;
m = m.length == 1 ? "0" + m : m;
s = s.length == 1 ? "0" + s : s;
return h + ":" + s;
return h + ":" + m + ":" + s;
};
/** 秒数转分钟,只返回分钟 */
const s_to_h = (s) => {
/** 秒数转分秒,返回分秒 */
const s_to_ms = (s) => {
//计算分钟
//算法将秒数除以60然后下舍入既得到分钟数
var h;
h = Math.floor(s / 60);
var m;
m = Math.floor(s / 60);
//计算秒
//算法:取得秒%60的余数既得到秒数
s = s % 60;
//将变量转换为字符串
h += "";
m += "";
s += "";
//如果只有一位数前面增加一个0
h = h.length == 1 ? "0" + h : h;
m = m.length == 1 ? "0" + m : m;
s = s.length == 1 ? "0" + s : s;
return h;
return m + ":" + s;
};
/** 秒数转分钟,只返回秒数 */
const s_to_s = (s) => {
/** 秒数转分钟,只返回分钟 */
const s_to_m = (s) => {
//计算分钟
//算法将秒数除以60然后下舍入既得到分钟数
var h;
h = Math.floor(s / 60);
//将变量转换为字符串
h += "";
//如果只有一位数前面增加一个0
h = h.length == 1 ? "0" + h : h;
return h;
};
/** 秒数转分钟,只返回秒数 */
const s_to_s = (s) => {
//计算秒
//算法:取得秒%60的余数既得到秒数
s = s % 60;
//将变量转换为字符串
h += "";
s += "";
//如果只有一位数前面增加一个0
h = h.length == 1 ? "0" + h : h;
s = s.length == 1 ? "0" + s : s;
return s;
};
@ -354,6 +367,15 @@ const minSecToS = (minSecStr) => {
return strArr.length ? parseInt(strArr[0]) * 60 + parseInt(strArr[1]) : 0;
};
/** 时分秒转秒数,返回秒数 */
const hourMinSecToS = (hourMinSecStr) => {
if (!hourMinSecStr) return 0;
let strArr = hourMinSecStr.split(":");
return strArr.length
? parseInt(strArr[0]) * 360 + parseInt(strArr[1]) * 60 + parseInt(strArr[2])
: 0;
};
// 将字符串转换成ArrayBufer
const string2buffer = (str) => {
let val = "";
@ -696,7 +718,6 @@ module.exports = {
filterData,
ccrc8, //crc8校验位
string2buffer, //将字符串转换成ArrayBufer
s_to_hs, //秒转换成分秒
checkEnd, //相加和
filterBleData,
getofflineData,
@ -709,9 +730,12 @@ module.exports = {
getimpedanceList,
DYNAMIC_BONES_OFFSETS, //阻抗获取值
getreportData, //解析上报数据
s_to_h,
s_to_m,
s_to_s,
s_to_ms, //秒转换成分秒
s_to_hms, //秒转换成时分秒
minSecToS,
hourMinSecToS,
getTimeCode, //同步时间指令
isNeedToUpdate,
compareVersion,

Loading…
Cancel
Save