Merge branch 'liubiao-new-20250827'

This commit is contained in:
fengerli
2025-11-20 16:44:34 +08:00
31 changed files with 4703 additions and 465 deletions

View File

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

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

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

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

@ -1,268 +0,0 @@
commit c14da42ce5e3a1ce49d73681df28e66982dedba2 (HEAD -> main)
Author: fengerli <528575642@qq.com>
Date: Mon Nov 17 08:55:48 2025 +0800
210页面开发
commit dadad6ed194f88dceff90dcaa6c20d6513bf0282 (origin/main, origin/HEAD)
Author: fengerli <528575642@qq.com>
Date: Wed Nov 12 09:51:35 2025 +0800
添加token过期跳转到登录页
commit 426fdeddee783a8a551d683fb88d6ce2d6a9b9a1
Merge: 968d7a6 f835e25
Author: fengerli <528575642@qq.com>
Date: Sat Nov 8 10:33:20 2025 +0800
Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
commit 968d7a613dfa6c8be53520c99c01d1a889110b13
Author: fengerli <528575642@qq.com>
Date: Sat Nov 8 10:33:00 2025 +0800
6075页面功能开发
commit f835e25bbb7497f6545713cade4b032de17e11d1
Merge: b8ce162 012eca6
Author: dyf <974332738@qq.com>
Date: Sat Nov 8 10:32:38 2025 +0800
Merge pull request 'new-20250827 一些小优化' (#22) from liubiao/APP:new-20250827 into main
Reviewed-on: http://47.107.152.87:3000/dyf/APP/pulls/22
commit 012eca69853acd92a2bab85721ed99c85e0b7969
Merge: 623a474 b8ce162
Author: liub <itliubiao@qq.com>
Date: Fri Nov 7 13:08:05 2025 +0800
Merge branch 'new-20250827' of http://47.107.152.87:3000/liubiao/APP into new-20250827
# Conflicts:
# pages.json
# pages/100/HBY100.vue
# pages/6075/BJQ6075.vue
# pages/7305/BJQ7305.vue
# utils/BleReceive.js
commit 623a47466a6fef7c3fe40cfe5c1d52f85ac8d478
Author: liub <itliubiao@qq.com>
Date: Fri Nov 7 12:16:10 2025 +0800
合并线上代码
commit 2493bb7113fd21e64836ed912ff9ff72ed0fcd1e
Author: liub <itliubiao@qq.com>
Date: Fri Nov 7 11:57:35 2025 +0800
完成100
commit b8ce1621b45e40c3ff14d5d0ddaed3b362526d58
Merge: c81a4d1 27d212e
Author: fengerli <528575642@qq.com>
Date: Thu Nov 6 08:47:45 2025 +0800
Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
commit c81a4d1903eb32ed784b97e33d29076e46fb1531
Author: fengerli <528575642@qq.com>
Date: Thu Nov 6 08:46:27 2025 +0800
6075设备控制页
commit 27d212e7dc9dcf61f361bd633482d5f26cde4886
Author: 微微一笑 <709648985@qq.com>
Date: Wed Nov 5 19:18:05 2025 +0800
继续优化7305
commit 9037ef6ac31cfdcbe273c47ed79b75bfccbf2877
Merge: a30a631 2b72cc1
Author: 微微一笑 <709648985@qq.com>
Date: Wed Nov 5 11:17:11 2025 +0800
Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
commit a30a631ea647b0a0615e0c78d06de90f872d4990
Author: 微微一笑 <709648985@qq.com>
Date: Wed Nov 5 11:17:08 2025 +0800
改成13*13符合设备端
commit 2b72cc1a5cbe2a9e5923a262ea6cafe0413cbc1c
Merge: 77be45f a0c883f
Author: fengerli <528575642@qq.com>
Date: Wed Nov 5 11:13:35 2025 +0800
Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
commit 77be45f1f3bf43dd7c5184a6ba196da7d5a92a02
Author: fengerli <528575642@qq.com>
Date: Wed Nov 5 11:13:32 2025 +0800
6075
commit a0c883f4e3dfafa6805090eaebaffec811f50aec
Author: 微微一笑 <709648985@qq.com>
Date: Wed Nov 5 10:22:17 2025 +0800
优化蓝牙连接7305同步状态
commit 9313ec01060e32c7160f61e6a557ed53a4277e86
Merge: ca6345e d06cd6c
Author: fengerli <528575642@qq.com>
Date: Wed Nov 5 08:48:15 2025 +0800
Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
commit ca6345ee3e8572415e1c3454f4fe9f696da8c303
Author: fengerli <528575642@qq.com>
Date: Wed Nov 5 08:48:13 2025 +0800
6075页面开发
commit d06cd6cdfdf94321f5257891a85516b066ff8014
Author: 微微一笑 <709648985@qq.com>
Date: Tue Nov 4 19:30:47 2025 +0800
修复复杂字体渲染设备端乱序问题
commit 2218ca06501de44ad9ffdb7fbbb09d0733a5ba9e
Author: 微微一笑 <709648985@qq.com>
Date: Sat Nov 1 17:32:03 2025 +0800
修改输入框文本
commit 500b461bdd86a7c352e11af1e4827f9f1bb33ebb
Author: 微微一笑 <709648985@qq.com>
Date: Sat Nov 1 17:21:45 2025 +0800
修复7305设备上报问题
commit 3526f28d067bbcfb1f91bd2f86faa478f5f23794
Author: 微微一笑 <709648985@qq.com>
Date: Fri Oct 31 15:35:03 2025 +0800
修复蓝牙传输数据
commit 3eeffdb62c82e61a3de86766e4ac1c075bf28287
Merge: 317c762 bd56ca9
Author: fengerli <528575642@qq.com>
Date: Fri Oct 31 11:15:39 2025 +0800
Merge branch 'liubiao-new-20250827'
commit 317c762edc62551c2045415b0f4e598b0772a622
Author: fengerli <528575642@qq.com>
Date: Fri Oct 31 11:13:07 2025 +0800
7305文件报错
commit c39cbcb34d1929b2abb177f59538aaaae34dd292
Author: liub <itliubiao@qq.com>
Date: Thu Oct 30 11:10:57 2025 +0800
蓝牙开始、结束搜索添加状态判定
commit bd56ca997bb95078cf9b1ff7e32791af34dc3670 (liubiao-new-20250827)
Author: liub <itliubiao@qq.com>
Date: Mon Oct 27 13:00:34 2025 +0800
修复7305标签未闭合问题
commit cf60414d7686194f35f41e6f1cf1dfe8f6e89765
Author: liub <itliubiao@qq.com>
Date: Mon Oct 27 11:51:38 2025 +0800
蓝牙断开连接变成异步操作
commit 61ed91695f15decff77a9fec9d7af3f7fae0226a
Author: liub <itliubiao@qq.com>
Date: Mon Oct 27 10:52:17 2025 +0800
蓝牙模块添加在web平台默认成功方便调试功能,4877功能完成
commit d37ccfeabc9324872b686eb581ce33246fc1bb5d
Author: liub <itliubiao@qq.com>
Date: Fri Oct 24 17:21:18 2025 +0800
完成BJQ4877功能开发
commit 0909d9f023c6e3db7d65c025954b2626d6f1615f
Merge: 1d8b3b4 b20a93d
Author: liubiao <3909916335@qq.com>
Date: Fri Oct 24 11:46:02 2025 +0800
merge upstream
commit b20a93dd2854fef472eca51fd2a2934cba43ec59
Author: 微微一笑 <709648985@qq.com>
Date: Fri Oct 24 11:42:56 2025 +0800
修复传输时序问题
commit 1d8b3b4a9a7ed1030ce97b1ebb9121e1ceed365a
Merge: a5c6faa fa64e7f
Author: liub <itliubiao@qq.com>
Date: Fri Oct 24 11:08:32 2025 +0800
修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
# Conflicts:
# pages/7305/BJQ7305.vue
commit a5c6faa9dac8cadbaf6ea9d745e43bca9d48395c
Author: liub <itliubiao@qq.com>
Date: Fri Oct 24 11:04:36 2025 +0800
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
* 修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
commit 15ba241317a9ecc46bbb7022b4ec3638bfa00a4e
Author: liub <itliubiao@qq.com>
Date: Fri Oct 24 11:00:35 2025 +0800
修复蓝牙设备6155/7305全局弹窗与详情弹窗重复出现的问题
commit fa64e7f1fc9eb4b24e9bf6eab269e718299aabce
Merge: 0033649 1de958d
Author: liubiao <3909916335@qq.com>
Date: Fri Oct 24 10:57:08 2025 +0800
merge upstream
commit 45328120c1b552b483b325cad2511ab274305006
Author: liub <itliubiao@qq.com>
Date: Fri Oct 24 10:56:37 2025 +0800
修复6155/7305全局订阅与详情订阅重复弹窗
commit 1de958df20014e6a858d1a0da9e277766518c96c
Author: 微微一笑 <709648985@qq.com>
Date: Fri Oct 24 10:29:46 2025 +0800
修复优化7305设备屏幕点阵取模兼容设备端填坑
commit 0033649677964eb94ea930ba76f5f1a9020cffa3
Author: liub <itliubiao@qq.com>
Date: Thu Oct 23 16:36:48 2025 +0800
修改蓝牙接收数据处理逻辑改成配置式避免if无限增多
commit 738ce209a60

View File

@ -2,7 +2,7 @@
"name" : "星汉物联", "name" : "星汉物联",
"appid" : "__UNI__A21EF43", "appid" : "__UNI__A21EF43",
"description" : "设备管控", "description" : "设备管控",
"versionName" : "1.0.6", "versionName" : "1.0.7",
"versionCode" : "100", "versionCode" : "100",
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
@ -22,7 +22,9 @@
"Bluetooth" : {}, "Bluetooth" : {},
"Camera" : {}, "Camera" : {},
"Geolocation" : {}, "Geolocation" : {},
"Maps" : {} "Maps" : {},
"Record" : {},
"VideoPlayer" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {
@ -89,7 +91,18 @@
"appkey_android" : "d7d852dbda2b95f6f796fb9a711a9fee" "appkey_android" : "d7d852dbda2b95f6f796fb9a711a9fee"
} }
}, },
"push" : {} "push" : {
"unipush" : {
"version" : "2",
"offline" : true,
"hms" : {},
"oppo" : {},
"vivo" : {},
"mi" : {},
"meizu" : {},
"honor" : {}
}
}
}, },
"icons" : { "icons" : {
"android" : { "android" : {

View File

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

View File

@ -172,7 +172,7 @@
<view class="slider-container"> <view class="slider-container">
<slider min="10" max="100" step="10" :disabled="false" :value="formData.sta_LightDimmer" <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" /> @change="onBrightnessChanging" @changing="onBrightnessChanging" class="custom-slider" />
</view> </view>
@ -184,7 +184,7 @@
<view class="slider-container"> <view class="slider-container">
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.sta_LightFreq" <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" /> @change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
</view> </view>
@ -196,7 +196,7 @@
<view class="slider-container"> <view class="slider-container">
<slider min="1" max="8" step="1" :disabled="false" :value="formData.sta_VoiceVolume" <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" /> @change="onVolumeChanging" @changing="onVolumeChanging" class="custom-slider" />
</view> </view>
@ -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

@ -2,8 +2,7 @@
<view class="content contentBg"> <view class="content contentBg">
<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" <image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
<view class="row"> <view class="row">
@ -39,16 +38,31 @@
<text class="lbl">蓝牙状态</text> <text class="lbl">蓝牙状态</text>
<text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text> <text class="value" :class="formData.bleStatu?'green':'red'">{{formData.bleStatu?'已连接':'未连接'}}</text>
</view> </view>
<view class="item">
<text class="lbl">信道:{{formData.sta_Channel}}</text>
<text class="value green" @click.stop="ShowChannelEdit()">修改</text>
</view>
</view> </view>
<view class="warnnig" :class="formData.sta_SOSType=='sos'?'':'displayNone'" <view class="warnnig" :class="formData.sta_SOSType=='sos'?'':'displayNone'" @click.stop="showUnWarn('sos_off')">
@click.stop="showUnWarn('sos_off')">
<view>设备强制报警中</view> <view>设备强制报警中</view>
<view class="netContent"> <view class="netContent">
{{formData.warnTime}}s {{formData.warnTime}}s
</view> </view>
</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="lamp">
<view class="title"> <view class="title">
@ -85,25 +99,22 @@
<view class="lamp"> <view class="lamp">
<view class="title"> <view class="title">
<text>单色配组</text> <text>单色配组</text>
<view @click.stop="groupSetting({val:'off'})"> <view class="checkgroup" @click.stop="groupCheck()">
<image class="img" src="/static/images/common/close.png" mode="aspectFit"></image> 选择配组
</view> </view>
</view> </view>
</view> </view>
<view class="lampMode"> <view class="lampMode">
<view class="mode fleft " v-for="item,index in dic.gropus" <view class="colorContent">
:class="{active:formData.sta_GroupType===item.val,marginLeft:index%2==1}" <view v-for="item,index in dic.groups" class="item"
v-on:click.stop="groupSetting(item,index)"> :class="{active:item.id===formData.sta_GroupType,marginNoLeft:index%3===0}"
<view class="leftImg"> @click.stop="groupSetting(item,index)">
<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="polygon" :style="{backgroundColor:item.hex}">
</view>
<view class="text">{{item.name}}</view>
</view> </view>
</view> </view>
@ -213,19 +224,16 @@
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText" :iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle" @buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText" 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> </MessagePopup>
</view>
</BottomSlideMenuPlus> -->
<global-loading ref="loading" /> <global-loading ref="loading" />
</view> </view>
@ -244,18 +252,23 @@
request, request,
baseURL baseURL
} from '../../utils/request'; } from '../../utils/request';
import {
colors as groupColors
} from '@/api/4877/BJQ4877.js';
import usrApi from '@/api/670/HBY670.js'
const pagePath = "/pages/4877/BJQ4877"; const pagePath = "/pages/4877/BJQ4877";
var ble = null; var ble = null;
var these = null; var these = null;
var recei = null; var recei = null;
var interval = null; var interval = null;
var slidTime = null;
export default { export default {
data() { data() {
return { return {
Status: { Status: {
ShowEditChannel: false,
pageHide: false, pageHide: false,
Pop: { Pop: {
showPop: false, //是否显示弹窗 showPop: false, //是否显示弹窗
@ -276,6 +289,7 @@
okCallback: null, okCallback: null,
buttonCancelText: '', buttonCancelText: '',
showCancel: false, showCancel: false,
showSlot: false
}, },
BottomMenu: { BottomMenu: {
show: false, show: false,
@ -327,13 +341,14 @@
macAddress: '', macAddress: '',
bleStatu: false, bleStatu: false,
sta_SOSType: '', //sos sta_SOSType: '', //sos
sta_GroupType: '', //配组 sta_GroupType: -1, //配组
sta_ArrowType: '', //箭头方向 sta_ArrowType: '', //箭头方向
warnTime: 0 warnTime: 0,
sta_Channel: 80
}, },
dic: { dic: {
SOS: [{ SOS: [{
text: '声光报警', text: 'SOS报警',
val: 'sos', val: 'sos',
img: '/static/images/4877/sg.png', img: '/static/images/4877/sg.png',
activeImg: '/static/images/4877/sgActive.png' activeImg: '/static/images/4877/sgActive.png'
@ -345,30 +360,7 @@
activeImg: '/static/images/4877/fanActive.png' activeImg: '/static/images/4877/fanActive.png'
} }
], ],
gropus: [{ groups: [
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'
}
] ]
}, },
@ -397,11 +389,14 @@
onUnload() { onUnload() {
console.log("页面卸载,释放资源"); console.log("页面卸载,释放资源");
ble.removeAllCallback(pagePath); ble.removeAllCallback(pagePath);
clearInterval(interval);
}, },
onLoad: function() { onLoad: function() {
these = this; these = this;
recei = BleReceive.getBleReceive(); recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool(); ble = BleTool.getBleTool();
this.dic.gropus = [];
ble.addReceiveCallback(this.bleValueNotify, pagePath); ble.addReceiveCallback(this.bleValueNotify, pagePath);
@ -415,7 +410,23 @@
eventChannel.on('detailData', function(data) { 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; var device = data.data;
these.device = device; these.device = device;
let f = ble.data.LinkedList.find((v) => { let f = ble.data.LinkedList.find((v) => {
@ -466,7 +477,71 @@
}, },
methods: { 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) { ArrowSet(val) {
if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警")
return;
}
let f = this.getDevice(); let f = this.getDevice();
if (!f) { if (!f) {
this.showBleUnConnect(); this.showBleUnConnect();
@ -486,68 +561,124 @@
this.showMsg(ex.msg); 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(); let f = this.getDevice();
if (!f) { if (!f) {
this.showBleUnConnect(); this.showBleUnConnect();
return; return;
} }
if (this.formData.sta_GroupType === item.val) {
this.formData.sta_GroupType = '';
} else {
this.formData.sta_GroupType = item.val;
}
var json = { var json = {
ins_GroupType: this.formData.sta_GroupType ins_GroupType: arr
} }
json = JSON.stringify(json); json = JSON.stringify(json);
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30) ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
.catch(ex => {
}).catch(ex => {
this.showMsg(ex.msg); this.showMsg(ex.msg);
}); });
}, },
showUnWarn(val) { showUnWarn(val) {
this.showPop({ // this.showPop({
message: '确定解除声光报警模式?', // message: '确定解除声光报警模式?',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", // iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d", // borderColor: "#e034344d",
buttonBgColor: "#E03434", // buttonBgColor: "#E03434",
okCallback: () => { // okCallback: () => {
clearInterval(interval); clearInterval(interval);
this.sosSetting({ this.sosSetting({
val: val val: val
}); });
}, // },
buttonText: "解除", // buttonText: "解除",
showCancel: true, // showCancel: true,
buttonCancelText: '取消' // buttonCancelText: '取消'
}); // });
}, },
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(); let f = this.getDevice();
if (!f) { if (!f) {
this.showBleUnConnect(); this.showBleUnConnect();
return; 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 = () => { let task = () => {
var json = { var json = {
ins_SOSType: this.formData.sta_SOSType == item.val ? 'sos_off' : item.val 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 => { ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
this.formData.sta_GroupType = -1;
if (this.formData.sta_SOSType === item.val) { this.formData.sta_SOSType = json.ins_SOSType
this.formData.sta_SOSType = 'sos_off';
} else {
this.formData.sta_SOSType = item.val;
}
if (this.formData.sta_SOSType == 'sos') { if (this.formData.sta_SOSType == 'sos') {
this.formData.warnTime = 0; this.formData.warnTime = 0;
clearInterval(interval); clearInterval(interval);
@ -560,25 +691,44 @@
}) })
.catch(ex => { .catch(ex => {
this.showMsg(ex.msg); this.showMsg(ex.msg);
}); });
} }
if (item.val === 'sos') {
let confirmTask=()=>{
this.showPop({ this.showPop({
message: '确定开启声光报警模式?', message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: task, okCallback: task,
buttonText: "开启", buttonText: (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启'),
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); });
}
if (item.val === 'sos') {
confirmTask();
} else if (item.val === 'sos_off') {
if(this.formData.sta_SOSType === 'sos'){
confirmTask();
}else{
task();
}
} else { } else {
if (index !== undefined && this.formData.sta_SOSType == 'sos') {
this.showUnWarn(item.val); if (this.formData.sta_SOSType === 'sos') {
this.showMsg("设备强制报警中,请先关闭报警");
return;
} else { } else {
task(); task();
} }
} }
@ -753,7 +903,7 @@
return false; return false;
}); });
uni.setStorageSync(ble.StorageKey, ble.data.LinkedList); ble.updateCache();
}, },
showBleUnConnect() { showBleUnConnect() {
@ -1345,7 +1495,7 @@
border-radius: 16rpx; border-radius: 16rpx;
background: rgba(26, 26, 26, 1); background: rgba(26, 26, 26, 1);
width: 100%; width: 100%;
padding: 30rpx 0rpx; padding: 10rpx 0rpx;
} }
.modeSetting { .modeSetting {
@ -1381,8 +1531,8 @@
} }
.modeSetting .arrow .outCircle { .modeSetting .arrow .outCircle {
width: 150rpx; width: 120rpx;
height: 150rpx; height: 120rpx;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -1593,4 +1743,124 @@
justify-content: space-between; justify-content: space-between;
align-items: center; 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> </style>

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

@ -86,6 +86,15 @@
<text class="smallTxt">上传</text> <text class="smallTxt">上传</text>
</view> </view>
</view> </view>
<view class="mode fleft marginLeft" v-on:click.stop="UploadOpenVideo()">
<view class="leftImg">
<image class="img" src="/static/images/common/video.png" mode="aspectFit"></image>
</view>
<view class="rightTxt">
<text class="bigTxt">开机视频</text>
<text class="smallTxt">上传</text>
</view>
</view>
<view class="clear"></view> <view class="clear"></view>
</view> </view>
<view class="usrinfo"> <view class="usrinfo">
@ -162,6 +171,10 @@
updateLoading updateLoading
} from '@/utils/loading.js' } from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive'; import BleReceive from '@/utils/BleReceive';
import {
baseURL
} from '@/utils/request.js';
var pagePath = "/pages/6155/HBY6155"; var pagePath = "/pages/6155/HBY6155";
var ble = null; var ble = null;
@ -246,7 +259,7 @@
mode: '', mode: '',
bleStatu: '' bleStatu: ''
}, },
inteval: 200, inteval: 80,
device: { device: {
id: "", id: "",
deviceName: "", deviceName: "",
@ -617,18 +630,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 +689,18 @@
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 +713,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, 0xFD); // 帧头
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 +754,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 +768,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 {
@ -817,7 +817,7 @@
ImgCutOver: function(data) { ImgCutOver: function(data) {
showLoading(these, { showLoading(these, {
text: "正在发送0/52" text: "正在发送0/64"
}); });
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
@ -843,6 +843,344 @@
} }
}); });
}, },
UploadOpenVideo: function() { //开机动画
let f = these.getDevice();
if (!f) {
these.showBleUnConnect();
return;
}
let timeDelayCloseLoading = () => {
setTimeout(() => {
hideLoading(these);
}, 1500);
}
//视频上传
let uplploadVideo = (videoPath) => {
return new Promise((resolve, reject) => {
let start = new Date();
let token = uni.getStorageSync('token');
let clientid = uni.getStorageSync('clientID');
uni.uploadFile({
url: baseURL + "/app/video/upload",
filePath: videoPath,
name: 'file',
header: {
"Method": "POST",
"Content-Type": "multipart/form-data",
"Authorization": 'Bearer ' + token,
"clientid": clientid
},
formData: {
code: 2
},
timeout: 600000,
fail: (ex) => {
updateLoading(these, {
text: '视频文件上传失败了,请检查网络连接'
});
reject(ex);
},
success: (res) => {
// console.error(res);
let end = new Date();
var diff = (end.getTime() - start.getTime()) / 1000;
let s = diff % 60;
let m = parseInt((diff - s) / 60);
console.log("res.statusCode==", res.statusCode);
res.data = JSON.parse(res.data);
if (res.statusCode === 200) {
if (res.data.code == 200) {
console.log("上传完成,耗时:" + m + "分" + s + "秒");
updateLoading(these,{text:"上传完成,耗时:" + m + "分" + s + "秒,正在切片。"})
resolve(res.data);
return;
}
}
console.error("上传完成,耗时:" + m + "分" + s + "秒");
reject(res);
}
});
});
}
//视频切片
let videoCutPacket = (array) => {
return new Promise((resolve, reject) => {
try {
let imgSize = 25600;
let packetSize = 3200;
let tdSize = 500;
let results = [];
for (let i = 0; i < 30; i++) { //先切出30张每张25600字节
let packet = array.slice(0, imgSize);
array.splice(0, imgSize)
let secondLevel = [];
for (let j = 0; j < 8; j++) { //每张切8大包每包3200字节
let childPacket = packet.slice(0, packetSize);
packet.splice(0, packetSize);
let thirdLevel = [];
for (let k = 0; k < 7; k++) { //每1个大包切出7个小包前6包500字节第7包200字节共计56小包
let arr = childPacket.slice(0, tdSize);
childPacket.splice(0, tdSize)
thirdLevel.push(arr);
}
secondLevel.push(thirdLevel);
}
results.push(secondLevel);
}
updateLoading(these,{text:'切片完成,正在发送'});
resolve(results);
} catch (error) {
updateLoading(these, {
text: '视频切片发生异常'
});
reject(error);
}
});
}
//发送视频到设备
let shotVideoClick = (array, type, ReSendNo) => {
var sendImagePackets = () => {
return new Promise((resolve, reject) => {
this.currentPacket = 0;
// 总数据包数
var totalPackets = 1680;
this.totalPackets = totalPackets;
let currentPacket = 1;
let imgIndex = 0;
let imgPackIndex = 0;
let childPacketIndex = 0;
if (ReSendNo) {
this.currentPacket = ReSendNo - 1;
currentPacket = ReSendNo;
totalPackets = ReSendNo;
this.totalPackets = ReSendNo;
}
// 发送单个数据包
const sendNextPacket = () => {
// console.log("111111")
if (currentPacket > totalPackets) {
resolve();
return;
}
// console.log("111111")
// 计算当前包的数据
let packetSize = 500;
if ((currentPacket - 1) % 56 === 0) {
packetSize = 508;
}
if (childPacketIndex === 6) {
packetSize = 200;
}
if ((currentPacket - 1) % 56 === 55) {
packetSize = 201;
}
console.log("imgIndex=" + imgIndex + ",imgPackIndex=" +
imgPackIndex +
",childPacketIndex=" + childPacketIndex)
let packetData = array[imgIndex][imgPackIndex][childPacketIndex];
let buffer = new ArrayBuffer(packetSize);
let dataView = new DataView(buffer);
let sortNo = currentPacket.toString(16).padStart(4, '0');
// console.log("11111");
let start = 0;
if ((currentPacket - 1) % 56 === 0) {
// 填充头部
dataView.setUint8(0, 0xFA); // 帧头
dataView.setUint8(1, 0x09); // 帧类型:开机画面
dataView.setUint8(2, 0x0C);
dataView.setUint8(3, 0x84);
dataView.setUint8(4, 0xFD);
dataView.setUint8(5, 0x09);
dataView.setUint8(6, imgIndex);
dataView.setUint8(7, imgPackIndex + 1);
start = 8;
}
console.log("222222");
for (let i = 0; i < packetData.length; i++) {
dataView.setUint8(start + i, '0x' + packetData[i]);
}
// console.log("333333333");
if ((currentPacket - 1) % 56 === 55) {
dataView.setUint8(200, 0xFF);
}
// console.log("444444");
let inteval = parseInt(this.inteval ? this.inteval : 80);
ble.sendData(f.deviceId, buffer, f.writeServiceId, f
.wirteCharactId, ).then(() => {
if (ReSendNo) {
resolve();
return;
}
// 更新进度
this.currentPacket = currentPacket;
updateLoading(these,{
text:'正在发送:'+currentPacket+"/"+totalPackets
});
childPacketIndex++;
if (childPacketIndex == 7) {
imgPackIndex++;
if (imgPackIndex == 8) {
imgIndex++;
imgPackIndex = 0;
}
childPacketIndex = 0;
}
// 发送下一个包(添加延迟避免蓝牙缓冲区溢出)
currentPacket++;
setTimeout(sendNextPacket, inteval);
}).catch(err => {
if (err.code == 10007) {
console.error(err.errMsg + ",发送失败了,正在补偿:" +
currentPacket);
setTimeout(sendNextPacket, 100);
return;
}
console.error(err.errMsg + ",发送失败了" + currentPacket);
updateLoading(these,{text:"发送失败,"+err.errMsg});
reject(err);
});
};
// console.log("111111")
sendNextPacket();
});
}
return sendImagePackets();
}
uni.chooseVideo({
sourceType: ['album'],
success: function(res) {
console.log("res=",res);
let path = res.tempFilePath;
let width = res.width;
let height = res.height;
let duration = res.duration;
let err = [];
if (duration < 2) {
err.push("视频时长至少2秒");
}
if (width != 160 || height != 80) {
err.push("视频宽高必须是160*80");
}
if (err.length > 0) {
err = err.join(";");
these.showPop({
message: err,
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
return;
}
showLoading(these, {
text: '正在上传'
});
setTimeout(() => {
uplploadVideo(path).then(result => {
videoCutPacket(result.data).then(array => {
let start = new Date();
console.log("开始发送");
shotVideoClick(array).then(() => {
console.log("发送完成");
let end = new Date();
var diff = (end.getTime() - start.getTime()) / 1000;
let s =parseInt(diff % 60);
let m =parseInt((diff - s) / 60);
console.log("发送完成,耗时:" + m + "分" + s + "秒");
updateLoading(these,{
text: "发送完成,耗时:" + m + "分" + s + "秒",
});
}).catch((ex1) => {
console.log("出现了异常", ex1)
}).finally(() => {
timeDelayCloseLoading();
});
}).catch(err => {
timeDelayCloseLoading();
});
}).catch(ex => {
timeDelayCloseLoading();
});
}, 0);
}
});
},
UploadOpenImg: function() { UploadOpenImg: function() {
//上传开机画面 //上传开机画面
this.Status.BottomMenu.menuItems = []; this.Status.BottomMenu.menuItems = [];

View File

@ -1007,7 +1007,7 @@
dataView.setUint8(6 + i, '0x' + packetData[i]); dataView.setUint8(6 + i, '0x' + packetData[i]);
} }
let inteval = 50; let inteval = 30;
console.log("开始发送一段视频"); // console.log("开始发送一段视频"); //
ble.sendData(f.deviceId, buffer, f.writeServiceId, f ble.sendData(f.deviceId, buffer, f.writeServiceId, f
.wirteCharactId, 10).then(() => { .wirteCharactId, 10).then(() => {

View File

@ -309,6 +309,8 @@
data() { data() {
return { return {
Status: { Status: {
msgOkIntval:null,//紧急通知等待的时间
msgOkTime:null,//
pageHide: false, pageHide: false,
apiType: "listA", apiType: "listA",
navbar: { navbar: {
@ -465,6 +467,8 @@
onUnload() { onUnload() {
console.log("页面卸载,释放资源"); console.log("页面卸载,释放资源");
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`; let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
clearInterval(these.Status.staticWarn.inteval);
clearInterval(this.Status.msgOkIntval);
ble.removeAllCallback(pagePath); ble.removeAllCallback(pagePath);
if (mqttClient) { if (mqttClient) {
mqttClient.unsubscribe(statusTopic); mqttClient.unsubscribe(statusTopic);
@ -863,10 +867,22 @@
// console.log("收到文本回复", payload); // console.log("收到文本回复", payload);
// // this.SendTxtMQ(json); // // this.SendTxtMQ(json);
// } // }
// else if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知 if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
// console.log("收到紧急消息回复", payload); if(json.sta_BreakNews==='I get it')// && this.Status.msgOkTime && this.Status.msgOkIntval){
// // this.sendUrgentMQ(json); {
// } these.showPop({
showPop: true,
message: "用户已确认收到紧急通知",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
});
// this.Status.msgOkTime=null
// clearInterval(this.Status.msgOkIntval);
}
}
// else { // else {
// console.log("收到不能处理的数据", payload); // console.log("收到不能处理的数据", payload);
// } // }
@ -2498,7 +2514,7 @@
buttonBgColor: '#BBE600', buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE', buttonTextColor: '#232323DE',
iconUrl: '/static/images/6155/DeviceDetail/sendSucc.png', iconUrl: '/static/images/6155/DeviceDetail/sendSucc.png',
message: '发送成功', message: '发送成功,待用户确认',
buttonText: '确定', buttonText: '确定',
clickEvt: 'SendUsr', clickEvt: 'SendUsr',
visiblePrompt: false, visiblePrompt: false,
@ -2506,6 +2522,20 @@
modelValue: '', modelValue: '',
visibleClose: true visibleClose: true
}); });
// clearInterval(this.Status.msgOkIntval);
// this.Status.msgOkTime=0;
// this.Status.msgOkIntval=setInterval(()=>{
// this.Status.msgOkTime++;
// if(this.Status.msgOkTime>180){
// this.Status.msgOkTime=null
// clearInterval(this.Status.msgOkIntval);
// this.Status.msgOkIntval=null;
// }
// });
} else { } else {
these.showPop({ these.showPop({
message: res.msg, message: res.msg,

View File

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

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) {
@ -604,7 +604,7 @@
console.log("res=", res); console.log("res=", res);
linkCallback(res); linkCallback(res);
}).catch(ex => { }).catch(ex => {
console.log("ex=", ex) console.error("ex=", ex)
uni.showModal({ uni.showModal({
content: "连接失败:" + ex.msg content: "连接失败:" + ex.msg
}); });

View File

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

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);
} }
@ -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 => {
@ -1467,7 +1480,7 @@ class BleHelper {
deviceId: deviceId, deviceId: deviceId,
timeout: 30000, timeout: 30000,
success: (info) => { success: (info) => {
// console.log("新连接成功", this.data.LinkedList); console.log("新连接成功", this.data.LinkedList);
this.getLinkBlue().then((arr) => { this.getLinkBlue().then((arr) => {
let cr = arr.devices.find(c => { let cr = arr.devices.find(c => {
if (c.deviceId == deviceId) { if (c.deviceId == deviceId) {
@ -1740,9 +1753,9 @@ class BleHelper {
bufferHex = bytes.map(b => '0x' + b.toString(16).padStart(2, '0').toUpperCase()).join(' '); bufferHex = bytes.map(b => '0x' + b.toString(16).padStart(2, '0').toUpperCase()).join(' ');
} }
} }
console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId); // console.log("准备发送蓝牙指令 - deviceId:", deviceid, "writeServiceId:", writeServiceId, "writeCharactId:", wirteCharactId);
console.log("发送数据(Hex):", bufferHex || "(空数据)"); // console.log("发送数据(Hex):", bufferHex || "(空数据)");
console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0); // console.log("发送数据(原始buffer长度):", buffer ? (buffer.byteLength || buffer.length || 0) : 0);
if (ms === undefined) { if (ms === undefined) {
ms = 50; ms = 50;
} }
@ -1831,10 +1844,10 @@ class BleHelper {
} }
if (c.Linked) { if (c.Linked) {
console.log("蓝牙已连接,直接发送数据"); // console.log("蓝牙已连接,直接发送数据");
return sendBuffer(); return sendBuffer();
} else { } else {
console.log("蓝牙未连接,先连接蓝牙再发送数据"); // console.log("蓝牙未连接,先连接蓝牙再发送数据");
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let f = this.data.LinkedList.find((v) => { let f = this.data.LinkedList.find((v) => {
return v.deviceId == deviceid; return v.deviceId == deviceid;
@ -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)
}; };
} }
@ -58,10 +59,10 @@ class BleReceive {
if (handler) { if (handler) {
let data = handler(receive, f, path, recArr); let data = handler(receive, f, path, recArr);
console.log("handler返回的数据:", data); console.log("设备"+f.device.deviceName+"收到消息,handler返回的数据:", data);
return data; return data;
} else { } else {
console.log("已收到消息,但无指定处理程序, deviceUrl:", f.device.detailPageUrl, "可用handlers:", keys); console.error("已收到消息,但无指定处理程序, deviceUrl:", f.device.detailPageUrl, "可用handlers:", keys);
} }
} else { } else {
@ -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

@ -393,4 +393,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,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();
} }
}); });