Compare commits

...

14 Commits

Author SHA1 Message Date
blak-kong 9b93ce8c0a fix:护理报告显示bug 2 years ago
blak-kong 7ce4b95528 临时提交 2 years ago
blak-kong 479306b979 临时提交 2 years ago
blak-kong 9b6a4077e2 临时提交 2 years ago
blak-kong 67d6d9fb88 Merge branch 'rwkdev' into lzwdev 2 years ago
blak-kong aec9e1ee3e 临时 2 years ago
blak-kong 6c6b7ab662 发箍固件升级完成,wl200测试中,目前缺失wl200固件包 2 years ago
rongweikang b7b1d4a055 优化样式 2 years ago
rongweikang 724482ca63 优化 2 years ago
blak-kong 148d8bf6a3 临时提交 2 years ago
rongweikang a4297eec94 Merge branch 'lzwdev' of https://gitee.com/yunqiang_technology/flowsomwechat into rwkdev 2 years ago
blak-kong 6b44f79caf 仪器时间步骤切换 2 years ago
rongweikang e788268e24 修改字段 2 years ago
rongweikang 60e062680d 添加跳过按钮 2 years ago

@ -37,7 +37,7 @@
"dependencies": { "dependencies": {
"@antmjs/vantui": "^3.2.2", "@antmjs/vantui": "^3.2.2",
"@flossom-npm/iot-translater": "^1.0.8", "@flossom-npm/iot-translater": "^1.0.8",
"@flossom-npm/iot-translater-we100": "^1.0.66", "@flossom-npm/iot-translater-we100": "^1.1.1",
"@reduxjs/toolkit": "^2.0.1", "@reduxjs/toolkit": "^2.0.1",
"@taroify/core": "^0.1.1-alpha.8", "@taroify/core": "^0.1.1-alpha.8",
"@tarojs/components": "3.6.19", "@tarojs/components": "3.6.19",

@ -32,43 +32,58 @@ import {
getofflineData, getofflineData,
hex2int, hex2int,
getTimeCode, getTimeCode,
isNeedToUpdate,
} from "@/utils/util"; } from "@/utils/util";
const log = require("@/utils/log"); const log = require("@/utils/log");
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
import { bleCommandSamples } from "./test"; import { bleCommandSamples } from "./test";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200"); const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
deviceToolKitInstanceWL200.setDebug(true); deviceToolKitInstanceWL200.setDebug(true);
// const _deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WE100", "WL200");
const deviceToolKitInstanceM01 = new DeviceToolKitWE100("WE100", "M01"); const deviceToolKitInstanceM01 = new DeviceToolKitWE100("WE100", "M01");
deviceToolKitInstanceM01.setDebug(true); deviceToolKitInstanceM01.setDebug(true);
const deviceToolKitInstanceFR200 = new DeviceToolKitFR200("FR200"); const deviceToolKitInstanceFR200 = new DeviceToolKitFR200("FR200");
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater"; import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
import { showModal, msg } from "@/utils/traoAPI"; import {
showModal,
msg,
setStorageSync,
getStorageSync,
} from "@/utils/traoAPI";
// const { InstrumentTypeEnum, OtaDeviceTypeEnum } = app.globalData; // const { InstrumentTypeEnum, OtaDeviceTypeEnum } = app.globalData;
import InstrumentTypeEnum from "../InstrumentTypeEnum"; import InstrumentTypeEnum from "../InstrumentTypeEnum";
import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum"; import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum";
// 定义一个变量,用于存放获取版本定时器
let isGetVersionTimer: any = null; let isGetVersionTimer: any = null;
// 定义一个变量,用于存放获取子设备定时器
let isGetSubDeviceTimer: any = null; let isGetSubDeviceTimer: any = null;
// 定义一个变量,用于存放获取同步录制定时器
let isGetSyncRecordingTimer: any = null; let isGetSyncRecordingTimer: any = null;
// 定义一个变量,用于存放超时定时器
let overTimer: any = null; let overTimer: any = null;
// 定义一个变量,用于存放获取子设备定时器次数
let isGetSubDeviceTimerNum = 0; let isGetSubDeviceTimerNum = 0;
// 定义一个变量,用于存放发送获取版本定时器
let sendgetversionTimer: any = null; let sendgetversionTimer: any = null;
// 定义一个变量,用于存放发送获取版本定时器次数
let sendGetVersionTimerNum = 0; let sendGetVersionTimerNum = 0;
let searchBluetootTimers: any = null; // 搜索蓝牙定时器 let searchBluetootTimers: any = null; // 搜索蓝牙定时器
let searchBluetootTimersNum = 0; // 搜索蓝牙秒数 let searchBluetootTimersNum = 15; // 搜索蓝牙秒数 15秒
let connectionTimer: any = null; // 连接蓝牙定时器 let connectionTimer: any = null; // 连接蓝牙定时器
let connectionTimerNum = 0; let connectionTimerNumber = 10000; // 连接蓝牙超时毫秒
let sendPairingTimer: any = null; // 发送配对 let sendPairingTimer: any = null; // 发送配对
@ -99,6 +114,16 @@ class ConnectionBluetoot extends Component<any, any> {
offlineDataindex: 0, //离线记录发送下标index offlineDataindex: 0, //离线记录发送下标index
versionInfo: {}, //版本号 versionInfo: {}, //版本号
offlineDataList: [], //离线数据 offlineDataList: [], //离线数据
prefix: "12CAA", // WL200蓝牙搜索前缀
// WL200匹配
tranType: [
"WE100", // 发箍
"WE200", // 发箍
"WL200", // 发箍
"12CAA", // 面罩前缀名
],
}; };
} }
@ -115,15 +140,23 @@ class ConnectionBluetoot extends Component<any, any> {
async initData() {} async initData() {}
isWL200() {
let currentDevicesName = getStorageSync("currentDevicesName");
if (currentDevicesName.indexOf("12CAA") > -1) {
return true;
}
return false;
}
close() { close() {
clearInterval(sendPairingTimer); clearInterval(sendPairingTimer);
clearInterval(sendgetversionTimer); clearInterval(sendgetversionTimer);
clearTimeout(isGetVersionTimer); clearTimeout(isGetVersionTimer);
clearTimeout(isGetSyncRecordingTimer); clearTimeout(isGetSyncRecordingTimer);
if (overTimer) clearTimeout(overTimer); if (overTimer) clearTimeout(overTimer);
// 重新开始
this.again(); this.again();
// this.triggerEvent("close", "connection_guide"); // 关闭弹窗
console.log("this.close");
this.onClose(); this.onClose();
Taro.closeBluetoothAdapter(); Taro.closeBluetoothAdapter();
} }
@ -260,7 +293,7 @@ class ConnectionBluetoot extends Component<any, any> {
"searchBluetootTimersNum value => ", "searchBluetootTimersNum value => ",
searchBluetootTimersNum searchBluetootTimersNum
); );
if (searchBluetootTimersNum === 8) { if (searchBluetootTimersNum === 15) {
clearInterval(searchBluetootTimers); clearInterval(searchBluetootTimers);
this.setState({ this.setState({
error: true, error: true,
@ -282,43 +315,36 @@ class ConnectionBluetoot extends Component<any, any> {
onBluetoothDeviceFound() { onBluetoothDeviceFound() {
Taro.onBluetoothDeviceFound((item: any) => { Taro.onBluetoothDeviceFound((item: any) => {
console.log("蓝牙查找item", item, item.devices[0].name); console.log("蓝牙查找item", item, item.devices[0].name);
/*
*
* type1 FR200
* type2 WM100
* type3 we100
* type4 FR380
* */
// const tranType = {
// 1: "FR200",
// 3: "WE200", // WL200
// 4: "FR380",
// 5: "FR390",
// 6: "WE200", // M01
// };
// let type = this.props.yiqiInfo.model || "FR200";
let type = "WE200";
// this.props.yiqiInfo.model = type;
console.log("this.props.yiqiInfo.model", this.props.yiqiInfo.model);
console.info("搜索到到蓝牙设备 value => ", item.devices[0]?.name); console.info("搜索到到蓝牙设备 value => ", item.devices[0]?.name);
console.log(">>>>>>>当前传入设备类型>>>>>", this.props.deviceInfo.model);
// 先匹配到哪个连接哪个
let tranType = [
this.props.deviceInfo.model, // 当前传入设备类型
...this.state.tranType,
];
for (let i = 0; i < item.devices.length; i++) { for (let i = 0; i < item.devices.length; i++) {
if ( let devicesName = item.devices[i].localName || item.devices[i].name;
item.devices[i].connectable && console.log("devicesName", devicesName);
(item.devices[i].localName console.log("tranType", tranType);
? item.devices[i].localName // 是否匹配可连接设备
: item.devices[i].name let isAvailable = tranType.some(
).indexOf(`${type}`) !== -1 (item) => devicesName && devicesName.indexOf(item) > -1
) { );
console.log("连接的设备信息", item.devices[i], type); console.log("isAvailable", isAvailable);
// 判断设备是否可连接
if (item.devices[i].connectable && isAvailable) {
// 缓存当前连接设备名 可能是发箍或面罩
setStorageSync("currentDevicesName", devicesName);
console.log("连接的设备信息", item.devices[i], devicesName);
let params = { let params = {
deviceId: item.devices[i].deviceId, deviceId: item.devices[i].deviceId,
}; };
this.props.setDeviceId(params); this.props.setDeviceId(params); // 设置蓝牙连接设备ID
setTimeout(() => { setTimeout(() => {
clearInterval(searchBluetootTimers); clearInterval(searchBluetootTimers);
Taro.stopBluetoothDevicesDiscovery(); //停止搜索蓝牙 Taro.stopBluetoothDevicesDiscovery(); //停止搜索蓝牙
// app.globalData.deviceInfo.deviceId = item.devices[i].deviceId;
this.createBLEConnection(); this.createBLEConnection();
}, 10); }, 10);
break; break;
@ -335,11 +361,7 @@ class ConnectionBluetoot extends Component<any, any> {
await closeBLEConnection(this.props.bluetoothInfo.deviceId); await closeBLEConnection(this.props.bluetoothInfo.deviceId);
} catch (e) {} } catch (e) {}
clearTimeout(connectionTimer); clearTimeout(connectionTimer);
const { yiqiInfo: deviceInfo } = this.props; const { deviceInfo } = this.props;
console.log(
"this.props.bluetoothInfo.deviceId",
this.props.bluetoothInfo.deviceId
);
/*********开始主动连接*******/ /*********开始主动连接*******/
createBLEConnection(this.props.bluetoothInfo.deviceId) createBLEConnection(this.props.bluetoothInfo.deviceId)
.then((res) => { .then((res) => {
@ -347,15 +369,12 @@ class ConnectionBluetoot extends Component<any, any> {
let { errno, errMsg } = res; let { errno, errMsg } = res;
if (errno == 0) { if (errno == 0) {
if (deviceInfo.model === "WL200") { if (deviceInfo.model === "WL200") {
this.setState({
connectionStatus: true,
});
connectionTimer = setTimeout(() => { connectionTimer = setTimeout(() => {
if (!this.state.islian) { if (!this.state.islian) {
if (overTimer) clearTimeout(overTimer); if (overTimer) clearTimeout(overTimer);
this.failErrorCode(-1, "连接蓝牙失败,请重新开机后重试"); this.failErrorCode(-1, "连接蓝牙失败,请重新开机后重试");
} }
}, 10000); }, connectionTimerNumber);
} }
this.getBLEDeviceServices(); //获取特征 this.getBLEDeviceServices(); //获取特征
} else { } else {
@ -400,7 +419,7 @@ class ConnectionBluetoot extends Component<any, any> {
/** 7.通知BLE特征值更改 */ /** 7.通知BLE特征值更改 */
notifyBLECharacteristicValueChange() { notifyBLECharacteristicValueChange() {
console.log("7.通知BLE特征值更改"); console.log("7.通知BLE特征值更改");
const { yiqiInfo: deviceInfo } = this.props; const { deviceInfo } = this.props;
const bluetoothInfo = this.props.bluetoothInfo; const bluetoothInfo = this.props.bluetoothInfo;
notifyBLECharacteristicValueChange({ notifyBLECharacteristicValueChange({
deviceId: bluetoothInfo.deviceId, deviceId: bluetoothInfo.deviceId,
@ -417,39 +436,32 @@ class ConnectionBluetoot extends Component<any, any> {
console.log("onBLECharacteristicValueChange value => ", value); console.log("onBLECharacteristicValueChange value => ", value);
let str = ab2hex(value.value); //转为16进制字符串 let str = ab2hex(value.value); //转为16进制字符串
console.log("转为16进制字符串 str", str); console.log("转为16进制字符串 str", str);
let connectionStatus = [
"FR200",
"WL200",
"FR380",
"FR390",
"M01",
].includes(deviceInfo.model);
let jsonStatus: any = null; let jsonStatus: any = null;
let querySubDeviceArrayBuffer; let querySubDeviceArrayBuffer;
if (deviceInfo.model == "WL200") { if (deviceInfo.model == "WL200") {
// querySubDeviceArrayBuffer = if (this.isWL200()) {
// deviceToolKitInstanceWL200.toBleCommand( jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
// bleCommandSamples.querySubDevice as any value.value
// ); );
// jsonStatus = deviceToolKitInstanceWL200.toJsonStatus( querySubDeviceArrayBuffer =
// value.value deviceToolKitInstanceWL200.toBleCommand(
// ); bleCommandSamples.querySubDevice as any
);
} else {
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand( querySubDeviceArrayBuffer =
deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any bleCommandSamples.querySubDevice as any
); // todo );
}
} else if (deviceInfo.model == "M01") { } else if (deviceInfo.model == "M01") {
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value); jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand( querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any bleCommandSamples.querySubDevice as any
); );
} }
// log.info(
// commandMap.reciviedBLECommand,
// `仪器模式: ${deviceInfo.model}`,
// jsonStatus
// );
console.log( console.log(
commandMap.reciviedBLECommand, commandMap.reciviedBLECommand,
`仪器模式: ${deviceInfo.model}`, `仪器模式: ${deviceInfo.model}`,
@ -465,12 +477,11 @@ class ConnectionBluetoot extends Component<any, any> {
if (overTimer) clearTimeout(overTimer); if (overTimer) clearTimeout(overTimer);
this.setState({ this.setState({
connectionSuccess: true, connectionSuccess: true,
connectionStatus,
islian: true, // 不需要离线记录但暂未完全删除这部分逻辑所以直接设为true islian: true, // 不需要离线记录但暂未完全删除这部分逻辑所以直接设为true
}); });
this.pairingChange(this.state); // 临时添加,用于跳转 // this.pairingChange(this.state); // 临时添加,用于跳转
// this.detectVersionUpdate(); // 获取升级信息 this.detectVersionUpdate(); // 获取升级信息
// todo 连接成功需删除离线记录,暂时未缓存离线记录 // todo 连接成功需删除离线记录,暂时未缓存离线记录
if (this.state.connectionSuccess) return; if (this.state.connectionSuccess) return;
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息 // 暂时不需要查询是否连接子设备, 直接进入查询版本信息
@ -482,7 +493,7 @@ class ConnectionBluetoot extends Component<any, any> {
}*/ }*/
} }
break; break;
case "BleStatusSync": case "BleStatusSync": // 设备连接状态
if (jsonStatus.connectMessage?.connectType == "CONNECTED") { if (jsonStatus.connectMessage?.connectType == "CONNECTED") {
switch (jsonStatus.connectMessage?.deviceName) { switch (jsonStatus.connectMessage?.deviceName) {
case OtaDeviceTypeEnum.WE100: case OtaDeviceTypeEnum.WE100:
@ -518,26 +529,27 @@ class ConnectionBluetoot extends Component<any, any> {
subDeviceConnectedStatus: true, subDeviceConnectedStatus: true,
synchronousStatus: true, synchronousStatus: true,
}); });
const deviceVersionNo = jsonStatus.versionNo;
const latestVersionNo = deviceInfo.iot_versions; let currentDevicesName = getStorageSync("currentDevicesName");
// const isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo) let deviceVersionNo = jsonStatus.versionNo;
// 判断是否需要升级 let latestVersionNo = deviceInfo.iotVersion;
// M01和WL200 不需要在这里进行蓝牙更新 if (currentDevicesName.indexOf("12CAA") === -1) {
// if (isNeedToUpdateBl) { latestVersionNo = deviceInfo.we200IotVersion;
// const pages = getCurrentPages(); }
// const matchPageList = [{ // 判断版本号是否需要升级
// route: 'pages/MatrixWL200/pages/index/index' const isNeedToUpdateBl = isNeedToUpdate(
// },{ deviceVersionNo,
// route: 'pages/MatrixM01/pages/index/index' latestVersionNo
// }]; );
// const hadOpen = checkSameKey(pages, matchPageList, 'route'); console.log("isNeedToUpdateBl", isNeedToUpdateBl);
// if (!hadOpen) { if (isNeedToUpdateBl) {
// this.triggerEvent("pairingChange", { deviceVersionNo }); // 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗
this.pairingChange({ deviceVersionNo }); this.props.upgradeFun();
// } } else {
// } else { // 不需要升级,跳转进入仪器详情页
// this.sendSyncRecording() if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
// } this.pairingChange(this.state);
}
break; break;
case "offlineClockSummary": case "offlineClockSummary":
clearTimeout(isGetSyncRecordingTimer); clearTimeout(isGetSyncRecordingTimer);
@ -546,9 +558,12 @@ class ConnectionBluetoot extends Component<any, any> {
hasSyncRecord: true, hasSyncRecord: true,
synchronousStatus: true, synchronousStatus: true,
}); });
console.log("offlineClockSummary value =>", jsonStatus); console.log(
"离线汇总offlineClockSummary value =>",
jsonStatus
);
// this.triggerEvent("pairingChange", this.state); // this.triggerEvent("pairingChange", this.state);
this.pairingChange(this.state); // this.pairingChange(this.state);
// TODO 查询离线记录结果 // TODO 查询离线记录结果
default: default:
break; break;
@ -610,7 +625,7 @@ class ConnectionBluetoot extends Component<any, any> {
// 8.发送指令:获取仪器版本号 // 8.发送指令:获取仪器版本号
sendGetVersion() { sendGetVersion() {
const { yiqiInfo: deviceInfo } = this.props; const { deviceInfo } = this.props;
const isFRDevice = ["FR200", "FR380", "FR390"].includes(deviceInfo.model); const isFRDevice = ["FR200", "FR380", "FR390"].includes(deviceInfo.model);
// log.info(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`); // log.info(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`);
console.log(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`); console.log(commandMap.sendVersionCommand, `仪器:${deviceInfo.model}`);
@ -624,22 +639,21 @@ class ConnectionBluetoot extends Component<any, any> {
value: `dbf0a00300${ccrc8("dbf0a00300")}de`, value: `dbf0a00300${ccrc8("dbf0a00300")}de`,
}); });
} else { } else {
// const otaDeviceType = deviceInfo.type == instrumentTypeEnum.WL200 ? OtaDeviceTypeEnum.WL200 : OtaDeviceTypeEnum.WE100; const otaDeviceType = this.isWL200()
// 通过发箍连 都用we100 ? OtaDeviceTypeEnum.WL200
const otaDeviceType =
deviceInfo.model == InstrumentTypeEnum.WL200
? OtaDeviceTypeEnum.WE100
: OtaDeviceTypeEnum.WE100; : OtaDeviceTypeEnum.WE100;
const versionCommand = { const versionCommand = {
commandType: "InfoQuery", commandType: "InfoQuery",
infoQueryType: "versionInfo", infoQueryType: "versionInfo",
otaDeviceType, otaDeviceType,
}; };
const value = console.log("versionCommand", versionCommand);
deviceInfo.model == InstrumentTypeEnum.WL200
? deviceToolKitInstanceM01.toBleCommand(versionCommand as any) // 区分WL200 和 发箍
const value = this.isWL200()
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any); : deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
// const value = deviceInfo.type == instrumentTypeEnum.WL200 ? deviceToolKitInstanceWL200.toBleCommand(versionCommand) : deviceToolKitInstanceM01.toBleCommand(versionCommand);
sendCommand({ value }); sendCommand({ value });
} }
} }
@ -648,7 +662,7 @@ class ConnectionBluetoot extends Component<any, any> {
sendofflist() { sendofflist() {
// log.info() // log.info()
if (this.state.offlineDataindex == this.state.offlineDataList.length) { if (this.state.offlineDataindex == this.state.offlineDataList.length) {
console.log("离线记录获取完成"); console.log("离线记录获取完成", this.state);
// log.info(commandMap.finishOfflineData, this.state.offlineDataList); // log.info(commandMap.finishOfflineData, this.state.offlineDataList);
/**** /****
* *
@ -658,8 +672,6 @@ class ConnectionBluetoot extends Component<any, any> {
console.log("版本号:" + this.state.versionInfo.version); console.log("版本号:" + this.state.versionInfo.version);
this.setState({ islian: true }); this.setState({ islian: true });
clearTimeout(connectionTimer); clearTimeout(connectionTimer);
// this.triggerEvent("offlineChange", this.state);
console.log("this.triggerEvent", this.state);
this.offlineChange(this.state); this.offlineChange(this.state);
return false; return false;
} }
@ -693,7 +705,7 @@ class ConnectionBluetoot extends Component<any, any> {
/** 9.发送配对码 */ /** 9.发送配对码 */
sendPairingSignal() { sendPairingSignal() {
console.log("9.发送配对码 sendPairingSignal"); console.log("9.发送配对码 sendPairingSignal");
const { yiqiInfo: deviceInfo } = this.props; const { deviceInfo } = this.props;
// log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`); // log.info(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
console.log(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`); console.log(commandMap.sendMatchCode, `仪器:${deviceInfo.model}发送匹配码`);
let matchArrayBuffer: any = null; let matchArrayBuffer: any = null;
@ -704,14 +716,20 @@ class ConnectionBluetoot extends Component<any, any> {
); );
break; break;
case InstrumentTypeEnum.WL200: case InstrumentTypeEnum.WL200:
// console.log("WL200无法配对只能用M01");
console.log("正在发送WL200", bleCommandSamples.match); console.log("正在发送WL200", bleCommandSamples.match);
// matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand( let currentDevicesName = getStorageSync("currentDevicesName");
// bleCommandSamples.match as any // 区分面罩和发箍
// ); if (currentDevicesName.indexOf("12CAA") > -1) {
console.log("12CAA");
matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
bleCommandSamples.match as any
);
} else {
matchArrayBuffer = deviceToolKitInstanceM01.toBleCommand( matchArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.match as any bleCommandSamples.match as any
); );
}
break; break;
case InstrumentTypeEnum.FR380: case InstrumentTypeEnum.FR380:
writeBLECharacteristicValue({ writeBLECharacteristicValue({
@ -752,64 +770,6 @@ class ConnectionBluetoot extends Component<any, any> {
}); });
} }
/** 发送记录 */
sendOfflistPost(str) {
let facehour = hex2int(str.substring(12, 14)); //脸部小时
let faceminutes = hex2int(str.substring(14, 16)); //脸部分钟
let faceseconds = hex2int(str.substring(16, 18)); //脸部秒
let faceposition1 = hex2int(str.substring(18, 20)); //当前档位
let facenum = hex2int(str.substring(20, 22)); //次数
let faceyear = hex2int(str.substring(22, 24)); //年份
let facemonth = hex2int(str.substring(24, 26)); //月份
let faceday = hex2int(str.substring(26, 28)); //日期
let eyehour = hex2int(str.substring(28, 30)); //眼部小时
let eyeminutes = hex2int(str.substring(30, 32)); //眼部分钟
let eyeseconds = hex2int(str.substring(32, 34)); //眼部秒
let eyeposition1 = hex2int(str.substring(34, 36)); //当前档位
let eyenum = hex2int(str.substring(36, 38)); //次数
let eyeyear = hex2int(str.substring(38, 40)); //年份
let eyemonth = hex2int(str.substring(40, 42)); //月份
let eyeday = hex2int(str.substring(42, 44)); //日期
// console.log('脸部小时:' + facehour)
// console.log('脸部分钟:' + faceminutes)
// console.log('脸部秒:' + faceseconds)
// console.log('当前档位:' + faceposition1)
// console.log('脸部次数:' + facenum)
// console.log('年:' + faceyear)
// console.log('月:' + facemonth)
// console.log('日:' + faceday)
// console.log('-------------------')
// console.log('眼部小时:' + eyehour)
// console.log('眼部分钟:' + eyeminutes)
// console.log('眼部秒:' + eyeseconds)
// console.log('当前档位:' + eyeposition1)
// console.log('眼部次数:' + eyenum)
// console.log('年:' + eyeyear)
// console.log('月:' + eyemonth)
// console.log('日:' + eyeday)
let { offlineDataList } = this.state;
offlineDataList.push({
facehour,
faceminutes,
faceseconds,
faceposition1,
facenum,
faceyear,
facemonth,
faceday,
eyehour,
eyeminutes,
eyeseconds,
eyeposition1,
eyenum,
eyeyear,
eyemonth,
eyeday,
});
this.setState({ offlineDataList });
}
/** 同步时间 */ /** 同步时间 */
sendAsyncTime() { sendAsyncTime() {
console.log("同步时间"); console.log("同步时间");
@ -853,9 +813,6 @@ class ConnectionBluetoot extends Component<any, any> {
case 10000: case 10000:
errorText = "未初始化蓝牙适配器"; errorText = "未初始化蓝牙适配器";
break; break;
case 10000:
errorText = "未初始化蓝牙适配器";
break;
case 10001: case 10001:
errorText = "当前蓝牙适配器不可用"; errorText = "当前蓝牙适配器不可用";
break; break;
@ -957,7 +914,8 @@ class ConnectionBluetoot extends Component<any, any> {
isGetSubDeviceTimer = setInterval(() => { isGetSubDeviceTimer = setInterval(() => {
sendCommand({ value }); sendCommand({ value });
isGetSubDeviceTimerNum += 1; isGetSubDeviceTimerNum += 1;
if (isGetSubDeviceTimerNum == 8) { // 15秒超时
if (isGetSubDeviceTimerNum === 15) {
this.closeQuerySubDevice(); this.closeQuerySubDevice();
this.setState({ this.setState({
error: true, error: true,
@ -973,30 +931,25 @@ class ConnectionBluetoot extends Component<any, any> {
// 获取版本信息 // 获取版本信息
detectVersionUpdate() { detectVersionUpdate() {
this.closeQuerySubDevice(); this.closeQuerySubDevice();
this.sendGetVersion(); this.sendGetVersion(); // 获取版本信息
sendGetVersionTimerNum = 0; sendGetVersionTimerNum = 0;
// 600毫秒查询一次版本号是否返回若返回则跳转护理页 // 600毫秒查询一次版本号是否返回若返回则跳转护理页
if (isGetVersionTimer) clearTimeout(isGetVersionTimer); if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
isGetVersionTimer = setInterval(() => { isGetVersionTimer = setInterval(() => {
if (this.state.hasVersionInfo) { if (this.state.hasVersionInfo) {
if (isGetVersionTimer) clearTimeout(isGetVersionTimer); if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
// that.sendSyncRecording()
} else { } else {
sendGetVersionTimerNum += 1; sendGetVersionTimerNum += 1;
if (sendGetVersionTimerNum >= 10) { if (sendGetVersionTimerNum >= 10) {
// 超时未返回版本号 // 超时未返回版本号
if (isGetVersionTimer) clearTimeout(isGetVersionTimer); if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
this.setState({ console.log("超时未返回版本号 this.pairingChange", this.state);
connectionStatus: true, // this.pairingChange(this.state);
});
// this.triggerEvent("pairingChange", this.state);
console.log("this.pairingChange", this.state);
this.pairingChange(this.state);
} else { } else {
this.sendGetVersion(); this.sendGetVersion();
} }
} }
}, 600); }, 1000);
// 5秒后没有收到版本返回直接跳去护理页 // 5秒后没有收到版本返回直接跳去护理页
// if (isGetVersionTimer) clearTimeout(isGetVersionTimer); // if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
@ -1011,13 +964,12 @@ class ConnectionBluetoot extends Component<any, any> {
/** 发送同步记录 */ /** 发送同步记录 */
sendSyncRecording() { sendSyncRecording() {
const { yiqiInfo: deviceInfo } = this.props; const { deviceInfo } = this.props;
const versionCommand = { const versionCommand = {
commandType: "InfoQuery", commandType: "InfoQuery",
infoQueryType: "offlineClockSummary", infoQueryType: "offlineClockSummary",
}; };
const value = const value = this.isWL200()
deviceInfo.model == InstrumentTypeEnum.WL200
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any) ? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any)
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any); : deviceToolKitInstanceM01.toBleCommand(versionCommand as any);
sendCommand({ value }).then(); sendCommand({ value }).then();
@ -1053,18 +1005,16 @@ class ConnectionBluetoot extends Component<any, any> {
}; };
render() { render() {
let { name, isConnection, connectionStatus, connectionSuccess, error } = let { name, isConnection, connectionSuccess, error } = this.state;
this.state; let { deviceInfo } = this.props;
let { yiqiInfo } = this.props;
return ( return (
<Block> <Block>
<DeviceConnectPopup <DeviceConnectPopup
close={this.onClose} close={this.onClose}
confirm={this.onConfirm} confirm={this.onConfirm}
reconnect={this.onReconnect} reconnect={this.onReconnect}
data={yiqiInfo} data={deviceInfo}
isShow={true} isShow={true}
// connectionStatus={connectionStatus}
connectionSuccess={connectionSuccess} connectionSuccess={connectionSuccess}
isConnection={isConnection} isConnection={isConnection}
error={error} error={error}

@ -0,0 +1,36 @@
.common-progress-box {
padding: 50rpx;
}
.progress {
display: flex;
margin-top: 10rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
color: #999999;
align-items: center;
.van-progress {
width: 440rpx;
.van-progress__portion {
background: linear-gradient(90deg, #ffe9c7, #eecda1);
border-radius: 6rpx;
height: 12rpx;
.van-progress__pivot {
display: none;
}
}
}
.percent {
margin-left: 52rpx;
}
}
.progress-tips {
font-family: PingFang SC;
font-weight: 500;
font-size: 26rpx;
color: #666666;
line-height: 60rpx;
}

@ -0,0 +1,481 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, PageMeta } from "@tarojs/components";
import { Popup, Progress } from "@antmjs/vantui";
import { connect } from "react-redux";
import {
msg,
back,
showModal,
go,
loading,
getStorageSync,
} from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface";
import {
notifyBLECharacteristicValueChange,
writeBLECharacteristicValue,
sendCommand,
} from "@/utils/bluetoothWXAPI";
import {
ab2hex,
ccrc8,
filterBleData,
hex2int,
string2buffer,
} from "@/utils/util";
import {
Stringkit,
TResponseFromDevice,
} from "@flossom-npm/iot-translater-we100";
// 通过设备类型判断给 deviceToolKitInstance 赋值
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import InstrumentTypeEnum from "../InstrumentTypeEnum";
import OtaDeviceTypeEnum from "../OtaDeviceTypeEnum";
// 临时替代
var log = console;
let deviceToolKitInstance: any = null;
// WE200 M01 M02都是WE200
let deviceToolKitInstanceM01 = new DeviceToolKitWE100("WE100", "M01");
// WL200面罩
let deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
import "./index.less";
class UpdateIotWL200 extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "UpdateIotWL200",
progressbar: 1, // 进度条
currentDevice: {},
hadStartOta: false, // 是否开始ota
};
}
$instance = Taro.getCurrentInstance();
$checkTimer: any = null;
// 与页面渲染无关的数据
$otaDataGroup: any = {
// 包大小面罩设置为100主机设置为240
packageSize: 240, //每个包的大小上限(单位是字节)
otaBin: null, //固件包buffer形式从16进制字符串转换成
otaHexString: "", //固件包的16进制字符串从后端接口返回
packageLength: 0, //升级包的总长度(单位是字节)
packageCount: 0, //分包后的总包数
otaData: [], //分包数组
packageCrc8: "", //总包的校验码
versionNo: "", //包的版本号
otaCurrentPackageIndex: 0, //现在正在传输的分包索引
countDown: 7,
};
async onLoad() {}
componentDidMount() {
this.initData();
}
isWL200() {
let currentDevicesName = getStorageSync("currentDevicesName");
if (currentDevicesName.indexOf("12CAA") > -1) {
return true;
}
return false;
}
async initData() {
console.log("UpdateIotWL200");
if (this.isWL200()) {
console.log("WL200更新");
deviceToolKitInstance = deviceToolKitInstanceWL200;
} else {
console.log("WE100更新");
deviceToolKitInstance = deviceToolKitInstanceM01;
}
let objStr = getStorageSync("instrument_detail");
if (objStr) {
let info = JSON.parse(objStr);
this.setState({
currentDevice: info,
});
}
setTimeout(() => {
this.notifyBLECharacteristicValueChange();
this.getDeviceUpgrade();
});
}
/**
*
*/
async getUpgradeData() {
//解析获取升级包更新数据
const { otaHexString, packageSize } = this.$otaDataGroup;
if (!otaHexString?.length) {
return [];
}
let arr: any = [];
for (let i = 0, len = otaHexString.length; i < len; i += packageSize * 2) {
let index = i + packageSize * 2;
let value = otaHexString.slice(i, index);
arr.push(value);
}
return arr;
}
/**
* OTA
*/
resetOta() {
this.$otaDataGroup = {
...this.$otaDataGroup,
otaCurrentPackageIndex: 0,
otaData: [],
};
}
/**
* ota
*/
startOTA() {
this.resetOta();
let jsoncmd = {
commandType: "OTAStart",
otaDeviceType: "",
versionNo: this.$otaDataGroup.versionNo,
};
// 根据设备类型传 otaDeviceType
if (this.isWL200()) {
jsoncmd.otaDeviceType = OtaDeviceTypeEnum.WL200;
} else {
jsoncmd.otaDeviceType = OtaDeviceTypeEnum.WE100;
}
console.log("startOTA jsoncmd", jsoncmd);
//@ts-ignore
const value = deviceToolKitInstance.toBleCommand(jsoncmd as any);
console.log(jsoncmd);
sendCommand({ value }).then((res) => {
this.setState({
hadStartOta: true,
});
this.createTimer();
});
}
/**
* ota
*/
preOTA() {
const { packageCount, packageLength, packageCrc8, versionNo } =
this.$otaDataGroup;
let jsoncmd = {
commandType: "OTAPrepare",
packageCount,
packageLength,
packageCrc8,
versionNo,
};
console.info("OTAPrepare json => ", jsoncmd);
//@ts-ignore
const value = deviceToolKitInstance.toBleCommand(jsoncmd as any);
sendCommand({ value });
}
/**
* ota
*/
processOTA(i, data) {
const { packageCount, packageLength } = this.$otaDataGroup;
if (!packageLength) {
this.quitOTA();
}
let jsoncmd = {
commandType: "OTAUpdating",
packageCount,
packageLength,
currentPackageNo: i + 1,
currentPackageLength: data.length / 2,
currentPackageContent: data,
};
console.info("OTAUpdating json => ", jsoncmd);
//@ts-ignore
const value = deviceToolKitInstance.toBleCommand(jsoncmd as any);
sendCommand({ value });
}
/**
* ota
*/
async finishedOTA() {
let jsoncmd = {
commandType: "OTAUpdateFinish",
versionNo: this.$otaDataGroup.versionNo,
};
clearInterval(this.$checkTimer);
log.info("ota成功日志, 清除计时器");
//@ts-ignore
const value = deviceToolKitInstance.toBleCommand(jsoncmd as any);
sendCommand({ value }).then((res) => {
this.resetOta();
});
}
/**
* ota退
*/
quitOTA(errorString = "") {
// log.info('ota失败日志', errorString);
console.log("ota失败日志", errorString);
const errorMap = {
packageError: "总包错误",
packageNumError: "包号错误",
checkedError: "校验错误",
dataLengthError: "数据总长度错误",
dataCRCError: "数据总数CRC错误",
updateTimeOut: "数据更新超时",
};
let jsoncmd = {
commandType: "OTAQuit",
};
//@ts-ignore
const value = deviceToolKitInstance.toBleCommand(jsoncmd as any);
sendCommand({ value })
.then((res) => {
this.resetOta();
// this.showError(errorMap[errorString] || tipMap[errorString] || '发生错误')
})
.catch((err) => {
if (!this.state.hadShowError) {
this.setState({
hadShowError: true,
});
// log.info('ota失败日志', '发送日志OTAQuit失败', err);
console.info("ota失败日志", "发送日志OTAQuit失败", err);
// this.showError(errorMap[errorString] || tipMap[errorString] || '发生错误')
}
});
}
/**
* OTA
*/
async parseData(json) {
console.log("parseData json.commandType", json.commandType);
if (!json || !json.commandType) return;
switch (json.commandType) {
case "OTAStart":
if (json.responseStatus == "OK") {
const otaData = await this.getUpgradeData();
this.$otaDataGroup = {
...this.$otaDataGroup,
otaData,
};
this.$otaDataGroup.otaCurrentPackageIndex = 0;
this.preOTA();
} else {
this.quitOTA(json.responseStatus);
}
break;
case "OTAPrepare":
if (json.responseStatus == "OK") {
this.processOTA(0, this.$otaDataGroup.otaData[0]);
} else {
this.quitOTA(json.responseStatus);
}
break;
case "OTAUpdating":
if (json.responseStatus == "OK") {
let ota = this.$otaDataGroup;
let progressbar =
(ota.otaCurrentPackageIndex / ota.packageCount) * 100;
this.setState({
progressbar: (progressbar <= 1 ? 1 : progressbar).toFixed(0),
});
if (!json.currentPackageNo) {
return;
}
if (json.currentPackageNo < this.$otaDataGroup.packageCount) {
this.$otaDataGroup.otaCurrentPackageIndex++;
this.processOTA(
this.$otaDataGroup.otaCurrentPackageIndex,
this.$otaDataGroup.otaData[
this.$otaDataGroup.otaCurrentPackageIndex
]
);
} else {
this.finishedOTA();
}
} else {
this.quitOTA(json.responseStatus);
}
break;
case "OTAUpdateFinish":
console.log("完成OTA传输");
this.setState({
progressbar: 100,
});
this.finishFun();
// quitOTA()
break;
default:
break;
}
}
/**
* ota
*/
getDeviceUpgrade = async () => {
let res: any = await InstrumentInfo.getUpgrade({
instrumentId: this.state.currentDevice.id,
isWe200: !this.isWL200(),
});
if (res.data.data == "解析失败") {
// this.showError('文件解析失败');
return;
}
if (res.data.code !== 200) {
return;
}
const otaHexString = res.data.data;
const otaBin = string2buffer(res.data.data);
const packageLength = otaBin?.byteLength || 0;
const packageSize = this.$otaDataGroup.packageSize;
const packageCrc8 = Stringkit.getCrc8CodeByString(otaHexString);
const packageCount = Math.ceil(packageLength / packageSize);
let { iotVersion: versionNo } = this.state.currentDevice;
this.$otaDataGroup = {
...this.$otaDataGroup,
otaHexString,
otaBin,
packageLength,
packageSize,
packageCrc8,
packageCount,
versionNo,
};
console.log("this.$otaDataGroup ", this.$otaDataGroup);
};
notifyBLECharacteristicValueChange = () => {
const bluetoothInfo = this.props.bluetoothInfo;
notifyBLECharacteristicValueChange({
deviceId: bluetoothInfo.deviceId,
servicesuuid: bluetoothInfo.servicesuuid,
characteristicsuuid1: bluetoothInfo.characteristicsuuid1,
characteristicsuuid0: bluetoothInfo.characteristicsuuid0,
}).then((res) => {
Taro.onBLECharacteristicValueChange((value) => {
// let str = ab2hex(value.value); //转为16进制字符串
// console.log('返回',str)
const jsonStatus: any = deviceToolKitInstance.toJsonStatus(value.value);
log.info("OTA页面设备响应数据打印==》", JSON.stringify(jsonStatus));
console.info("onBLECharacteristicValueChange json => ", jsonStatus);
this.$otaDataGroup.currentPackageNo = jsonStatus.currentPackageNo;
this.$otaDataGroup.countDown = 7;
this.parseData(jsonStatus);
});
setTimeout(() => {
this.startOTA();
}, 500);
});
};
createTimer() {
log.info("设备ota计时器创建成功");
this.$checkTimer = setInterval(() => {
// 超过7s没有回包, 直接断开
if (this.$otaDataGroup.countDown <= 0 && this.state.hadStartOta) {
if (!this.isWL200()) {
this.quitOTA("shutDownMaskTip");
} else {
this.quitOTA("updateTimeOut");
}
} else {
this.$otaDataGroup.countDown--;
}
console.log(this.$otaDataGroup.countDown);
}, 1000);
}
//升级销毁页面时关闭小程序蓝牙
onUnload() {
if (this.$checkTimer) clearInterval(this.$checkTimer);
Taro.closeBluetoothAdapter();
}
onPullDownRefresh() {
Taro.stopPullDownRefresh();
}
onClickStop = (e) => {
e.stopPropagation();
};
// 错误关闭回调
errorFun = () => {
this.props.errorFun();
};
// 升级完成回调
finishFun = () => {
this.props.finishFun();
};
render() {
let { isShow } = this.props;
let { progressbar } = this.state;
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
<View
className={classnames(
"common-box",
"common-progress-box",
"common-large"
)}
catchMove
>
<View className={classnames("common-popup-title", "margin-samll")}>
</View>
<View className="common-popup-content-box">
<View className={classnames("common-popup-content", "text-left")}>
<View className="progress">
<Progress
percentage={progressbar}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent"> {progressbar}%</View>
</View>
<View className="progress-tips"></View>
<View className="progress-tips">1.</View>
<View className="progress-tips">2.</View>
</View>
</View>
</View>
</Popup>
</Block>
);
}
}
const mapStateToProps = (state) => ({
bluetoothInfo: state.deviceInfo.bluetoothInfo,
});
const mapDispatchToProps = (dispatch) => ({});
export default connect(mapStateToProps, mapDispatchToProps)(UpdateIotWL200);

@ -110,13 +110,13 @@ export default class AtCalendarController extends React.Component<any, any> {
> >
{/* <Text className="controller__info"></Text> */} {/* <Text className="controller__info"></Text> */}
{/* <Text>{dayjsDate.format(monthFormat)}</Text> */} {/* <Text>{dayjsDate.format(monthFormat)}</Text> */}
<Text style={{ fontSize: "36rpx", fontWeight: "600" }}> <Text style={{ fontSize: "32rpx", fontWeight: "600" }}>
{dayjsDate.format("YYYY.MM.DD")} {dayjsDate.format("YYYY.MM.DD")}
</Text> </Text>
<View style="margin-left: 34rpx;"> <View style="margin-left: 34rpx;">
<Image <Image
src={require("../img/calendar.png")} src={require("../img/calendar.png")}
style="width:34rpx;height:34rpx;" style="width:28rpx;height:28rpx;"
/> />
</View> </View>
</View> </View>

@ -86,17 +86,19 @@ export default class PopupAlert extends Component<any, any> {
isClose, isClose,
isLarge, isLarge,
myClassName, myClassName,
zIndex,
type, type,
} = this.props; } = this.props;
if (!zIndex) zIndex = 10001;
return ( return (
<Block> <Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} /> <PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup <Popup
className={myClassName} className={myClassName}
overlayStyle={`width: 100vw;padding: 0;z-index: ${zIndex} !important`}
show={isShow} show={isShow}
closeOnClickOverlay={false} closeOnClickOverlay={false}
round round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop} onClick={this.onClickStop}
> >
{/* <View {/* <View

@ -0,0 +1,14 @@
.popup-status-title {
margin-bottom: 50rpx;
}
.popup-status-box {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
margin: 0 auto;
margin-bottom: 50rpx;
.popup-status {
width: 100%;
height: 100%;
}
}

@ -0,0 +1,159 @@
import classnames from "classnames";
import { Component } from "react";
import {
Block,
View,
Image,
Text,
Button,
PageMeta,
ScrollView,
} from "@tarojs/components";
import { Popup } from "@antmjs/vantui";
import "./popup.less";
import "./popup-status.less";
/** props
* isLarge
* isShow
* isClose
* title
* content
* confirmButtonText
* textAlgin left right center
* type: 1
* @confirm
*/
export default class PopupStatus 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();
};
onTouchMove = () => {
return true;
};
render() {
let {
title,
content,
confirmButtonText,
textAlgin,
isShow,
isClose,
isBtn,
isLarge,
myClassName,
zIndex,
type,
} = this.props;
if (!zIndex) zIndex = 10001;
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
className={myClassName}
overlayStyle={`width: 100vw;padding: 0;z-index: ${
zIndex || 10001
} !important`}
show={isShow}
closeOnClickOverlay={false}
round
onClick={this.onClickStop}
>
{isClose && (
<View
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
)}
<View
className={classnames("common-box", {
"common-large": isLarge,
})}
catchMove
>
{title && (
<View
className={classnames(
"common-popup-title",
"opup-status-title",
{
"margin-samll": isLarge,
}
)}
>
{title}
</View>
)}
<View className="common-popup-content-box">
<ScrollView
scrollY
className={classnames("common-popup-content", {
"text-left": textAlgin === "left",
"text-right": textAlgin === "right",
"text-center": textAlgin === "center",
})}
>
<View className="popup-status-box">
{type === "success" && (
<Image
className="popup-status"
src={require("../../img/status/success.png")}
mode="aspectFit"
/>
)}
{type === "error" && (
<Image
className="popup-status"
src={require("../../img/status/error.png")}
mode="aspectFit"
/>
)}
</View>
{content}
</ScrollView>
</View>
{isBtn && (
<View className="alert-popup-btns">
<Button className="alert-popup-btn" onClick={this.onConfirm}>
{confirmButtonText}
</Button>
</View>
)}
</View>
</Popup>
</Block>
);
}
}

@ -107,3 +107,12 @@
font-size: 36rpx; font-size: 36rpx;
z-index: 100009; z-index: 100009;
} }
.level-up {
&.van-overlay {
z-index: 10020 !important;
}
&.van-popup {
z-index: 10021 !important;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

@ -1,7 +1,7 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Progress } from '@antmjs/vantui' import { Progress } from "@antmjs/vantui";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components"; import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { date, getdates, previewImage } from "../../utils/util"; import { date, getdates, previewImage } from "../../utils/util";
@ -9,7 +9,7 @@ import { date, getdates, previewImage } from "../../utils/util";
/** 自定义组件 **/ /** 自定义组件 **/
import Navbar from "../../components/navbar/navbar"; import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert"; import PopupAlert from "../../components/popup/popup-alert";
import { InstrumentInfo } from '../../utils/Interface' import { InstrumentInfo } from "../../utils/Interface";
/** 自定义组件 **/ /** 自定义组件 **/
import "./face_report.less"; import "./face_report.less";
@ -21,54 +21,60 @@ export default class Index extends Component<any, any> {
name: "template模板页", name: "template模板页",
statistics: {}, statistics: {},
recordList: [], recordList: [],
recordData: {} recordData: {},
}; };
} }
componentDidMount() { } componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
// 查询用户护理记录的当月统计信息 // 查询用户护理记录的当月统计信息
async getStatistics(id) { async getStatistics(id) {
let data = {} let data = {};
if (id != null) { if (id != null) {
data['instrumentId'] = id data["instrumentId"] = id;
} }
let res = await InstrumentInfo.apiNursingLog.getStatistics(data) let res = await InstrumentInfo.apiNursingLog.getStatistics(data);
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ statistics: res.data.data }) this.setState({ statistics: res.data.data });
} }
} }
async getRecord(id, recordId) { async getRecord(id, recordId) {
let data = {} console.log("id, recordId", id, recordId);
let data = {};
if (id != null) { if (id != null) {
data['instrumentId'] = id data["instrumentId"] = id;
} }
let res = await InstrumentInfo.apiNursingLog.getRecord(data) let res = await InstrumentInfo.apiNursingLog.getRecord(data);
if (res.data.code === 200) { if (res.data.code === 200) {
res.data.rows.map(item => { if (recordId) {
item.nursingTime = this.getTime(item.nursingTime) res.data.rows.map((item) => {
item.createTime = getdates(item.createTime).replace(/-/g, '.') item.nursingTime = this.getTime(item.nursingTime);
item.createTime = getdates(item.createTime).replace(/-/g, ".");
if (item.id == recordId) { if (item.id == recordId) {
this.setState({ recordData: item }) this.setState({ recordData: item });
}
});
} else {
this.setState({ recordData: res.data.rows[0] });
} }
})
this.setState({ recordList: res.data.rows.filter(item => item.id != recordId) })
this.setState({
recordList: res.data.rows.filter((item) => item.id != recordId),
});
} }
} }
getRouteId() { getRouteId() {
const searchParams = new URLSearchParams(window.location.search); const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get('id'); const id = searchParams.get("id");
const recordId = searchParams.get('recordId'); const recordId = searchParams.get("recordId");
this.getStatistics(id) this.getStatistics(id);
this.getRecord(id, recordId) this.getRecord(id, recordId);
console.log(recordId); console.log(recordId);
} }
getTime(time) { getTime(time) {
const hour = time.slice(0, 2); const hour = time.slice(0, 2);
@ -76,188 +82,152 @@ export default class Index extends Component<any, any> {
const second = time.slice(6, 8); const second = time.slice(6, 8);
if (hour > 0) { if (hour > 0) {
return hour + '时' + minute + '分' + second + '秒' return hour + "时" + minute + "分" + second + "秒";
} else { } else {
return minute + '分' + second + '秒' return minute + "分" + second + "秒";
} }
} }
async onLoad() { async onLoad() {
this.getRouteId() this.getRouteId();
} }
componentDidShow() { } componentDidShow() {}
componentDidHide() { } componentDidHide() {}
async initData() { } async initData() {}
render() { render() {
let { name, statistics, recordList, recordData } = this.state; let { name, statistics, recordList, recordData } = this.state;
return ( return (
<Block> <Block>
<Navbar isBack titleSlot='护理报告'></Navbar> <Navbar isBack titleSlot="护理报告"></Navbar>
{/* <View className="time m-x-30">{{reportData.curDate}}</View> */} <View className="statistic m-x-30 flex aitems">
{/* <View className="time m-x-30"></View> */} <View className="statistic_item">
<View className='statistic m-x-30 flex aitems'> <View className="statistic_title">
{/* <block wx:if="{{ reportData.instrument_type !== 5 && reportData.instrument_type !== 4 }}"> */}
<View className='statistic_item'>
<View className='statistic_title'>
<text>3</text>
<text className='num'></text>
</View>
{/* <View wx:if="{{ reportData.instrument_id == 74 || reportData.instrument_id == 73 }}" className="statistic_desc">
</View> */}
<View className='statistic_desc'>
</View>
{/* <View className="statistic_desc">{{options.type == 'led' ? '本月光照天数': '本月促渗天数'}}</View> */}
<View className='statistic_desc'></View>
</View>
<View className='statistic_item'>
<View className='statistic_title'>28:00</View>
{/* <View className="statistic_desc">{{options.type == 'led' ? '本月护理时间': '本月促渗时间'}}</View> */}
<View className='statistic_desc'></View>
</View>
{/* </block> */}
{/* <block wx:if="{{ reportData.instrument_type == 4 || reportData.instrument_type == 5 }}"> */}
<View className='statistic_item'>
<View className='statistic_title'>
<text>{statistics.nursingNum}</text> <text>{statistics.nursingNum}</text>
<text className='num'></text> <text className="num"></text>
</View>
<View className='statistic_desc'>
</View> </View>
<View className="statistic_desc"></View>
</View> </View>
<View className='statistic_item'> <View className="statistic_item">
<View className='statistic_title'>{statistics.nursingTime}</View> <View className="statistic_title">{statistics.nursingTime}</View>
<View className='statistic_desc'></View> <View className="statistic_desc"></View>
</View> </View>
{/* </block> */} {/* </block> */}
</View> </View>
<View className='main m-x-30'> <View className="main m-x-30">
{/* <block wx:if="{{ reportData.instrument_type !== 4 && reportData.instrument_type !== 5 }}"> */} <View className="products_item" style="border: none">
<View className='products_item' style='border: none'> <View className="products_top flex aitems">
<View className='products_top flex aitems'> <View className="add_time">{recordData.createTime}</View>
<View className='add_time'>{recordData.createTime}</View> <View
<View className={classnames("tag", { className={classnames("tag", {
tag_active: recordData.online === 2, tag_active: recordData.online === 2,
})} })}
>{recordData.online == 1 ? '在线' : '离线'}</View> >
</View> {recordData.online == 1 ? "在线" : "离线"}
<View className='products_middle flex'>
<Image className='cover' src={recordData.modeImage} mode='aspectFill'></Image>
<View className='content'>
<View className='content_top'>
<View className='title'>{recordData.instrumentName}</View>
<View className='desc_box'>
<View className='desc'>{recordData.modeName}</View>
<View className='desc'>{recordData.nursingTime}</View>
</View> </View>
</View> </View>
<View className='progress'> <View className="products_middle flex">
<Image
<Progress percentage={recordData.completionPercentage * 100} strokeWidth='12' color='linearGradient(to right, #eecda1, #ffe9c7) !important' /> className="cover"
<View className='percent'> {recordData.completionPercentage * 100}%</View> src={recordData.modeImage}
</View> mode="aspectFill"
></Image>
<View className="content">
<View className="content_top">
<View className="title">{recordData.instrumentName}</View>
<View className="desc_box">
<View className="desc">{recordData.modeName}</View>
<View className="desc">
{recordData.nursingTime}
</View> </View>
</View> </View>
</View> </View>
<View className='main_title' ></View> <View className="progress">
{recordList.map(item => (
<View className='products_item' style='border: none' key={item.id}>
<View className='products_top flex aitems'>
<View className='add_time'>{item.createTime}</View>
<View className={classnames("tag", {
tag_active: item.online === 2,
})}
>{item.online == 1 ? '在线' : '离线'}</View>
</View>
<View className='products_middle flex'>
<Image className='cover' src={item.modeImage} mode='aspectFill'></Image>
<View className='content'>
<View className='content_top'>
<View className='title'>{item.instrumentName}</View>
<View className='desc_box'>
<View className='desc'>{item.modeName}</View>
<View className='desc'>{item.nursingTime}</View>
</View>
</View>
<View className='progress'>
<Progress percentage={item.completionPercentage * 100} strokeWidth='12' color='linearGradient(to right, #eecda1, #ffe9c7) !important' /> <Progress
<View className='percent'> {item.completionPercentage * 100}%</View> percentage={
recordData.completionPercentage * 100 > 100
? 100
: recordData.completionPercentage * 100
}
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{recordData.completionPercentage * 100 > 100
? 100
: recordData.completionPercentage * 100}
%
</View> </View>
</View> </View>
</View> </View>
</View> </View>
))}
{/* </block> */}
{/* <block wx:if="{{ reportData.instrument_type == 4 || reportData.instrument_type == 5 }}"> */}
{/* <View className='products_item' style='border: none'>
<View className='products_top flex aitems'>
<View className='add_time'>2024.01.01</View>
<View className="{{reportData.online === 2 ? 'tag tag_active' : 'tag'}}">线</View>
</View> </View>
<View className='products_middle flex'> <View className="main_title"></View>
<Image className='cover' src={require('../../img/test/1706667011027.jpg')} mode='aspectFill'></Image> {recordList.map((item) => (
<View className='content'> <View className="products_item" style="border: none" key={item.id}>
<View className='content_top'> <View className="products_top flex aitems">
<View className='title'></View> <View className="add_time">{item.createTime}</View>
<View className='desc_box'> <View
<View className='desc'></View> className={classnames("tag", {
<View className='desc'>10:00</View> tag_active: item.online === 2,
</View> })}
</View> >
<View className='progress'> {item.online == 1 ? "在线" : "离线"}
<Progress percentage='80' strokeWidth='12' pivotText='' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> 80%</View>
</View> </View>
</View> </View>
<View className="products_middle flex">
<Image
className="cover"
src={item.modeImage}
mode="aspectFill"
></Image>
<View className="content">
<View className="content_top">
<View className="title">{item.instrumentName}</View>
<View className="desc_box">
<View className="desc">{item.modeName}</View>
<View className="desc">{item.nursingTime}</View>
</View> </View>
</View> */}
{/* <View className='main_title' ></View>
<View className='products_item' >
<View className='products_top flex aitems'>
<View className='add_time'>2024.01.01</View>
<View className="{{item.online === 2 ? 'tag tag_active' : 'tag'}}">线</View>
</View> </View>
<View className='products_middle flex'> <View className="progress">
<Image className='cover' src={require('../../img/test/1706667011027.jpg')} mode='aspectFill'></Image>
<View className='content'> <Progress
<View className='content_top'> percentage={
<View className='title'></View> item.completionPercentage * 100 > 100
<View className='desc_box'> ? 100
<View className='desc'></View> : item.completionPercentage * 100
<View className='desc'>10:00</View> }
strokeWidth="12"
color="linearGradient(to right, #eecda1, #ffe9c7) !important"
/>
<View className="percent">
{" "}
{item.completionPercentage * 100 > 100
? 100
: item.completionPercentage * 100}
%
</View> </View>
</View> </View>
<View className='progress'>
<Progress percentage='80' strokeWidth='12' pivotText='' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> 80%</View>
</View> </View>
</View> </View>
</View> </View>
</View> */} ))}
{/* </block> */}
</View> </View>
<View className='footer flex aitems' > <View className="footer flex aitems">
<View className='btn'></View> <View className="btn"></View>
<View className='text flex aitems'> <View className="text flex aitems">
<View></View> <View></View>
<Image src='../../img/right.png' mode='aspectFill'></Image> <Image
src={require("../../img/right.png")}
mode="aspectFill"
></Image>
</View> </View>
</View> </View>
{/* <clockInDialog id="clockInDialog" instrumentId="{{reportData.instrument_id}}" isCustom="{{ true }}" bind:submitFun="confirmSubmit"/> */}
</Block> </Block>
); );
} }

@ -2,6 +2,11 @@ page {
background: #f3f3f3; background: #f3f3f3;
} }
.mb10{
margin-bottom: 20rpx;
font-size: 32rpx;
}
/* 隐藏横向滚动条 */ /* 隐藏横向滚动条 */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0; width: 0;
@ -992,7 +997,7 @@ page {
padding-top: 32rpx; padding-top: 32rpx;
background-color: #fff; background-color: #fff;
box-shadow: 0rpx 2rpx 25rpx 18rpx rgba(210, 210, 210, 0.1); box-shadow: 0rpx 2rpx 25rpx 18rpx rgba(210, 210, 210, 0.1);
border-radius: 0rpx 0rpx 30rpx 30rpx; border-radius:30rpx;
.date-title { .date-title {
position: absolute; position: absolute;
top: 32rpx; top: 32rpx;

@ -9,6 +9,7 @@ import {
Image, Image,
Swiper, Swiper,
SwiperItem, SwiperItem,
RichText,
} from "@tarojs/components"; } from "@tarojs/components";
/*** redux ***/ /*** redux ***/
@ -25,10 +26,12 @@ import PopupBinding from "@/components/popup/popup-binding";
import PopupSiteSwiper from "@/components/popup/popup-site-swiper"; import PopupSiteSwiper from "@/components/popup/popup-site-swiper";
import PopupAlert from "@/components/popup/popup-alert"; import PopupAlert from "@/components/popup/popup-alert";
import PopupConfirm from "@/components/popup/popup-confirm";
import type CustomTabBar from "@/custom-tab-bar"; import type CustomTabBar from "@/custom-tab-bar";
import Navbar from "@/components/navbar/navbar"; import Navbar from "@/components/navbar/navbar";
import ConnectionBluetoot from "@/components/bluetoot/connection"; import ConnectionBluetoot from "@/components/bluetoot/connection";
import UpdateIotWL200 from "@/components/bluetoot/update-wl200/index";
/** 自定义组件 **/ /** 自定义组件 **/
import { import {
@ -52,13 +55,13 @@ import {
setStorageSync, setStorageSync,
showModal, showModal,
} from "@/utils/traoAPI"; } from "@/utils/traoAPI";
const log = require("@/utils/log");
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
import InstrumentTypeEnum from "@/components/bluetoot/instrumentTypeEnum"; import InstrumentTypeEnum from "@/components/bluetoot/InstrumentTypeEnum";
import OtaDeviceTypeEnum from "@/components/bluetoot/OtaDeviceTypeEnum"; import OtaDeviceTypeEnum from "@/components/bluetoot/OtaDeviceTypeEnum";
const log = require("@/utils/log");
class Index extends Component<any, any> { class Index extends Component<any, any> {
// pageCtx = Taro.getCurrentInstance().page; // pageCtx = Taro.getCurrentInstance().page;
$instance = Taro.getCurrentInstance(); $instance = Taro.getCurrentInstance();
@ -131,13 +134,20 @@ class Index extends Component<any, any> {
/** 蓝牙相关 */ /** 蓝牙相关 */
isConnectShow: false, isConnectShow: false,
connectInstrument: {}, connectInstrument: {}, // 当前连接设备
yiqiinfo: {},
/* END */ /* END */
// 设备升级弹窗
isShowUpdateVersionTip: false, // 升级提示
isShowVersionUpgrading: false, // 升级中
isShowVersionUpgradFinish: false, // 升级完成:升级内容公告
versionUpgradFinishNodes: "", // 公告内容
}; };
} }
async onLoad() { async onLoad() {
console.log(1123131233);
// 仅非扫码进入页面时,校验跳转欢迎页 // 仅非扫码进入页面时,校验跳转欢迎页
if (!this.$instance.router?.params?.q) { if (!this.$instance.router?.params?.q) {
const isFirst = Taro.getStorageSync("isWelcome"); const isFirst = Taro.getStorageSync("isWelcome");
@ -145,11 +155,17 @@ class Index extends Component<any, any> {
go("/pages/initiate/initiate"); go("/pages/initiate/initiate");
} }
} }
if (Taro.getStorageSync("skip")) {
this.setState({ showEquipment: true })
Taro.removeStorageSync('skip');
}
} }
componentDidMount() {} componentDidMount() {
componentWillUnmount() {} }
componentWillUnmount() { }
componentDidShow() { componentDidShow() {
const tabbar = Taro.getTabBar<CustomTabBar>(this.$instance.page); const tabbar = Taro.getTabBar<CustomTabBar>(this.$instance.page);
@ -158,7 +174,7 @@ class Index extends Component<any, any> {
this.showInit(); this.showInit();
} }
componentDidHide() {} componentDidHide() { }
showInit() { showInit() {
// 判断是否登录 // 判断是否登录
@ -185,6 +201,9 @@ class Index extends Component<any, any> {
if (ids.length > 1) { if (ids.length > 1) {
let serial = ids[1]; let serial = ids[1];
Taro.setStorageSync("serial", serial); Taro.setStorageSync("serial", serial);
if (!Taro.getStorageSync("mobile")) {
go("/pages/register/register");
}
} }
} }
} }
@ -205,7 +224,7 @@ class Index extends Component<any, any> {
this.isSancQrcodeEnter(); this.isSancQrcodeEnter();
} }
}, },
fail: () => {}, fail: () => { },
complete: () => { complete: () => {
// 授权完成运行页面初始化 // 授权完成运行页面初始化
}, },
@ -363,7 +382,7 @@ class Index extends Component<any, any> {
this.setState({ isShowSiteSwiper: false }); this.setState({ isShowSiteSwiper: false });
}; };
bannerSwiperchange() {} bannerSwiperchange() { }
gobanner(item) { gobanner(item) {
// 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间', // 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间',
@ -635,7 +654,12 @@ class Index extends Component<any, any> {
go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
// return; // return;
} }
onUnloginConfirm() {
this.setState({ showEquipment: false })
}
onUnloginClose() {
this.setState({ showEquipment: false })
}
//连接完成时数据的回调 //连接完成时数据的回调
offlineChange = async (e) => { offlineChange = async (e) => {
console.log("offlineChange", e); console.log("offlineChange", e);
@ -650,96 +674,7 @@ class Index extends Component<any, any> {
versionInfo, versionInfo,
}); });
let offlinelist: any = []; let offlinelist: any = [];
offlineDataList.map((item, index) => {
let obj: any = {
clock_day: "",
status: 3,
second: 120,
screne_id: "",
screne_name: "离线打卡",
model_face_ward: 0,
model_face_use: 0,
model_face_type: "",
model_eye_ward: 0,
model_eye_use: 0,
model_eye_type: "",
instrument_id: this.state.connectInstrument.id,
};
//判断日期是否正常,如果不正常不处理 --- 脸部
if (
item.faceyear > 0 &&
item.faceyear <= 99 &&
item.facemonth >= 1 &&
item.facemonth <= 12 &&
item.faceday >= 1 &&
item.faceday <= 31
) {
if (
item.facehour > 0 ||
(item.faceminutes > 0 && item.faceminutes < 60) ||
(item.faceseconds > 0 && item.faceseconds < 60)
) {
//脸部离线记录有值
obj.model_face_use =
Number(item.facehour) * 60 * 60 +
Number(item.faceminutes) * 60 +
Number(item.faceseconds);
obj.model_face_ward = item.faceposition1;
obj.clock_day = `20${String(item.faceyear).padStart(2, "0")}-${String(
item.facemonth
).padStart(2, "0")}-${String(item.faceday).padStart(2, "0")}`;
}
}
//判断日期是否正常,如果不正常不处理 --- 眼部
if (
item.eyeyear > 0 &&
item.eyeyear <= 99 &&
item.eyemonth >= 1 &&
item.eyemonth <= 12 &&
item.eyeday >= 1 &&
item.eyeday <= 31
) {
if (
item.eyehour > 0 ||
(item.eyeminutes > 0 && item.eyeminutes < 60) ||
(item.eyeseconds > 0 && item.eyeseconds < 60)
) {
//眼部离线记录有值
obj.model_eye_use =
Number(item.eyehour) * 60 * 60 +
Number(item.eyeminutes) * 60 +
Number(item.eyeseconds);
obj.model_eye_ward = item.eyeposition1;
obj.clock_day = `20${String(item.eyeyear).padStart(2, "0")}-${String(
item.eyemonth
).padStart(2, "0")}-${String(item.eyeday).padStart(2, "0")}`;
}
}
obj.second = obj.model_face_use + obj.model_eye_use;
if (
item.faceyear > 0 &&
item.faceyear <= 99 &&
(item.facemonth == 1 || item.facemonth <= 12) &&
(item.faceday == 1 || item.faceday <= 31)
) {
let dayTime = new Date(`${obj.clock_day.replace(/-/g, "/")}`).getTime(); //离线记录的日期
let now = new Date(
`${new Date().getFullYear()}/${String(
new Date().getMonth() + 1
).padStart(2, "0")}/${String(new Date().getDate()).padStart(2, "0")}`
).getTime(); //当前日期
/**
* 7线
*
*/
if (dayTime <= now && dayTime >= now - 24 * 60 * 60 * 1000 * 6) {
offlinelist.push(obj);
}
}
});
console.log(offlinelist); console.log(offlinelist);
}; };
@ -752,8 +687,64 @@ class Index extends Component<any, any> {
connectionConfirm = async () => { connectionConfirm = async () => {
this.connectionClose(); this.connectionClose();
}; };
/*蓝牙 END*/ /*蓝牙 END*/
/** 设备iot固件版本升级 */
// 是否更新弹窗
upgradeFun = () => {
this.setState({ isShowUpdateVersionTip: true, isConnectShow: false });
};
cancelUpdateVersionTip = () => {
// 关闭提示
this.setState({ isShowUpdateVersionTip: false });
};
confirmUpdateVersionTip = () => {
// 提示升级与开始升级
this.setState({
isShowUpdateVersionTip: false,
isShowVersionUpgrading: true,
});
};
// 完成升级
wl200UpgradeFinishFun = (isWL200) => {
let { connectInstrument } = this.state;
console.log("connectInstrument", connectInstrument);
let content = "";
if (isWL200) {
content = connectInstrument.iotVersionUpgrade;
} else {
content = connectInstrument.we200IotVersionUpgrade;
}
let nodes = decodeURIComponent(content || "");
nodes = nodes.replace(/\<img/gi, '<img style="width:100%;height:auto" ');
nodes = nodes.replace(
/\<table/gi,
'<table style="border-spacing: 0;border-collapse: collapse;border: 1px solid #000" '
);
nodes = nodes.replace(
/\<td/gi,
'<td style="border: 1px solid #000;text-align:center" '
);
this.setState({
isShowVersionUpgrading: false,
versionUpgradFinishNodes: nodes,
});
};
// 升级失败
wl200UpgradeErrorFun = () => {
this.setState({
isShowVersionUpgrading: false,
});
};
// 关闭升级完成公告
onVersionUpgradFinish = () => {
this.setState({
isShowVersionUpgradFinish: false,
});
};
/** iot版本升级 END */
render() { render() {
let { let {
calendarComplete, calendarComplete,
@ -776,6 +767,13 @@ class Index extends Component<any, any> {
isExchangeBinding, isExchangeBinding,
instrumentInfo, instrumentInfo,
instrumentList, instrumentList,
showEquipment,
// 升级弹窗
isShowUpdateVersionTip,
isShowVersionUpgrading,
isShowVersionUpgradFinish,
versionUpgradFinishNodes,
// 蓝牙连接 // 蓝牙连接
isConnectShow, isConnectShow,
@ -786,22 +784,37 @@ class Index extends Component<any, any> {
<Block> <Block>
<View catchMove> <View catchMove>
<PopupAlert <PopupAlert
isShow={isNotRegister} isShow={isBindingError}
isClose={true}
title="提示" title="提示"
content="暂未授权注册,请点击注册" content={
confirmButtonText="确定" <Block>
<View></View>
<View></View>
</Block>
}
confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
type="1" isClose={false}
close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm}
/>
<PopupAlert
isShow={isNotRegister}
isClose
title='提示'
content='暂未授权注册,请点击注册'
confirmButtonText='确定'
textAlgin='center'
type='1'
close={this.closeAlert} close={this.closeAlert}
confirm={this.closeAlert} confirm={this.closeAlert}
/> />
<PopupAlert <PopupAlert
isShow={isDev} isShow={isDev}
title="提示" title='提示'
content="页面正在开发中" content='页面正在开发中'
confirmButtonText="确定" confirmButtonText='确定'
textAlgin="center" textAlgin='center'
close={this.closeDev} close={this.closeDev}
confirm={this.closeDev} confirm={this.closeDev}
/> />
@ -821,28 +834,45 @@ class Index extends Component<any, any> {
/> />
<PopupAlert <PopupAlert
isShow={isBindingError} isShow={isBindingError}
title="提示" title='提示'
content={ content={
<Block> <Block>
<View></View> <View></View>
<View></View> <View></View>
</Block> </Block>
} }
confirmButtonText="知道了" confirmButtonText='知道了'
textAlgin="center" textAlgin='center'
isClose={false} isClose={false}
close={this.onBindErrorClose} close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm} confirm={this.onBindErrorConfirm}
></PopupAlert> />
<PopupAlert <PopupAlert
isShow={isBeforeBinding} isShow={isBeforeBinding}
title="提示" title='提示'
content="您选择的仪器有误,请重新确认选择" content='您选择的仪器有误,请重新确认选择'
confirmButtonText="知道了" confirmButtonText='知道了'
textAlgin="center" textAlgin='center'
isClose={false} isClose={false}
close={this.onBeforeBindClose} close={this.onBeforeBindClose}
confirm={this.onBeforeBindConfirm} confirm={this.onBeforeBindConfirm}
/>
<PopupAlert
isShow={showEquipment}
title='提示'
content={
<Block>
<View className='mb10'></View>
<View className='mb10'>uniquie14231</View>
<View className='mb10'></View>
</Block>
}
confirmButtonText='知道了'
textAlgin='center'
isClose={false}
close={this.onUnloginClose.bind(this)}
confirm={this.onUnloginConfirm.bind(this)}
></PopupAlert> ></PopupAlert>
{/* <PopupPrivacyTest {/* <PopupPrivacyTest
@ -853,54 +883,96 @@ class Index extends Component<any, any> {
<PopupSiteSwiper <PopupSiteSwiper
isShow={isShowSiteSwiper} isShow={isShowSiteSwiper}
siteData={sitePopupList} siteData={sitePopupList}
size="middle" size='middle'
confirmButtonText="确定" confirmButtonText='确定'
textAlgin="center" textAlgin='center'
close={this.closeSiteSwiper} close={this.closeSiteSwiper}
confirm={this.closeSiteSwiper} confirm={this.closeSiteSwiper}
/> />
</View>
{/* IOT相关弹窗 */}
{isConnectShow && ( {isConnectShow && (
<ConnectionBluetoot <ConnectionBluetoot
yiqiInfo={connectInstrument} deviceInfo={connectInstrument}
close={this.connectionClose} close={this.connectionClose}
confirm={this.connectionConfirm} confirm={this.connectionConfirm}
offlineChange={this.offlineChange} offlineChange={this.offlineChange}
pairingChange={this.pairingChange} pairingChange={this.pairingChange}
upgradeFun={this.upgradeFun}
/> />
)} )}
{/* <ConnectionBluetoot /> */} <PopupConfirm
isLarge
isClose
isShow={isShowUpdateVersionTip}
title="提示"
content={
<Block>
<View></View>
<View></View>
</Block>
}
textAlgin="center"
cancelButtonText="取消"
confirmButtonText="确定"
close={this.cancelUpdateVersionTip}
confirm={this.confirmUpdateVersionTip}
/>
{isShowVersionUpgrading && (
<UpdateIotWL200
isShow={isShowVersionUpgrading}
finishFun={this.wl200UpgradeFinishFun}
errorFun={this.wl200UpgradeErrorFun}
/>
)}
<PopupAlert
isShow={isShowVersionUpgradFinish}
title="升级内容公告"
content={
<Block>
<View className="nodes">
<RichText nodes={versionUpgradFinishNodes} />
</View>
</Block>
}
confirmButtonText="知道了"
textAlgin="left"
isClose
close={this.onVersionUpgradFinish}
confirm={this.onVersionUpgradFinish}
/>
{/* IOT相关弹窗 END */}
</View>
<Navbar <Navbar
leftSlot={ leftSlot={
<Block> <Block>
<View <View
className="message" className='message'
onClick={this.gourl} onClick={this.gourl}
data-url="/pages/message/message" data-url='/pages/message/message'
> >
<Image <Image
className="message-img" className='message-img'
src={require("../../img/index/message.png")} src={require("../../img/index/message.png")}
mode="aspectFill" mode='aspectFill'
/> />
{messagecount ? <View className="tip" /> : ""} {messagecount ? <View className='tip' /> : ""}
</View> </View>
</Block> </Block>
} }
/> />
<View className="index"> <View className='index'>
<View className="date-title" onClick={this.toNursingRecords}> <View className='date-title' onClick={this.toNursingRecords}>
<Text className="text"></Text> <Text className='text'></Text>
<Image <Image
src={require("../../img/index/right.png")} src={require("../../img/index/right.png")}
style="width: 20rpx;height: 20rpx;" style='width: 20rpx;height: 20rpx;'
/> />
</View> </View>
<View className="bg-while"> <View className='bg-while'>
<AtCalendar <AtCalendar
hideArrow={true} hideArrow
isSwiper={false} isSwiper={false}
currentDate={currentDate} currentDate={currentDate}
complete={calendarComplete} complete={calendarComplete}
@ -910,41 +982,41 @@ class Index extends Component<any, any> {
/> />
</View> </View>
</View> </View>
<View className="infobox5"> <View className='infobox5'>
{instrumentList.length > 0 && ( {instrumentList.length > 0 && (
<Block> <Block>
<View className="nurse_plan_box flex aitems sb"> <View className='nurse_plan_box flex aitems sb'>
<View className="title"></View> <View className='title'></View>
<View <View
className="txt_box flex jcenter aitems" className='txt_box flex jcenter aitems'
data-url="/pages/instrument/instrument" data-url='/pages/instrument/instrument'
onClick={this.gourl} onClick={this.gourl}
> >
<Image <Image
className="right_icon" className='right_icon'
src={require("../../img/black-add.png")} src={require("../../img/black-add.png")}
mode="aspectFill" mode='aspectFill'
/> />
<View className="txt"></View> <View className='txt'></View>
</View> </View>
</View> </View>
<View style="overflow-x: auto;"> <View style='overflow-x: auto;'>
<View className="device_list flex"> <View className='device_list flex'>
{instrumentList.map((item, index) => { {instrumentList.map((item, index) => {
if (item.status === 0) { if (item.status === 0) {
return ( return (
<View <View
key={"instrumentList" + index} key={"instrumentList" + index}
className="device_item" className='device_item'
onClick={this.goNursing.bind(this, item)} onClick={this.goNursing.bind(this, item)}
> >
<Image <Image
className="banner_img" className='banner_img'
src={item.banner} src={item.banner}
mode="aspectFill" mode='aspectFill'
/> />
<View className="device_name ellipsis1"> <View className='device_name ellipsis1'>
{item.name} {item.name}
</View> </View>
</View> </View>
@ -957,34 +1029,34 @@ class Index extends Component<any, any> {
)} )}
{instrumentList.length === 0 && ( {instrumentList.length === 0 && (
<Block> <Block>
<View className="nurse_plan_box flex aitems sb"> <View className='nurse_plan_box flex aitems sb'>
<View className="title"></View> <View className='title'></View>
</View> </View>
<View className="add_device flex jcenter aitems bg-while"> <View className='add_device flex jcenter aitems bg-while'>
<View className="add_device_btn"> <View className='add_device_btn'>
<View className="txt_box flex jcenter aitems"> <View className='txt_box flex jcenter aitems'>
<View <View
className="at-icon at-icon-add" className='at-icon at-icon-add'
style="color: #fff;font-size: 30rpx;" style='color: #fff;font-size: 30rpx;'
></View> ></View>
<View className="txt" onClick={this.addNewDevice}> <View className='txt' onClick={this.addNewDevice}>
</View> </View>
</View> </View>
</View> </View>
<View className="tips"></View> <View className='tips'></View>
</View> </View>
</Block> </Block>
)} )}
</View> </View>
<View style="margin: 20px"> <View style='margin: 20px'>
<View onClick={this.goIot}></View> <View onClick={this.goIot}></View>
</View> </View>
<View className="infobox3"> <View className='infobox3'>
<Swiper <Swiper
autoplay={true} autoplay
onAnimationFinish={this.bannerSwiperchange.bind(this)} onAnimationFinish={this.bannerSwiperchange.bind(this)}
current={bannerCurrent} current={bannerCurrent}
> >
@ -994,13 +1066,13 @@ class Index extends Component<any, any> {
key={"banner_" + index} key={"banner_" + index}
onClick={this.gobanner.bind(this, item)} onClick={this.gobanner.bind(this, item)}
> >
<Image style="width:100%;height:100%" src={item.fileUrl} /> <Image style='width:100%;height:100%' src={item.fileUrl} />
</SwiperItem> </SwiperItem>
); );
})} })}
</Swiper> </Swiper>
</View> </View>
<View style="height:200rpx"></View> <View style='height:200rpx'></View>
</Block> </Block>
); );
} }

@ -255,8 +255,8 @@ export default class Instrument extends Component<any, any> {
}; };
onSubmit = () => { onSubmit = () => {
const { serial, serialImage, id } = this.state.channelInfo; const { serialCode, serialImage, id } = this.state.channelInfo;
if (!serial?.trim()) return msg("请输入设备序列号"); if (!serialCode?.trim()) return msg("请填写序列号");
if (!serialImage) return msg("请上传序列号照片"); if (!serialImage) return msg("请上传序列号照片");
this.manualCodeBinding(); this.manualCodeBinding();
}; };
@ -343,10 +343,9 @@ export default class Instrument extends Component<any, any> {
}); });
Taro.hideLoading(); Taro.hideLoading();
if (res.data.code === 200) { if (res.data.code === 200) {
// this.setState({ isVisibleBinding: false });
this.binding(); this.binding();
} else if (res.data.code === 204) { } else if (res.data.code === 204) {
this.setState({ isBindingCheckError: false }); this.setState({ isBindingCheckError: true });
} else { } else {
this.setState({ isBindingError: true }); this.setState({ isBindingError: true });
} }

@ -23,7 +23,7 @@ page {
.infobox1 { .infobox1 {
/* background: #fff; */ /* background: #fff; */
margin: 20rpx 0rpx; margin: 30rpx 0rpx 24rpx;
box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05); box-shadow: -2rpx 0 12rpx 0.5rpx rgba(129, 129, 129, 0.05);
#myVideo { #myVideo {
display: block; display: block;

@ -70,16 +70,16 @@ export default class InstrumentClickInUpload extends Component<any, any> {
async onLoad() { async onLoad() {
this.initData(); this.initData();
} }
componentDidMount() {} componentDidMount() { }
componentWillUnmount() {} componentWillUnmount() { }
componentDidShow() { componentDidShow() {
let videoContext = Taro.createVideoContext("myVideo"); let videoContext = Taro.createVideoContext("myVideo");
this.setState({ videoContext }); this.setState({ videoContext });
} }
componentDidHide() {} componentDidHide() { }
async initData() { async initData() {
let objStr = getStorageSync("instrument_detail"); let objStr = getStorageSync("instrument_detail");
@ -242,15 +242,15 @@ export default class InstrumentClickInUpload extends Component<any, any> {
}); });
}; };
videoBindTimeUpdate = async () => {}; videoBindTimeUpdate = async () => { };
videoEnded = async () => {}; videoEnded = async () => { };
videoPause = async () => {}; videoPause = async () => { };
videoPlay = async () => {}; videoPlay = async () => { };
videoLoadedMetaData = async () => {}; videoLoadedMetaData = async () => { };
handleTextareaInput = async (e) => { handleTextareaInput = async (e) => {
let { punchInInfo } = this.state; let { punchInInfo } = this.state;
@ -313,7 +313,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
isShow={isModeLock} isShow={isModeLock}
title="提示" title="提示"
content="该模式即将上线,敬请期待" content="该模式即将上线,敬请期待"
confirmButtonText="知道了" confirmButtonText="知道了"
textAlgin="center" textAlgin="center"
isClose={false} isClose={false}
close={this.onModeLockClose} close={this.onModeLockClose}

@ -45,13 +45,13 @@ export default class InstrumentManage extends Component<any, any> {
async onLoad() { async onLoad() {
this.initData(); this.initData();
} }
componentDidMount() {} componentDidMount() { }
componentWillUnmount() {} componentWillUnmount() { }
componentDidShow() {} componentDidShow() { }
componentDidHide() {} componentDidHide() { }
async initData() { async initData() {
this.bindingInstrumentList(); this.bindingInstrumentList();
@ -127,7 +127,7 @@ export default class InstrumentManage extends Component<any, any> {
<Block> <Block>
<Navbar titleSlot="设备管理" background="#fff" isBack={true} /> <Navbar titleSlot="设备管理" background="#fff" isBack={true} />
<View className="instrument_box"> <View className="instrument_box">
{bindList.length && ( {bindList.length > 0 &&
<Block> <Block>
<View className="title"></View> <View className="title"></View>
<View className="scroll"> <View className="scroll">
@ -220,8 +220,7 @@ export default class InstrumentManage extends Component<any, any> {
</ScrollView> */} </ScrollView> */}
</View> </View>
</Block> </Block>
)} }
<View className="title"></View> <View className="title"></View>
<View className="scroll"> <View className="scroll">
<ScrollView scroll-x="true" className="un_bind_list"> <ScrollView scroll-x="true" className="un_bind_list">

@ -17,7 +17,7 @@ function Index({
return ( return (
<Block> <Block>
<View className="electricity-box"> <View className="electricity-box">
<View className="item"> {/* <View className="item">
<View className="label">WE200 :</View> <View className="label">WE200 :</View>
<View className="value flex aitems"> <View className="value flex aitems">
{matrixElectricity >= 4 && ( {matrixElectricity >= 4 && (
@ -61,7 +61,7 @@ function Index({
</Block> </Block>
)} )}
</View> </View>
</View> </View> */}
{facialMaskConnectStatus === 1 && ( {facialMaskConnectStatus === 1 && (
<Block> <Block>
<View className="item"> <View className="item">

@ -5,7 +5,7 @@ import { useState, useEffect } from "react";
import "./index.less"; import "./index.less";
interface Props { interface Props {
isConnectionBlutoot: boolean; isCanClick: boolean;
isShowNurse: boolean; isShowNurse: boolean;
isStopNurse: boolean; isStopNurse: boolean;
onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件 onEmitStartNurse: Function; // 每次点击item回调事件和数据给父组件
@ -13,7 +13,7 @@ interface Props {
onEmitEndPlan: Function; onEmitEndPlan: Function;
} }
function Index({ function Index({
isConnectionBlutoot, isCanClick,
isShowNurse, isShowNurse,
isStopNurse, isStopNurse,
onEmitStartNurse, onEmitStartNurse,
@ -37,7 +37,7 @@ function Index({
<View className="footer"> <View className="footer">
{!isShowNurse && ( {!isShowNurse && (
<Block> <Block>
{isConnectionBlutoot ? ( {isCanClick ? (
<View className="btn" onClick={onStartNurse}> <View className="btn" onClick={onStartNurse}>
</View> </View>

File diff suppressed because it is too large Load Diff

@ -2,7 +2,17 @@ import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react"; import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, Image, Input, Button, ScrollView, Picker, Textarea } from "@tarojs/components"; import {
Block,
View,
Text,
Image,
Input,
Button,
ScrollView,
Picker,
Textarea,
} from "@tarojs/components";
import { go } from "@/utils/traoAPI"; import { go } from "@/utils/traoAPI";
import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui"; import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
@ -10,9 +20,9 @@ import { Tab, Tabs, Dialog, Popup } from "@antmjs/vantui";
import Navbar from "../../components/navbar/navbar"; import Navbar from "../../components/navbar/navbar";
import PopupClock from "../../components/popup/popup-clock"; import PopupClock from "../../components/popup/popup-clock";
/** 自定义组件 **/ /** 自定义组件 **/
import { InstrumentInfo } from '../../utils/Interface' import { InstrumentInfo } from "../../utils/Interface";
import { date, getdates, previewImage } from "../../utils/util"; import { date, getdates, previewImage } from "../../utils/util";
import { showModal } from '../../utils/traoAPI.js' import { showModal } from "../../utils/traoAPI.js";
import "./recording.less"; import "./recording.less";
@ -47,14 +57,14 @@ export default class Recording extends Component<any, any> {
show: false, show: false,
punchInInfo: { punchInInfo: {
clockImageList: [], clockImageList: [],
clockContent: '', clockContent: "",
}, },
}; };
} }
componentDidMount() { } componentDidMount() {}
componentWillUnmount() { } componentWillUnmount() {}
// 格式化时间 // 格式化时间
getTime(time) { getTime(time) {
const hour = time.slice(0, 2); const hour = time.slice(0, 2);
@ -62,46 +72,45 @@ export default class Recording extends Component<any, any> {
const second = time.slice(6, 8); const second = time.slice(6, 8);
if (hour > 0) { if (hour > 0) {
return hour + '时' + minute + '分' + second + '秒' return hour + "时" + minute + "分" + second + "秒";
} else { } else {
return minute + '分' + second + '秒' return minute + "分" + second + "秒";
} }
} }
// 获取仪器列表 // 获取仪器列表
async getBindingInstrumentList() { async getBindingInstrumentList() {
let res = await InstrumentInfo.bindingInstrumentList() let res = await InstrumentInfo.bindingInstrumentList();
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ bindingInstrumentList: res.data.data }) this.setState({ bindingInstrumentList: res.data.data });
} }
} }
// 获取护理历程 // 获取护理历程
async getRecord(id) { async getRecord(id) {
let data = {} let data = {};
if (id != null) { if (id != null) {
data['instrumentId'] = id data["instrumentId"] = id;
} }
let res = await InstrumentInfo.apiNursingLog.getRecord(data) let res = await InstrumentInfo.apiNursingLog.getRecord(data);
if (res.data.code === 200) { if (res.data.code === 200) {
res.data.rows.map(item => { res.data.rows.map((item) => {
item.nursingTime = this.getTime(item.nursingTime) item.nursingTime = this.getTime(item.nursingTime);
item.createTime = getdates(item.createTime).replace(/-/g, '.') item.createTime = getdates(item.createTime).replace(/-/g, ".");
});
}) this.setState({ recordList: res.data.rows });
this.setState({ recordList: res.data.rows })
} }
} }
// 查询用户当天最新的一条打卡记录 // 查询用户当天最新的一条打卡记录
async getLatestClockRecord() { async getLatestClockRecord() {
let res = await InstrumentInfo.apiClock.getLatestClockRecord() let res = await InstrumentInfo.apiClock.getLatestClockRecord();
if (res.data.code === 200) { if (res.data.code === 200) {
if (!res.data.data) { if (!res.data.data) {
this.setShow(true) this.setShow(true);
} else { } else {
let punchInInfo = { let punchInInfo = {
clockImageList: res.data.data.clockImg, clockImageList: res.data.data.clockImg,
clockContent: res.data.data.clockContent, clockContent: res.data.data.clockContent,
} };
this.setState({ punchInInfo }) this.setState({ punchInInfo });
} }
} }
} }
@ -113,34 +122,34 @@ export default class Recording extends Component<any, any> {
online: 1, online: 1,
modeId: 100, modeId: 100,
modeName: "护理记录测试", modeName: "护理记录测试",
nursingTime: "00:15:00" nursingTime: "00:15:00",
} };
let res = await InstrumentInfo.apiNursingLog.addLog(data) let res = await InstrumentInfo.apiNursingLog.addLog(data);
if (res.data.code === 200) { if (res.data.code === 200) {
} }
} }
/**分页获取用户的打卡记录 page size*/ /**分页获取用户的打卡记录 page size*/
async getClockStatistics(year = this.state.year) { async getClockStatistics(year = this.state.year) {
let res = await InstrumentInfo.apiClock.getClockStatistics({ year }) let res = await InstrumentInfo.apiClock.getClockStatistics({ year });
if (res.data.code === 200) { if (res.data.code === 200) {
res.data.data.reverse() res.data.data.reverse();
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
res.data.data.map((item, index) => { res.data.data.map((item, index) => {
item.isMore = false item.isMore = false;
item.detail = [] item.detail = [];
if (index === 0) { if (index === 0) {
item.isMore = true item.isMore = true;
this.getList(item.id, item.year, item.month) this.getList(item.id, item.year, item.month);
} }
this.state.monthTime.map(monthItem => { this.state.monthTime.map((monthItem) => {
if (monthItem.month == item.month) { if (monthItem.month == item.month) {
monthItem.time = item.clockNum monthItem.time = item.clockNum;
} }
}) });
}) });
this.setState({ monthTime: this.state.monthTime }) this.setState({ monthTime: this.state.monthTime });
} else { } else {
let monthTime = [ let monthTime = [
{ month: 1, time: 0 }, { month: 1, time: 0 },
@ -155,87 +164,86 @@ export default class Recording extends Component<any, any> {
{ month: 10, time: 0 }, { month: 10, time: 0 },
{ month: 11, time: 0 }, { month: 11, time: 0 },
{ month: 12, time: 0 }, { month: 12, time: 0 },
] ];
this.setState({ monthTime }) this.setState({ monthTime });
} }
this.setState({ clockStatistics: res.data.data }) this.setState({ clockStatistics: res.data.data });
} }
} }
// 文本框输入文字 // 文本框输入文字
handleTextareaInput(e) { handleTextareaInput(e) {
const punchInInfo = this.state.punchInInfo const punchInInfo = this.state.punchInInfo;
punchInInfo.clockContent = e.detail.value punchInInfo.clockContent = e.detail.value;
this.setState({ punchInInfo }) this.setState({ punchInInfo });
} }
// 打开/关闭弹窗 // 打开/关闭弹窗
setShow(show: boolean) { setShow(show: boolean) {
this.setState({ show }) this.setState({ show });
} }
// 选择仪器 // 选择仪器
onChangeProduct(id) { onChangeProduct(id) {
this.setState({ curIndex: id }) this.setState({ curIndex: id });
this.getRecord(id) this.getRecord(id);
this.addLog() this.addLog();
}; }
// 展开收起 // 展开收起
onChangeMore(id, year, month) { onChangeMore(id, year, month) {
this.state.clockStatistics.map(item => { this.state.clockStatistics.map((item) => {
if (item.id === id) { if (item.id === id) {
item.isMore = !item.isMore item.isMore = !item.isMore;
if (item.isMore && item.detail.length === 0) { if (item.isMore && item.detail.length === 0) {
this.getList(id, year, month) this.getList(id, year, month);
} }
} }
}) });
this.setState({ clockStatistics: this.state.clockStatistics }) this.setState({ clockStatistics: this.state.clockStatistics });
} }
// 获取当月打卡记录 // 获取当月打卡记录
async getList(id, year, month) { async getList(id, year, month) {
let data = { let data = {
year, month year,
} month,
let res = await InstrumentInfo.apiClock.getList(data) };
let res = await InstrumentInfo.apiClock.getList(data);
if (res.data.code === 200) { if (res.data.code === 200) {
console.log(this.state.clockStatistics, 88888); console.log(this.state.clockStatistics, 88888);
this.state.clockStatistics.map(item => { this.state.clockStatistics.map((item) => {
if (item.id === id) { if (item.id === id) {
item.detail = res.data.data item.detail = res.data.data;
item.detail.map(obj => { item.detail.map((obj) => {
obj.updateTime = getdates(obj.updateTime).replace(/-/g, '.') obj.updateTime = getdates(obj.updateTime).replace(/-/g, ".");
}) });
} }
}) });
this.setState({ clockStatistics: this.state.clockStatistics }) this.setState({ clockStatistics: this.state.clockStatistics });
} }
} }
async onLoad() { async onLoad() {
this.getRecord(null) this.getRecord(null);
this.getBindingInstrumentList() this.getBindingInstrumentList();
this.getLatestClockRecord() this.getLatestClockRecord();
this.getClockStatistics() this.getClockStatistics();
} }
componentDidShow() { } componentDidShow() {}
componentDidHide() { } componentDidHide() {}
async initData() { } async initData() {}
// 选择年份 // 选择年份
onChangeYear(event) { onChangeYear(event) {
this.setState({ year: event.detail.value }) this.setState({ year: event.detail.value });
this.getClockStatistics(event.detail.value) this.getClockStatistics(event.detail.value);
} }
// 点击tab栏 // 点击tab栏
onTab = async (event) => { onTab = async (event) => {
const { current } = event.currentTarget.dataset; const { current } = event.currentTarget.dataset;
this.setState({ current }); this.setState({ current });
if (current === 1) { if (current === 1) {
this.getClockStatistics() this.getClockStatistics();
} }
}; };
// 跳转到护理报告 // 跳转到护理报告
@ -246,72 +254,87 @@ export default class Recording extends Component<any, any> {
handleChooseImage() { handleChooseImage() {
Taro.chooseMedia({ Taro.chooseMedia({
count: 1, count: 1,
mediaType: ['image'], mediaType: ["image"],
sourceType: ['album', 'camera'], sourceType: ["album", "camera"],
success: (res) => { success: (res) => {
const tempFilePaths = res.tempFiles.map((item) => item.tempFilePath) const tempFilePaths = res.tempFiles.map((item) => item.tempFilePath);
tempFilePaths?.forEach((item) => { tempFilePaths?.forEach((item) => {
// eslint-disable-next-line @typescript-eslint/no-shadow // eslint-disable-next-line @typescript-eslint/no-shadow
InstrumentInfo.apiClock.clockFileUpload({ clockImg: item }).then((res) => { InstrumentInfo.apiClock
const currentImage = res.data.url .clockFileUpload({ clockImg: item })
.then((res) => {
const currentImage = res.data.url;
const newImageList = const newImageList =
this.state.punchInInfo.clockImageList.length >= 3 this.state.punchInInfo.clockImageList.length >= 3
? this.state.punchInInfo.clockImageList ? this.state.punchInInfo.clockImageList
: [... this.state.punchInInfo.clockImageList, currentImage] : [...this.state.punchInInfo.clockImageList, currentImage];
const punchInInfo = this.state.punchInInfo const punchInInfo = this.state.punchInInfo;
punchInInfo.clockImageList = newImageList punchInInfo.clockImageList = newImageList;
this.setState({ punchInInfo }) this.setState({ punchInInfo });
}) });
}) });
}, },
fail: (err) => { fail: (err) => {
console.info('err', err) console.info("err", err);
}, },
}) });
} }
// 删除打卡图片 // 删除打卡图片
delImg(i) { delImg(i) {
const punchInInfo = this.state.punchInInfo const punchInInfo = this.state.punchInInfo;
punchInInfo.clockImageList.splice(i, 1) punchInInfo.clockImageList.splice(i, 1);
this.setState({ punchInInfo }) this.setState({ punchInInfo });
} }
async submit() { async submit() {
let punchInInfo = this.state.punchInInfo || {} let punchInInfo = this.state.punchInInfo || {};
if (!punchInInfo.clockImageList.length) { if (!punchInInfo.clockImageList.length) {
Taro.showToast({ Taro.showToast({
title: '请上传图片', title: "请上传图片",
icon: 'none', icon: "none",
}) });
return return;
} }
if (!punchInInfo.clockContent) { if (!punchInInfo.clockContent) {
Taro.showToast({ Taro.showToast({
title: '请输入打卡心得', title: "请输入打卡心得",
icon: 'none', icon: "none",
}) });
return return;
} }
InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => { InstrumentInfo.apiClock.postInsertClockLog(punchInInfo).then((res) => {
showModal({ showModal({
t2: '您已完成今日打卡', t2: "您已完成今日打卡",
btn1show: false, btn1show: false,
}).then(() => { }).then(() => {
this.setShow(false) this.setShow(false);
}) });
});
})
} }
back() { back() {
Taro.navigateBack({ Taro.navigateBack({
delta: 1, delta: 1,
}) });
} }
render() { render() {
let { current, array, name, recordList, bindingInstrumentList, curIndex, clockStatistics, statistics, year, today, monthTime, show, punchInInfo } = this.state; let {
current,
array,
name,
recordList,
bindingInstrumentList,
curIndex,
clockStatistics,
statistics,
year,
today,
monthTime,
show,
punchInInfo,
} = this.state;
return ( return (
<Block> <Block>
<Navbar isBack titleSlot='护理记录'></Navbar> <Navbar isBack titleSlot="护理记录"></Navbar>
<View className='tabs'> <View className="tabs">
<View <View
className={classnames("tab", { className={classnames("tab", {
tab_active: current === 0, tab_active: current === 0,
@ -331,42 +354,48 @@ export default class Recording extends Component<any, any> {
</View> </View>
</View> </View>
{current === 0 && <ScrollView className='products_list' scroll-x='true' > {current === 0 && (
<View className={classnames("all", { <ScrollView className="products_list" scroll-x="true">
<View
className={classnames("all", {
products_item_active: !curIndex, products_item_active: !curIndex,
})} onClick={this.onChangeProduct.bind(this, null)} })}
> onClick={this.onChangeProduct.bind(this, null)}
>
</View> </View>
{bindingInstrumentList.map((item: any, index: any) => ( {bindingInstrumentList.map((item: any, index: any) => (
<View key={item.id} <View
key={item.id}
className={classnames("products_item", { className={classnames("products_item", {
products_item_active: curIndex === item.id, products_item_active: curIndex === item.id,
})} })}
onClick={this.onChangeProduct.bind(this, item.id)} onClick={this.onChangeProduct.bind(this, item.id)}
> >
<Image className='products_cover' <Image
src={require("../../img/test/1706692819894.jpg")} mode='aspectFit' className="products_cover"
src={require("../../img/test/1706692819894.jpg")}
mode="aspectFit"
></Image> ></Image>
<View className='products_title'></View> <View className="products_title"></View>
</View> </View>
))} ))}
</ScrollView>} </ScrollView>
)}
{current === 0 && {current === 0 && recordList.length === 0 && (
recordList.length ===
0 && (
<View> <View>
<View className='nodata'> <View className="nodata">
<Image <Image
className='nodata_img' className="nodata_img"
src={require("../../img/nodata.png")} src={require("../../img/nodata.png")}
></Image> ></Image>
<View className='nodata_text'></View> <View className="nodata_text"></View>
</View> </View>
</View> </View>
)} )}
{current === 0 && ( {current === 0 && (
<View style='padding-bottom:200px'> <View style="padding-bottom:200px">
{/* <View className='instrument_item' > {/* <View className='instrument_item' >
<View className='instrument_top flex sb aitems'> <View className='instrument_top flex sb aitems'>
<View className='time_box flex aitems'> <View className='time_box flex aitems'>
@ -393,35 +422,50 @@ export default class Recording extends Component<any, any> {
</View> </View>
</View> */} </View> */}
<View className="instrument_list ">
<View className='instrument_list '>
{recordList.map((item: any, index: any) => ( {recordList.map((item: any, index: any) => (
<View className='recording-box' key={item.id}> <View className="recording-box" key={item.id}>
<View className='box-top'> <View className="box-top">
<View className='top-left'> <View className="top-left">
<View className='date'>{item.createTime}</View> <View className="date">{item.createTime}</View>
<View className={classnames("tip", { <View
className={classnames("tip", {
tag_active: item.online === 2, tag_active: item.online === 2,
})} })}
>{item.online ? '在线' : '离线'}</View> >
{item.online ? "在线" : "离线"}
</View> </View>
{item.instrumentType === 2 && </View>
<View className='top-right' onClick={this.toReport.bind(this, item.instrumentId, item.id)}> {item.instrumentType === 2 && (
<View
className="top-right"
onClick={this.toReport.bind(
this,
item.instrumentId,
item.id
)}
>
<Image className='arrow_icon' src={require("../../img/index/right.png")} mode='aspectFill'></Image> <Image
className="arrow_icon"
src={require("../../img/index/right.png")}
mode="aspectFill"
></Image>
</View> </View>
} )}
</View> </View>
<View className='box-bottom'> <View className="box-bottom">
<Image <Image
className='recording_img' className="recording_img"
src={item.modeImage} src={item.modeImage}
></Image> ></Image>
<View className='bottom-right'> <View className="bottom-right">
<View className='title'>{item.instrumentName}</View> <View className="title">{item.instrumentName}</View>
<View className='subtitle-box'> <View className="subtitle-box">
<View className='subtitle'>{item.modeName}</View> <View className="subtitle">{item.modeName}</View>
<View className='subtitle'>{item.nursingTime}</View> <View className="subtitle">
{item.nursingTime}
</View>
</View> </View>
</View> </View>
</View> </View>
@ -431,7 +475,7 @@ export default class Recording extends Component<any, any> {
</View> </View>
)} )}
{current === 1 && ( {current === 1 && (
<View style='padding-bottom:200px'> <View style="padding-bottom:200px">
{/* <View className='nodata'> {/* <View className='nodata'>
<Image <Image
className='nodata_img' className='nodata_img'
@ -439,139 +483,198 @@ export default class Recording extends Component<any, any> {
></Image> ></Image>
<View className='nodata_text'></View> <View className='nodata_text'></View>
</View> */} </View> */}
<View style='height: 30rpx; background: #F8F8F8'></View> <View style="height: 30rpx; background: #F8F8F8"></View>
<View className='clock_in_statistics m-x-30 flex sb'> <View className="clock_in_statistics m-x-30 flex sb">
<View className='flex sb ab'> <View className="flex sb ab">
<View className='clock_in_statistics_title'></View> <View className="clock_in_statistics_title"></View>
<Picker mode='date' fields='year' onChange={this.onChangeYear.bind(this)} value='{{year}}' end='{{today}}'> <Picker
<View className='clock_in_statistics_date flex aitems'> mode="date"
fields="year"
onChange={this.onChangeYear.bind(this)}
value="{{year}}"
end="{{today}}"
>
<View className="clock_in_statistics_date flex aitems">
<View>{year}</View> <View>{year}</View>
<Image className='more_icon' src={require('../../img/arrow-down.png')} mode='widthFix'></Image> <Image
className="more_icon"
src={require("../../img/arrow-down.png")}
mode="widthFix"
></Image>
</View> </View>
</Picker> </Picker>
</View> </View>
<View className='chart flex sb'> <View className="chart flex sb">
{ {monthTime.map((item) => (
monthTime.map(item => ( <View className="flex fc aitems" key={item.month}>
<View className='flex fc aitems' key={item.month}> {item.time > 0 && (
{ <View className="buoy">{item.time}</View>
item.time > 0 && <View className='buoy' >{item.time}</View> )}
} <View
<View className='column' style={{ height: `calc(186/31*${item.time}rpx)` }}></View> className="column"
<View className='month'>{item.month}</View> style={{ height: `calc(186/31*${item.time}rpx)` }}
></View>
<View className="month">{item.month}</View>
</View>
))}
</View> </View>
))
}
</View> </View>
<View style="padding-bottom: env(safe-area-inset-bottom)">
<View className="month_box m-x-30">
{clockStatistics.map((item) => (
<View className="month_statistics" key={item.id}>
<View className="flex aitems sb">
<View className="time">
{item.year}{item.month}
</View> </View>
<View style='padding-bottom: env(safe-area-inset-bottom)' > <View
<View className='month_box m-x-30'> className="more_box flex aitems"
{clockStatistics.map(item => ( onClick={this.onChangeMore.bind(
<View className='month_statistics' key={item.id}> this,
<View className='flex aitems sb'> item.id,
<View className='time'>{item.year}{item.month}</View> item.year,
<View className='more_box flex aitems' onClick={this.onChangeMore.bind(this, item.id, item.year, item.month)}> item.month
<View className='more_text'> {!item.isMore ? '展开更多' : '收起更多'}</View> )}
<Image style={{ transform: (item.isMore) ? 'rotate(180deg)' : 'rotate(0deg)' }} className='more_icon' >
src={require("../../img/arrow-down.png")} mode='widthFix' <View className="more_text">
{" "}
{!item.isMore ? "展开更多" : "收起更多"}
</View>
<Image
style={{
transform: item.isMore
? "rotate(180deg)"
: "rotate(0deg)",
}}
className="more_icon"
src={require("../../img/arrow-down.png")}
mode="widthFix"
></Image> ></Image>
</View> </View>
</View> </View>
<View style='height: 59rpx'></View> <View style="height: 59rpx"></View>
<View className='statistic'> <View className="statistic">
<View className='statistic_item'> <View className="statistic_item">
<View className='statistic_num'>{item.clockNum}</View> <View className="statistic_num">{item.clockNum}</View>
<View className='statistic_desc'></View> <View className="statistic_desc"></View>
</View> </View>
<View className='statistic_item'> <View className="statistic_item">
<View className='statistic_num'>{(item.percentage * 100).toFixed(2)}%</View> <View className="statistic_num">
<View className='statistic_desc'></View> {(item.percentage * 100).toFixed(2)}%
</View> </View>
<View className='border'></View> <View className="statistic_desc"></View>
</View> </View>
{item.isMore && item.detail && <View> <View className="border"></View>
{ </View>
item.detail.map(obj => ( {item.isMore && item.detail && (
<View>
{item.detail.map((obj) => (
<View key={obj}> <View key={obj}>
<View style='height: 57rpx' ></View> <View style="height: 57rpx"></View>
<View className='month_item'> <View className="month_item">
<View className='month_item_date'>{obj.updateTime}</View> <View className="month_item_date">
<View className='month_image_box flex sb'> {obj.updateTime}
{obj.clockImg.map(img => (<Image key={img} className='month_item_cover' src={img} ></Image>))}
</View> </View>
<View className='month_item_date'>PRO </View> <View className="month_image_box flex sb">
<View className='month_item_note'>{obj.clockContent}</View> {obj.clockImg.map((img) => (
<Image
key={img}
className="month_item_cover"
src={img}
></Image>
))}
</View> </View>
</View>))} <View className="month_item_date">
PRO{" "}
</View> </View>
} <View className="month_item_note">
{obj.clockContent}
</View> </View>
))
}
</View> </View>
</View> </View>
))}
</View>
)}
</View>
))}
</View>
</View>
</View>
)}
<View className="footer flex aitems">
<View className="btn" onClick={this.setShow.bind(this, true)}>
</View> </View>
)
}
<View className='footer flex aitems' >
<View className='btn' onClick={this.setShow.bind(this, true)}></View>
<View className="text" onClick={this.back}> <View className="text" onClick={this.back}>
> &gt;
</View> </View>
</View> </View>
<Popup show={show} onClose={() => this.setState({ show: false })}> <Popup show={show} onClose={() => this.setState({ show: false })}>
<View className='popBox'> <View className="popBox">
<Image className='close_icon' <Image
src={require("../../img/close.png")} mode='widthFix' onClick={this.setShow.bind(this, false)} className="close_icon"
></Image> src={require("../../img/close.png")}
<View className='popTitle'></View> mode="widthFix"
<View className='popSubtitle'><View className='bold'>{clockStatistics[0]?.clockNum}</View> <View className='bold'>{(clockStatistics[0]?.percentage * 100).toFixed(1)}%</View></View> onClick={this.setShow.bind(this, false)}
<View className='img_box'>
{
punchInInfo.clockImageList.map((item, index) => (
<View key={item} className='img'>
<Image className='showImg'
src={item} mode='widthFix'
></Image> ></Image>
<Image className='closeImg' <View className="popTitle"></View>
src={require('../../img/close1.png')} <View className="popSubtitle">
mode='widthFix'
<View className="bold">{clockStatistics[0]?.clockNum}</View>{" "}
<View className="bold">
{(clockStatistics[0]?.percentage * 100).toFixed(1)}%
</View>
</View>
<View className="img_box">
{punchInInfo.clockImageList.map((item, index) => (
<View key={item} className="img">
<Image className="showImg" src={item} mode="widthFix"></Image>
<Image
className="closeImg"
src={require("../../img/close1.png")}
mode="widthFix"
onClick={this.delImg.bind(this, index)} onClick={this.delImg.bind(this, index)}
></Image> ></Image>
</View> </View>
)) ))}
} {punchInInfo.clockImageList.length < 3 && (
{punchInInfo.clockImageList.length < 3 && <View
<View className='addBox' onClick={this.handleChooseImage.bind(this)}> className="addBox"
<Image className='showImg' onClick={this.handleChooseImage.bind(this)}
src={require("../../img/clock_in_upload/add-image.png")} mode='widthFix' >
<Image
className="showImg"
src={require("../../img/clock_in_upload/add-image.png")}
mode="widthFix"
></Image> ></Image>
</View> </View>
} )}
</View> </View>
<View className='info4'> <View className="info4">
<View className='content'> <View className="content">
<Textarea <Textarea
placeholderStyle='color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;' placeholderStyle="color: #ccc; font-size: 26rpx;font-weight: 400;font-family: PingFang SC;"
placeholder='请记录一下今天的护理心得吧' placeholder="请记录一下今天的护理心得吧"
maxlength={120} maxlength={120}
onInput={this.handleTextareaInput.bind(this)} onInput={this.handleTextareaInput.bind(this)}
value={punchInInfo.clockContent} value={punchInInfo.clockContent}
></Textarea> ></Textarea>
</View> </View>
<View className='tip'> <View className="tip">
{'' + (punchInInfo.clockContent.length || 0) + '/120'} {"" + (punchInInfo.clockContent.length || 0) + "/120"}
</View> </View>
</View> </View>
<View className='popbtnbox flex aitems jcenter'> <View className="popbtnbox flex aitems jcenter">
<View className='btn1' onClick={this.submit.bind(this)}> <View className="btn1" onClick={this.submit.bind(this)}>
</View> </View>
</View> </View>
</View> </View>
</Popup> </Popup>
</Block > </Block>
); );
} }
} }

@ -39,6 +39,14 @@ page {
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
} }
.footer1 {
background: #ffffff;
justify-content: center;
display: flex;
align-items: center;
margin: 110rpx 0 36rpx 0;
}
.title { .title {
font-size: 48rpx; font-size: 48rpx;
font-weight: 400; font-weight: 400;
@ -61,6 +69,19 @@ page {
} }
.btn_login { .btn_login {
width: 540rpx;
height: 90rpx;
background: #000000;
border-radius: 45rpx;
color: #fff;
line-height: 90rpx;
font-size: 32rpx;
font-weight: bold;
text-align: center;
margin: 0;
}
.btn_login1 {
width: 690rpx; width: 690rpx;
height: 90rpx; height: 90rpx;
background: #000000; background: #000000;
@ -120,12 +141,11 @@ page {
} }
.text { .text {
height: 28rpx; font-size: 32rpx;
font-size: 30rpx; font-family: PingFang SC;
font-weight: 400; font-weight: bold;
color: #030000; color: #000000;
line-height: 60rpx; margin-left: 48rpx;
margin-bottom: 40rpx;
} }
.btn_ok { .btn_ok {

@ -39,6 +39,7 @@ class Register extends Component<any, any> {
showPrivacyContent: false, showPrivacyContent: false,
// isRead: true, // isRead: true,
fromUrl: "", fromUrl: "",
serial: Taro.getStorageSync("serial"),
}; };
} }
@ -54,7 +55,11 @@ class Register extends Component<any, any> {
url: "/pages/index/index", url: "/pages/index/index",
}); });
}; };
back() {
Taro.navigateBack({
delta: 1,
});
}
onDisagreeTap = () => { onDisagreeTap = () => {
// 关闭小程序 // 关闭小程序
Taro.exitMiniProgram({}); Taro.exitMiniProgram({});
@ -167,7 +172,7 @@ class Register extends Component<any, any> {
} }
render() { render() {
let { isChecked, bg, isButtonDisabled } = this.state; let { isChecked, bg, isButtonDisabled, serial } = this.state;
return ( return (
<Block> <Block>
<View> <View>
@ -193,6 +198,8 @@ class Register extends Component<any, any> {
</View> </View>
</View> </View>
{serial && (
<View className="footer1">
<Button <Button
type="primary" type="primary"
disabled={!isChecked || isButtonDisabled} disabled={!isChecked || isButtonDisabled}
@ -203,6 +210,24 @@ class Register extends Component<any, any> {
> >
</Button> </Button>
<View className="text" onClick={this.back}>
&gt;
</View>
</View>
)}
{!serial && (
<Button
type="primary"
disabled={!isChecked || isButtonDisabled}
open-type="getPhoneNumber"
className={classnames("btn_login1")}
onGetPhoneNumber={this.onSubmit}
onClick={this.changeGetPhoneNumberBtn}
>
</Button>
)}
<View className="checked_box"> <View className="checked_box">
{isChecked ? ( {isChecked ? (
<Image <Image

@ -59,20 +59,21 @@ export const Ajax = (params) => {
return; return;
} }
if (res.statusCode !== 200) { // if (res.statusCode !== 200) {
Taro.showModal({ // Taro.showModal({
title: "提示", // title: "提示",
content: String("错误码:" + res.statusCode), // content: String("错误码:" + res.statusCode),
showCancel: false, // showCancel: false,
}); // });
return false; // return false;
} // }
if (res.data.code === 500) { if (res.data.code === 500) {
let msg = "系统异常,请联系管理人员"; let msg = "系统异常,请联系管理人员";
// typeof res.data.msg == "string" // typeof res.data.msg == "string"
// ? res.data.msg // ? res.data.msg
// : "系统异常,请联系管理人员"; // : "系统异常,请联系管理人员";
console.log("500 ===》", res.data.msg);
if (msg == "请不要操作太快哦") { if (msg == "请不要操作太快哦") {
reject(res); reject(res);
return false; return false;
@ -80,7 +81,7 @@ export const Ajax = (params) => {
Taro.showModal({ Taro.showModal({
title: "提示", title: "提示",
content: String(res.data.msg), content: String(msg),
showCancel: false, showCancel: false,
}); });
// reject(res); // reject(res);

@ -703,6 +703,14 @@ const checkSameKey = (array1, array2, key) => {
return false; return false;
}; };
const sleep = (second) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, second * 1000);
});
};
module.exports = { module.exports = {
isVideo, isVideo,
previewImage, previewImage,
@ -740,4 +748,5 @@ module.exports = {
isNeedToUpdate, isNeedToUpdate,
compareVersion, compareVersion,
checkSameKey, checkSameKey,
sleep,
}; };

Loading…
Cancel
Save