1
0
forked from dyf/APP

Compare commits

...

4 Commits

Author SHA1 Message Date
547ec3f94b 完成HBY102 2025-11-17 15:31:44 +08:00
f2e5e7c1f3 Merge branch 'new-20250827' of http://47.107.152.87:3000/liubiao/APP into new-20250827 2025-11-17 15:31:14 +08:00
18fd446b07 完成HBY102 2025-11-17 15:30:57 +08:00
cb9ed0b1da 添加102 2025-11-14 17:28:20 +08:00
24 changed files with 3917 additions and 94 deletions

110
api/4877/BJQ4877.js Normal file
View File

@ -0,0 +1,110 @@
export const colors=[
{
r: 255,
g: 0,
b: 0,
name: '红色',
hex: '#FF0000',
check: false,
id: 1
},
{
r: 0,
g: 0,
b: 255,
name: '蓝色',
hex: '#0000FF',
check: false,
id: 2
},
{
r: 0,
g: 255,
b: 0,
name: '绿色',
hex: '#00FF00',
check: false,
id: 3
},
{
r: 255,
g: 255,
b: 0,
name: '黄色',
hex: '#FFFF00',
check: false,
id: 4
},
{
r: 0,
g: 255,
b: 255,
name: '青色',
hex: '#00FFFF',
check: false,
id: 5
},
{
r: 255,
g: 0,
b: 255,
name: '紫红色',
hex: '#FF00FF',
check: false,
id: 6
},
{
r: 51,
g: 255,
b: 153,
name: '薄荷绿',
hex: '#33FF99',
check: false,
id: 7
},
{
r: 255,
g: 102,
b: 102,
name: '珊瑚红',
hex: '#FF6666',
check: false,
id: 8
},
{
r: 153,
g: 255,
b: 0,
name: '柠绿',
hex: '#99FF00',
check: false,
id: 9
},
{
r: 128,
g: 0,
b: 128,
name: '紫色',
hex: '#800080',
check: false,
id: 10
},
{
r: 204,
g: 102,
b: 255,
name: '淡紫',
hex: '#CC66FF',
check: false,
id: 11
},
{
r: 102,
g: 204,
b: 255,
name: '浅蓝',
hex: '#66CCFF',
check: false,
id: 12
}
]

View File

@ -2,7 +2,7 @@
const config = { const config = {
// 开发环境 // 开发环境
development: { development: {
BASE_URL: 'http://192.168.2.23:8000', BASE_URL: 'https://www.cnxhyc.com/jq',
API_PREFIX: '', API_PREFIX: '',
// MQTT 配置 // MQTT 配置
MQTT_HOST: 'www.cnxhyc.com', MQTT_HOST: 'www.cnxhyc.com',

View File

@ -23,7 +23,8 @@
"Camera" : {}, "Camera" : {},
"Geolocation" : {}, "Geolocation" : {},
"Maps" : {}, "Maps" : {},
"Record" : {} "Record" : {},
"VideoPlayer" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {

View File

@ -347,6 +347,13 @@
{ {
"navigationBarTitleText" : "选择配组" "navigationBarTitleText" : "选择配组"
} }
},
{
"path" : "pages/102/HBY102",
"style" :
{
"navigationBarTitleText" : "HBY102"
}
} }

View File

@ -1118,7 +1118,7 @@
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) {
@ -1126,6 +1126,7 @@
console.log("22222", val) console.log("22222", val)
if (val === 'start') { if (val === 'start') {
//开始发包 //开始发包
console.log("开始发送数据");
updateLoading(these, { updateLoading(these, {
text: "开始发送" text: "开始发送"
}); });

1735
pages/102/HBY102.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,310 @@
<template>
<view class="contentBg mainContent">
<view class="colorContent">
<view v-for="item,index in colors" class="item" :class="{active:item.check,marginNoLeft:index%3===0}"
@click.stop="CheckGroup(item,index)">
<view class="polygon" :style="{backgroundColor:item.hex}">
</view>
<view class="text">{{item.name}}</view>
</view>
</view>
<view class="footer">
<view class="btnSave" @click.stop="CheckOver()">确定</view>
</view>
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
: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" />
</view>
</template>
<script>
import {
colors
} from '@/api/4877/BJQ4877.js';
var eventChannel = null;
var these=null;
export default {
data() {
return {
Status: {
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '您确定要这样做吗?',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '设备名称',
modelValue: '',
visibleClose: false,
okCallback: null,
buttonCancelText: '',
showCancel: false,
}
},
colors: [
],
device:{
}
}
},
onLoad() {
these=this;
this.colors = Object.assign([], colors);
eventChannel = this.getOpenerEventChannel();
eventChannel.on('CheckGroup', function(data) {
debugger;
if (data && data.id) {
these.device=data;
uni.getStorage({
key: "4877CheckColor_" + data.id,
success: (res) => {
if (res.data) {
debugger;
for (var index = 0; index < these.colors.length; index++) {
let f=res.data.find(v=>{
return v===these.colors[index].id;
});
if(f){
these.$set(these.colors[index], 'check',true);
}else{
these.$set(these.colors[index], 'check',false);
}
}
}
}
})
}
});
},
methods: {
CheckOver() {
let arr = this.colors.map(v => {
return v.check ? 1 : 0;
})
if (!arr.length) {
this.showMsg("请选择至少1个颜色配组");
return;
}
let checks = this.colors.filter(v => {
return v.check
}).map(item => {
return item.id
});
console.log("checks=", checks);
eventChannel.emit('CheckGroupOver', {allFlag:arr,checkIds:checks});
uni.setStorage({
key: "4877CheckColor_" + this.device.id,
data: checks
});
uni.navigateBack();
},
CheckGroup(item, index) {
this.$set(this.colors[index], 'check', !item.check)
},
closePop: function() {
this.Status.Pop.showPop = false;
if (this.Status.Pop.cancelCallback) {
this.Status.Pop.cancelCallback();
}
},
HidePop: function() {
if (this.Status.Pop.clickEvt == 'SendUsr') {
}
this.Status.Pop.showPop = false;
if (this.Status.Pop.okCallback) {
this.Status.Pop.okCallback();
}
},
showPop: function(option) {
hideLoading(this);
let def = {
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: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
showMsg(msg, isSucc) {
let icoUrl = '/static/images/6155/DeviceDetail/uploadErr.png';
let borderColor = "#e034344d";
let buttonBgColor = "#E03434";
if (isSucc) {
icoUrl = '/static/images/common/success.png';
borderColor = "#BBE600";
buttonBgColor = "#BBE600";
}
this.showPop({
message: msg,
iconUrl: icoUrl,
borderColor: borderColor,
buttonBgColor: buttonBgColor,
buttonText: '确定',
okCallback: null
});
}
}
}
</script>
<style>
.mainContent {
width: 100%;
min-height: 100vh;
box-sizing: border-box;
padding: 30rpx
}
.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;
}
.polygon {
/* 矩形 235 */
width: 30rpx;
height: 30rpx;
border-radius: 8rpx;
}
.text {
color: rgba(255, 255, 255, 0.87);
font-family: PingFang SC;
font-size: 28rpx;
font-weight: 400;
letter-spacing: 2rpx;
margin-left: 15rpx;
}
.item {
background-color: #1A1A1A;
margin-left: 36rpx;
width: calc(calc(100% - 72rpx) / 3);
height: 90rpx;
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;
}
.item.active {
border-color: #AED600 !important;
}
.marginNoLeft {
margin-left: 0rpx !important;
}
.footer {
position: fixed;
bottom: 75px;
left: 00rpx;
width: 100%;
height: 100rpx;
box-sizing: border-box;
padding: 0rpx 120rpx;
}
.btnSave {
background-color: #BBE600;
color: #232323DE;
text-align: center;
border-radius: 60rpx;
width: 100%;
height: 100rpx;
font-family: PingFang SC;
font-size: 32rpx;
font-weight: 400;
line-height: 100rpx;
letter-spacing: 12rpx;
}
</style>

1596
pages/4877/BJQ4877V1.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -617,18 +617,19 @@
var processAndSendImageData = function(pixels) { var processAndSendImageData = function(pixels) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 创建RGB565格式的像素数据 // 创建RGB565格式的像素数据
// console.log("pixels=",pixels);
const arr = ble.convertToRGB565(pixels, 'bgr'); const arr = ble.convertToRGB565(pixels, 'bgr');
var list = []; var list = [];
let index = 0; // 用于追踪arr的当前位置 let index = 0; // 用于追踪arr的当前位置
let packetSize = 2048; let packetSize = 3200;
let cSize = 248; let cSize = 200;
// 外层循环7个主要元素i从1到7 // 外层循环7个主要元素i从1到7
for (let i = 1; i < 8; i++) { for (let i = 1; i < 9; i++) {
let secondLevel = []; let secondLevel = [];
let secondCnt = 0; let secondCnt = 0;
// 中层循环每个主要元素包含9个子数组j从1到9 // 中层循环每个主要元素包含9个子数组j从1到9
for (let j = 1; j < 10; j++) { for (let j = 1; j < 9; j++) {
// 确定当前子数组的长度前8个是254第9个是64 // 确定当前子数组的长度前8个是254第9个是64
let thirdLevel = []; let thirdLevel = [];
@ -675,15 +676,16 @@
var sendImagePackets = function(imageData) { var sendImagePackets = function(imageData) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 总数据包数 // 总数据包数
const totalPackets = 7; const totalPackets = 8;
let currentPacket = 1; let currentPacket = 1;
let childPacket = 1; let childPacket = 1;
let totalChildPacket = 9; let totalChildPacket = 8;
// 发送单个数据包 // 发送单个数据包
const sendNextPacket = () => { const sendNextPacket = () => {
if (currentPacket > totalPackets) { if (currentPacket > totalPackets) {
updateLoading(these,{text:'发送完成,等待设备30秒'});
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
@ -696,57 +698,40 @@
}); });
resolve(); resolve();
}, 20000) }, 0)
return; return;
} }
var packetData = imageData[currentPacket - 1][childPacket - 1]; var packetData = imageData[currentPacket - 1][childPacket - 1];
// if (packetData.length == 0) { console.log("childPacket=", childPacket);
// hideLoading(these); console.log("packetData=", packetData);
// these.Status.BottomMenu.show = false;
// these.showPop({
// message: "上传成功",
// iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
// });
// resolve();
// return;
// }
let start = 0; let start = 0;
let bufferSize = packetData.length * 2; let bufferSize = packetData.length * 2;
if (currentPacket == 7) {
if (childPacket > 2 && childPacket < 9) {
bufferSize = 496;
} else if (childPacket == 9) {
bufferSize = 128;
}
}
if (childPacket == 1) { if (childPacket == 1) {
bufferSize = bufferSize + 8 bufferSize = bufferSize + 8
start = 8; start = 8;
} }
if (childPacket == 9) { //|| (currentPacket==7 && childPacket==3 if (childPacket == 8) { //|| (currentPacket==7 && childPacket==3
bufferSize = bufferSize + 1 bufferSize = bufferSize + 1
} }
//FA 09 10 04 FC 09 [00] [01] + 4096字节+FF 数据格式 //FA 09 0C 84 FB 09 00 [01~08] + 3200字节 +FF 数据格式
var buffer = new ArrayBuffer(bufferSize); var buffer = new ArrayBuffer(bufferSize);
var dataView = new DataView(buffer); var dataView = new DataView(buffer);
if (childPacket == 1) { if (childPacket == 1) {
dataView.setUint8(0, 0xFA); // 帧头 dataView.setUint8(0, 0xFA); // 帧头
dataView.setUint8(1, 0x09); // 帧头 dataView.setUint8(1, 0x09); // 帧头
dataView.setUint8(2, 0x10); // 帧头 dataView.setUint8(2, 0x0C); // 帧头
dataView.setUint8(3, 0x04); // 帧头 dataView.setUint8(3, 0x84); // 帧头
dataView.setUint8(4, 0xFC); // 帧头 dataView.setUint8(4, 0xFB); // 帧头
dataView.setUint8(5, 0x09); // 帧头 dataView.setUint8(5, 0x09);
dataView.setUint8(6, 0x00); // 帧头
dataView.setUint8(6, 0x00); // 图序号,图片固定0视频的话要写序号 dataView.setUint8(7, currentPacket); //包序号
dataView.setUint8(7, currentPacket); //子包序号
} }
for (let i = 0; i < packetData.length; i++) { for (let i = 0; i < packetData.length; i++) {
@ -754,7 +739,7 @@
} }
console.log("packetData.length=", packetData.length); console.log("packetData.length=", packetData.length);
console.log("bufferSize=", bufferSize) console.log("bufferSize=", bufferSize)
if (childPacket == 9) { // || (currentPacket==7 && childPacket==3 if (childPacket == 8) { // || (currentPacket==7 && childPacket==3
dataView.setUint8(bufferSize - 1, 0xFF); dataView.setUint8(bufferSize - 1, 0xFF);
} }
@ -768,10 +753,10 @@
console.log("第" + currentPacket + "大包,第" + childPacket + console.log("第" + currentPacket + "大包,第" + childPacket +
"小包发送完成,总计:" + curr); "小包发送完成,总计:" + curr);
updateLoading(these, { updateLoading(these, {
text: "正在发送" + curr + "/63" text: "正在发送" + curr + "/64"
}) })
if (childPacket == 9) { if (childPacket == 8) {
currentPacket++; currentPacket++;
childPacket = 1; childPacket = 1;
} else { } else {

View File

@ -328,7 +328,7 @@
these.EquipMents.push(arr[i]); these.EquipMents.push(arr[i]);
} }
} }
console.log("EquipMents=", these.EquipMents) // console.log("EquipMents=", these.EquipMents)
}, pagePath); }, pagePath);
//收到设备的消息回调 //收到设备的消息回调
ble.addReceiveCallback((receivData, f, path, arr) => { ble.addReceiveCallback((receivData, f, path, arr) => {
@ -386,11 +386,11 @@
Promise.allSettled(promis).finally(() => { Promise.allSettled(promis).finally(() => {
ble.StopSearch().finally(res => { ble.StopSearch().finally(res => {
// console.log("停止搜索成功"); console.log("停止搜索成功");
these.EquipMents = []; these.EquipMents = [];
these.PairEquip = []; these.PairEquip = [];
ble.StartSearch().then(result => { ble.StartSearch().then(result => {
// console.log("开始搜索成功"); console.log("开始搜索成功");
}).catch(err => { }).catch(err => {
console.error("开始搜索失败,err=", err); console.error("开始搜索失败,err=", err);
if (err.code === 10001) { if (err.code === 10001) {

BIN
static/images/102/line.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
static/images/102/redar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -6,6 +6,11 @@ const serviceDic = [ //合作供应商的蓝牙主服务
"writeId": "0000FFE1-0000-1000-8000-00805F9B34FB", "writeId": "0000FFE1-0000-1000-8000-00805F9B34FB",
"notifyId": "0000FFE2-0000-1000-8000-00805F9B34FB" "notifyId": "0000FFE2-0000-1000-8000-00805F9B34FB"
}, },
{
"serviceId": "0000FFF0-0000-1000-8000-00805F9B34FB",
"writeId": "0000FFF2-0000-1000-8000-00805F9B34FB",
"notifyId": "0000FFF1-0000-1000-8000-00805F9B34FB"
},
{ {
"serviceId": "0000AE30-0000-1000-8000-00805F9B34FB", "serviceId": "0000AE30-0000-1000-8000-00805F9B34FB",
"writeId": "0000AE03-0000-1000-8000-00805F9B34FB", "writeId": "0000AE03-0000-1000-8000-00805F9B34FB",
@ -510,7 +515,7 @@ class BleHelper {
} }
uni.onBluetoothAdapterStateChange((state) => { uni.onBluetoothAdapterStateChange((state) => {
// console.log('蓝牙状态发生变化:' + JSON.stringify(state)); console.log('蓝牙状态发生变化:' + JSON.stringify(state));
this.data.discovering = state.discovering; this.data.discovering = state.discovering;
if (this.data.available !== state.available) { if (this.data.available !== state.available) {
@ -632,18 +637,23 @@ class BleHelper {
}, 0); }, 0);
}); });
console.log("111111111")
uni.onBluetoothDeviceFound((res) => { uni.onBluetoothDeviceFound((res) => {
// console.log("发现新设备:" + JSON.stringify(devices)); // console.log("发现新设备:" + JSON.stringify(res,'name'));
let arr = []; let arr = [];
for (var i = 0; i < res.devices.length; i++) { for (var i = 0; i < res.devices.length; i++) {
let item = res.devices[i]; let item = res.devices[i];
// if(item.name){
// console.log("发现新设备",item.name+" "+item.RSSI);
// }
let f = serviceDic.find(v => { let f = serviceDic.find(v => {
return item.advertisServiceUUIDs return item.advertisServiceUUIDs
.includes(v.serviceId); .includes(v.serviceId);
}); });
if (f) { if (f) {
console.log("发现设备:", item); // console.log("发现目标设备:", item);
arr.push(item); arr.push(item);
} }
@ -788,7 +798,7 @@ class BleHelper {
if (isUpdate) { if (isUpdate) {
this.updateCache(); this.updateCache();
} }
// console.log("str1=", str); console.log("str1=", str);
} catch (ex) { } catch (ex) {
console.error("将数据转文本失败", ex); console.error("将数据转文本失败", ex);
} }
@ -927,7 +937,7 @@ class BleHelper {
services: serviceId ? [serviceId] : [], services: serviceId ? [serviceId] : [],
allowDuplicatesKey: true, allowDuplicatesKey: true,
success: (res) => { success: (res) => {
//console.log('开始搜索蓝牙设备成功'); console.log('开始搜索蓝牙设备成功');
resolve(res); resolve(res);
}, },
@ -1198,7 +1208,7 @@ class BleHelper {
deviceId: id, deviceId: id,
success: (res) => { success: (res) => {
if (res.services && res.services.length > 0) { if (res.services && res.services.length > 0) {
// console.log("获取到服务:" + JSON.stringify(res)); console.log("获取到服务:" + JSON.stringify(res));
this.data.LinkedList.find((v) => { this.data.LinkedList.find((v) => {
if (v.deviceId == id) { if (v.deviceId == id) {
@ -1223,7 +1233,7 @@ class BleHelper {
}); });
if (se) { if (se) {
// console.log("合作供应商的", s) console.log("合作供应商的", s)
this.data.LinkedList.find((v) => { this.data.LinkedList.find((v) => {
if (v.deviceId == id) { if (v.deviceId == id) {
v.writeServiceId = s.serviceId; v.writeServiceId = s.serviceId;
@ -1241,7 +1251,9 @@ class BleHelper {
// notifyCharId)); // notifyCharId));
} else { } else
{
console.error("预设的蓝牙服务和特征中找不到"); console.error("预设的蓝牙服务和特征中找不到");
for (var i = 0; i < res.services.length; i++) { for (var i = 0; i < res.services.length; i++) {
let service = res.services[i]; let service = res.services[i];
@ -1261,6 +1273,7 @@ class BleHelper {
Promise.all(promises) Promise.all(promises)
.then(results => { .then(results => {
console.log("results= ",results);
if (!s) { if (!s) {
//非指定供应商的设备,走订阅消息 //非指定供应商的设备,走订阅消息
return this.subScribe(id, true); return this.subScribe(id, true);
@ -1321,10 +1334,10 @@ class BleHelper {
serviceId: serviceId, serviceId: serviceId,
success: (res) => { success: (res) => {
// console.log("获取到特征:" + JSON.stringify(res)); console.log("获取到特征:" + JSON.stringify(res));
// res.characteristics.forEach((v) => { res.characteristics.forEach((v) => {
// v.serviceId = serviceId; v.serviceId = serviceId;
// }); });
//写特征 //写特征
let writeChar = res.characteristics.find(char => { let writeChar = res.characteristics.find(char => {
@ -1888,6 +1901,7 @@ class BleHelper {
} }
} }
let instance = null; let instance = null;

View File

@ -7,7 +7,8 @@ class BleReceive {
'/pages/650/HBY650': this.Receive_650.bind(this), '/pages/650/HBY650': this.Receive_650.bind(this),
'/pages/670/HBY670': this.Receive_670.bind(this), '/pages/670/HBY670': this.Receive_670.bind(this),
'/pages/4877/BJQ4877': this.Receive_4877.bind(this), '/pages/4877/BJQ4877': this.Receive_4877.bind(this),
'/pages/100/HBY100': this.Receive_100.bind(this) '/pages/100/HBY100': this.Receive_100.bind(this),
'/pages/102/HBY102':this.Receive_102.bind(this)
}; };
} }
@ -536,7 +537,7 @@ class BleReceive {
try { try {
// console.log("str=",receive.str); console.log("str=",receive.str);
receiveData = JSON.parse(receive.str); receiveData = JSON.parse(receive.str);
let recCnt = recArr.find(v => { let recCnt = recArr.find(v => {
@ -561,6 +562,44 @@ class BleReceive {
} }
Receive_102(receive,f,path,recArr){
let receiveData={};
try {
console.log("str=",receive.str);
receiveData = JSON.parse(receive.str);
let recCnt = recArr.find(v => {
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
.replace(/\//g, "").toLowerCase();
});
if (!recCnt) {
if (receiveData.sta_PowerPercent<=20) {
uni.showModal({
title: "提示",
content: "设备电量低",
showCancel: false
});
}
if (receiveData.sta_Intrusion===1) {
uni.showModal({
title: "提示",
content: "闯入报警中",
showCancel: false
});
}
}
} catch (error) {
receiveData = {};
console.log("文本解析失败",error)
}
return receiveData;
}
} }

View File

@ -363,4 +363,16 @@ export default {
}); });
}, },
getOSAndUpload(){
let os=uni.getSystemInfoSync().platform;
let url=''
if(os==='ios'){
url='https://apps.apple.com/cn/app/星汉物联/id6752555460'
}
else if(os==='android'){
url='https://www.pgyer.com/xhwl';
}
return {os:os,url:url};
}
} }

View File

@ -1,5 +1,5 @@
import config from '../config/index.js'; import config from '../config/index.js';
export const env = 'production'; //production development //开发of线上 改这里就行 export const env = 'development'; //production development //开发of线上 改这里就行
const BASE = config[env]; const BASE = config[env];
const request = (options) => { const request = (options) => {
console.log("options" + JSON.stringify(options), BASE.BASE_URL) console.log("options" + JSON.stringify(options), BASE.BASE_URL)

View File

@ -1,7 +1,7 @@
import request, { import request, {
baseURL baseURL
} from '@/utils/request.js' } from '@/utils/request.js'
import Common from '@/utils/Common.js'
/** /**
* 检查并执行wgt热更新 * 检查并执行wgt热更新
* @param {String} updateUrl - 检查更新的接口地址 * @param {String} updateUrl - 检查更新的接口地址
@ -178,10 +178,20 @@ function downloadAndInstallWgt(wgtUrl) {
var wating = plus.nativeUI.showWaiting({ var wating = plus.nativeUI.showWaiting({
title: "下载中0%" title: "下载中0%"
}); });
// uni.showLoading({
// title: '更新下载中...', //手动更新
// mask: true let ManualUpdate=()=>{
// }); setTimeout(()=>{
let url=Common.getOSAndUpload().url
plus.runtime.openURL(url, (res) => {
uni.showToast({
title: '打开失败',
icon: 'none'
});
});
},1000);
}
// 1. 下载wgt包 // 1. 下载wgt包
const downloadTask = uni.downloadFile({ const downloadTask = uni.downloadFile({
@ -219,20 +229,22 @@ function downloadAndInstallWgt(wgtUrl) {
wating.close(); wating.close();
uni.showToast({ uni.showToast({
title: '安装失败: ' + error.message, title: '安装失败,请手动下载更新;' + error.message,
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
console.error('wgt安装失败:', error); console.error('wgt安装失败:', error);
ManualUpdate();
}); });
} else { } else {
wating.close(); wating.close();
uni.showToast({ uni.showToast({
title: '下载失败', title: '下载失败,请手动下载更新;',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
ManualUpdate();
} }
}, },
fail: (err) => { fail: (err) => {
@ -243,6 +255,7 @@ function downloadAndInstallWgt(wgtUrl) {
duration: 2000 duration: 2000
}); });
console.error('wgt下载失败:', err); console.error('wgt下载失败:', err);
ManualUpdate();
} }
}); });