6155添加分享

This commit is contained in:
liub
2026-01-29 14:40:20 +08:00
parent d6ca84170f
commit 1e971292cd
8 changed files with 596 additions and 419 deletions

178
App.vue
View File

@ -1,178 +0,0 @@
<script>
import bleTool from '@/utils/BleHelper.js'
import upgrade from '@/utils/update.js'
export default {
onLaunch: function() {
//以下代码仅在开发时使用,否则会出现不可预知的问题。
//清除登陆之外的所有信息;
// let store=uni.getStorageInfoSync();
// store.keys.forEach((val,index,array)=>{
// if(val=="tokenTime"){
// let time=uni.getStorageSync(val);
// if(!time){
// time=0;
// }
// let currTime=new Date().getTime();
// if(currTime>=time){
// uni.removeStorageSync(val);
// uni.removeStorageSync("token");
// uni.removeStorageSync("clientID");
// }
// }
// else if(val=="token" || val=="clientID" || val=='phone'){
// console.log("忽略登陆信息");
// }else{
// uni.removeStorageSync(val);
// }
// });
// uni.clearStorageSync();
//以上代码仅在开发时使用,否则会出现不可预知的问题。
// #ifdef APP-PLUS
var appid = plus.runtime.appid;
console.log('应用的 appid 为:' + appid);
// #endif
},
onShow: function() {
console.log('App Show');
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
uni.getSystemInfo({
success: function(res) {
if (res.uniPlatform == 'app') {
bleTool.getBleTool();
let appid = plus.runtime.appid;
if (appid !== 'HBuilder') {
console.log("appid=", appid);
upgrade.checkAndUpdateWgt();
}
}
}
});
},
onHide: function() {
console.log('App Hide');
},
onError(ex) {
console.error("出现了未知的异常",ex);
}
}
</script>
<style lang="scss">
@import 'vk-uview-ui/index.scss';
/* #ifdef APP-ANDROID */
//苹果应用以下样式后Slider不可拖动
uni-slider .uni-slider-handle-wrapper {
border-radius: 20rpx;
}
uni-slider .uni-slider-thumb {
width: 66rpx !important;
height: 80rpx !important;
margin-top: -40rpx !important;
border-radius: 16rpx !important;
margin-left: -72rpx !important;
}
uni-slider .uni-slider-handle-wrapper {
height: 88rpx;
position: relative;
// }
/* #endif */
.custom-file-picker .file-picker__box-content {
background: rgba(26, 26, 26, 1);
border: none !important;
border-radius: 45rpx;
width: 180rpx;
height: 180rpx;
}
.uni-file-picker.custom-file-picker {
overflow: inherit !important;
}
.custom-file-picker .icon-add {
height: 5rpx !important;
width: 70rpx !important;
}
.uni-picker-view-mask {
background: rgba(42, 42, 42, 1);
z-index: -1;
}
.uni-picker-view-content {
position: inherit;
}
.uni-picker-view-wrapper {
background: rgba(42, 42, 42, 1);
}
.green {
color: #aed600 !important;
}
.red {
color: #FF0000 !important;
}
.maincontent {
width: 100%;
min-height: 100vh;
height: auto;
padding: 30rpx;
box-sizing: border-box;
}
.contentBg {
background-color: #121212;
color: #ffffffde;
}
.fleft {
float: left;
}
.fright {
float: right;
}
.clear {
clear: both;
}
.displayNone {
display: none !important;
}
.visibilityHidden{
visibility: hidden !important;
}
.center {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-content: center;
justify-content: center;
align-items: center;
}
@font-face {
font-family: "PingFang SC";
src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
}
@font-face {
font-family: "PingFangBold";
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
}
</style>

View File

@ -156,7 +156,8 @@
{ {
"path": "pages/6155/deviceDetail", "path": "pages/6155/deviceDetail",
"style": { "style": {
"navigationBarTitleText": "HBY 6155" "navigationBarTitleText": "HBY 6155",
"navigationStyle": "custom"
} }
}, },
{ {
@ -375,7 +376,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>
@ -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,8 +1805,8 @@
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 = "关闭";
@ -441,16 +471,16 @@
} }
break; break;
case 2: case 2:
if (type == 'main' && this.formData.mode == 'main') { if (type == 'main' && this.formData.mode == 'main') {
txt = "爆闪"; txt = "爆闪";
} }
break; break;
case 3: case 3:
if (type == 'main' && this.formData.mode == 'main') { if (type == 'main' && this.formData.mode == 'main') {
txt = "关闭"; txt = "关闭";
} }
break; break;
default: default:
txt = "关闭"; 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 = "上传开机画面";
@ -1284,7 +1339,7 @@
}, },
ModeSetting: function(type) { ModeSetting: function(type) {
let items = []; let items = [];
let title = ''; let title = '';
@ -1326,16 +1381,16 @@
]; ];
break; break;
} }
this.Status.BottomMenu.menuItems = items; this.Status.BottomMenu.menuItems = items;
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;
} }
}, },
showMenu(flag) { showMenu(flag) {
this.Status.BottomMenu.show = true; this.Status.BottomMenu.show = true;
@ -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);
@ -2178,4 +2272,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

@ -120,7 +120,7 @@
var ble = null; var ble = null;
var these = null; var these = null;
var eventChannel = null; var eventChannel = null;
export default { export default {
data() { data() {
return { return {
@ -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;
} }
@ -226,36 +226,36 @@
"linkStatu": false "linkStatu": false
}, },
{ {
"RSSI": -55, "RSSI": -55,
"advertisData": "", "advertisData": "",
"advertisServiceUUIDs": [ "advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB" "0000FFE0-0000-1000-8000-00805F9B34FB"
], ],
"deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375", "deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
"name": "HBY670-BF74EA", "name": "HBY670-BF74EA",
"linkStatu": false "linkStatu": false
}, },
{ {
"RSSI": -61, "RSSI": -61,
"advertisData": "", "advertisData": "",
"advertisServiceUUIDs": [ "advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB" "0000FFE0-0000-1000-8000-00805F9B34FB"
], ],
"deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB", "deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
"name": "EF4651", "name": "EF4651",
"linkStatu": false, "linkStatu": false,
"isTarget": true "isTarget": true
}, },
{ {
"RSSI": -69, "RSSI": -69,
"advertisData": "", "advertisData": "",
"advertisServiceUUIDs": [ "advertisServiceUUIDs": [
"0000FFE0-0000-1000-8000-00805F9B34FB" "0000FFE0-0000-1000-8000-00805F9B34FB"
], ],
"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 +320,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);
@ -378,8 +381,8 @@
} }
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 +421,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;
@ -454,11 +455,11 @@
console.log("接收到父页面的参数:", rec); console.log("接收到父页面的参数:", rec);
these.device = rec.data; these.device = rec.data;
if (rec.data.bluetoothName) { if (rec.data.bluetoothName) {
these.search = rec.data.bluetoothName.replace('JQZM-', ''); these.search = rec.data.bluetoothName;
} }
startValidDevice(); startValidDevice();
}); });
}, },
@ -508,8 +509,8 @@
}); });
}, },
async refreshBleList() { async refreshBleList() {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
if (systemInfo.uniPlatform == 'web') { if (systemInfo.uniPlatform == 'web') {
return; return;
@ -528,42 +529,42 @@
return; return;
} }
} }
ble.StopSearch().finally(() => { ble.StopSearch().finally(() => {
let disconnectPromises = []; let disconnectPromises = [];
if (ble.data && ble.data.LinkedList) { if (ble.data && ble.data.LinkedList) {
ble.data.LinkedList.forEach(device => { ble.data.LinkedList.forEach(device => {
console.log(`Requesting disconnect for ${device.deviceId}`); console.log(`Requesting disconnect for ${device.deviceId}`);
disconnectPromises.push(ble.disconnectDevice(device.deviceId)); disconnectPromises.push(ble.disconnectDevice(device.deviceId));
}); });
} }
Promise.allSettled(disconnectPromises).finally(() => { Promise.allSettled(disconnectPromises).finally(() => {
these.EquipMents = []; these.EquipMents = [];
these.PairEquip = []; these.PairEquip = [];
ble.StartSearch().then(result => { ble.StartSearch().then(result => {
console.log("Fresh scan started successfully."); console.log("Fresh scan started successfully.");
}).catch(err => { }).catch(err => {
console.error("Failed to start fresh scan:", err); console.error("Failed to start fresh scan:", err);
if (err.code === 10001) { if (err.code === 10001) {
these.showOpenSetting(); these.showOpenSetting();
} else { } else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '开始搜索失败:' + err.msg content: '开始搜索失败:' + err.msg
}); });
} }
});
}); });
}); });
});
}, },
isItemLink: function(item, index) { isItemLink: function(item, index) {
let src = '/static/images/BLEAdd/noLink.png'; let src = '/static/images/BLEAdd/noLink.png';
@ -614,28 +615,71 @@
} }
} }
console.log("f=", f); //不是目标设备的处理方法
if (f && f.macAddress) { let deviceInvalid = () => {
console.error("连接的设备不是目标设备");
removeLink();
if (f.macAddress != these.device.deviceMac) { updateLoading(these, {
removeLink(); text: "设备Mac地址错误,请重选设备连接"
updateLoading(these, { });
text: "设备Mac地址错误,请重选设备连接" setTimeout(() => {
}); hideLoading(these);
setTimeout(() => { }, 1500)
hideLoading(these); return;
}, 1000) }
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 +708,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;
} }
@ -1113,20 +1151,20 @@
-webkit-filter: none !important; -webkit-filter: none !important;
} }
.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

@ -783,31 +783,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']
}, },
{ {
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']
}, },
{ {
value: "4", value: "4",
label: "人员信息登记", label: "人员信息登记",
checked: false, checked: false,
type: ['210', '6170', '670'] type: ['210', '6170', '670','6155']
}, },
{ {
value: "5", value: "5",