1
0
forked from dyf/APP

4877V1完成

This commit is contained in:
liub
2025-11-10 17:27:37 +08:00
parent 012eca6985
commit 1ad1ae0ac9
9 changed files with 396 additions and 102 deletions

View File

@ -113,7 +113,7 @@
}
.green {
color: #4CAF50 !important;
color: #aed600 !important;
}
.red {

View File

@ -393,4 +393,6 @@ padding-top: 40rpx;
}
</style>

View File

@ -22,7 +22,8 @@
"Bluetooth" : {},
"Camera" : {},
"Geolocation" : {},
"Maps" : {}
"Maps" : {},
"Record" : {}
},
/* */
"distribute" : {
@ -89,7 +90,24 @@
"appkey_android" : "d7d852dbda2b95f6f796fb9a711a9fee"
}
},
"push" : {}
"push" : {
"unipush" : {
"version" : "2",
"offline" : true,
"honor" : {},
"meizu" : {},
"mi" : {},
"vivo" : {},
"oppo" : {},
"hms" : {},
"icons" : {
"small" : {
"xxhdpi" : "",
"xhdpi" : ""
}
}
}
}
},
"icons" : {
"android" : {

View File

@ -329,11 +329,24 @@
"navigationBarTitleText": "BJQ 4877"
}
},
{
"path": "pages/4877/BJQ4877V1",
"style": {
"navigationBarTitleText": "BJQ 4877"
}
},
{
"path": "pages/100/HBY100",
"style": {
"navigationBarTitleText": "HBY 100"
}
},
{
"path" : "pages/4877/BJQ4877CheckColor",
"style" :
{
"navigationBarTitleText" : "选择配组"
}
}

View File

@ -172,7 +172,7 @@
<view class="slider-container">
<slider min="10" max="100" step="10" :disabled="false" :value="formData.sta_LightDimmer"
activeColor="#bbe600" backgroundColor="#00000000" block-size="20" block-color="#ffffffde"
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onBrightnessChanging" @changing="onBrightnessChanging" class="custom-slider" />
</view>
@ -184,7 +184,7 @@
<view class="slider-container">
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.sta_LightFreq"
activeColor="#bbe600" backgroundColor="#00000000" block-size="20" block-color="#ffffffde"
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
</view>
@ -196,7 +196,7 @@
<view class="slider-container">
<slider min="1" max="8" step="1" :disabled="false" :value="formData.sta_VoiceVolume"
activeColor="#bbe600" backgroundColor="#00000000" block-size="20" block-color="#ffffffde"
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onVolumeChanging" @changing="onVolumeChanging" class="custom-slider" />
</view>

View File

@ -2,8 +2,7 @@
<view class="content contentBg">
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img"
mode="aspectFit"></image>
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
</view>
<view class="rightTxt">
<view class="row">
@ -28,27 +27,42 @@
<text class="value">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<text class="lbl">Mac地址</text>
<text class="value">{{device.deviceMac}}</text>
</view>
<view class="item">
<text class="lbl">蓝牙名称</text>
<text class="value">{{device.bluetoothName}}</text>
</view>
</view>
<view class="item">
<text class="lbl">蓝牙状态</text>
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
</view>
<view class="item">
<text class="lbl">信道:{{formData.sta_Channel}}</text>
<text class="value green" @click.stop="ShowChannelEdit()">修改</text>
</view>
</view>
<view class="warnnig" :class="formData.sta_SOSType=='sos'?'':'displayNone'"
@click.stop="showUnWarn('sos_off')">
<view class="warnnig" :class="formData.sta_SOSType=='sos'?'':'displayNone'" @click.stop="showUnWarn('sos_off')">
<view>设备强制报警中</view>
<view class="netContent">
{{formData.warnTime}}s
</view>
</view>
<!-- <view class="lamp">
<view class="title">
<text>信道设置</text>
<text>{{formData.sta_Channel}}</text>
</view>
</view>
<view class="lampMode">
<slider min="1" max="125" step="1" :disabled="false" :value="formData.sta_Channel" activeColor="#bbe600"
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="onChannelChanging"
@changing="onChannelChanging" class="custom-slider" />
</view> -->
<view class="lamp">
<view class="title">
@ -85,25 +99,22 @@
<view class="lamp">
<view class="title">
<text>单色配组</text>
<view @click.stop="groupSetting({val:'off'})">
<image class="img" src="/static/images/common/close.png" mode="aspectFit"></image>
<view class="checkgroup" @click.stop="groupCheck()">
选择配组
</view>
</view>
</view>
<view class="lampMode">
<view class="mode fleft " v-for="item,index in dic.gropus"
:class="{active:formData.sta_GroupType===item.val,marginLeft:index%2==1}"
v-on:click.stop="groupSetting(item,index)">
<view class="leftImg">
<image class="img" :class="formData.sta_GroupType!==item.val?'':'displayNone'"
src="/static/images/4877/lightt.png" mode="aspectFit"></image>
<image class="img" :class="formData.sta_GroupType===item.val?'':'displayNone'" :src="item.activeImg"
mode="aspectFit"></image>
</view>
<view class="rightTxt">
<text class="bigTxt">{{item['text']}}</text>
<view class="colorContent">
<view v-for="item,index in dic.groups" class="item"
:class="{active:item.id===formData.sta_GroupType,marginNoLeft:index%3===0}"
@click.stop="groupSetting(item,index)">
<view class="polygon" :style="{backgroundColor:item.hex}">
</view>
<view class="text">{{item.name}}</view>
</view>
</view>
@ -213,19 +224,16 @@
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" :showSlot="Status.Pop.showSlot">
<view v-if="Status.ShowEditChannel" class="popup-prompt">
<text class="popup-prompt-title">修改信道</text>
<input class="popup-prompt-input" type="number" placeholder="1-125的整数"
placeholder-class="popup-prompt-input-placeHolder" v-model="formData.sta_Channel" />
<!-- 下方菜单 -->
<!-- <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@btnClick="btnClick">
<view>
<view class="addIco">
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
</view>
</view>
</view>
</BottomSlideMenuPlus> -->
</MessagePopup>
<global-loading ref="loading" />
</view>
@ -244,18 +252,23 @@
request,
baseURL
} from '../../utils/request';
import {
colors as groupColors
} from '@/api/4877/BJQ4877.js';
import usrApi from '@/api/670/HBY670.js'
const pagePath = "/pages/4877/BJQ4877";
var ble = null;
var these = null;
var recei = null;
var interval = null;
var slidTime = null;
export default {
data() {
return {
Status: {
ShowEditChannel: false,
pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
@ -276,6 +289,7 @@
okCallback: null,
buttonCancelText: '',
showCancel: false,
showSlot: false
},
BottomMenu: {
show: false,
@ -327,13 +341,14 @@
macAddress: '',
bleStatu: false,
sta_SOSType: '', //sos
sta_GroupType: '', //配组
sta_GroupType: -1, //配组
sta_ArrowType: '', //箭头方向
warnTime: 0
warnTime: 0,
sta_Channel: 80
},
dic: {
SOS: [{
text: '声光报警',
text: 'SOS报警',
val: 'sos',
img: '/static/images/4877/sg.png',
activeImg: '/static/images/4877/sgActive.png'
@ -345,30 +360,7 @@
activeImg: '/static/images/4877/fanActive.png'
}
],
gropus: [{
text: '红配组',
val: 'red_group',
img: '/static/images/4877/light.png',
activeImg: '/static/images/4877/lightActive.png'
},
{
text: '蓝配组',
val: 'blue_group',
img: '/static/images/4877/light.png',
activeImg: '/static/images/4877/lightActive.png'
},
{
text: '绿配组',
val: 'green_group',
img: '/static/images/4877/light.png',
activeImg: '/static/images/4877/lightActive.png'
},
{
text: '黄配组',
val: 'yellow_group',
img: '/static/images/4877/light.png',
activeImg: '/static/images/4877/lightActive.png'
}
groups: [
]
},
@ -397,11 +389,14 @@
onUnload() {
console.log("页面卸载,释放资源");
ble.removeAllCallback(pagePath);
clearInterval(interval);
},
onLoad: function() {
these = this;
recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
this.dic.gropus = [];
ble.addReceiveCallback(this.bleValueNotify, pagePath);
@ -415,7 +410,23 @@
eventChannel.on('detailData', function(data) {
// console.log("收到父页面的参数:" + JSON.stringify(data));
console.log("收到父页面的参数:" + JSON.stringify(data));
let checkIds = uni.getStorageSync("4877CheckColor_" + data.data.id);
if (checkIds && checkIds.length) {
let groups = groupColors.filter(v => {
let filt = checkIds.find(id => {
return id === v.id;
});
if (filt) {
return true;
}
return false;
});
these.dic.groups = groups;
}
var device = data.data;
these.device = device;
let f = ble.data.LinkedList.find((v) => {
@ -443,7 +454,7 @@
}
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
@ -466,7 +477,71 @@
},
methods: {
ShowChannelEdit() {
this.Status.ShowEditChannel = true;
this.showPop({
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: ()=>{
this.onChannelChanging();
this.Status.ShowEditChannel=false;
},
showSlot: true,
buttonCancelText: '取消',
showCancel: true,
cancelCallback:()=>{
this.Status.ShowEditChannel=false;
}
});
},
onChannelChanging() {
let regex = /^(0|([1-9]\d?)|1[01]\d|12[0-5])$/;
if (!regex.test(this.formData.sta_Channel)) {
this.showMsg("只能输入0-125整数");
return;
}
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
clearTimeout(slidTime);
slidTime = setTimeout(() => {
console.log("11111");
let json = {
ins_channel: this.formData.sta_Channel
}
json = JSON.stringify(json);
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
console.log("发送成功");
this.setBleFormData();
}).catch(ex => {
this.showMsg(ex.msg);
});
}, 200)
},
ArrowSet(val) {
if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警")
return;
}
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
@ -486,27 +561,54 @@
this.showMsg(ex.msg);
});
},
groupSetting(item, index) {
groupCheck() {
uni.navigateTo({
url: '/pages/4877/BJQ4877CheckColor',
events: {
CheckGroupOver: function(data) {
debugger;
let arr = groupColors.filter(v => {
let f = data.checkIds.find(item => {
return item === v.id;
})
if (f) {
return true;
}
return false;
});
these.dic.groups = arr;
these.CheckGroupOver(data.allFlag);
}
},
success(res) {
res.eventChannel.emit("CheckGroup", these.device)
}
});
},
CheckGroupOver(arr) { //选择了某些配组
debugger;
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
if (this.formData.sta_GroupType === item.val) {
this.formData.sta_GroupType = '';
} else {
this.formData.sta_GroupType = item.val;
}
var json = {
ins_GroupType: this.formData.sta_GroupType
ins_GroupType: arr
}
json = JSON.stringify(json);
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30)
.catch(ex => {
this.showMsg(ex.msg);
});
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
}).catch(ex => {
this.showMsg(ex.msg);
});
},
showUnWarn(val) {
this.showPop({
message: '确定解除声光报警模式?',
@ -526,28 +628,57 @@
});
},
sosSetting(item, index) {
groupSetting(item, index) {
if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警")
return;
}
if (this.formData.sta_GroupType === item.id) {
return;
}
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
let groupSet = () => {
setTimeout(() => {
let buffer = {
ins_statusType: [item.id]
}
buffer = JSON.stringify(buffer);
console.error("发送命令:", buffer);
ble.sendString(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(
result => {
this.formData.sta_GroupType = item.id;
this.formData.sta_SOSType = 'sos_off'
console.log("配组设置成功");
});
}, 0);
}
groupSet();
},
sosSetting(item, index) {
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
let task = () => {
var json = {
ins_SOSType: this.formData.sta_SOSType == item.val ? 'sos_off' : item.val
}
json = JSON.stringify(json);
console.error("发送指令:", json);
// let f={deviceId:'111111'}
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
if (this.formData.sta_SOSType === item.val) {
this.formData.sta_SOSType = 'sos_off';
} else {
this.formData.sta_SOSType = item.val;
}
this.formData.sta_GroupType = -1;
this.formData.sta_SOSType = json.ins_SOSType
if (this.formData.sta_SOSType == 'sos') {
this.formData.warnTime = 0;
clearInterval(interval);
@ -560,25 +691,32 @@
})
.catch(ex => {
this.showMsg(ex.msg);
});
}
if (item.val === 'sos') {
this.showPop({
message: '确定开启声光报警模式?',
message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: task,
buttonText: "开启",
buttonText: (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启'),
showCancel: true,
buttonCancelText: '取消'
});
} else if (item.val === 'sos_off') {
task();
} else {
if (index !== undefined && this.formData.sta_SOSType == 'sos') {
this.showUnWarn(item.val);
if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警");
return;
} else {
task();
}
}
@ -753,7 +891,7 @@
return false;
});
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList);
ble.updateCache();
},
showBleUnConnect() {
@ -1345,7 +1483,7 @@
border-radius: 16rpx;
background: rgba(26, 26, 26, 1);
width: 100%;
padding: 30rpx 0rpx;
padding: 10rpx 0rpx;
}
.modeSetting {
@ -1381,8 +1519,8 @@
}
.modeSetting .arrow .outCircle {
width: 150rpx;
height: 150rpx;
width: 120rpx;
height: 120rpx;
box-sizing: border-box;
display: flex;
flex-direction: row;
@ -1593,4 +1731,124 @@
justify-content: space-between;
align-items: center;
}
.checkgroup {
color: rgba(174, 214, 0, 1);
font-family: PingFang SC;
font-size: 28rpx;
font-weight: 400;
letter-spacing: 0.14px;
text-align: left;
}
.colorContent {
display: flex;
align-content: center;
justify-content: flex-start;
justify-items: center;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
width: 100%;
box-sizing: border-box;
}
.colorContent .polygon {
width: 40rpx;
height: 40rpx;
border-radius: 8rpx;
}
.colorContent .text {
color: rgba(255, 255, 255, 0.87);
font-family: PingFang SC;
font-size: 30rpx;
font-weight: 400;
letter-spacing: 2rpx;
margin-left: 15rpx;
}
.colorContent .item {
background-color: #1A1A1A;
margin-left: 36rpx;
width: calc(calc(100% - 72rpx) / 3);
height: 110rpx;
margin-top: 24rpx;
box-sizing: border-box;
padding-left: 25rpx;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
align-content: center;
border-width: 1rpx;
border-style: solid;
border-color: #00000000;
border-radius: 8rpx;
}
.colorContent .item.active {
border-color: #AED600 !important;
}
.colorContent .marginNoLeft {
margin-left: 0rpx !important;
}
.popup-prompt {
width: 100%;
box-sizing: border-box;
padding: 30rpx 15%;
}
.popup-prompt-title {
text-align: center;
width: 100%;
float: left;
box-sizing: border-box;
white-space: nowrap;
color: rgba(255, 255, 255, 0.87);
font-family: PingFang SC;
font-size: 28rpx;
font-weight: 400;
line-height: 40rpx;
letter-spacing: 0.14rpx;
}
.popup-prompt-input {
width: 100%;
height: 60rpx;
line-height: 60rpx;
color: rgba(255, 255, 255, 0.87);
box-sizing: border-box;
border-bottom: 2rpx solid rgba(255, 255, 255, 0.4);
font-size: 28rpx;
font-weight: 400;
letter-spacing: 0.14px;
}
.popup-prompt-input-placeHolder {
color: rgba(255, 255, 255, 0.4);
font-family: PingFang SC;
font-size: 28rpx;
font-weight: 400;
letter-spacing: 0.14px;
text-align: center;
}
</style>

View File

@ -173,6 +173,7 @@
}
else{
try{
console.log("str=",receive.str)
let json=JSON.parse(receive.str);
let key = "sta_address";
if (key in json) {//100

View File

@ -601,6 +601,8 @@
console.log("无文件删除");
return;
}
console.log("item=", item);
let delFile = (tempFilePath) => {
let promise = new Promise((resolve, reject) => {
@ -687,7 +689,7 @@
this.Status.isEdit = false;
this.showMsg("操作成功", true);
}, 100)
}, 0)
}

View File

@ -1740,9 +1740,9 @@ class BleHelper {
bufferHex = bytes.map(b => '0x' + b.toString(16).padStart(2, '0').toUpperCase()).join(' ');
}
}
console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId);
console.log("发送数据(Hex):", bufferHex || "(空数据)");
console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0);
// console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId);
// console.log("发送数据(Hex):", bufferHex || "(空数据)");
// console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0);
if (ms === undefined) {
ms = 50;
}
@ -1831,10 +1831,10 @@ class BleHelper {
}
if (c.Linked) {
console.log("蓝牙已连接,直接发送数据");
// console.log("蓝牙已连接,直接发送数据");
return sendBuffer();
} else {
console.log("蓝牙未连接,先连接蓝牙再发送数据");
// console.log("蓝牙未连接,先连接蓝牙再发送数据");
return new Promise((resolve, reject) => {
let f = this.data.LinkedList.find((v) => {
return v.deviceId == deviceid;