diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index 426163d..5f99f6f 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -7,7 +7,7 @@
},
{
"customPlaygroundType" : "local",
- "playground" : "custom",
+ "playground" : "standard",
"type" : "uni-app:app-android"
}
]
diff --git a/manifest.json b/manifest.json
index f6657fb..129e01d 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,14 +2,14 @@
"name" : "星汉物联",
"appid" : "__UNI__A21EF43",
"description" : "设备管控",
- "versionName" : "1.0.8",
+ "versionName" : "1.0.7",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
- "compatible":{
- "ignoreVersion":true
- },
+ "compatible" : {
+ "ignoreVersion" : true
+ },
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue
index 39647e1..75ec006 100644
--- a/pages/6155/deviceDetail.vue
+++ b/pages/6155/deviceDetail.vue
@@ -65,7 +65,7 @@
主灯模式
- {{getMode}}
+ {{getMode('main')}}
@@ -74,7 +74,7 @@
辅灯模式
- 泛光模式
+ {{getMode('fu')}}
@@ -108,15 +108,18 @@
单位:
-
+
部门:
-
+
姓名:
-
+
@@ -257,6 +260,7 @@
deviceId: '',
textLines: ['', '', ''],
mode: '',
+ light:null,
bleStatu: ''
},
inteval: 80,
@@ -415,33 +419,48 @@
remark = '微弱';
}
},
- getMode() {
+
+ },
+ methods: {
+ getMode(type) {
let txt = "关闭";
- if (this.Status.BottomMenu.type == 'fu') {
- return txt;
- }
- switch (this.formData.mode) {
+
+ switch (this.formData.light) {
case 0:
- txt = "强光模式";
+ if (type == 'fu' && this.formData.mode == 'fu') {
+ txt = '泛光';
+ } else if (type == 'main' && this.formData.mode == 'main') {
+ txt = "强光";
+ }
break;
case 1:
- txt = "弱光模式";
+ if (type == 'fu' && this.formData.mode == 'fu') {
+ txt = '强+泛光';
+ } else if (type == 'main' && this.formData.mode == 'main') {
+ txt = "弱光";
+ }
break;
case 2:
- txt = "爆闪模式";
+ if (type == 'main' && this.formData.mode == 'main') {
+ txt = "爆闪";
+ }
+
break;
case 3:
+ if (type == 'main' && this.formData.mode == 'main') {
txt = "关闭";
+ }
+
break;
default:
txt = "关闭";
break;
}
+
+
return txt;
- }
- },
- methods: {
+ },
calcTotalPackets(frames) {
if (!Array.isArray(frames) || frames.length === 0) {
return 0;
@@ -570,7 +589,8 @@
if (!json) {
return;
}
- console.log("收到设备数据:", json);
+ console.log("收到原始数据:", receive);
+ console.log("解析设备数据:", json);
let keys = Object.keys(json);
keys.forEach((key) => {
if (key in these.formData) {
@@ -579,7 +599,7 @@
these.$set(these.formData, key, json[key]);
} else {
console.log(`字段 ${key} 不在 formData 中,跳过更新`);
- }
+ }
});
// 强制触发视图更新,确保电量显示同步
@@ -919,7 +939,7 @@
fail: (ex) => {
updateLoading(these, {
- text : '视频文件上传失败了,请检查网络连接'
+ text: '视频文件上传失败了,请检查网络连接'
});
reject(ex);
@@ -942,8 +962,8 @@
resolve(res.data);
return;
- }else{
- console.log("res.data=",res.data);
+ } else {
+ console.log("res.data=", res.data);
}
}
@@ -1264,9 +1284,10 @@
},
ModeSetting: function(type) {
- this.formData.mode = type;
+
let items = [];
let title = '';
+
switch (type) {
case "main":
title = '主灯模式';
@@ -1305,12 +1326,16 @@
];
break;
}
-
+
this.Status.BottomMenu.menuItems = items;
this.Status.BottomMenu.title = title;
this.Status.BottomMenu.type = type;
this.Status.BottomMenu.show = true;
-
+ if(this.formData.mode != type){
+
+ this.Status.BottomMenu.activeIndex =null;
+ }
+
},
showMenu(flag) {
this.Status.BottomMenu.show = true;
@@ -1320,8 +1345,8 @@
},
btnClick(item, index) {
- if (this.Status.BottomMenu.activeIndex == -1) {
- this.showToast('请选择模式');
+ if (parseInt(this.Status.BottomMenu.activeIndex) === NaN) {
+ uni.showToast('请选择模式');
return;
}
//发送指令给设备
@@ -1386,7 +1411,8 @@
});
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(() => {
- this.formData.mode = mode;
+ this.formData.light = mode;
+ this.formData.mode = type
this.setBleFormData();
}).catch((ex) => {
these.showPop({
@@ -1404,14 +1430,14 @@
},
handleItemClick(item, index) {
- switch (this.Status.BottomMenu.type) {
- case "main":
+ // switch (this.Status.BottomMenu.type) {
+ // case "main":
- break;
- case "fu":
+ // break;
+ // case "fu":
- break;
- }
+ // break;
+ // }
this.Status.BottomMenu.activeIndex = index;
},
@@ -1569,7 +1595,7 @@
logicalDataView.setUint8(logicalPacketSize - 1, 0xFF);
// 4. 将逻辑大包分包发送
- const CHUNK_SIZE = 20; // 每个物理包的大小
+ const CHUNK_SIZE = 500; // 每个物理包的大小
const totalChunks = Math.ceil(logicalPacketSize / CHUNK_SIZE);
updateLoading(these, {
diff --git a/utils/BleReceive.js b/utils/BleReceive.js
index 4519d5c..14747be 100644
--- a/utils/BleReceive.js
+++ b/utils/BleReceive.js
@@ -415,37 +415,42 @@ class BleReceive {
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
try {
- let staticLevelByte = bytes[2];
- let getName = function(type) {
+
+ let getName = function(type,) {
let name = "";
switch (type) {
- case 0x02:
- // name = '弱光';
- name=1;
- break;
- case 0x04:
- name = '工作光';
- break;
case 0x01:
// name = '强光';
name=0;
break;
- case 0x03:
- // name = '爆闪';
- name=2;
+ case 0x02:
+ // name = '弱光';
+ name=1;
break;
- case 0x00:
+ case 0x03:
+ // name = '爆闪';
+ name=2;
+ break;
+ case 0x04:
+ name = 0;//泛光
+ break;
+ case 0x0A:
+ name = 1;//强光&泛光
+ break;
+
+
+ default:
// name = '关闭';
- name=3;
+ name=null;
break;
}
return name;
}
- let staticLevelText = getName(staticLevelByte);
+
+ let staticLevelText = getName(bytes[2]);
- // 解析照明档位
- let lightingLevelByte = bytes[3];
- let lightingLevelText = getName(lightingLevelByte);
+ // 解析照明档位
+ let lightingLevelText = getName(bytes[3]);
// 解析剩余电量
@@ -470,8 +475,9 @@ class BleReceive {
let mm = Math.max(0, Math.min(100, bytes[7]));
lightingTime = HH + "小时" + mm + "分钟";
let formData = {};
- formData.mode = staticLevelText;
- formData.fuMode = lightingLevelText;
+ formData.mode = (bytes[2]===0x00 || bytes[2]===0x0B)?'fu':'main';
+ formData.light=formData.mode=='fu'?lightingLevelText:staticLevelText;
+
formData.battary = batteryLevel;
formData.statu = warn;
formData.xuhang = lightingTime;