qsj 2 years ago
commit 8e7a2e5eb0

@ -37,7 +37,7 @@
"author": "", "author": "",
"dependencies": { "dependencies": {
"@antmjs/vantui": "^3.3.5", "@antmjs/vantui": "^3.3.5",
"@flossom-npm/iot-translater": "^1.0.8", "@flossom-npm/iot-translater": "^1.1.2",
"@flossom-npm/iot-translater-we100": "^1.1.1", "@flossom-npm/iot-translater-we100": "^1.1.1",
"@reduxjs/toolkit": "^2.0.1", "@reduxjs/toolkit": "^2.0.1",
"@tarojs/components": "~3.6.24", "@tarojs/components": "~3.6.24",

@ -1,7 +0,0 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"setting": {
"compileHotReLoad": true,
"bigPackageSizeSupport": true
}
}

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

@ -88,7 +88,8 @@ export default defineAppConfig({
{ {
root: 'moduleIOT', root: 'moduleIOT',
pages: [ pages: [
"pages/iotCarePlan/iotCarePlan", "pages/iotCarePlan/WL200",
"pages/iotCarePlan/FR200",
] ]
} }
] ]

@ -27,7 +27,6 @@ class App extends Component<PropsWithChildren> {
// 每次进入小程序,删除可能残留的同步状态 // 每次进入小程序,删除可能残留的同步状态
Taro.removeStorageSync("isSyncHistory"); Taro.removeStorageSync("isSyncHistory");
// go("/pages/iotCarePlan/iotCarePlan");
// go("/pages/instrument_clickin_upload/index"); // go("/pages/instrument_clickin_upload/index");
// go("/pages/instrument/intro"); // go("/pages/instrument/intro");
// Taro.switchTab({ // Taro.switchTab({

@ -0,0 +1,90 @@
/**蓝牙命令合集*/
export const fr200BleCommand = {
/**发送配对码*/
match: {
commandType: "BleMatch",
bleCommandType: "SendMatchCode",
},
InfoQuery: {
/**查询版本指令*/
versionInfo: {
commandType: "InfoQuery",
infoQueryType: "versionInfo",
otaDeviceType: "FR200",
},
/**时间同步*/
timeSync: {
commandType: "InfoQuery",
infoQueryType: "timeSync",
date: new Date(),
},
/**查询离线记录概要*/
clockSummary: {
commandType: "InfoQuery",
infoQueryType: "offlineClockInInfo",
dataType: "summary",
},
/**查询离线明细第一条*/
clockDetail: {
commandType: "InfoQuery",
infoQueryType: "offlineClockInInfo",
dataType: "detail",
dataIndex: 0,
},
},
};
/**控制设备命令合集*/
export const fr200DeviceControlCommand = {
/**查询设备状态指令*/
queryDeviceStatus: {
commandType: "DeviceStatusSync",
deviceSyncCommandType: "onlySyncStatusToDevice",
},
/**控制设备暂停 pause暂停 working启动 end关闭*/
pause: {
commandType: "DeviceControl",
workStatus: "pause",
},
standby: {
commandType: "DeviceControl",
workStatus: "standby",
},
end: {
commandType: "DeviceControl",
workStatus: "end",
},
/**
* '脸部' = 'workFace',
* '眼部' = 'workEye',
* '颈纹' = 'workNeck',
* '进入水分测试模式' = 'switchTestMode',
* '启动水分测试模式' = 'startTestMode',
* face
* eyes
* neck
* moistureTest
*/
// 普通工作模式
work: {
commandType: "DeviceControl",
workStatus: "working",
workMode: "face",
},
// 切换/进入水分测试
switchTestMode: {
commandType: "DeviceControl",
workStatus: "working",
workMode: "moistureTest",
testStatus: "standby",
},
// 启动水分测试
startTestMode: {
commandType: "DeviceControl",
workStatus: "working",
workMode: "moistureTest",
testStatus: "start",
},
};

@ -37,17 +37,19 @@ import {
// const log = require("@/utils/log"); // const log = require("@/utils/log");
import commandMap from "@/utils/commandMap"; import commandMap from "@/utils/commandMap";
import { bleCommandSamples } from "./wl200"; import { bleCommandSamples } from "./wl200";
import { fr200BleCommand, fr200DeviceControlCommand } from "./fr200";
import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100"; import { DeviceToolKit as DeviceToolKitWE100 } from "@flossom-npm/iot-translater-we100";
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200"); const deviceToolKitInstanceWL200 = new DeviceToolKitWE100("WL200", "WL200");
deviceToolKitInstanceWL200.setDebug(true); deviceToolKitInstanceWL200.setDebug(true);
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");
deviceToolKitInstanceFR200.setDebug(true);
import { DeviceToolKit as DeviceToolKitFR200 } from "@flossom-npm/iot-translater";
import { import {
showModal, showModal,
msg, msg,
@ -113,13 +115,13 @@ class ConnectionBluetoot extends Component<any, any> {
versionInfo: {}, //版本号 versionInfo: {}, //版本号
offlineDataList: [], //离线数据 offlineDataList: [], //离线数据
prefix: "12CAA", // WL200蓝牙搜索前缀
// WL200匹配 // WL200匹配
tranType: [ tranType: [
"WE100", // 发箍 "WE100", // 发箍
"WE200", // 发箍 "WE200", // 发箍
"WL200", // 面罩 "WL200", // 面罩
"12CAA", // 面罩前缀名 "12CAA", // 面罩前缀名
"FR200", // FR200
], ],
currentDeviceType: "", // 现在的设备类型: WE200 WL200 currentDeviceType: "", // 现在的设备类型: WE200 WL200
@ -422,6 +424,41 @@ class ConnectionBluetoot extends Component<any, any> {
}); });
} }
/**获取附属设备信息与设置当前设备名字*/
getQueryMatchStatusAndSetName(value) {
const { deviceInfo } = this.props;
let querySubDeviceArrayBuffer: any = null;
let jsonStatus: any = null;
if (deviceInfo.model == "WL200") {
if (this.isWL200()) {
this.setState({ currentDeviceType: "WL200" });
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(value);
querySubDeviceArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
bleCommandSamples.querySubDevice as any
);
} else {
this.setState({ currentDeviceType: "WE200" });
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value);
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any
);
}
} else if (deviceInfo.model == "M01") {
this.setState({ currentDeviceType: "M01" });
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value);
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any
);
} else if (deviceInfo.model === "FR200") {
// FR200 不需要查询子设备
jsonStatus = deviceToolKitInstanceFR200.toJsonStatus(value);
console.log("FR200 jsonStatus", jsonStatus);
this.setState({ currentDeviceType: "FR200" });
}
// if (querySubDeviceArrayBuffer) this.sendQuerySubDevice(querySubDeviceArrayBuffer)
return jsonStatus;
}
/** 7.通知BLE特征值更改 */ /** 7.通知BLE特征值更改 */
notifyBLECharacteristicValueChange() { notifyBLECharacteristicValueChange() {
console.log("7.通知BLE特征值更改"); console.log("7.通知BLE特征值更改");
@ -443,39 +480,13 @@ class ConnectionBluetoot extends Component<any, any> {
let str = ab2hex(value.value); //转为16进制字符串 let str = ab2hex(value.value); //转为16进制字符串
console.log("转为16进制字符串 str", str); console.log("转为16进制字符串 str", str);
let jsonStatus: any = null; let jsonStatus = this.getQueryMatchStatusAndSetName(value.value);
let querySubDeviceArrayBuffer;
if (deviceInfo.model == "WL200") {
if (this.isWL200()) {
this.setState({ currentDeviceType: "WL200" });
jsonStatus = deviceToolKitInstanceWL200.toJsonStatus(
value.value
);
querySubDeviceArrayBuffer =
deviceToolKitInstanceWL200.toBleCommand(
bleCommandSamples.querySubDevice as any
);
} else {
this.setState({ currentDeviceType: "WE200" });
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
querySubDeviceArrayBuffer =
deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any
);
}
} else if (deviceInfo.model == "M01") {
this.setState({ currentDeviceType: "M01" });
jsonStatus = deviceToolKitInstanceM01.toJsonStatus(value.value);
querySubDeviceArrayBuffer = deviceToolKitInstanceM01.toBleCommand(
bleCommandSamples.querySubDevice as any
);
}
console.log( console.log(
commandMap.reciviedBLECommand, commandMap.reciviedBLECommand,
`仪器模式: ${deviceInfo.model}`, `仪器模式: ${deviceInfo.model}`,
jsonStatus jsonStatus
); );
console.log("jsonStatus", jsonStatus); console.log("jsonStatus", jsonStatus);
if (jsonStatus?.commandType === "BleMatch") { if (jsonStatus?.commandType === "BleMatch") {
switch (jsonStatus?.bleCommandType) { switch (jsonStatus?.bleCommandType) {
@ -489,17 +500,9 @@ class ConnectionBluetoot extends Component<any, any> {
islian: true, // 不需要离线记录但暂未完全删除这部分逻辑所以直接设为true islian: true, // 不需要离线记录但暂未完全删除这部分逻辑所以直接设为true
}); });
// this.pairingChange(this.state); // 临时添加,用于跳转
this.detectVersionUpdate(); // 获取升级信息 this.detectVersionUpdate(); // 获取升级信息
// todo 连接成功需删除离线记录,暂时未缓存离线记录 // todo 连接成功需删除离线记录,暂时未缓存离线记录
if (this.state.connectionSuccess) return; if (this.state.connectionSuccess) return;
// 暂时不需要查询是否连接子设备, 直接进入查询版本信息
// this.detectVersionUpdate();
/*if(deviceInfo.type == instrumentTypeEnum.M01) {
this.detectVersionUpdate()
} else {
this.sendQuerySubDevice(querySubDeviceArrayBuffer)
}*/
} }
break; break;
case "BleStatusSync": // 设备连接状态 case "BleStatusSync": // 设备连接状态
@ -519,6 +522,10 @@ class ConnectionBluetoot extends Component<any, any> {
console.log("面罩连上了 value => ", jsonStatus); console.log("面罩连上了 value => ", jsonStatus);
this.detectVersionUpdate(); this.detectVersionUpdate();
break; break;
case "FR200":
console.log("FR200连上了 value => ", jsonStatus);
this.detectVersionUpdate();
break;
default: default:
break; break;
} }
@ -526,7 +533,10 @@ class ConnectionBluetoot extends Component<any, any> {
console.log("BleStatusSync value => ", jsonStatus); console.log("BleStatusSync value => ", jsonStatus);
break; break;
case "QueryMatchStatus": case "QueryMatchStatus":
console.log("QueryMatchStatus value => ", jsonStatus); console.log(
"查询附属设备QueryMatchStatus value => ",
jsonStatus
);
break; break;
default: default:
break; break;
@ -536,16 +546,6 @@ class ConnectionBluetoot extends Component<any, any> {
console.log("当前设备:", jsonStatus.otaDeviceType); console.log("当前设备:", jsonStatus.otaDeviceType);
console.log("当前设备版本号:", jsonStatus.versionNo); console.log("当前设备版本号:", jsonStatus.versionNo);
if (
jsonStatus.otaDeviceType === "WE100" ||
jsonStatus.otaDeviceType === "WE200"
) {
console.log("closeBLEConnection");
setTimeout(() => {
this.againConnection();
}, 1000);
}
switch (jsonStatus.infoQueryType) { switch (jsonStatus.infoQueryType) {
case "versionInfo": case "versionInfo":
if (this.state.hasVersionInfo) return; if (this.state.hasVersionInfo) return;
@ -560,7 +560,7 @@ class ConnectionBluetoot extends Component<any, any> {
let currentDevicesName = getStorageSync("currentDevicesName"); let currentDevicesName = getStorageSync("currentDevicesName");
let deviceVersionNo = jsonStatus.versionNo; let deviceVersionNo = jsonStatus.versionNo;
let latestVersionNo = deviceInfo.iotVersion; let latestVersionNo = deviceInfo.iotVersion;
if (currentDevicesName.indexOf("12CAA") === -1) { if (currentDevicesName.indexOf("WE") > -1) {
latestVersionNo = deviceInfo.we200IotVersion; latestVersionNo = deviceInfo.we200IotVersion;
} }
// 判断版本号是否需要升级 // 判断版本号是否需要升级
@ -573,6 +573,16 @@ class ConnectionBluetoot extends Component<any, any> {
// 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗 // 版本号需要更新: 告诉父级页面,关闭连接弹窗,显示更新弹窗
this.props.upgradeFun(); this.props.upgradeFun();
} else { } else {
if (
currentDevicesName === "WE100" ||
currentDevicesName === "WE200"
) {
console.log("closeBLEConnection");
setTimeout(() => {
this.againConnection();
}, 1000);
return;
}
console.log("不需要升级,跳转进入仪器详情页"); console.log("不需要升级,跳转进入仪器详情页");
// 不需要升级,跳转进入仪器详情页 // 不需要升级,跳转进入仪器详情页
if (isGetVersionTimer) clearTimeout(isGetVersionTimer); if (isGetVersionTimer) clearTimeout(isGetVersionTimer);
@ -615,7 +625,6 @@ class ConnectionBluetoot extends Component<any, any> {
} else if (deviceInfo.model == "WL200" || deviceInfo.model == "M01") { } else if (deviceInfo.model == "WL200" || deviceInfo.model == "M01") {
if (sendPairingTimer) clearInterval(sendPairingTimer); if (sendPairingTimer) clearInterval(sendPairingTimer);
sendPairingTimer = setInterval(() => { sendPairingTimer = setInterval(() => {
console.log("test WL200");
this.sendPairingSignal(); this.sendPairingSignal();
}, 1000); }, 1000);
} else if ( } else if (
@ -661,44 +670,54 @@ class ConnectionBluetoot extends Component<any, any> {
} }
} }
const isWEorWL = ["WL200", "WE200", "WE100"].includes(model);
const isFRDevice = ["FR200", "FR380", "FR390"].includes(model); const isFRDevice = ["FR200", "FR380", "FR390"].includes(model);
console.log(commandMap.sendVersionCommand, `仪器:${model}`);
if (isFRDevice) { if (isFRDevice) {
writeBLECharacteristicValue({ if (model === "FR200") {
//发送获取仪器版本号 const value = deviceToolKitInstanceFR200.toBleCommand(
deviceId: this.props.bluetoothInfo.deviceId, fr200BleCommand.InfoQuery.versionInfo as any
servicesuuid: this.props.bluetoothInfo.servicesuuid, );
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1, sendCommand({ value });
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0, } else {
value: `dbf0a00300${ccrc8("dbf0a00300")}de`, writeBLECharacteristicValue({
}); //发送获取仪器版本号
} else { deviceId: this.props.bluetoothInfo.deviceId,
const otaDeviceType = this.isWL200() servicesuuid: this.props.bluetoothInfo.servicesuuid,
? OtaDeviceTypeEnum.WL200 characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
: OtaDeviceTypeEnum.WE100; characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
value: `dbf0a00300${ccrc8("dbf0a00300")}de`,
});
}
} else if (isWEorWL) {
const versionCommand = { const versionCommand = {
commandType: "InfoQuery", commandType: "InfoQuery",
infoQueryType: "versionInfo", infoQueryType: "versionInfo",
otaDeviceType, otaDeviceType: "",
}; };
console.log("versionCommand", versionCommand); if (this.isWL200()) {
// WL200
// 区分WL200 和 发箍 const otaDeviceType = OtaDeviceTypeEnum.WL200;
const value = this.isWL200() versionCommand.otaDeviceType = otaDeviceType;
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any) const value = deviceToolKitInstanceWL200.toBleCommand(
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any); versionCommand as any
);
console.log(otaDeviceType, " value", value); sendCommand({ value });
sendCommand({ value }); } else {
// WE200 WE100
const otaDeviceType = OtaDeviceTypeEnum.WE100;
versionCommand.otaDeviceType = otaDeviceType;
const value = deviceToolKitInstanceM01.toBleCommand(
versionCommand as any
);
sendCommand({ value });
}
} }
} }
/** 获取离线记录 */ /** 获取离线记录 */
sendofflist() { sendofflist() {
// log.info()
if (this.state.offlineDataindex == this.state.offlineDataList.length) { if (this.state.offlineDataindex == this.state.offlineDataList.length) {
console.log("离线记录获取完成", this.state); console.log("离线记录获取完成", this.state);
// log.info(commandMap.finishOfflineData, this.state.offlineDataList);
/**** /****
* *
* ****/ * ****/
@ -711,51 +730,65 @@ class ConnectionBluetoot extends Component<any, any> {
return false; return false;
} }
console.log("发送获取离线记录(细)指令"); console.log("发送获取离线记录(细)指令");
// log.info(commandMap.finishOfflineData, "发送获取离线记录(细)指令"); const { deviceInfo } = this.props;
writeBLECharacteristicValue({ let model = deviceInfo.model;
//发送获取离线记录 if (model === "FR200") {
deviceId: this.props.bluetoothInfo.deviceId, let matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand(
servicesuuid: this.props.bluetoothInfo.servicesuuid, fr200BleCommand.InfoQuery.clockDetail as any
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1, );
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0, sendCommand({ value: matchArrayBuffer });
value: this.state.offlineData[this.state.offlineDataList.length], } else {
}); writeBLECharacteristicValue({
//发送获取离线记录
deviceId: this.props.bluetoothInfo.deviceId,
servicesuuid: this.props.bluetoothInfo.servicesuuid,
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
value: this.state.offlineData[this.state.offlineDataList.length],
});
}
} }
/** 获取离线记录(汇总) */ /** 获取离线记录(汇总) */
sendofflistSummary() { sendofflistSummary() {
let str = "DBF0A00200"; let str = "DBF0A00200";
console.log("发送离线记录汇总指令 ==》", str); console.log("发送离线记录汇总指令 ==》", str);
this.setState({ offlineDataList: [] }); // 置空重查离线记录 this.setState({ offlineDataList: [] }); // 置空重查离线记录
// log.info(commandMap.finishOfflineData, `发送获取离线记录(总)指令`);
writeBLECharacteristicValue({ const { deviceInfo } = this.props;
//发送获取离线记录 let model = deviceInfo.model;
deviceId: this.props.bluetoothInfo.deviceId, if (model === "FR200") {
servicesuuid: this.props.bluetoothInfo.servicesuuid, let matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand(
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1, fr200BleCommand.InfoQuery.clockSummary as any
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0, );
value: `${str}${ccrc8(str)}DE`, sendCommand({ value: matchArrayBuffer });
}); } else {
writeBLECharacteristicValue({
//发送获取离线记录
deviceId: this.props.bluetoothInfo.deviceId,
servicesuuid: this.props.bluetoothInfo.servicesuuid,
characteristicsuuid1: this.props.bluetoothInfo.characteristicsuuid1,
characteristicsuuid0: this.props.bluetoothInfo.characteristicsuuid0,
value: `${str}${ccrc8(str)}DE`,
});
}
} }
/** 9.发送配对码 */ /** 9.发送配对码 */
sendPairingSignal() { sendPairingSignal() {
console.log("9.发送配对码 sendPairingSignal"); console.log("9.发送配对码 sendPairingSignal");
const { deviceInfo } = this.props; const { deviceInfo } = this.props;
// 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;
switch (deviceInfo.model) { switch (deviceInfo.model) {
case InstrumentTypeEnum.FR200: case InstrumentTypeEnum.FR200:
matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand( matchArrayBuffer = deviceToolKitInstanceFR200.toBleCommand(
bleCommandSamples.match as any fr200BleCommand.match as any
); );
break; break;
case InstrumentTypeEnum.WL200: case InstrumentTypeEnum.WL200:
console.log("正在发送WL200", bleCommandSamples.match);
let currentDevicesName = getStorageSync("currentDevicesName"); let currentDevicesName = getStorageSync("currentDevicesName");
// 区分面罩和发箍 // 区分面罩和发箍
if (currentDevicesName.indexOf("12CAA") > -1) { if (currentDevicesName.indexOf("12CAA") > -1) {
console.log("12CAA");
matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand( matchArrayBuffer = deviceToolKitInstanceWL200.toBleCommand(
bleCommandSamples.match as any bleCommandSamples.match as any
); );
@ -800,7 +833,6 @@ class ConnectionBluetoot extends Component<any, any> {
.catch((e) => { .catch((e) => {
// 下发配对指令失败,走重连操作 // 下发配对指令失败,走重连操作
clearInterval(sendPairingTimer); clearInterval(sendPairingTimer);
// wx.closeBLEConnection();
this.createBLEConnection(); this.createBLEConnection();
}); });
} }
@ -945,6 +977,8 @@ class ConnectionBluetoot extends Component<any, any> {
errorText, errorText,
}); });
} }
/**发送消息获取子设备*/
sendQuerySubDevice(value) { sendQuerySubDevice(value) {
isGetSubDeviceTimer = setInterval(() => { isGetSubDeviceTimer = setInterval(() => {
sendCommand({ value }); sendCommand({ value });
@ -995,14 +1029,35 @@ class ConnectionBluetoot extends Component<any, any> {
/** 发送同步记录 */ /** 发送同步记录 */
sendSyncRecording() { sendSyncRecording() {
const versionCommand = { const clockSummaryCommand = {
commandType: "InfoQuery", commandType: "InfoQuery",
infoQueryType: "offlineClockSummary", infoQueryType: "offlineClockSummary",
}; };
const value = this.isWL200()
? deviceToolKitInstanceWL200.toBleCommand(versionCommand as any) const { deviceInfo } = this.props;
: deviceToolKitInstanceM01.toBleCommand(versionCommand as any); let model = deviceInfo.model;
sendCommand({ value }).then(); if (model === "WL200") {
if (!this.isWL200()) {
model = "WE200";
}
}
const isWEorWL = ["WL200", "WE200", "WE100"].includes(model);
const isFRDevice = ["FR200", "FR380", "FR390"].includes(model);
if (isFRDevice) {
if (model === "FR200") {
let value = deviceToolKitInstanceFR200.toBleCommand(
fr200BleCommand.InfoQuery.clockSummary as any
);
sendCommand({ value }).then();
}
} else if (isWEorWL) {
const value = this.isWL200()
? deviceToolKitInstanceWL200.toBleCommand(clockSummaryCommand as any)
: deviceToolKitInstanceM01.toBleCommand(clockSummaryCommand as any);
sendCommand({ value }).then();
}
if (isGetSyncRecordingTimer) clearTimeout(isGetSyncRecordingTimer); if (isGetSyncRecordingTimer) clearTimeout(isGetSyncRecordingTimer);
isGetSyncRecordingTimer = setTimeout(() => { isGetSyncRecordingTimer = setTimeout(() => {
if (this.state.hasSyncRecord) { if (this.state.hasSyncRecord) {

@ -0,0 +1 @@
@import url(./WL200.less);

File diff suppressed because it is too large Load Diff

@ -38,14 +38,14 @@ import ConnectionBluetoot from "@/components/bluetoot/connection";
/* 本页组件 */ /* 本页组件 */
import ElectricityView from "./components/ElectricityView/index"; import ElectricityView from "./components/ElectricityView/index";
import ModeListView from "./components/ModeList/index"; import ModeListView from "./components/ModeList/WL200";
import ModeContent from "./components/ModeContent/index"; import ModeContent from "./components/ModeContent/WL200";
import Footer from "./components/Footer"; import Footer from "./components/Footer";
/* 本页组件 END */ /* 本页组件 END */
import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI"; import { go, getStorageSync, setStorageSync, msg } from "@/utils/traoAPI";
import { InstrumentInfo } from "@/utils/Interface"; import { InstrumentInfo } from "@/utils/Interface";
import "./iotCarePlan.less"; import "./WL200.less";
import { import {
notifyBLECharacteristicValueChange, notifyBLECharacteristicValueChange,
@ -122,12 +122,12 @@ let DeviceSyncData = {
}; };
let deviceToolKitInstance = deviceToolKitInstanceWL200; let deviceToolKitInstance = deviceToolKitInstanceWL200;
class IotCarePlan extends Component<any, any> { class IotCarePlanWL200 extends Component<any, any> {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
name: "iotCarePlan", name: "WL200",
title: "美容仪名字", // 页面标题 title: "WL200", // 页面标题
// 当前设备 // 当前设备
currentDevice: { currentDevice: {
name: "", name: "",
@ -1962,20 +1962,20 @@ class IotCarePlan extends Component<any, any> {
let res = await InstrumentInfo.firstNurseInfo({ let res = await InstrumentInfo.firstNurseInfo({
instrumentId: currentDevice.id, instrumentId: currentDevice.id,
}); });
console.log(res,'接口'); console.log(res, "接口");
if (res.data.code === 200) { if (res.data.code === 200) {
let isFirstTipShow = getStorageSync( let isFirstTipShow = getStorageSync(
"first_instrument_" + currentDevice.id "first_instrument_" + currentDevice.id
); );
console.log(isFirstTipShow,'查看返回值'); console.log(isFirstTipShow, "查看返回值");
if (!isFirstTipShow) { if (!isFirstTipShow) {
if(res.data.data.length !== 0){ if (res.data.data.length !== 0) {
// 首次进入页面:自动打开打卡介绍弹窗 // 首次进入页面:自动打开打卡介绍弹窗
this.setState({ nurseInfo: res.data.data, isFirstTipShow: true }); this.setState({ nurseInfo: res.data.data, isFirstTipShow: true });
} }
setStorageSync("first_instrument_" + currentDevice.id, true); setStorageSync("first_instrument_" + currentDevice.id, true);
} else { } else {
this.setState({ nurseInfo: res.data.data }); this.setState({ nurseInfo: res.data.data });
@ -2311,6 +2311,6 @@ const mapDispatchToProps = (dispatch) => ({
// dispatch(userRefresh(data)); // dispatch(userRefresh(data));
// }, // },
}); });
export default connect(mapStateToProps, mapDispatchToProps)(IotCarePlan); export default connect(mapStateToProps, mapDispatchToProps)(IotCarePlanWL200);
// isCharging // isCharging

@ -1,6 +1,6 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Block, View, Image, Text } from "@tarojs/components"; import { Block, View, Image, Text, CoverView } from "@tarojs/components";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import "./index.less"; import "./index.less";
@ -42,7 +42,7 @@ function Index({
return ( return (
<Block> <Block>
<View className="iot-footer"> <CoverView className="iot-footer">
{!isShowNurse && ( {!isShowNurse && (
<Block> <Block>
{isDisabled ? ( {isDisabled ? (
@ -124,7 +124,7 @@ function Index({
</View> </View>
</View> </View>
)} )}
</View> </CoverView>
</Block> </Block>
); );
} }

@ -0,0 +1,23 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Block, View, ScrollView, Image } from "@tarojs/components";
import { useState, useEffect } from "react";
import "./FR200.less";
interface Props {
isShowNurse: boolean;
ActiveModeItem: any;
ModeStepIndex: number;
}
function Index({ isShowNurse, ActiveModeItem, ModeStepIndex }: Props) {
const ModeColor = {
"590nm": "#CF231D",
"630nm": "#CF231D",
"830nm": "#9C1D17",
};
return (
<Block>{isShowNurse && <View className="modelInfo-box"></View>}</Block>
);
}
export default Index;

@ -2,7 +2,7 @@ import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Block, View, ScrollView, Image } from "@tarojs/components"; import { Block, View, ScrollView, Image } from "@tarojs/components";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import "./index.less"; import "./WL200.less";
interface Props { interface Props {
isShowNurse: boolean; isShowNurse: boolean;

@ -0,0 +1,347 @@
import Taro from "@tarojs/taro";
import classnames from "classnames";
import { Block, View, ScrollView, Image } from "@tarojs/components";
import { useState, useEffect } from "react";
import "./FR200.less";
interface Props {
ModeID: any;
activeModeID: any;
ModeList: any;
ModeType: string; // all visor cabin yimeish
isShowNurse: boolean; // 是否已进入护理详情页
isPop: boolean; // 是否弹窗
onEmit: Function; // 每次点击item回调事件和数据给父组件
onEmitShowAll: Function; // 打开弹窗按钮
}
function Index({
isShowNurse,
isPop,
ModeList,
ModeType,
ModeID,
activeModeID,
onEmit,
onEmitShowAll,
}: Props) {
let BaseList = ModeList.filter((item) => item.modeClass === 1); // 基础护理
let ZoneList = ModeList.filter((item) => item.modeClass === 2); // 专区护理
let PermeationList = ModeList.filter((item) => item.modeClass === 3); // 专研促渗
let SensitiveList = ModeList.filter((item) => item.modeClass === 4); // 敏感期护理
let IntelligenceList = ModeList.filter((item) => item.modeClass === 5); // 智能测肤
const onItemClick = (item) => {
onEmit(item);
};
const showAll = () => {
onEmitShowAll();
};
return (
<Block>
<View className="mode-list-main">
{!isPop && ModeList.length > 0 && isShowNurse && (
<View className="change-all-mode-btn" onClick={showAll}>
<View className="title"></View>
<Image
className="icon"
src={require("@/img/iot/mode-switch.png")}
/>
</View>
)}
{BaseList.length > 0 &&
(ModeType === "all" || ModeType === "Base" || isPop) && (
<ScrollView
className="mode-list-box"
scroll-x="true"
scrollIntoView={ModeID} // itemID自动滚动到该元素位置
>
<View className="mode-list">
<View className="mode-item-title"></View>
{BaseList.map((item: any, index: any) => {
return (
<View
key={"Base_" + index}
id={"Base_" + item.id}
className={classnames("mode-item", {
"mode-item-active": activeModeID === item.id,
})}
onClick={onItemClick.bind(this, item)}
>
<View
className={classnames("new", {
"is-new": item.isNew === 1,
})}
>
NEW
</View>
<View className="mode-info">
<View className="mode-info-title">{item.modeName}</View>
<View className="mode-info-time">
{item.modeTimeStr}
</View>
<View
className={classnames("mode-info-select", {
"is-select": activeModeID === item.id,
})}
>
{activeModeID === item.id && (
<View className="mode-info-select-point"></View>
)}
</View>
</View>
{activeModeID === item.id && (
<View className="mode-pic">
<Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View>
)}
</View>
);
})}
<View style="width:120rpx;min-width:120rpx;height:40rpx;display:flex"></View>
</View>
</ScrollView>
)}
{ZoneList.length > 0 &&
(ModeType === "all" || ModeType === "Zone" || isPop) && (
<ScrollView
className="mode-list-box"
scrollX={true}
scrollIntoView={ModeID}
>
<View className="mode-list">
<View className="mode-item-title"></View>
{ZoneList.map((item: any, index: any) => {
return (
<View
key={"Zone_" + index}
id={"Zone_" + item.id}
onClick={onItemClick.bind(this, item)}
className={classnames("mode-item", {
"mode-item-active": activeModeID === item.id,
})}
>
<View
className={classnames("new", {
"is-new": item.isNew === 1,
})}
>
NEW
</View>
<View className="mode-info">
<View className="mode-info-title">{item.modeName}</View>
<View className="mode-info-time">
{item.modeTimeStr}
</View>
<View
className={classnames("mode-info-select", {
"is-select": activeModeID === item.id,
})}
>
{activeModeID === item.id && (
<View className="mode-info-select-point"></View>
)}
</View>
</View>
{activeModeID === item.id && (
<View className="mode-pic">
<Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View>
)}
</View>
);
})}
</View>
</ScrollView>
)}
{PermeationList.length > 0 &&
(ModeType === "all" || ModeType === "Permeation" || isPop) && (
<ScrollView
className="mode-list-box"
scrollX={true}
scrollIntoView={ModeID}
>
<View className="mode-list">
<View className="mode-item-title"></View>
{PermeationList.map((item: any, index: any) => {
return (
<View
key={"Permeation_" + index}
id={"Permeation_" + item.id}
onClick={onItemClick.bind(this, item)}
className={classnames("mode-item", {
"mode-item-active": activeModeID === item.id,
})}
>
<View
className={classnames("new", {
"is-new": item.isNew === 1,
})}
>
NEW
</View>
<View className="mode-info">
<View className="mode-info-title">{item.modeName}</View>
<View className="mode-info-time">
{item.modeTimeStr}
</View>
<View
className={classnames("mode-info-select", {
"is-select": activeModeID === item.id,
})}
>
{activeModeID === item.id && (
<View className="mode-info-select-point"></View>
)}
</View>
</View>
{activeModeID === item.id && (
<View className="mode-pic">
<Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View>
)}
</View>
);
})}
</View>
</ScrollView>
)}
{SensitiveList.length > 0 &&
(ModeType === "all" || ModeType === "Sensitive" || isPop) && (
<ScrollView
className="mode-list-box"
scrollX={true}
scrollIntoView={ModeID}
>
<View className="mode-list">
<View className="mode-item-title"></View>
{PermeationList.map((item: any, index: any) => {
return (
<View
key={"Sensitive_" + index}
id={"Sensitive_" + item.id}
onClick={onItemClick.bind(this, item)}
className={classnames("mode-item", {
"mode-item-active": activeModeID === item.id,
})}
>
<View
className={classnames("new", {
"is-new": item.isNew === 1,
})}
>
NEW
</View>
<View className="mode-info">
<View className="mode-info-title">{item.modeName}</View>
<View className="mode-info-time">
{item.modeTimeStr}
</View>
<View
className={classnames("mode-info-select", {
"is-select": activeModeID === item.id,
})}
>
{activeModeID === item.id && (
<View className="mode-info-select-point"></View>
)}
</View>
</View>
{activeModeID === item.id && (
<View className="mode-pic">
<Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View>
)}
</View>
);
})}
</View>
</ScrollView>
)}
{IntelligenceList.length > 0 &&
(ModeType === "all" || ModeType === "Intelligence" || isPop) && (
<ScrollView
className="mode-list-box"
scrollX={true}
scrollIntoView={ModeID}
>
<View className="mode-list">
<View className="mode-item-title"></View>
{IntelligenceList.map((item: any, index: any) => {
return (
<View
key={"Intelligence_" + index}
id={"Intelligence_" + item.id}
onClick={onItemClick.bind(this, item)}
className={classnames("mode-item", {
"mode-item-active": activeModeID === item.id,
})}
>
<View
className={classnames("new", {
"is-new": item.isNew === 1,
})}
>
NEW
</View>
<View className="mode-info">
<View className="mode-info-title">{item.modeName}</View>
<View className="mode-info-time">
{item.modeTimeStr}
</View>
<View
className={classnames("mode-info-select", {
"is-select": activeModeID === item.id,
})}
>
{activeModeID === item.id && (
<View className="mode-info-select-point"></View>
)}
</View>
</View>
{activeModeID === item.id && (
<View className="mode-pic">
<Image
src={item.modeBanner}
mode="aspectFill"
style="animation-iteration-count:1;"
/>
</View>
)}
</View>
);
})}
</View>
</ScrollView>
)}
</View>
</Block>
);
}
export default Index;

@ -2,7 +2,7 @@ import Taro from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { Block, View, ScrollView, Image } from "@tarojs/components"; import { Block, View, ScrollView, Image } from "@tarojs/components";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import "./index.less"; import "./WL200.less";
interface Props { interface Props {
ModeID: any; ModeID: any;
@ -28,7 +28,6 @@ function Index({
let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式 let CabinList = ModeList.filter((item) => item.modeClass === 2); // 舱体模式
let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后 let YimeishList = ModeList.filter((item) => item.modeClass === 3); // 医美术后
console.log("ModeType", ModeType);
const yimeishClick = (item) => { const yimeishClick = (item) => {
onEmit(item); onEmit(item);
}; };

@ -839,6 +839,16 @@ class Index extends Component<any, any> {
// 跳转仪器介绍页 // 跳转仪器介绍页
goNursing = (item) => { goNursing = (item) => {
// 仅开发者工具调试使用
const platform = Taro.getSystemInfoSync().platform;
if (platform === "devtools") {
setStorageSync("instrument_detail", item);
this.setState({ connectInstrument: item });
setTimeout(() => this.goIot());
return;
}
// 移动端真正逻辑
if (item.status === 0) { if (item.status === 0) {
setStorageSync("instrument_detail", item); setStorageSync("instrument_detail", item);
this.setState({ connectInstrument: item }); this.setState({ connectInstrument: item });
@ -897,13 +907,22 @@ class Index extends Component<any, any> {
*/ */
pairingChange = (e) => { pairingChange = (e) => {
console.log("===epairingChange===》", e); console.log("===epairingChange===》", e);
go("/moduleIOT/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
if (this.state.connectInstrument.model === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
}
this.connectionClose(); this.connectionClose();
}; };
async goIot() { async goIot() {
go("/moduleIOT/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 if (this.state.connectInstrument.model === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
}
// return; // return;
} }

@ -334,11 +334,6 @@ export default class Instrument extends Component<any, any> {
let code = Number(res.code); // 强制类型转换 let code = Number(res.code); // 强制类型转换
setTimeout(() => { setTimeout(() => {
if (code === 200) { if (code === 200) {
// msg("绑定成功");
// setTimeout(() => {
// setStorageSync("instrument_item", JSON.stringify(channelInfo));
// go("/pages/instrument/intro?id=" + channelInfo.id);
// }, 1000);
this.openBindingVisible(); this.openBindingVisible();
} else if (code === 202) { } else if (code === 202) {
this.changeBindBox(); this.changeBindBox();
@ -375,7 +370,7 @@ export default class Instrument extends Component<any, any> {
if (code === 200) { if (code === 200) {
msg("绑定成功"); msg("绑定成功");
setTimeout(() => { setTimeout(() => {
setStorageSync("instrument_item", JSON.stringify(channelInfo)); setStorageSync("instrument_detail", JSON.stringify(channelInfo));
go("/pages/instrument/intro?id=" + channelInfo.id); go("/pages/instrument/intro?id=" + channelInfo.id);
}, 1000); }, 1000);
} else if (res.data.code === 202) { } else if (res.data.code === 202) {
@ -406,7 +401,7 @@ export default class Instrument extends Component<any, any> {
if (res.data.code === 200) { if (res.data.code === 200) {
this.setState({ isVisibleBinding: false }); this.setState({ isVisibleBinding: false });
msg("绑定成功"); msg("绑定成功");
setStorageSync("instrument_item", JSON.stringify(channelInfo)); setStorageSync("instrument_detail", JSON.stringify(channelInfo));
setTimeout(() => { setTimeout(() => {
go("/pages/instrument/intro?id=" + channelInfo.id); go("/pages/instrument/intro?id=" + channelInfo.id);
}, 1000); }, 1000);

@ -187,7 +187,12 @@ class Intro extends Component<any, any> {
*/ */
pairingChange = (e) => { pairingChange = (e) => {
console.log("===epairingChange===》", e); console.log("===epairingChange===》", e);
go("/moduleIOT/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转
if (this.state.connectInstrument.model === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
}
setTimeout(() => { setTimeout(() => {
this.connectionClose(); this.connectionClose();
@ -195,7 +200,11 @@ class Intro extends Component<any, any> {
}; };
async goIot() { async goIot() {
go("/moduleIOT/pages/iotCarePlan/iotCarePlan"); // 画页面直接跳转 if (this.state.connectInstrument.model === "FR200") {
go("/moduleIOT/pages/iotCarePlan/FR200"); // 画页面直接跳转
} else {
go("/moduleIOT/pages/iotCarePlan/WL200"); // 画页面直接跳转
}
setTimeout(() => { setTimeout(() => {
this.connectionClose(); this.connectionClose();
}, 100); }, 100);

Loading…
Cancel
Save