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": {
"@antmjs/vantui": "^3.2.2",
"@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",
"@taroify/core": "^0.1.1-alpha.8",
"@tarojs/components": "3.6.19",

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

@ -86,17 +86,19 @@ export default class PopupAlert extends Component<any, any> {
isClose,
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} !important`}
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
{/* <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;
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 classnames from "classnames";
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 { date, getdates, previewImage } from "../../utils/util";
@ -9,7 +9,7 @@ import { date, getdates, previewImage } from "../../utils/util";
/** 自定义组件 **/
import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
import { InstrumentInfo } from '../../utils/Interface'
import { InstrumentInfo } from "../../utils/Interface";
/** 自定义组件 **/
import "./face_report.less";
@ -21,54 +21,60 @@ export default class Index extends Component<any, any> {
name: "template模板页",
statistics: {},
recordList: [],
recordData: {}
recordData: {},
};
}
componentDidMount() { }
componentDidMount() {}
componentWillUnmount() { }
componentWillUnmount() {}
// 查询用户护理记录的当月统计信息
async getStatistics(id) {
let data = {}
let data = {};
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) {
this.setState({ statistics: res.data.data })
this.setState({ statistics: res.data.data });
}
}
async getRecord(id, recordId) {
let data = {}
console.log("id, recordId", id, recordId);
let data = {};
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) {
res.data.rows.map(item => {
item.nursingTime = this.getTime(item.nursingTime)
item.createTime = getdates(item.createTime).replace(/-/g, '.')
if (item.id == recordId) {
this.setState({ recordData: item })
}
})
this.setState({ recordList: res.data.rows.filter(item => item.id != recordId) })
if (recordId) {
res.data.rows.map((item) => {
item.nursingTime = this.getTime(item.nursingTime);
item.createTime = getdates(item.createTime).replace(/-/g, ".");
if (item.id == recordId) {
this.setState({ recordData: item });
}
});
} else {
this.setState({ recordData: res.data.rows[0] });
}
this.setState({
recordList: res.data.rows.filter((item) => item.id != recordId),
});
}
}
getRouteId() {
const searchParams = new URLSearchParams(window.location.search);
const id = searchParams.get('id');
const recordId = searchParams.get('recordId');
this.getStatistics(id)
this.getRecord(id, recordId)
const id = searchParams.get("id");
const recordId = searchParams.get("recordId");
this.getStatistics(id);
this.getRecord(id, recordId);
console.log(recordId);
}
getTime(time) {
const hour = time.slice(0, 2);
@ -76,188 +82,152 @@ export default class Index extends Component<any, any> {
const second = time.slice(6, 8);
if (hour > 0) {
return hour + '时' + minute + '分' + second + '秒'
return hour + "时" + minute + "分" + second + "秒";
} else {
return minute + '分' + second + '秒'
return minute + "分" + second + "秒";
}
}
async onLoad() {
this.getRouteId()
this.getRouteId();
}
componentDidShow() { }
componentDidShow() {}
componentDidHide() { }
componentDidHide() {}
async initData() { }
async initData() {}
render() {
let { name, statistics, recordList, recordData } = this.state;
return (
<Block>
<Navbar isBack titleSlot='护理报告'></Navbar>
{/* <View className="time m-x-30">{{reportData.curDate}}</View> */}
{/* <View className="time m-x-30"></View> */}
<View className='statistic m-x-30 flex aitems'>
{/* <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'>
<Navbar isBack titleSlot="护理报告"></Navbar>
<View className="statistic m-x-30 flex aitems">
<View className="statistic_item">
<View className="statistic_title">
<text>{statistics.nursingNum}</text>
<text className='num'></text>
</View>
<View className='statistic_desc'>
<text className="num"></text>
</View>
<View className="statistic_desc"></View>
</View>
<View className='statistic_item'>
<View className='statistic_title'>{statistics.nursingTime}</View>
<View className='statistic_desc'></View>
<View className="statistic_item">
<View className="statistic_title">{statistics.nursingTime}</View>
<View className="statistic_desc"></View>
</View>
{/* </block> */}
</View>
<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_top flex aitems'>
<View className='add_time'>{recordData.createTime}</View>
<View className={classnames("tag", {
tag_active: recordData.online === 2,
})}
>{recordData.online == 1 ? '在线' : '离线'}</View>
<View className="main m-x-30">
<View className="products_item" style="border: none">
<View className="products_top flex aitems">
<View className="add_time">{recordData.createTime}</View>
<View
className={classnames("tag", {
tag_active: recordData.online === 2,
})}
>
{recordData.online == 1 ? "在线" : "离线"}
</View>
</View>
<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 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 className='progress'>
<View className="progress">
<Progress percentage={recordData.completionPercentage * 100} strokeWidth='12' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> {recordData.completionPercentage * 100}%</View>
<Progress
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 className='main_title' ></View>
{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 className="main_title"></View>
{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 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'>
<View className="progress">
<Progress percentage={item.completionPercentage * 100} strokeWidth='12' color='linearGradient(to right, #eecda1, #ffe9c7) !important' />
<View className='percent'> {item.completionPercentage * 100}%</View>
<Progress
percentage={
item.completionPercentage * 100 > 100
? 100
: item.completionPercentage * 100
}
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>
))}
{/* </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 className='products_middle flex'>
<Image className='cover' src={require('../../img/test/1706667011027.jpg')} mode='aspectFill'></Image>
<View className='content'>
<View className='content_top'>
<View className='title'></View>
<View className='desc_box'>
<View className='desc'></View>
<View className='desc'>10:00</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 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 className='products_middle flex'>
<Image className='cover' src={require('../../img/test/1706667011027.jpg')} mode='aspectFill'></Image>
<View className='content'>
<View className='content_top'>
<View className='title'></View>
<View className='desc_box'>
<View className='desc'></View>
<View className='desc'>10:00</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> */}
{/* </block> */}
</View>
<View className='footer flex aitems' >
<View className='btn'></View>
<View className='text flex aitems'>
<View className="footer flex aitems">
<View className="btn"></View>
<View className="text flex aitems">
<View></View>
<Image src='../../img/right.png' mode='aspectFill'></Image>
<Image
src={require("../../img/right.png")}
mode="aspectFill"
></Image>
</View>
</View>
{/* <clockInDialog id="clockInDialog" instrumentId="{{reportData.instrument_id}}" isCustom="{{ true }}" bind:submitFun="confirmSubmit"/> */}
</Block>
);
}

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

@ -9,6 +9,7 @@ import {
Image,
Swiper,
SwiperItem,
RichText,
} from "@tarojs/components";
/*** redux ***/
@ -25,10 +26,12 @@ import PopupBinding from "@/components/popup/popup-binding";
import PopupSiteSwiper from "@/components/popup/popup-site-swiper";
import PopupAlert from "@/components/popup/popup-alert";
import PopupConfirm from "@/components/popup/popup-confirm";
import type CustomTabBar from "@/custom-tab-bar";
import Navbar from "@/components/navbar/navbar";
import ConnectionBluetoot from "@/components/bluetoot/connection";
import UpdateIotWL200 from "@/components/bluetoot/update-wl200/index";
/** 自定义组件 **/
import {
@ -52,13 +55,13 @@ import {
setStorageSync,
showModal,
} from "@/utils/traoAPI";
const log = require("@/utils/log");
import commandMap from "@/utils/commandMap";
import InstrumentTypeEnum from "@/components/bluetoot/instrumentTypeEnum";
import InstrumentTypeEnum from "@/components/bluetoot/InstrumentTypeEnum";
import OtaDeviceTypeEnum from "@/components/bluetoot/OtaDeviceTypeEnum";
const log = require("@/utils/log");
class Index extends Component<any, any> {
// pageCtx = Taro.getCurrentInstance().page;
$instance = Taro.getCurrentInstance();
@ -131,13 +134,20 @@ class Index extends Component<any, any> {
/** 蓝牙相关 */
isConnectShow: false,
connectInstrument: {},
yiqiinfo: {},
connectInstrument: {}, // 当前连接设备
/* END */
// 设备升级弹窗
isShowUpdateVersionTip: false, // 升级提示
isShowVersionUpgrading: false, // 升级中
isShowVersionUpgradFinish: false, // 升级完成:升级内容公告
versionUpgradFinishNodes: "", // 公告内容
};
}
async onLoad() {
console.log(1123131233);
// 仅非扫码进入页面时,校验跳转欢迎页
if (!this.$instance.router?.params?.q) {
const isFirst = Taro.getStorageSync("isWelcome");
@ -145,11 +155,17 @@ class Index extends Component<any, any> {
go("/pages/initiate/initiate");
}
}
if (Taro.getStorageSync("skip")) {
this.setState({ showEquipment: true })
Taro.removeStorageSync('skip');
}
}
componentDidMount() {}
componentDidMount() {
componentWillUnmount() {}
}
componentWillUnmount() { }
componentDidShow() {
const tabbar = Taro.getTabBar<CustomTabBar>(this.$instance.page);
@ -158,7 +174,7 @@ class Index extends Component<any, any> {
this.showInit();
}
componentDidHide() {}
componentDidHide() { }
showInit() {
// 判断是否登录
@ -185,6 +201,9 @@ class Index extends Component<any, any> {
if (ids.length > 1) {
let serial = ids[1];
Taro.setStorageSync("serial", serial);
if (!Taro.getStorageSync("mobile")) {
go("/pages/register/register");
}
}
}
}
@ -205,7 +224,7 @@ class Index extends Component<any, any> {
this.isSancQrcodeEnter();
}
},
fail: () => {},
fail: () => { },
complete: () => {
// 授权完成运行页面初始化
},
@ -363,7 +382,7 @@ class Index extends Component<any, any> {
this.setState({ isShowSiteSwiper: false });
};
bannerSwiperchange() {}
bannerSwiperchange() { }
gobanner(item) {
// 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间',
@ -635,7 +654,12 @@ class Index extends Component<any, any> {
go("/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
// return;
}
onUnloginConfirm() {
this.setState({ showEquipment: false })
}
onUnloginClose() {
this.setState({ showEquipment: false })
}
//连接完成时数据的回调
offlineChange = async (e) => {
console.log("offlineChange", e);
@ -650,96 +674,7 @@ class Index extends Component<any, any> {
versionInfo,
});
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);
};
@ -752,8 +687,64 @@ class Index extends Component<any, any> {
connectionConfirm = async () => {
this.connectionClose();
};
/*蓝牙 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() {
let {
calendarComplete,
@ -776,6 +767,13 @@ class Index extends Component<any, any> {
isExchangeBinding,
instrumentInfo,
instrumentList,
showEquipment,
// 升级弹窗
isShowUpdateVersionTip,
isShowVersionUpgrading,
isShowVersionUpgradFinish,
versionUpgradFinishNodes,
// 蓝牙连接
isConnectShow,
@ -786,22 +784,37 @@ class Index extends Component<any, any> {
<Block>
<View catchMove>
<PopupAlert
isShow={isNotRegister}
isClose={true}
isShow={isBindingError}
title="提示"
content="暂未授权注册,请点击注册"
confirmButtonText="确定"
content={
<Block>
<View></View>
<View></View>
</Block>
}
confirmButtonText="知道了"
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}
confirm={this.closeAlert}
/>
<PopupAlert
isShow={isDev}
title="提示"
content="页面正在开发中"
confirmButtonText="确定"
textAlgin="center"
title='提示'
content='页面正在开发中'
confirmButtonText='确定'
textAlgin='center'
close={this.closeDev}
confirm={this.closeDev}
/>
@ -821,28 +834,45 @@ class Index extends Component<any, any> {
/>
<PopupAlert
isShow={isBindingError}
title="提示"
title='提示'
content={
<Block>
<View></View>
<View></View>
</Block>
}
confirmButtonText="知道了"
textAlgin="center"
confirmButtonText='知道了'
textAlgin='center'
isClose={false}
close={this.onBindErrorClose}
confirm={this.onBindErrorConfirm}
></PopupAlert>
/>
<PopupAlert
isShow={isBeforeBinding}
title="提示"
content="您选择的仪器有误,请重新确认选择"
confirmButtonText="知道了"
textAlgin="center"
title='提示'
content='您选择的仪器有误,请重新确认选择'
confirmButtonText='知道了'
textAlgin='center'
isClose={false}
close={this.onBeforeBindClose}
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>
{/* <PopupPrivacyTest
@ -853,54 +883,96 @@ class Index extends Component<any, any> {
<PopupSiteSwiper
isShow={isShowSiteSwiper}
siteData={sitePopupList}
size="middle"
confirmButtonText="确定"
textAlgin="center"
size='middle'
confirmButtonText='确定'
textAlgin='center'
close={this.closeSiteSwiper}
confirm={this.closeSiteSwiper}
/>
</View>
{isConnectShow && (
<ConnectionBluetoot
yiqiInfo={connectInstrument}
close={this.connectionClose}
confirm={this.connectionConfirm}
offlineChange={this.offlineChange}
pairingChange={this.pairingChange}
{/* IOT相关弹窗 */}
{isConnectShow && (
<ConnectionBluetoot
deviceInfo={connectInstrument}
close={this.connectionClose}
confirm={this.connectionConfirm}
offlineChange={this.offlineChange}
pairingChange={this.pairingChange}
upgradeFun={this.upgradeFun}
/>
)}
<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}
/>
)}
{/* <ConnectionBluetoot /> */}
{/* IOT相关弹窗 END */}
</View>
<Navbar
leftSlot={
<Block>
<View
className="message"
className='message'
onClick={this.gourl}
data-url="/pages/message/message"
data-url='/pages/message/message'
>
<Image
className="message-img"
className='message-img'
src={require("../../img/index/message.png")}
mode="aspectFill"
mode='aspectFill'
/>
{messagecount ? <View className="tip" /> : ""}
{messagecount ? <View className='tip' /> : ""}
</View>
</Block>
}
/>
<View className="index">
<View className="date-title" onClick={this.toNursingRecords}>
<Text className="text"></Text>
<View className='index'>
<View className='date-title' onClick={this.toNursingRecords}>
<Text className='text'></Text>
<Image
src={require("../../img/index/right.png")}
style="width: 20rpx;height: 20rpx;"
style='width: 20rpx;height: 20rpx;'
/>
</View>
<View className="bg-while">
<View className='bg-while'>
<AtCalendar
hideArrow={true}
hideArrow
isSwiper={false}
currentDate={currentDate}
complete={calendarComplete}
@ -910,41 +982,41 @@ class Index extends Component<any, any> {
/>
</View>
</View>
<View className="infobox5">
<View className='infobox5'>
{instrumentList.length > 0 && (
<Block>
<View className="nurse_plan_box flex aitems sb">
<View className="title"></View>
<View className='nurse_plan_box flex aitems sb'>
<View className='title'></View>
<View
className="txt_box flex jcenter aitems"
data-url="/pages/instrument/instrument"
className='txt_box flex jcenter aitems'
data-url='/pages/instrument/instrument'
onClick={this.gourl}
>
<Image
className="right_icon"
className='right_icon'
src={require("../../img/black-add.png")}
mode="aspectFill"
mode='aspectFill'
/>
<View className="txt"></View>
<View className='txt'></View>
</View>
</View>
<View style="overflow-x: auto;">
<View className="device_list flex">
<View style='overflow-x: auto;'>
<View className='device_list flex'>
{instrumentList.map((item, index) => {
if (item.status === 0) {
return (
<View
key={"instrumentList" + index}
className="device_item"
className='device_item'
onClick={this.goNursing.bind(this, item)}
>
<Image
className="banner_img"
className='banner_img'
src={item.banner}
mode="aspectFill"
mode='aspectFill'
/>
<View className="device_name ellipsis1">
<View className='device_name ellipsis1'>
{item.name}
</View>
</View>
@ -957,34 +1029,34 @@ class Index extends Component<any, any> {
)}
{instrumentList.length === 0 && (
<Block>
<View className="nurse_plan_box flex aitems sb">
<View className="title"></View>
<View className='nurse_plan_box flex aitems sb'>
<View className='title'></View>
</View>
<View className="add_device flex jcenter aitems bg-while">
<View className="add_device_btn">
<View className="txt_box flex jcenter aitems">
<View className='add_device flex jcenter aitems bg-while'>
<View className='add_device_btn'>
<View className='txt_box flex jcenter aitems'>
<View
className="at-icon at-icon-add"
style="color: #fff;font-size: 30rpx;"
className='at-icon at-icon-add'
style='color: #fff;font-size: 30rpx;'
></View>
<View className="txt" onClick={this.addNewDevice}>
<View className='txt' onClick={this.addNewDevice}>
</View>
</View>
</View>
<View className="tips"></View>
<View className='tips'></View>
</View>
</Block>
)}
</View>
<View style="margin: 20px">
<View style='margin: 20px'>
<View onClick={this.goIot}></View>
</View>
<View className="infobox3">
<View className='infobox3'>
<Swiper
autoplay={true}
autoplay
onAnimationFinish={this.bannerSwiperchange.bind(this)}
current={bannerCurrent}
>
@ -994,13 +1066,13 @@ class Index extends Component<any, any> {
key={"banner_" + index}
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>
);
})}
</Swiper>
</View>
<View style="height:200rpx"></View>
<View style='height:200rpx'></View>
</Block>
);
}

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

@ -88,7 +88,7 @@ class Intro extends Component<any, any> {
// setStorageSync("introduceId", info.id);
// }
const url = "/pages/index/index";
Taro.switchTab({
Taro.switchTab({
url,
});
}

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save