1
0
forked from dyf/APP

Compare commits

...

9 Commits

33 changed files with 5705 additions and 1500 deletions

View File

@ -0,0 +1,159 @@
/**
* HBY102J 晶全应用层协议:下行 FA … FF上行 FB/FC … FF。
* 与 HBY100-J 使用同一颗蓝牙模组 / 同一套 GATTAE30 + AE03 写 + AE02 通知),
* 见 `api/100J/HBY100-J.js` 中 SERVICE_UUID / WRITE / NOTIFY仅帧语义与 100J 不同。
*/
export const HBY102J_SERVICE = '0000AE30-0000-1000-8000-00805F9B34FB'
export const HBY102J_WRITE = '0000AE03-0000-1000-8000-00805F9B34FB'
export const HBY102J_NOTIFY = '0000AE02-0000-1000-8000-00805F9B34FB'
function buildFaFrame(func, dataBytes = []) {
return [0xfa, func & 0xff, ...dataBytes.map((b) => b & 0xff), 0xff]
}
const BYTE_TO_RADAR = {
0: 'status_off',
1: 'status_2M',
2: 'status_4M',
3: 'status_7M',
4: 'status_10M'
}
const BYTE_TO_LED = {
0: 'led_off',
1: 'led_flash',
2: 'led_low_flash',
3: 'led_steady',
4: 'led_alarm'
}
const RADAR_KEY_TO_BYTE = {
status_off: 0,
status_2M: 1,
status_4M: 2,
status_7M: 3,
status_10M: 4,
status_on: 1
}
const LED_KEY_TO_BYTE = {
led_off: 0,
led_flash: 1,
led_low_flash: 2,
led_steady: 3,
led_alarm: 4
}
export function encodeChannelSet(channelDecimal1to80) {
const ch = Math.max(1, Math.min(80, Number(channelDecimal1to80) || 1))
return buildFaFrame(0x21, [ch])
}
export function encodeOnline(on) {
return buildFaFrame(0x22, [on ? 1 : 0])
}
export function encodeRadarFromUiKey(sta_RadarType) {
const b = RADAR_KEY_TO_BYTE[sta_RadarType] !== undefined ? RADAR_KEY_TO_BYTE[sta_RadarType] : 0
return buildFaFrame(0x23, [b])
}
export function encodeWarningLightFromLedKey(ledKey) {
const m = LED_KEY_TO_BYTE[ledKey] !== undefined ? LED_KEY_TO_BYTE[ledKey] : 0
return buildFaFrame(0x24, [m])
}
export function encodeQueryOnlineCount() {
return buildFaFrame(0x25, [0])
}
export function encodeQueryPower() {
return buildFaFrame(0x26, [])
}
function formatMacFromBytes(u8, start, len) {
const hex = []
for (let i = 0; i < len; i++) {
hex.push(u8[start + i].toString(16).padStart(2, '0'))
}
return hex.join(':').toUpperCase()
}
/**
* 解析设备上行一帧Notify输出与 HBY102 页 formData 对齐的字段
*/
export function parseHby102jUplink(u8) {
const out = {}
if (!u8 || u8.length < 3) return out
const h = u8[0]
const func = u8[1]
const tail = u8[u8.length - 1]
if (tail !== 0xff && u8.length >= 4) {
// 非标准结尾时仍尽量解析
}
if (h === 0xfc && u8.length >= 8 && u8[7] === 0xff) {
out.sta_address = formatMacFromBytes(u8, 1, 6)
return out
}
if (h !== 0xfb) return out
switch (func) {
case 0x21:
if (u8.length >= 4) {
out.sta_Channel = u8[2]
}
break
case 0x22:
out.sta_Online = u8[2] === 1 ? 'E49_on' : 'E49_off'
break
case 0x23:
out.sta_RadarType = BYTE_TO_RADAR[u8[2]] !== undefined ? BYTE_TO_RADAR[u8[2]] : 'status_off'
break
case 0x24:
out.sta_LedType = BYTE_TO_LED[u8[2]] !== undefined ? BYTE_TO_LED[u8[2]] : 'led_off'
break
case 0x25:
if (u8.length >= 4) {
out.sta_onlineQuantity = u8[2]
}
break
case 0x26:
if (u8.length >= 5) {
out.sta_PowerPercent = u8[2]
out.sta_charge = u8[3]
}
break
case 0x27:
if (u8.length >= 9) {
out.sta_PowerPercent = u8[2]
out.sta_charge = u8[3]
out.sta_Channel = u8[4]
out.sta_LedType = BYTE_TO_LED[u8[5]] !== undefined ? BYTE_TO_LED[u8[5]] : 'led_off'
out.sta_RadarType = BYTE_TO_RADAR[u8[6]] !== undefined ? BYTE_TO_RADAR[u8[6]] : 'status_off'
out.sta_Online = u8[7] === 1 ? 'E49_on' : 'E49_off'
}
break
case 0x28:
if (u8.length >= 10) {
const peerMac = formatMacFromBytes(u8, 2, 6)
const ev = u8[8]
if (ev === 0x01) {
out.sta_sosadd = peerMac
out.sta_Intrusion = 1
} else if (ev === 0x02) {
out.sta_sosadd_off = peerMac
} else if (ev === 0x03) {
out.sta_tomac = peerMac
}
}
break
default:
break
}
return out
}

View File

@ -6,10 +6,12 @@
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
:buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt"
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel"
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" :showSlot="item.showSlot"
:showHeader="item.showHeader" :headerTxt="item.headerTxt"
@cancelPop="cancelClick(item,index)" />
@cancelPop="cancelClick(item,index)" >
<slot />
</MessagePopup>
</view>
</template>
@ -48,10 +50,10 @@
this.closePop(item);
},
closePop: function(item) {
debugger;
if (item) {
this.Msgboxs.find((v, i) => {
debugger;
if (item.key && v.key) {
if (item.key === v.key) {
this.Msgboxs.splice(i, 1);
@ -79,7 +81,7 @@
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
borderColor: '#BBE6004d',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
@ -116,7 +118,7 @@
}
if (!json.borderColor) {
json.borderColor = '#BBE600';
json.borderColor = '#BBE6004d';
json.buttonBgColor = '#BBE600';
}
json.showPop = true;
@ -137,21 +139,37 @@
error: {
icoUrl: '/static/images/common/uploadErr.png',
borderColor: "#e034344d",
buttonBgColor: "#E03434"
buttonBgColor: "#E03434",
bgColor:'#38393466',
buttonTextColor:'#FFFFFFde'
},
succ: {
icoUrl: '/static/images/common/success.png',
borderColor: "#BBE600",
buttonBgColor: "#BBE600"
borderColor: "#BBE6004d",
buttonBgColor: "#BBE600",
bgColor:'#38393466'
},
warn: {
icoUrl: '/static/images/common/warning.png',
borderColor: "#FFC84E",
borderColor: "#FFC84E4d",
buttonBgColor: "#FFC84E",
bgColor:'#38393466'
},
info:{
borderColor: "#BBE600",
buttonBgColor: "#BBE600"
borderColor: "#BBE6004d",
buttonBgColor: "#BBE600",
bgColor:'#38393466'
},
prompt:{
borderColor: "#aed6004d",
buttonBgColor: "#aed600",
bgColor:'#38393466',
buttonTextColor:'#232323de',
showSlot:true,
showCancel:true,
buttonCancelText:'取消'
}
}
@ -171,7 +189,13 @@
borderColor: cfg[type].borderColor,
buttonBgColor: cfg[type].buttonBgColor,
buttonText: btnTxt ? btnTxt : '确定',
okCallback: okCallback ? okCallback : this.closePop
okCallback: okCallback ? okCallback : this.closePop,
buttonTextColor:cfg[type].buttonTextColor,
bgColor:cfg[type].bgColor,
showSlot:cfg[type].showSlot,
showCancel:cfg[type].showCancel,
buttonCancelText:cfg[type].buttonCancelText
};
return this.showPop(options);

View File

@ -141,9 +141,8 @@
flex-direction: column;
align-items: center;
justify-content: center;
transform: translateZ(0);
/* 启用GPU加速 */
margin-top: -150rpx;
transform: translateZ(0);
margin-top: 0rpx;
}
/* 刻度容器 */

View File

@ -339,6 +339,14 @@
"navigationBarTitleText" : "HBY102"
}
},
{
"path" : "pages/102J/HBY102J",
"style" :
{
"navigationStyle": "custom",
"navigationBarTitleText" : "HBY102"
}
},
{
"path" : "pages/common/user/logOff",
"style" :
@ -459,6 +467,13 @@
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/210/HBY210",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "HBY210"
}
}
],

View File

@ -66,7 +66,9 @@
</view>
<ProParams :id="device.id"></ProParams>
<MsgBox ref="msgPop" />
<global-loading ref="loading" />
</view>
</template>
@ -85,7 +87,8 @@
MsgClose,
MsgWarning,
showPop,
MsgInfo
MsgInfo,
MsgPrompt
} from '@/utils/MsgPops.js'
import Common from '@/utils/Common.js';
import BleTool from '@/utils/BleHelper.js'
@ -213,7 +216,7 @@
},
onLoad() {
these = this;
recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
@ -227,8 +230,8 @@
eventChannel = this.getOpenerEventChannel();
eventChannel.on('detailData', function(data) {
eventChannel.on('detailData', (data)=> {
console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.Status.apiType = data.apiType;
@ -1196,7 +1199,7 @@
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed {

View File

@ -623,7 +623,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -1360,7 +1360,7 @@ onFreqChanging(e){
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -58,6 +58,11 @@
<text class="value"
:class="deviceInfo.onlineStatus===0?'red':'green'">{{ deviceInfo.onlineStatus === 0 ? '离线': '在线' }}</text>
</view>
<view class="item">
<text class="lbl">充电状态</text>
<text class="value"
>{{ deviceInfo.chargingStatus === 0 ? '未充电': '充电中' }}</text>
</view>
<view class="info-row">
<text class="info-label" style="display: flex; align-items: center;">定位信息</text>
<view class="info-value status-running" @click="gpsPosition(deviceInfo)">
@ -192,6 +197,16 @@
</view>
</view>
<ProParams :id="device.id"></ProParams>
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue"
:buttonCancelText="Status.Pop.buttonCancelText" :showCancel="Status.Pop.showCancel"
@cancelPop="closePop" />
<MsgBox ref="msgPop" />
</view>
</view>
@ -794,6 +809,14 @@
that.formData.strobeFrequency = that.normalizeStrobeFreq(that.formData.strobeFrequency);
that.deviceInfo = res.data;
that.$nextTick(() => that.sync100JBleUiFromHelper && that.sync100JBleUiFromHelper());
// 语音频闪报警0=关闭1=开启 ui7是播放的状态
const voiceBroadcast = res.data.voiceBroadcast;
if (voiceBroadcast === 1) {
console.log('wo shi shui ');
that.formData.sta_VoiceType = '7'
} else {
that.formData.sta_VoiceType = '-1'
}
const strobeEnable = res.data.strobeEnable ?? 0; // 0=关闭1=开启
const strobeMode = res.data.strobeMode ?? 0; // 0=红闪、1=蓝闪、3=红色顺时针...
if (strobeEnable === 1) {
@ -1022,7 +1045,7 @@
openVolume(item, index) {
if (!item) {
item = this.dic.sta_VoiceType[index];
}
}
let val = item.key;
const prevVoiceType = this.formData.sta_VoiceType;
if (this.formData.sta_VoiceType === val) {
@ -1037,7 +1060,7 @@
const data = {
deviceIds: [this.deviceInfo.deviceId],
voiceStrobeAlarm: 1,
mode: this.formData.sta_VoiceType
mode: item.key
};
deviceForceAlarmActivation(data).then((res) => {
if (res.code === 200) {
@ -1056,7 +1079,7 @@
const data = {
deviceId: this.deviceInfo.deviceId,
voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1,
mode: this.formData.sta_VoiceType,
mode: item.key,
voiceStrobeAlarm: this.deviceInfo.voiceStrobeAlarm
};
deviceVoiceBroadcast(data).then((res) => {
@ -1506,7 +1529,7 @@
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
showPop(option,this);
},
btnClick() {

View File

@ -1196,7 +1196,7 @@
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed {

View File

@ -1365,7 +1365,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

2302
pages/102J/HBY102J.vue Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1528
pages/210/HBY210Old.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1252,7 +1252,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -748,7 +748,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -263,7 +263,7 @@
baseURL
} from '@/utils/request.js';
import {
showLoading,
showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js';
@ -293,7 +293,7 @@
},
data() {
return {
Status: {
Status: {
pageHide: false,
@ -1912,7 +1912,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
showCancel: true,
okCallback: function() {
console.log("1111");
@ -2858,7 +2858,7 @@
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed {

View File

@ -840,7 +840,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -708,7 +708,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
// console.log("1111");
uni.navigateTo({

View File

@ -688,7 +688,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
// console.log("1111");
uni.navigateTo({

View File

@ -556,7 +556,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
showCancel: true,
okCallback: function() {
console.log("1111");

View File

@ -739,7 +739,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -822,7 +822,7 @@ import request, { baseURL } from '@/utils/request.js';
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
uni.navigateTo({

View File

@ -180,7 +180,7 @@
<view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''">
<view class="imgContent center">
<image class="img"
:src="formData.lightCurr=='close'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
:src="formData.lightCurr=='close'?'/static/images/lightImg/closeLightActive.png':'/static/images/lightImg/closeLight.png'"
mode="aspectFit"></image>
</view>
<view class="txt">关闭</view>
@ -340,7 +340,7 @@
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
buttonTextColor: '#FFFFFFDE',
iconUrl: '',
message: '您确定要这样做吗?',
@ -725,7 +725,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
showCancel: true,
cancelCallback: () => {
// this.closePop();
@ -1178,6 +1178,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -1221,6 +1222,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -1285,7 +1287,8 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -1367,7 +1370,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -1439,7 +1443,8 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -1562,6 +1567,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor:"#FFFFFFde",
okCallback: OpenSOS,
buttonText: "开启"
},these);
@ -1591,6 +1597,7 @@
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -1632,7 +1639,8 @@
message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde"
},these);
}).finally(() => {
@ -2192,7 +2200,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -2313,7 +2322,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -2531,7 +2541,8 @@
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonBgColor: "#E03434",
buttonTextColor: "#FFFFFFde",
okCallback: null,
buttonText: "确定"
},these)
@ -2921,18 +2932,16 @@
}
.usrinfo .btnSend {
line-height: 65rpx;
border-radius: 8px;
width: 120rpx;
height: 65rpx;
color: rgba(35, 35, 35, 0.87);
font-family: PingFang SC;
font-size: 24rpx;
font-weight: 400;
letter-spacing: 0.15rpx;
text-align: center;
background-color: #BBE600;
.usrinfo .btnSend {
background-color: rgb(187, 230, 0);
color: rgba(35, 35, 35, 0.87);
height: 50rpx;
line-height: 50rpx;
border-radius: 16rpx;
font-size: 26rpx;
width: 112rpx;
white-space: nowrap;
text-align: center;
}
.usrinfo .item {
@ -3330,7 +3339,7 @@
.navbarRight .img{
width: 35rpx;
height: 35rpx;
margin-right: 20rpx;
margin-right: 30rpx;
}
.uni-navbar--fixed{
top:0rpx;

View File

@ -628,7 +628,7 @@
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: '去连接',
buttonTextColor: '#232323de',
buttonTextColor: '#FFFFFFde',
okCallback: function() {
console.log("1111");
uni.navigateTo({

View File

@ -357,8 +357,12 @@
device.isTarget = true;
}
}
// 102J与 100J 同 AE30 芯片;协议不同。广播名一般为 HBY102J-xxxxxx见协议
if (device.name && /^HBY102J/i.test(device.name)) {
device.isTarget = true;
}
if (device.name) {
device.name = device.name.replace('JQZM-', '');
device.name = device.name.replace(/^JQZM-/i, '').replace(/^HBY102J-/i, '');
}
these.EquipMents.push(device);
}
@ -399,9 +403,9 @@
return;
}
if (receivData.str.indexOf('mac address:') > -1 || receivData.str.indexOf(
'sta_address') > -1 ||
(receivData.bytes[0] === 0xFC && receivData.bytes.length >= 7)) {
if ((receivData.str && (receivData.str.indexOf('mac address:') > -1 || receivData.str.indexOf(
'sta_address') > -1)) ||
(receivData.bytes && receivData.bytes[0] === 0xFC && receivData.bytes.length >= 7)) {
if (f.macAddress && these.device) {

View File

@ -27,7 +27,7 @@
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<view v-if="deviceList.length>0">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action ref="swipeAction" >
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
<uni-swipe-action-item :right-options="Options"
@click="handleSwipeClick($event, item, index)" class="device-card"
@ -88,6 +88,7 @@
</view>
<!-- 按钮组 -->
<view class="popup-buttons">
<button class="btn cancelBtn" @click="closePopup('delete')">取消</button>
<button class="btn agreeBtn" @click="handleBtn">确定</button>
</view>
</view>
@ -98,14 +99,15 @@
<view class="popup-content">
<view>
<view class="popup-flex">
<text>设备名称</text>
<input type="text" v-model="deviceName" placeholder="请输入设备名称" class="popup-input"
<text>名称</text>
<input type="text" v-model="deviceName" placeholder="请输入名称" class="popup-input"
@click.stop />
</view>
</view>
</view>
<!-- 按钮组 -->
<view class="popup-buttons" style="margin-top:50rpx;">
<button class="btn cancelBtn" @click="closePopup('rename')">取消</button>
<button class="btn agreeBtn4" @click="handleBtnName">确定</button>
</view>
</view>
@ -878,12 +880,25 @@
text-align: center;
/* 文字居中 */
/* 设置最小宽度 */
position: relative;
}
.active {
color: rgba(187, 230, 0, 1);
border-bottom: 6rpx solid rgba(187, 230, 0, 1);
.tab-item.active {
color: #bbe600;
height: 60rpx;
font-weight: bold;
}
.tab-item.active::before{
content: "";
background-color: #bbe600;
position: absolute;
top: 90%;
left:35%;
width: 30%;
height: 6rpx;
border-radius: 6rpx;
}
.sendFlex {
@ -1133,14 +1148,32 @@
border-radius: 40rpx;
padding: 30rpx;
text-align: center;
border: 1px solid rgba(255, 200, 78, 0.3);
border: 1px solid #E034344d;
}
.cancelBtn{
text-align: center;
width: 170rpx !important;
background-color: #00000000;
}
.agreement-popupC .cancelBtn{
border:1rpx solid #E034344d;
color:#E03434;
}
.agreement-popupD .cancelBtn{
border: 1rpx solid rgba(255, 255, 255, 0.6);
color:rgba(255, 255, 255, 0.6);
}
.agreement-popupD {
width: 70%;
width: 75%;
background-color: rgb(42, 42, 42);
border-radius: 40rpx;
padding: 40rpx;
padding: 40rpx 5rpx;
text-align: center;
border: 1px solid rgba(187, 230, 0, 0.3);
}
@ -1162,6 +1195,7 @@
font-size: 28rpx;
text-align: left;
text-indent: 5rpx;
width: calc(100% - 75rpx);
}
.svg {
@ -1182,8 +1216,8 @@
/* 同意按钮 */
.agreeBtn {
background: #FFC84E;
color: #232323;
background: #E03434;
color: #FFFFFF;
border: none;
width: 170rpx !important;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -2,6 +2,9 @@ import Common from '@/utils/Common.js'
import {
parseBleData
} from '@/api/100J/HBY100-J.js'
import {
parseHby102jUplink
} from '@/api/102J/hby102jBleProtocol.js'
import {
MsgSuccess,
MsgError,
@ -14,7 +17,9 @@ import {
class BleReceive {
constructor(_ref) {
this.ref = _ref;
if(_ref){
this.ref = _ref;
}
this.StorageKey = "linkedDevices";
this.HandlerMap = {
'/pages/6155/deviceDetail': this.Receive_6155.bind(this),
@ -25,9 +30,11 @@ class BleReceive {
'/pages/4877/BJQ4877': this.Receive_4877.bind(this),
'/pages/100/HBY100': this.Receive_100.bind(this),
'/pages/102/HBY102': this.Receive_102.bind(this),
'/pages/102J/HBY102J': this.Receive_102J.bind(this),
'/pages/6170/deviceControl/index': this.Receive_6170.bind(this),
'/pages/100J/HBY100-J': this.Receive_100J.bind(this),
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this)
'/pages/6075J/BJQ6075J': this.Receive_6075.bind(this),
'/pages/210/HBY210':this.Receive_210.bind(this),
};
}
@ -63,15 +70,24 @@ class BleReceive {
ReceiveData(receive, f, path, recArr) {
// 100J首页等场景 LinkedList 项可能未带齐 mac/device但语音分片上传依赖 parseBleData 消费 FB 05
// AE30 服务100J 与 102J 为同一套蓝牙芯片GATT 相同),应用层协议不同。
// 100Jf 未就绪时仍需 parseBleData 消费 FB 05 等语音/文件应答。
// 102J上行 FB 2128 为晶全协议,不得走 100J parseBleData避免误触发语音/文件回调。
const sid = receive && receive.serviceId ? String(receive.serviceId) : '';
const is100JAe30 = /ae30/i.test(sid);
const isAe30 = /ae30/i.test(sid);
const fReady = f && f.macAddress && f.device && f.device.id;
if (is100JAe30 && receive && receive.bytes && receive.bytes.length >= 3 && !fReady) {
try {
parseBleData(new Uint8Array(receive.bytes));
} catch (e) {
console.warn('[100J] ReceiveData 兜底解析失败', e);
const u8Early = receive && receive.bytes && receive.bytes.length >= 4
? new Uint8Array(receive.bytes)
: null;
const is102JFbControl = u8Early && u8Early[0] === 0xfb && u8Early[u8Early.length - 1] === 0xff
&& u8Early[1] >= 0x21 && u8Early[1] <= 0x28;
if (isAe30 && receive && receive.bytes && receive.bytes.length >= 3 && !fReady) {
if (!is102JFbControl) {
try {
parseBleData(new Uint8Array(receive.bytes));
} catch (e) {
console.warn('[100J/AE30] ReceiveData 兜底 parseBleData 失败', e);
}
}
return receive;
}
@ -100,8 +116,8 @@ class BleReceive {
}
} else {
// 100J AE30 二进制帧在 f 不完整时已在上方 parseBleData,此处不再误报「无法处理」
if (!is100JAe30) {
// AE30100J 在 f 不完整时已在上方 parseBleData102J 控制帧被有意跳过 parseBleData
if (!isAe30) {
console.error("已收到该消息,但无法处理", receive, "f:", f);
}
}
@ -941,6 +957,147 @@ class BleReceive {
}
Receive_102J(receive, f, path, recArr) {
let receiveData = {}
try {
if (receive && receive.bytes && receive.bytes.length >= 3) {
receiveData = parseHby102jUplink(new Uint8Array(receive.bytes))
}
let recCnt = recArr.find((v) => {
return v.key.replace(/\//g, '').toLowerCase() == f.device.detailPageUrl
.replace(/\//g, '').toLowerCase()
})
if (!recCnt) {
let msgs = []
if (receiveData.sta_PowerPercent <= 20 && receiveData.sta_charge == 0) {
msgs.push("设备'" + f.device.deviceName + "'电量低")
}
if (receiveData.sta_Intrusion === 1) {
msgs.push("设备'" + f.device.deviceName + "'闯入报警中")
}
if (this.ref && msgs.length > 0) {
const text = msgs.join(',')
MsgError(text, '', this.ref, () => {
MsgClear(this.ref)
})
}
}
if (f.device && path === 'pages/common/index') {
let linkKey = '102J_' + f.device.id + '_linked'
let warnKey = '102J_' + f.device.id + '_warning'
let time = new Date()
if (receiveData.sta_tomac) {
if (receiveData.sta_tomac.indexOf(':') === -1) {
receiveData.sta_tomac = receiveData.sta_tomac.replace(/(.{2})/g, '$1:').slice(0, -1)
}
uni.getStorageInfo({
success: function(res) {
let arr = []
let linked = {
linkId: f.linkId,
read: false,
linkEqs: [{
linkTime: time,
linkMac: f.macAddress
}, {
linkTime: time,
linkMac: receiveData.sta_tomac
}]
}
if (res.keys.includes(linkKey)) {
arr = uni.getStorageSync(linkKey)
}
if (arr.length === 0) {
arr.unshift(linked)
} else {
let dev = arr.find((v) => {
if (v.linkId === f.linkId) {
let vl = v.linkEqs.find((cvl) => {
if (cvl.linkMac === receiveData.sta_tomac) {
v.read = false
cvl.linkTime = time
return true
}
return false
})
if (!vl) {
v.linkEqs.push({
linkTime: time,
linkMac: receiveData.sta_tomac
})
}
return vl
}
return false
})
if (!dev) {
arr.unshift(linked)
}
}
uni.setStorage({
key: linkKey,
data: arr
})
}
})
}
let warnArrs = []
let guid = Common.guid()
if (receiveData.sta_sosadd) {
if (receiveData.sta_sosadd.indexOf(':') === -1) {
receiveData.sta_sosadd = receiveData.sta_sosadd.replace(/(.{2})/g, '$1:').slice(0, -1)
}
warnArrs.push({
linkId: f.linkId,
read: false,
key: guid,
warnType: '闯入报警',
warnMac: receiveData.sta_sosadd,
warnTime: time,
warnName: ''
})
}
if (receiveData.sta_LedType === 'led_alarm' || receiveData.ins_LedType === 'led_alarm') {
warnArrs.push({
linkId: f.linkId,
read: false,
key: guid,
warnType: '强制报警',
warnMac: f.macAddress,
warnTime: time,
warnName: ''
})
}
if (warnArrs.length > 0) {
uni.getStorageInfo({
success: function(res) {
let arr = []
if (res.keys.includes(warnKey)) {
arr = uni.getStorageSync(warnKey)
arr = warnArrs.concat(arr)
} else {
arr = warnArrs
}
uni.setStorage({
key: warnKey,
data: arr
})
}
})
}
}
} catch (error) {
receiveData = {}
console.log('Receive_102J 解析失败', error)
}
return receiveData
}
Receive_6075(receive, f, path, recArr) {
let receiveData = {};
@ -970,6 +1127,34 @@ class BleReceive {
return receiveData;
}
Receive_210(receive, f, path, recArr) {
let receiveData = {};
try {
receiveData = JSON.parse(receive.str);
let recCnt = recArr.find(v => {
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
.replace(/\//g, "").toLowerCase();
});
if (!recCnt && this.ref) {
if (receiveData.sta_PowerPercent <= 20 && (receiveData.sta_system != 3 || receiveData.sta_system !=1)) {
MsgError("设备'" + f.device.deviceName + "'电量低", '', this.ref, () => {
MsgClear(this.ref);
});
}
}
} catch (error) {
receiveData = {};
console.log("文本解析失败", error)
}
return receiveData;
}
}

View File

@ -2,7 +2,8 @@ var MsgType = {
error: "error",
succ: "succ",
warn: "warn",
info:'info'
info:'info',
prompt:'prompt'
}
var time = null;
// 显示成功
@ -74,6 +75,26 @@ export const MsgInfo = (msg, btnTxt, ev, isClear,btnCallback) => {
return option;
}
//显示捕获窗口,用于自定义弹窗内容
export const MsgPrompt = ( ev,refName, btnCallback,isClear) => {
if (!ev) {
return null;
}
if (!ev.$refs[refName]) {
return null;
}
let option = ev.$refs[refName].showMsg("", "", MsgType.prompt,btnCallback);
if (isClear === undefined || isClear) {
createClear(ev);
}
return option;
}
// 隐藏loading