Merge pull request 'new-20250827 蓝牙设备添加分享功能' (#31) from liubiao/APP:new-20250827 into main

Reviewed-on: #31
This commit is contained in:
dyf
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", "path": "pages/6155/deviceDetail",
"style": { "style": {
"navigationBarTitleText": "HBY 6155" "navigationBarTitleText": "HBY 6155",
"navigationStyle": "custom"
} }
}, },
{ {
@ -239,7 +240,8 @@
{ {
"path": "pages/650/HBY650", "path": "pages/650/HBY650",
"style": { "style": {
"navigationBarTitleText": "HBY650" "navigationBarTitleText": "HBY650",
"navigationStyle": "custom"
} }
}, },
{ {
@ -251,7 +253,8 @@
{ {
"path": "pages/7305/BJQ7305", "path": "pages/7305/BJQ7305",
"style": { "style": {
"navigationBarTitleText": "BJQ7305" "navigationBarTitleText": "BJQ7305",
"navigationStyle": "custom"
} }
}, },
{ {
@ -264,13 +267,15 @@
{ {
"path": "pages/4877/BJQ4877", "path": "pages/4877/BJQ4877",
"style": { "style": {
"navigationBarTitleText": "BJQ 4877" "navigationBarTitleText": "BJQ 4877",
"navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/100/HBY100", "path": "pages/100/HBY100",
"style": { "style": {
"navigationBarTitleText": "HBY 100" "navigationBarTitleText": "HBY 100",
"navigationStyle": "custom"
} }
}, },
{ {
@ -375,7 +380,8 @@
"path" : "pages/6155/BJQ6155", "path" : "pages/6155/BJQ6155",
"style" : "style" :
{ {
"navigationBarTitleText" : "BJQ6155" "navigationBarTitleText" : "BJQ6155",
"navigationStyle": "custom"
} }
}, },
{ {

View File

@ -1,5 +1,26 @@
<template> <template>
<view class="content contentBg"> <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="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)"> <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> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -255,7 +276,9 @@
hideLoading, hideLoading,
updateLoading updateLoading
} from '@/utils/loading.js' } from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js'; import request, {
baseURL
} from '@/utils/request.js';
import Common from '@/utils/Common.js' import Common from '@/utils/Common.js'
const pagePath = "/pages/100/HBY100"; const pagePath = "/pages/100/HBY100";
@ -271,6 +294,16 @@ import request, { baseURL } from '@/utils/request.js';
data() { data() {
return { return {
Status: { Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'HBY100'
},
curr: 0, curr: 0,
total: 0, total: 0,
pageHide: false, pageHide: false,
@ -464,7 +497,7 @@ import request, { baseURL } from '@/utils/request.js';
detailPageUrl: "/pages/650/HBY650", detailPageUrl: "/pages/650/HBY650",
showConfirm: false showConfirm: false
}, },
permissions: [],
audioData: { audioData: {
packetCtn: 0, packetCtn: 0,
hexs: [] hexs: []
@ -496,6 +529,17 @@ import request, { baseURL } from '@/utils/request.js';
// console.log("收到父页面的参数:" + JSON.stringify(data)); // console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data; var device = data.data;
these.device = device; 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) => { let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) { if (v.macAddress == device.deviceMac) {
// console.log("找到设备了", v); // console.log("找到设备了", v);
@ -544,8 +588,49 @@ import request, { baseURL } from '@/utils/request.js';
}, },
methods: { 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({ uni.navigateTo({
url: '/pages/common/audioManager/AudioList', url: '/pages/common/audioManager/AudioList',
events: { events: {
@ -860,6 +945,19 @@ import request, { baseURL } from '@/utils/request.js';
}, 100); }, 100);
}, },
lightTypeSet(item, index) { 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(); let f = this.getDevice();
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (!f) { if (!f) {
@ -899,6 +997,20 @@ import request, { baseURL } from '@/utils/request.js';
this.Status.usrToggle = !this.Status.usrToggle; this.Status.usrToggle = !this.Status.usrToggle;
}, },
openVolume(item, index) { 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(); let f = this.getDevice();
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (!f) { if (!f) {
@ -950,6 +1062,20 @@ import request, { baseURL } from '@/utils/request.js';
}); });
}, },
sosSetting(item, isOk) { 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) { if (item === 0 && this.formData.sta_SOSType === item) {
return; return;
} }
@ -2102,4 +2228,71 @@ import request, { baseURL } from '@/utils/request.js';
letter-spacing: 0.07px; 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> </style>

View File

@ -1,5 +1,25 @@
<template> <template>
<view class="content contentBg"> <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="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)"> <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> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -276,6 +296,7 @@
updateLoading updateLoading
} from '@/utils/loading.js' } from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js'; import request, { baseURL } from '@/utils/request.js';
import Common from '@/utils/Common.js';
import { import {
colors as groupColors colors as groupColors
} from '@/api/4877/BJQ4877.js'; } from '@/api/4877/BJQ4877.js';
@ -294,6 +315,16 @@ import request, { baseURL } from '@/utils/request.js';
data() { data() {
return { return {
Status: { Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'BJQ4877'
},
ShowEditChannel: false, ShowEditChannel: false,
pageHide: false, pageHide: false,
Pop: { Pop: {
@ -355,6 +386,7 @@ import request, { baseURL } from '@/utils/request.js';
}, },
usrToggle: true, usrToggle: true,
}, },
permissions: [],
formData: { formData: {
img: '/static/images/common/BJQ4877.png', img: '/static/images/common/BJQ4877.png',
sta_PowerPercent: '', sta_PowerPercent: '',
@ -446,6 +478,20 @@ import request, { baseURL } from '@/utils/request.js';
eventChannel.on('detailData', function(data) { eventChannel.on('detailData', function(data) {
// console.log("收到父页面的参数:" + JSON.stringify(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); let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id);
if (checkIds && checkIds.length) { if (checkIds && checkIds.length) {
@ -462,8 +508,7 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.groups = groups; these.formData.groups = groups;
} }
var device = data.data;
these.device = device;
let arr = [{ let arr = [{
topic: 'C/4877_Groups_' + these.device.id, topic: 'C/4877_Groups_' + these.device.id,
@ -531,6 +576,36 @@ import request, { baseURL } from '@/utils/request.js';
}, },
methods: { 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) { getChannel(rec) {
console.error("收到MQ信道保留消息:", rec); console.error("收到MQ信道保留消息:", rec);
try { try {
@ -580,6 +655,20 @@ import request, { baseURL } from '@/utils/request.js';
}, },
ShowChannelEdit() { 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.Status.ShowEditChannel = true;
this.showPop({ this.showPop({
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
@ -647,6 +736,20 @@ import request, { baseURL } from '@/utils/request.js';
}, },
ArrowModeSet(val) { 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') { if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警") this.showMsg("设备强制报警中,请先关闭报警")
return; return;
@ -697,7 +800,18 @@ import request, { baseURL } from '@/utils/request.js';
}); });
}, },
groupCheck() { 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({ uni.navigateTo({
url: '/pages/4877/BJQ4877CheckColor', url: '/pages/4877/BJQ4877CheckColor',
events: { events: {
@ -768,6 +882,20 @@ import request, { baseURL } from '@/utils/request.js';
// }); // });
}, },
groupSetting(item, index) { 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') { if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警") this.showMsg("设备强制报警中,请先关闭报警")
return; return;
@ -814,7 +942,18 @@ import request, { baseURL } from '@/utils/request.js';
}, },
sosSetting(item, index) { 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(); let f = this.getDevice();
if (!f) { if (!f) {
this.showBleUnConnect(); this.showBleUnConnect();
@ -2063,4 +2202,73 @@ import request, { baseURL } from '@/utils/request.js';
text-align: center; 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> </style>

View File

@ -1,5 +1,26 @@
<template> <template>
<view class="content contentBg"> <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="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)"> <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> <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 TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
import bleTool from '@/utils/BleHelper.js'; 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 { import {
showLoading, showLoading,
hideLoading, hideLoading,
@ -192,6 +214,16 @@
data() { data() {
return { return {
Status: { Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType:'listA'
}],
title: 'BJQ6155'
},
lightMode: { lightMode: {
}, },
@ -276,6 +308,7 @@
}, },
videoHexArray: [], videoHexArray: [],
rgb565Data: [], rgb565Data: [],
permissions: [],
dic: { dic: {
menuItems: [{ menuItems: [{
text: '强光', text: '强光',
@ -325,52 +358,7 @@
these = this; these = this;
recei = BleReceive.getBleReceive(); recei = BleReceive.getBleReceive();
ble = bleTool.getBleTool(); 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.addReceiveCallback(these.bleValueNotify, pagePath);
ble.addStateBreakCallback(these.bleStateBreak, pagePath); ble.addStateBreakCallback(these.bleStateBreak, pagePath);
ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath); ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath);
@ -384,7 +372,17 @@
let device = data.data; let device = data.data;
these.device = device; 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) => { let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) { if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v); console.log("找到设备了", v);
@ -441,6 +439,36 @@
}, },
methods: { 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) { getMode(type) {
let txt = "关闭"; let txt = "关闭";
@ -869,6 +897,18 @@
}, },
UploadOpenVideo: function() { //开机动画 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(); let f = these.getDevice();
if (!f) { if (!f) {
@ -1215,6 +1255,18 @@
}, },
UploadOpenImg: function() { 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.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面"; this.Status.BottomMenu.title = "上传开机画面";
@ -1259,6 +1311,18 @@
this.Status.BottomMenu.show = false; this.Status.BottomMenu.show = false;
}, },
btnClick(item, index) { 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) { if (parseInt(this.Status.BottomMenu.activeIndex) === NaN) {
uni.showToast('请选择模式'); uni.showToast('请选择模式');
@ -1440,6 +1504,18 @@
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
}, },
sendUsr() { 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(); let f = this.getDevice();
if (!f) { if (!f) {
these.showBleUnConnect() these.showBleUnConnect()
@ -1669,6 +1745,19 @@
}, },
sliderChange: function(evt) { 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(); let f = this.getDevice();
if (!f) { if (!f) {
these.showBleUnConnect() these.showBleUnConnect()
@ -1716,7 +1805,7 @@
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(res => { ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(res => {
this.setBleFormData(); this.setBleFormData();
}).catch(err=>{ }).catch(err => {
}); });
@ -2163,4 +2252,70 @@
left: -99999rpx; left: -99999rpx;
visibility: hidden; 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> </style>

View File

@ -1,5 +1,27 @@
<template> <template>
<view class="content contentBg"> <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="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)"> <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> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -167,7 +189,8 @@
<script> <script>
import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue'; import TextToHexV1 from '@/components/TextToHex/TextToHexV1.vue';
import bleTool from '@/utils/BleHelper.js'; 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 { import {
showLoading, showLoading,
hideLoading, hideLoading,
@ -192,7 +215,18 @@
data() { data() {
return { return {
Status: { Status: {
pageHide: false, pageHide: false,
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'BJQ6155'
},
Pop: { Pop: {
showPop: false, //是否显示弹窗 showPop: false, //是否显示弹窗
popType: 'custom', popType: 'custom',
@ -260,10 +294,11 @@
deviceId: '', deviceId: '',
textLines: ['', '', ''], textLines: ['', '', ''],
mode: '', mode: '',
light:null, light: null,
bleStatu: '' bleStatu: ''
}, },
inteval: 80, inteval: 80,
permissions: [],
device: { device: {
id: "", id: "",
deviceName: "", deviceName: "",
@ -293,52 +328,8 @@
these = this; these = this;
recei = BleReceive.getBleReceive(); recei = BleReceive.getBleReceive();
ble = bleTool.getBleTool(); 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.addReceiveCallback(these.bleValueNotify, pagePath);
ble.addStateBreakCallback(these.bleStateBreak, pagePath); ble.addStateBreakCallback(these.bleStateBreak, pagePath);
ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath); ble.addStateRecoveryCallback(these.bleStateRecovry, pagePath);
@ -352,7 +343,16 @@
let device = data.data; let device = data.data;
these.device = device; 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) => { let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) { if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v); console.log("找到设备了", v);
@ -422,6 +422,36 @@
}, },
methods: { 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) { getMode(type) {
let txt = "关闭"; let txt = "关闭";
@ -899,6 +929,19 @@
}, },
UploadOpenVideo: function() { //开机动画 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(); let f = these.getDevice();
if (!f) { if (!f) {
@ -1276,6 +1319,18 @@
}, },
UploadOpenImg: function() { 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.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面"; this.Status.BottomMenu.title = "上传开机画面";
@ -1331,9 +1386,9 @@
this.Status.BottomMenu.title = title; this.Status.BottomMenu.title = title;
this.Status.BottomMenu.type = type; this.Status.BottomMenu.type = type;
this.Status.BottomMenu.show = true; this.Status.BottomMenu.show = true;
if(this.formData.mode != type){ if (this.formData.mode != type) {
this.Status.BottomMenu.activeIndex =null; this.Status.BottomMenu.activeIndex = null;
} }
}, },
@ -1344,7 +1399,18 @@
this.Status.BottomMenu.show = false; this.Status.BottomMenu.show = false;
}, },
btnClick(item, index) { 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) { if (parseInt(this.Status.BottomMenu.activeIndex) === NaN) {
uni.showToast('请选择模式'); uni.showToast('请选择模式');
return; return;
@ -1522,6 +1588,20 @@
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
}, },
sendUsr() { 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(); let f = this.getDevice();
if (!f) { if (!f) {
these.showBleUnConnect() these.showBleUnConnect()
@ -1675,6 +1755,20 @@
clearTimeout(BrighInteval) clearTimeout(BrighInteval)
//给蓝牙设备发送信号更新亮度 //给蓝牙设备发送信号更新亮度
BrighInteval = setTimeout(() => { 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.sendBrightness();
this.setBleFormData(); this.setBleFormData();
}, 100); }, 100);
@ -1699,51 +1793,10 @@
} }
},
//获取当前设备状态
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);
}
} }
} }
} }
</script> </script>
@ -2178,4 +2231,70 @@
left: -99999rpx; left: -99999rpx;
visibility: hidden; 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> </style>

View File

@ -1,5 +1,26 @@
<template> <template>
<view class="content contentBg"> <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="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)"> <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> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -184,6 +205,7 @@
import gbk from '@/utils/gbk.js' import gbk from '@/utils/gbk.js'
import BleTool from '@/utils/BleHelper.js' import BleTool from '@/utils/BleHelper.js'
import BleReceive from '@/utils/BleReceive'; import BleReceive from '@/utils/BleReceive';
import Common from '@/utils/Common.js'
import { import {
showLoading, showLoading,
hideLoading, hideLoading,
@ -201,6 +223,16 @@ import request, { baseURL } from '@/utils/request.js';
data() { data() {
return { return {
Status: { Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType: 'listA'
}],
title: 'HBY650'
},
pageHide: false, pageHide: false,
Pop: { Pop: {
showPop: false, //是否显示弹窗 showPop: false, //是否显示弹窗
@ -282,6 +314,7 @@ import request, { baseURL } from '@/utils/request.js';
}, },
rgb565Data: [], rgb565Data: [],
videoHexArray: [], videoHexArray: [],
permissions: [],
device: { device: {
id: "", id: "",
deviceName: "", deviceName: "",
@ -328,6 +361,17 @@ import request, { baseURL } from '@/utils/request.js';
// console.log("收到父页面的参数:" + JSON.stringify(data)); // console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data; var device = data.data;
these.device = device; 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) => { let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) { if (v.macAddress == device.deviceMac) {
// console.log("找到设备了", v); // console.log("找到设备了", v);
@ -393,6 +437,36 @@ import request, { baseURL } from '@/utils/request.js';
} }
}, },
methods: { 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) { deviceRecovry(res) {
if (this.Status.pageHide) { if (this.Status.pageHide) {
return; return;
@ -616,6 +690,20 @@ import request, { baseURL } from '@/utils/request.js';
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList); uni.setStorageSync(ble.StorageKey, ble.data.LinkedList);
}, },
MainModeSetting: function(type, byteType) { 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) { if (this.formData.modeCurr == type) {
type = 'close'; type = 'close';
} }
@ -741,7 +829,18 @@ import request, { baseURL } from '@/utils/request.js';
}); });
}, },
LampToggle: function() { 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.formData.cMode = !this.formData.cMode;
this.MainModeSetting(this.formData.cMode, "lamp"); this.MainModeSetting(this.formData.cMode, "lamp");
}, },
@ -1238,6 +1337,19 @@ import request, { baseURL } from '@/utils/request.js';
}, },
ShowUpload: function() { 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.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面"; this.Status.BottomMenu.title = "上传开机画面";
@ -1345,7 +1457,18 @@ import request, { baseURL } from '@/utils/request.js';
}, },
sendUsr: function(ReSendNo) { 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 = [ var textLines = [
this.formData.company, this.formData.company,
@ -2111,4 +2234,71 @@ import request, { baseURL } from '@/utils/request.js';
.net.active { .net.active {
background: #FFFFFF !important; 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> </style>

View File

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

View File

@ -1,5 +1,25 @@
<template> <template>
<view class="content contentBg"> <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="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)"> <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> <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -162,7 +182,7 @@
updateLoading updateLoading
} from '@/utils/loading.js' } from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive'; import BleReceive from '@/utils/BleReceive';
import Common from '@/utils/Common.js';
var ble = null; var ble = null;
var these = null; var these = null;
@ -176,6 +196,16 @@
data() { data() {
return { return {
Status: { Status: {
apiType: '',
navbar: {
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
apiType:'listA'
}],
title: 'BJQ6155'
},
pageHide: false, pageHide: false,
Pop: { Pop: {
showPop: false, //是否显示弹窗 showPop: false, //是否显示弹窗
@ -265,7 +295,8 @@
alarmStatus: null, alarmStatus: null,
detailPageUrl: "/pages/6155/deviceDetail", detailPageUrl: "/pages/6155/deviceDetail",
showConfirm: false showConfirm: false
} },
permissions: []
} }
}, },
@ -289,7 +320,17 @@
let device = data.data; let device = data.data;
these.device = device; 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) => { let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) { if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v); console.log("找到设备了", v);
@ -384,6 +425,36 @@
} }
}, },
methods: { 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) { deviceRecovry(res) {
if (this.Status.pageHide) { if (this.Status.pageHide) {
return; return;
@ -815,6 +886,19 @@
}); });
}, },
UploadOpenImg: function() { 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.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面"; this.Status.BottomMenu.title = "上传开机画面";
@ -822,7 +906,18 @@
this.Status.BottomMenu.show = true; this.Status.BottomMenu.show = true;
}, },
ModeSetting: function(type) { 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; this.formData.mode = type;
let items = []; let items = [];
let title = ''; let title = '';
@ -1055,6 +1150,18 @@
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
}, },
sendUsr() { 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(); let f = this.getDevice();
if (!f) { if (!f) {
these.showBleUnConnect() these.showBleUnConnect()
@ -1258,6 +1365,19 @@
clearTimeout(BrighInteval) clearTimeout(BrighInteval)
//给蓝牙设备发送信号更新亮度 //给蓝牙设备发送信号更新亮度
BrighInteval = setTimeout(() => { 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.sendBrightness();
this.setBleFormData(); this.setBleFormData();
}, 100); }, 100);
@ -1776,4 +1896,71 @@
left: -99999rpx; left: -99999rpx;
visibility: hidden; 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> </style>

View File

@ -164,9 +164,9 @@
} }
}, },
computed: { computed: {
deviceCnt:function(){ deviceCnt: function() {
let arr=this.EquipMents.filter(item=>{ let arr = this.EquipMents.filter(item => {
return item.name.toLowerCase().indexOf(this.search.toLowerCase())>-1; return item.name.toLowerCase().indexOf(this.search.toLowerCase()) > -1;
}); });
return arr.length; return arr.length;
} }
@ -183,10 +183,23 @@
} }
}, },
onLoad(option) { 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; let search = option.search;
these = this; these = this;
eventChannel = this.getOpenerEventChannel();
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
ble = bleTool.getBleTool(); // Ensure ble is initialized ble = bleTool.getBleTool(); // Ensure ble is initialized
@ -255,7 +268,7 @@
"deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3", "deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
"name": "4877-BF743D", "name": "4877-BF743D",
"linkStatu": false "linkStatu": false
},{ }, {
"RSSI": -55, "RSSI": -55,
"advertisData": "", "advertisData": "",
"advertisServiceUUIDs": [ "advertisServiceUUIDs": [
@ -320,14 +333,17 @@
if (these.Status.isPageHidden) { if (these.Status.isPageHidden) {
return; return;
} }
console.log("处理蓝牙断开连接"); // console.log("处理蓝牙断开连接");
hideLoading(these);
these.PairEquip.find(function(v, ind) { these.PairEquip.find(function(v, ind) {
these.PairEquip.splice(ind, 1); these.PairEquip.splice(ind, 1);
return v.deviceId == res.deviceId; return v.deviceId == res.deviceId;
}); });
setTimeout(() => {
hideLoading(these);
}, 1500);
}, pagePath); }, pagePath);
@ -379,7 +395,7 @@
these.EquipMents.push(device); these.EquipMents.push(device);
} }
these.EquipMents.sort((a, b) => b.RSSI - a.RSSI);//信号好的排前面,一般信号好的是目标设备 these.EquipMents.sort((a, b) => b.RSSI - a.RSSI); //信号好的排前面,一般信号好的是目标设备
} }
}, pagePath); }, pagePath);
} }
@ -418,19 +434,17 @@
//收到设备的消息回调 //收到设备的消息回调
ble.addReceiveCallback((receivData, f, path, arr) => { ble.addReceiveCallback((receivData, f, path, arr) => {
console.log("000000",receivData); console.log("000000", receivData);
if (these.Status.isPageHidden) { if (these.Status.isPageHidden) {
return; 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 ||
if(receivData.str.indexOf('mac address:')>-1 || receivData.str.indexOf('sta_address')>-1 (receivData.bytes[0] === 0xFC && receivData.bytes.length >= 7)) {
|| (receivData.bytes[0]===0xFC && receivData.bytes.length>=7))
{
console.log("1111111");
if (f.macAddress && these.device) { if (f.macAddress && these.device) {
console.log("222222");
clearInterval(this.Status.intval); clearInterval(this.Status.intval);
this.Status.intval = null; this.Status.intval = null;
this.Status.time = null; this.Status.time = null;
@ -450,16 +464,7 @@
StartSubsrib(); 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();
});
}, },
@ -614,28 +619,71 @@
} }
} }
console.log("f=", f); //不是目标设备的处理方法
if (f && f.macAddress) { let deviceInvalid = () => {
console.error("连接的设备不是目标设备");
if (f.macAddress != these.device.deviceMac) {
removeLink(); removeLink();
updateLoading(these, { updateLoading(these, {
text: "设备Mac地址错误,请重选设备连接" text: "设备Mac地址错误,请重选设备连接"
}); });
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
}, 1000) }, 1500)
return; return;
} else {
} }
//找到目标设备的处理方法
let deviceOK = () => {
hideLoading(these); hideLoading(these);
eventChannel.emit('BindOver', these.device); eventChannel.emit('BindOver', these.device);
ble.updateCache(); ble.updateCache();
uni.navigateBack(); 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; return true;
} else { } else {
@ -664,14 +712,8 @@
return false; return false;
}); });
if (!(f && f.macAddress)) { if (!(f && f.macAddress)) {
removeLink(); deviceInvalid()
updateLoading(these, { return;
text: "出现错误,未收到设备Mac地址"
});
setTimeout(() => {
hideLoading(these)
}, 1500);
} }
return; return;
} }
@ -1115,18 +1157,18 @@
.uni-input{ .uni-input {
background-color: #121212; background-color: #121212;
width:100%; width: 100%;
height: 60rpx; height: 60rpx;
color: #ffffffde; color: #ffffffde;
border:1rpx solid #cbcbcbde; border: 1rpx solid #cbcbcbde;
border-radius: 8rpx; border-radius: 8rpx;
font-size: 26rpx; font-size: 26rpx;
text-indent: 8rpx; text-indent: 8rpx;
font-family: "PingFang SC"; font-family: "PingFang SC";
line-height: 60rpx; line-height: 60rpx;
caret-color:#BBE600; caret-color: #BBE600;
font-weight: 200; font-weight: 200;
} }
</style> </style>

View File

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

View File

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

View File

@ -218,7 +218,7 @@ export default {
value: "1", value: "1",
label: "灯光模式", label: "灯光模式",
checked: false, checked: false,
type: ['6170', '670','102'] type: ['6170', '670','102','6155','650','7305']
}, },
{ {
value: "2", value: "2",
@ -230,13 +230,13 @@ export default {
value: "3", value: "3",
label: "开机画面", label: "开机画面",
checked: false, checked: false,
type: ['210', '6170', '670'] type: ['210', '6170', '670','6155','650','7305']
}, },
{ {
value: "4", value: "4",
label: "人员信息登记", label: "人员信息登记",
checked: false, checked: false,
type: ['210', '6170', '670'] type: ['210', '6170', '670','6155','650','7305']
}, },
{ {
value: "5", value: "5",
@ -253,12 +253,12 @@ export default {
value: "41", value: "41",
label: "静电探测", label: "静电探测",
checked: false, checked: false,
type: ['670'] type: ['670','650']
}, { }, {
value: "42", value: "42",
label: "SOS", label: "SOS",
checked: false, checked: false,
type: ['670'] type: ['670','4877']
}, },
{ {
value: "43", value: "43",
@ -302,6 +302,46 @@ export default {
checked: false, checked: false,
type: ['102'] 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 = []; let arr = [];