new-20250827 蓝牙设备添加分享功能 #31

Merged
dyf merged 4 commits from liubiao/APP:new-20250827 into main 2026-01-30 13:35:03 +08:00
12 changed files with 1458 additions and 311 deletions

View File

@ -156,7 +156,8 @@
{
"path": "pages/6155/deviceDetail",
"style": {
"navigationBarTitleText": "HBY 6155"
"navigationBarTitleText": "HBY 6155",
"navigationStyle": "custom"
}
},
{
@ -239,7 +240,8 @@
{
"path": "pages/650/HBY650",
"style": {
"navigationBarTitleText": "HBY650"
"navigationBarTitleText": "HBY650",
"navigationStyle": "custom"
}
},
{
@ -251,7 +253,8 @@
{
"path": "pages/7305/BJQ7305",
"style": {
"navigationBarTitleText": "BJQ7305"
"navigationBarTitleText": "BJQ7305",
"navigationStyle": "custom"
}
},
{
@ -264,13 +267,15 @@
{
"path": "pages/4877/BJQ4877",
"style": {
"navigationBarTitleText": "BJQ 4877"
"navigationBarTitleText": "BJQ 4877",
"navigationStyle": "custom"
}
},
{
"path": "pages/100/HBY100",
"style": {
"navigationBarTitleText": "HBY 100"
"navigationBarTitleText": "HBY 100",
"navigationStyle": "custom"
}
},
{
@ -375,7 +380,8 @@
"path" : "pages/6155/BJQ6155",
"style" :
{
"navigationBarTitleText" : "BJQ6155"
"navigationBarTitleText" : "BJQ6155",
"navigationStyle": "custom"
}
},
{

View File

@ -1,5 +1,26 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -243,7 +264,7 @@
<global-loading ref="loading" />
</view>
</view>
</view>
</template>
<script>
@ -255,7 +276,9 @@
hideLoading,
updateLoading
} from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js';
import request, {
baseURL
} from '@/utils/request.js';
import Common from '@/utils/Common.js'
const pagePath = "/pages/100/HBY100";
@ -271,6 +294,16 @@ import request, { baseURL } from '@/utils/request.js';
data() {
return {
Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'HBY100'
},
curr: 0,
total: 0,
pageHide: false,
@ -464,7 +497,7 @@ import request, { baseURL } from '@/utils/request.js';
detailPageUrl: "/pages/650/HBY650",
showConfirm: false
},
permissions: [],
audioData: {
packetCtn: 0,
hexs: []
@ -496,6 +529,17 @@ import request, { baseURL } from '@/utils/request.js';
// console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
these.Status.navbar.title = device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
// console.log("找到设备了", v);
@ -544,8 +588,49 @@ import request, { baseURL } from '@/utils/request.js';
},
methods: {
audioManager() {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '100'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
audioManager() {
if (!this.permissions.includes('52') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
uni.navigateTo({
url: '/pages/common/audioManager/AudioList',
events: {
@ -860,6 +945,19 @@ import request, { baseURL } from '@/utils/request.js';
}, 100);
},
lightTypeSet(item, index) {
if (!this.permissions.includes('51') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
// #ifdef APP-PLUS
if (!f) {
@ -899,6 +997,20 @@ import request, { baseURL } from '@/utils/request.js';
this.Status.usrToggle = !this.Status.usrToggle;
},
openVolume(item, index) {
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
// #ifdef APP-PLUS
if (!f) {
@ -950,6 +1062,20 @@ import request, { baseURL } from '@/utils/request.js';
});
},
sosSetting(item, isOk) {
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (item === 0 && this.formData.sta_SOSType === item) {
return;
}
@ -1115,7 +1241,7 @@ import request, { baseURL } from '@/utils/request.js';
let json = recei.ReceiveData(receive, device, pagePath, recArr);
console.log("收到设备的数据", json)
console.log("收到设备的数据", json)
let key = 'sta_VoiceDate';
if (key in json) {
@ -2102,4 +2228,71 @@ import request, { baseURL } from '@/utils/request.js';
letter-spacing: 0.07px;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>

View File

@ -1,5 +1,25 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -276,6 +296,7 @@
updateLoading
} from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js';
import Common from '@/utils/Common.js';
import {
colors as groupColors
} from '@/api/4877/BJQ4877.js';
@ -294,6 +315,16 @@ import request, { baseURL } from '@/utils/request.js';
data() {
return {
Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'BJQ4877'
},
ShowEditChannel: false,
pageHide: false,
Pop: {
@ -355,6 +386,7 @@ import request, { baseURL } from '@/utils/request.js';
},
usrToggle: true,
},
permissions: [],
formData: {
img: '/static/images/common/BJQ4877.png',
sta_PowerPercent: '',
@ -446,7 +478,21 @@ import request, { baseURL } from '@/utils/request.js';
eventChannel.on('detailData', function(data) {
// console.log("收到父页面的参数:" + JSON.stringify(data));
let device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
these.Status.navbar.title = device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id);
if (checkIds && checkIds.length) {
let groups = groupColors.filter(v => {
@ -462,8 +508,7 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.groups = groups;
}
var device = data.data;
these.device = device;
let arr = [{
topic: 'C/4877_Groups_' + these.device.id,
@ -531,6 +576,36 @@ import request, { baseURL } from '@/utils/request.js';
},
methods: {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '4877'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
getChannel(rec) {
console.error("收到MQ信道保留消息:", rec);
try {
@ -580,6 +655,20 @@ import request, { baseURL } from '@/utils/request.js';
},
ShowChannelEdit() {
if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
this.Status.ShowEditChannel = true;
this.showPop({
showPop: true, //是否显示弹窗
@ -647,6 +736,20 @@ import request, { baseURL } from '@/utils/request.js';
},
ArrowModeSet(val) {
if (!this.permissions.includes('53') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警")
return;
@ -697,7 +800,18 @@ import request, { baseURL } from '@/utils/request.js';
});
},
groupCheck() {
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
uni.navigateTo({
url: '/pages/4877/BJQ4877CheckColor',
events: {
@ -768,6 +882,20 @@ import request, { baseURL } from '@/utils/request.js';
// });
},
groupSetting(item, index) {
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警")
return;
@ -814,7 +942,18 @@ import request, { baseURL } from '@/utils/request.js';
},
sosSetting(item, index) {
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
@ -2063,4 +2202,73 @@ import request, { baseURL } from '@/utils/request.js';
text-align: center;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>

View File

@ -1,5 +1,26 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}" @click.stop="handleRightClick(item,index)"
v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -168,6 +189,7 @@
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
import bleTool from '@/utils/BleHelper.js';
import usrApi from '@/api/670/HBY670.js'
import Common from '@/utils/Common.js';
import {
showLoading,
hideLoading,
@ -192,6 +214,16 @@
data() {
return {
Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType:'listA'
}],
title: 'BJQ6155'
},
lightMode: {
},
@ -276,6 +308,7 @@
},
videoHexArray: [],
rgb565Data: [],
permissions: [],
dic: {
menuItems: [{
text: '强光',
@ -325,52 +358,7 @@
these = this;
recei = BleReceive.getBleReceive();
ble = bleTool.getBleTool();
// let bleName = 'FB_Site_UART'; //JQZM-EF4651 FB_Site_UART
// let f = ble.data.LinkedList.find((v) => {
// if (v.name == bleName) {
// console.log("找到设备了", v);
// these.formData.deviceId = v.deviceId;
// return true;
// }
// return false;
// });
// let link = () => {
// if (bleName == 'FB_Site_UART') {
// ble.LinkBlue(f.deviceId, '0000AE30-0000-1000-8000-00805F9B34FB',
// '0000AE03-0000-1000-8000-00805F9B34FB', '0000AE02-0000-1000-8000-00805F9B34FB');
// } else {
// ble.LinkBlue(f.deviceId, '0000FFE0-0000-1000-8000-00805F9B34FB',
// '0000FFE1-0000-1000-8000-00805F9B34FB', '0000FFE2-0000-1000-8000-00805F9B34FB');
// }
// }
// if (!f) {
// ble.addDeviceFound((res) => {
// // console.log("发现新设备", res);
// f = res.devices.find((v) => {
// return v.name == bleName;
// });
// if (f) {
// console.log("找到目标设备了", f);
// these.formData.deviceId = f.deviceId;
// link();
// ble.StopSearch();
// }
// });
// ble.StartSearch();
// } else {
// link();
// }
console.log("6155");
ble.addReceiveCallback(these.bleValueNotify, pagePath);
ble.addStateBreakCallback(these.bleStateBreak, pagePath);
ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath);
@ -384,7 +372,17 @@
let device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
these.Status.navbar.title=device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v);
@ -441,6 +439,36 @@
},
methods: {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '6155'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
getMode(type) {
let txt = "关闭";
@ -869,6 +897,18 @@
},
UploadOpenVideo: function() { //开机动画
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = these.getDevice();
if (!f) {
@ -1215,6 +1255,18 @@
},
UploadOpenImg: function() {
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
//上传开机画面
this.Status.BottomMenu.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面";
@ -1259,6 +1311,18 @@
this.Status.BottomMenu.show = false;
},
btnClick(item, index) {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (parseInt(this.Status.BottomMenu.activeIndex) === NaN) {
uni.showToast('请选择模式');
@ -1440,6 +1504,18 @@
these.Status.Pop.showPop = true;
},
sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
if (!f) {
these.showBleUnConnect()
@ -1669,6 +1745,19 @@
},
sliderChange: function(evt) {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
if (!f) {
these.showBleUnConnect()
@ -1716,8 +1805,8 @@
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(res => {
this.setBleFormData();
}).catch(err=>{
}).catch(err => {
});
}
@ -2163,4 +2252,70 @@
left: -99999rpx;
visibility: hidden;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>

View File

@ -1,5 +1,27 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -167,7 +189,8 @@
<script>
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
import bleTool from '@/utils/BleHelper.js';
import usrApi from '@/api/670/HBY670.js'
import usrApi from '@/api/670/HBY670.js';
import Common from '@/utils/Common.js';
import {
showLoading,
hideLoading,
@ -192,7 +215,18 @@
data() {
return {
Status: {
pageHide: false,
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'BJQ6155'
},
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
@ -260,10 +294,11 @@
deviceId: '',
textLines: ['', '', ''],
mode: '',
light:null,
light: null,
bleStatu: ''
},
inteval: 80,
permissions: [],
device: {
id: "",
deviceName: "",
@ -293,52 +328,8 @@
these = this;
recei = BleReceive.getBleReceive();
ble = bleTool.getBleTool();
// let bleName = 'FB_Site_UART'; //JQZM-EF4651 FB_Site_UART
// let f = ble.data.LinkedList.find((v) => {
// if (v.name == bleName) {
// console.log("找到设备了", v);
// these.formData.deviceId = v.deviceId;
// return true;
// }
// return false;
// });
// let link = () => {
// if (bleName == 'FB_Site_UART') {
// ble.LinkBlue(f.deviceId, '0000AE30-0000-1000-8000-00805F9B34FB',
// '0000AE03-0000-1000-8000-00805F9B34FB', '0000AE02-0000-1000-8000-00805F9B34FB');
// } else {
// ble.LinkBlue(f.deviceId, '0000FFE0-0000-1000-8000-00805F9B34FB',
// '0000FFE1-0000-1000-8000-00805F9B34FB', '0000FFE2-0000-1000-8000-00805F9B34FB');
// }
// }
// if (!f) {
// ble.addDeviceFound((res) => {
// // console.log("发现新设备", res);
// f = res.devices.find((v) => {
// return v.name == bleName;
// });
// if (f) {
// console.log("找到目标设备了", f);
// these.formData.deviceId = f.deviceId;
// link();
// ble.StopSearch();
// }
// });
// ble.StartSearch();
// } else {
// link();
// }
console.log("6155");
ble.addReceiveCallback(these.bleValueNotify, pagePath);
ble.addStateBreakCallback(these.bleStateBreak, pagePath);
ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath);
@ -352,7 +343,16 @@
let device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v);
@ -422,6 +422,36 @@
},
methods: {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '6155'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
getMode(type) {
let txt = "关闭";
@ -441,16 +471,16 @@
}
break;
case 2:
if (type == 'main' && this.formData.mode == 'main') {
txt = "爆闪";
}
if (type == 'main' && this.formData.mode == 'main') {
txt = "爆闪";
}
break;
case 3:
if (type == 'main' && this.formData.mode == 'main') {
txt = "关闭";
}
if (type == 'main' && this.formData.mode == 'main') {
txt = "关闭";
}
break;
default:
txt = "关闭";
@ -899,6 +929,19 @@
},
UploadOpenVideo: function() { //开机动画
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = these.getDevice();
if (!f) {
@ -1276,6 +1319,18 @@
},
UploadOpenImg: function() {
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
//上传开机画面
this.Status.BottomMenu.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面";
@ -1284,7 +1339,7 @@
},
ModeSetting: function(type) {
let items = [];
let title = '';
@ -1326,16 +1381,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;
}
if (this.formData.mode != type) {
this.Status.BottomMenu.activeIndex = null;
}
},
showMenu(flag) {
this.Status.BottomMenu.show = true;
@ -1344,7 +1399,18 @@
this.Status.BottomMenu.show = false;
},
btnClick(item, index) {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (parseInt(this.Status.BottomMenu.activeIndex) === NaN) {
uni.showToast('请选择模式');
return;
@ -1522,6 +1588,20 @@
these.Status.Pop.showPop = true;
},
sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
if (!f) {
these.showBleUnConnect()
@ -1675,6 +1755,20 @@
clearTimeout(BrighInteval)
//给蓝牙设备发送信号更新亮度
BrighInteval = setTimeout(() => {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
this.sendBrightness();
this.setBleFormData();
}, 100);
@ -1699,49 +1793,8 @@
}
},
//获取当前设备状态
GetDeviceStatu: function() {
//数据头 命令码 数据 校验码
//JQOC 0B 00 9C41
//硬件响应
//数据头 命令码 主灯模式 副灯模式 亮度(%) 电量(%) 充电状态 校验码
//JQOC 0B 01 01 64 85 01 9C41
this.sendCmd('0x0B');
},
//设备重启
DeviceReStart: function() {
//数据头 命令码 数据 校验码
//JQOC 0C 01 9C412
this.sendCmd('0x0C');
},
//恢复出厂设置
DeviceReSet: function() {
//数据头 命令码 数据 校验码
//JQOC 0D 01 9C412
this.sendCmd('0x0D');
},
sendCmd: function(type, callback) {
//数据头 命令码 数据 校验码
const buffer = new ArrayBuffer(7);
const dataView = new DataView(buffer);
let data = '0x' + parseInt(this.formData.liangDu).toString(16);
console.log("亮度:" + this.formData.liangDu + ',16进制:' + data);
dataView.setUint8(0, 'JQOC'); // 帧头
dataView.setUint8(1, type); // 帧类型:亮度调节
dataView.setUint8(2, '0x01'); // 包序号
dataView.setUint8(3, '9C41'); // 数据长度
let f = this.getDevice();
if (f) {
// 发送数据
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30);
}
}
}
@ -2178,4 +2231,70 @@
left: -99999rpx;
visibility: hidden;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>

View File

@ -1,5 +1,26 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -184,6 +205,7 @@
import gbk from '@/utils/gbk.js'
import BleTool from '@/utils/BleHelper.js'
import BleReceive from '@/utils/BleReceive';
import Common from '@/utils/Common.js'
import {
showLoading,
hideLoading,
@ -201,6 +223,16 @@ import request, { baseURL } from '@/utils/request.js';
data() {
return {
Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'HBY650'
},
pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
@ -282,6 +314,7 @@ import request, { baseURL } from '@/utils/request.js';
},
rgb565Data: [],
videoHexArray: [],
permissions: [],
device: {
id: "",
deviceName: "",
@ -328,6 +361,17 @@ import request, { baseURL } from '@/utils/request.js';
// console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
these.Status.navbar.title = device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
// console.log("找到设备了", v);
@ -393,6 +437,36 @@ import request, { baseURL } from '@/utils/request.js';
}
},
methods: {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '650'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
deviceRecovry(res) {
if (this.Status.pageHide) {
return;
@ -616,6 +690,20 @@ import request, { baseURL } from '@/utils/request.js';
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList);
},
MainModeSetting: function(type, byteType) {
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
if (this.formData.modeCurr == type) {
type = 'close';
}
@ -741,7 +829,18 @@ import request, { baseURL } from '@/utils/request.js';
});
},
LampToggle: function() {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
this.formData.cMode = !this.formData.cMode;
this.MainModeSetting(this.formData.cMode, "lamp");
},
@ -1238,6 +1337,19 @@ import request, { baseURL } from '@/utils/request.js';
},
ShowUpload: function() {
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
//上传开机画面
this.Status.BottomMenu.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面";
@ -1345,7 +1457,18 @@ import request, { baseURL } from '@/utils/request.js';
},
sendUsr: function(ReSendNo) {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
var textLines = [
this.formData.company,
@ -2111,4 +2234,71 @@ import request, { baseURL } from '@/utils/request.js';
.net.active {
background: #FFFFFF !important;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>

View File

@ -15,6 +15,9 @@
</block>
</uni-nav-bar>
<view class="eq" :style="{marginTop:Status.navbar.height+'px'}">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
@ -3346,4 +3349,8 @@
.uni-navbar--fixed{
top:0rpx;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
</style>

View File

@ -1,5 +1,25 @@
<template>
<view class="content contentBg">
<uni-nav-bar class="nvbar" leftIcon="left" @clickLeft="navigatorBack">
<view slot="left">
<uni-icons type="back" size="23" color="#FFFFFF"></uni-icons>
</view>
<view slot="default" class="center uninavebartext">
{{Status.navbar.title}}
</view>
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}" @click.stop="handleRightClick(item,index)"
v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -162,7 +182,7 @@
updateLoading
} from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive';
import Common from '@/utils/Common.js';
var ble = null;
var these = null;
@ -176,6 +196,16 @@
data() {
return {
Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType:'listA'
}],
title: 'BJQ6155'
},
pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
@ -265,7 +295,8 @@
alarmStatus: null,
detailPageUrl: "/pages/6155/deviceDetail",
showConfirm: false
}
},
permissions: []
}
},
@ -289,7 +320,17 @@
let device = data.data;
these.device = device;
these.Status.apiType = data.apiType;
these.Status.navbar.title=device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
if (res.data.permission) {
these.permissions = res.data.permission.split(',');
}
}
});
}
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v);
@ -384,6 +425,36 @@
}
},
methods: {
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
} else {
uni.showModal({
content: '敬请期待'
})
}
},
navigatorBack() {
uni.navigateBack();
},
gotoShare(item, s) {
uni.navigateTo({
url: '/pages/common/share/index',
events: {
ack: function(data) {}
},
success: (res) => {
let json = {
persissonType: '7305'
};
Object.assign(json, this.device);
res.eventChannel.emit('share', {
data: json
});
}
})
},
deviceRecovry(res) {
if (this.Status.pageHide) {
return;
@ -815,6 +886,19 @@
});
},
UploadOpenImg: function() {
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
//上传开机画面
this.Status.BottomMenu.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面";
@ -822,7 +906,18 @@
this.Status.BottomMenu.show = true;
},
ModeSetting: function(type) {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
this.formData.mode = type;
let items = [];
let title = '';
@ -1055,6 +1150,18 @@
these.Status.Pop.showPop = true;
},
sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
let f = this.getDevice();
if (!f) {
these.showBleUnConnect()
@ -1258,6 +1365,19 @@
clearTimeout(BrighInteval)
//给蓝牙设备发送信号更新亮度
BrighInteval = setTimeout(() => {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
return;
}
this.sendBrightness();
this.setBleFormData();
}, 100);
@ -1776,4 +1896,71 @@
left: -99999rpx;
visibility: hidden;
}
.navbarRight {
width: 40px;
height: 100%;
}
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
.navbarRight .imgContent:first-child {
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
right: -15rpx;
top: -15rpx;
border-radius: 50%;
background: #f12828;
color: #ffffff;
font-family: 'PingFang SC';
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
.nvbar {
top: 0px;
}
/deep/ .uni-navbar--fixed {
top: 0px;
}
.uninavebartext {
width: 100%;
font-size: 32rpx;
}
</style>

View File

@ -120,7 +120,7 @@
var ble = null;
var these = null;
var eventChannel = null;
export default {
data() {
return {
@ -164,9 +164,9 @@
}
},
computed: {
deviceCnt:function(){
let arr=this.EquipMents.filter(item=>{
return item.name.toLowerCase().indexOf(this.search.toLowerCase())>-1;
deviceCnt: function() {
let arr = this.EquipMents.filter(item => {
return item.name.toLowerCase().indexOf(this.search.toLowerCase()) > -1;
});
return arr.length;
}
@ -183,10 +183,23 @@
}
},
onLoad(option) {
debugger;
eventChannel = this.getOpenerEventChannel();
eventChannel.on('detailData', function(rec) {
console.log("接收到父页面的参数:", rec);
these.device = rec.data;
if (rec.data.bluetoothName) {
these.search = rec.data.bluetoothName;
}else if(rec.data.deviceName){
these.search = rec.data.deviceName;
}
startValidDevice();
});
let search = option.search;
these = this;
eventChannel = this.getOpenerEventChannel();
const systemInfo = uni.getSystemInfoSync();
ble = bleTool.getBleTool(); // Ensure ble is initialized
@ -226,36 +239,36 @@
"linkStatu": false
},
{
"RSSI": -55,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
"name": "HBY670-BF74EA",
"linkStatu": false
},
{
"RSSI": -61,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
"name": "EF4651",
"linkStatu": false,
"isTarget": true
},
{
"RSSI": -69,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
"name": "4877-BF743D",
"linkStatu": false
},{
"RSSI": -55,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
"name": "HBY670-BF74EA",
"linkStatu": false
},
{
"RSSI": -61,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
"name": "EF4651",
"linkStatu": false,
"isTarget": true
},
{
"RSSI": -69,
"advertisData": "",
"advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB"
],
"deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
"name": "4877-BF743D",
"linkStatu": false
}, {
"RSSI": -55,
"advertisData": "",
"advertisServiceUUIDs": [
@ -320,14 +333,17 @@
if (these.Status.isPageHidden) {
return;
}
console.log("处理蓝牙断开连接");
hideLoading(these);
// console.log("处理蓝牙断开连接");
these.PairEquip.find(function(v, ind) {
these.PairEquip.splice(ind, 1);
return v.deviceId == res.deviceId;
});
setTimeout(() => {
hideLoading(these);
}, 1500);
}, pagePath);
@ -378,8 +394,8 @@
}
these.EquipMents.push(device);
}
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI);//信号好的排前面,一般信号好的是目标设备
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
}
}, pagePath);
}
@ -418,19 +434,17 @@
//收到设备的消息回调
ble.addReceiveCallback((receivData, f, path, arr) => {
console.log("000000",receivData);
console.log("000000", receivData);
if (these.Status.isPageHidden) {
return;
}
if(receivData.bytes[0]===0xFC && receivData.hexs.length>=7){
console.log("22222222");
}
if(receivData.str.indexOf('mac address:')>-1 || receivData.str.indexOf('sta_address')>-1
|| (receivData.bytes[0]===0xFC && receivData.bytes.length>=7))
{
console.log("1111111");
if (receivData.str.indexOf('mac address:') > -1 || receivData.str.indexOf(
'sta_address') > -1 ||
(receivData.bytes[0] === 0xFC && receivData.bytes.length >= 7)) {
if (f.macAddress && these.device) {
console.log("222222");
clearInterval(this.Status.intval);
this.Status.intval = null;
this.Status.time = null;
@ -450,16 +464,7 @@
StartSubsrib();
eventChannel.on('detailData', function(rec) {
console.log("接收到父页面的参数:", rec);
these.device = rec.data;
if (rec.data.bluetoothName) {
these.search = rec.data.bluetoothName.replace('JQZM-', '');
}
startValidDevice();
});
},
@ -508,8 +513,8 @@
});
},
async refreshBleList() {
const systemInfo = uni.getSystemInfoSync();
if (systemInfo.uniPlatform == 'web') {
return;
@ -528,42 +533,42 @@
return;
}
}
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
console.log(`Requesting disconnect for ${device.deviceId}`);
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
});
}
Promise.allSettled(disconnectPromises).finally(() => {
these.EquipMents = [];
these.PairEquip = [];
ble.StartSearch().then(result => {
console.log("Fresh scan started successfully.");
}).catch(err => {
console.error("Failed to start fresh scan:", err);
if (err.code === 10001) {
these.showOpenSetting();
} else {
uni.showModal({
title: '提示',
content: '开始搜索失败:' + err.msg
});
}
});
ble.StopSearch().finally(() => {
let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => {
console.log(`Requesting disconnect for ${device.deviceId}`);
disconnectPromises.push(ble.disconnectDevice(device.deviceId));
});
}
Promise.allSettled(disconnectPromises).finally(() => {
these.EquipMents = [];
these.PairEquip = [];
ble.StartSearch().then(result => {
console.log("Fresh scan started successfully.");
}).catch(err => {
console.error("Failed to start fresh scan:", err);
if (err.code === 10001) {
these.showOpenSetting();
} else {
uni.showModal({
title: '提示',
content: '开始搜索失败:' + err.msg
});
}
});
});
});
},
isItemLink: function(item, index) {
let src = '/static/images/BLEAdd/noLink.png';
@ -614,28 +619,71 @@
}
}
console.log("f=", f);
if (f && f.macAddress) {
if (f.macAddress != these.device.deviceMac) {
removeLink();
updateLoading(these, {
text: "设备Mac地址错误,请重选设备连接"
});
setTimeout(() => {
hideLoading(these);
}, 1000)
return;
} else {
}
//不是目标设备的处理方法
let deviceInvalid = () => {
console.error("连接的设备不是目标设备");
removeLink();
updateLoading(these, {
text: "设备Mac地址错误,请重选设备连接"
});
setTimeout(() => {
hideLoading(these);
}, 1500)
return;
}
//找到目标设备的处理方法
let deviceOK = () => {
hideLoading(these);
eventChannel.emit('BindOver', these.device);
ble.updateCache();
uni.navigateBack();
}
if (f && f.macAddress) {
if (!this.device.deviceMac) { //走服务端验证
console.error("走服务端验证")
request({
url: '/app/device/getDeviceInfoByDeviceMac',
method: 'GET',
data: {
deviceMac: f.macAddress
}
}).then(res => {
if (res && res.code == 200) {
let data = res.data;
//服务端验证要验证id而不是mac地址了
if (data.id != these.device.id) {
deviceInvalid();
return;
} else {
deviceOK();
}
} else {
this.serverDevice = null;
deviceInvalid();
}
}).catch((ex) => {
deviceInvalid();
});
return;
} else if (f.macAddress != these.device.deviceMac) { //直接验证上层传过来的数据
console.log("客户端验证失败");
deviceInvalid();
return;
}
else if (f.macAddress == these.device.deviceMac){
console.log("客户端验证成功");
deviceOK();
}
return true;
} else {
@ -664,14 +712,8 @@
return false;
});
if (!(f && f.macAddress)) {
removeLink();
updateLoading(these, {
text: "出现错误,未收到设备Mac地址"
});
setTimeout(() => {
hideLoading(these)
}, 1500);
deviceInvalid()
return;
}
return;
}
@ -1113,20 +1155,20 @@
-webkit-filter: none !important;
}
.uni-input{
.uni-input {
background-color: #121212;
width:100%;
width: 100%;
height: 60rpx;
color: #ffffffde;
border:1rpx solid #cbcbcbde;
border: 1rpx solid #cbcbcbde;
border-radius: 8rpx;
font-size: 26rpx;
text-indent: 8rpx;
font-family: "PingFang SC";
line-height: 60rpx;
caret-color:#BBE600;
caret-color: #BBE600;
font-weight: 200;
}
</style>

View File

@ -783,31 +783,31 @@ import BleReceive from '@/utils/BleReceive';
recei = BleReceive.getBleReceive();
//蓝牙连接成功的回调
ble.addRecoveryCallback((res) => {
console.log("蓝牙连接成功的回调");
// console.log("蓝牙连接成功的回调");
this.bleRecovery(res);
}, pagePath);
//蓝牙断开连接的回调
ble.addDisposeCallback((res) => {
console.log("蓝牙断开连接的回调");
// console.log("蓝牙断开连接的回调");
this.bleBreak(res);
}, pagePath);
//蓝牙适配器恢复可用的回调,一般是重连设备
ble.addStateRecoveryCallback(res => {
console.log("蓝牙适配器恢复可用的回调");
// console.log("蓝牙适配器恢复可用的回调");
this.bleStateRecovery();
}, pagePath);
//蓝牙适配器不可用的回调
ble.addStateBreakCallback(res => {
console.error("蓝牙适配器不可用的回调");
// console.error("蓝牙适配器不可用的回调");
this.bleStateBreak();
}, pagePath);
//接收到消息的回调
ble.addReceiveCallback((receive, device, path, recArr) => {
console.error("首页收到消息了");
// console.error("首页收到消息了");
recei.ReceiveData(receive, device, path, recArr);
this.updateBleStatu();
}, pagePath);

View File

@ -160,7 +160,7 @@ class BleHelper {
} else {
if (bleId && item.deviceId == bleId) {
console.error("找到要删除的设备1,", item)
// console.error("找到要删除的设备1,", item)
this.data.LinkedList.splice(i, 1);
this.disconnectDevice(item.deviceId);
flag = true;
@ -896,12 +896,12 @@ class BleHelper {
return;
}
}
console.log("蓝牙连接状态变化了", res);
// console.log("蓝牙连接状态变化了", res);
clearTimeout(stateTimeout);
stateTimeout=setTimeout(() => {
if (!res.connected) {
console.error("蓝牙已断开", res);
// console.error("蓝牙已断开", res);
let f = this.data.LinkedList.find((
v) => {
if (v.deviceId == res
@ -939,7 +939,7 @@ class BleHelper {
(c) => {
try {
c.callback(res);
console.log("执行蓝牙断开连接的回调成功");
// console.log("执行蓝牙断开连接的回调成功");
} catch (error) {
console.error(
"执行蓝牙断开连接的回调出现异常,",
@ -1168,7 +1168,7 @@ class BleHelper {
//订阅消息
subScribe(deviceId, state) {
console.log("开始订阅消息", deviceId, state);
// console.log("开始订阅消息", deviceId, state);
return new Promise((resolve, reject) => {
setTimeout(() => {
@ -1791,7 +1791,7 @@ class BleHelper {
uni.closeBLEConnection({
deviceId: id,
success: (res) => {
console.log("用户主动断开了蓝牙:" + id);
// console.log("用户主动断开了蓝牙:" + id);
this.subScribe(id, false);
this.data.Disconnect.push(id);
resolve();

View File

@ -218,7 +218,7 @@ export default {
value: "1",
label: "灯光模式",
checked: false,
type: ['6170', '670','102']
type: ['6170', '670','102','6155','650','7305']
},
{
value: "2",
@ -230,13 +230,13 @@ export default {
value: "3",
label: "开机画面",
checked: false,
type: ['210', '6170', '670']
type: ['210', '6170', '670','6155','650','7305']
},
{
value: "4",
label: "人员信息登记",
checked: false,
type: ['210', '6170', '670']
type: ['210', '6170', '670','6155','650','7305']
},
{
value: "5",
@ -253,12 +253,12 @@ export default {
value: "41",
label: "静电探测",
checked: false,
type: ['670']
type: ['670','650']
}, {
value: "42",
label: "SOS",
checked: false,
type: ['670']
type: ['670','4877']
},
{
value: "43",
@ -302,6 +302,46 @@ export default {
checked: false,
type: ['102']
},
{
value: "50",
label: "报警模式",
checked: false,
type: ['100']
},
{
value: "51",
label: "警示灯",
checked: false,
type: ['100']
},
{
value: "52",
label: "语音管理",
checked: false,
type: ['100']
},
{
value: "53",
label: "箭头模式",
checked: false,
type: ['4877']
},
{
value: "54",
label: "配组设置",
checked: false,
type: ['4877']
},
{
value: "55",
label: "修改信道",
checked: false,
type: ['4877']
},
]
let arr = [];