蓝牙设备添加分享功能

This commit is contained in:
liub
2026-01-29 16:52:52 +08:00
parent dae3561235
commit 23fe40902b
8 changed files with 852 additions and 64 deletions

View File

@ -240,7 +240,8 @@
{ {
"path": "pages/650/HBY650", "path": "pages/650/HBY650",
"style": { "style": {
"navigationBarTitleText": "HBY650" "navigationBarTitleText": "HBY650",
"navigationStyle": "custom"
} }
}, },
{ {
@ -252,7 +253,8 @@
{ {
"path": "pages/7305/BJQ7305", "path": "pages/7305/BJQ7305",
"style": { "style": {
"navigationBarTitleText": "BJQ7305" "navigationBarTitleText": "BJQ7305",
"navigationStyle": "custom"
} }
}, },
{ {
@ -265,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"
} }
}, },
{ {

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>
@ -243,7 +264,7 @@
<global-loading ref="loading" /> <global-loading ref="loading" />
</view> </view>
</view> </view>
</template> </template>
<script> <script>
@ -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;
} }
@ -1115,7 +1241,7 @@ import request, { baseURL } from '@/utils/request.js';
let json = recei.ReceiveData(receive, device, pagePath, recArr); let json = recei.ReceiveData(receive, device, pagePath, recArr);
console.log("收到设备的数据", json) console.log("收到设备的数据", json)
let key = 'sta_VoiceDate'; let key = 'sta_VoiceDate';
if (key in json) { if (key in json) {
@ -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,7 +478,21 @@ 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) {
let groups = groupColors.filter(v => { let groups = groupColors.filter(v => {
@ -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

@ -1793,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);
}
} }
} }

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

@ -15,6 +15,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)">
@ -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

@ -218,7 +218,7 @@ export default {
value: "1", value: "1",
label: "灯光模式", label: "灯光模式",
checked: false, checked: false,
type: ['6170', '670','102','6155'] 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','6155'] type: ['210', '6170', '670','6155','650','7305']
}, },
{ {
value: "4", value: "4",
label: "人员信息登记", label: "人员信息登记",
checked: false, checked: false,
type: ['210', '6170', '670','6155'] 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 = [];