完成7305,添加在详情页去绑定蓝牙设备
This commit is contained in:
69
App.vue
69
App.vue
@ -6,26 +6,26 @@
|
||||
onLaunch: function() {
|
||||
//以下代码仅在开发时使用,否则会出现不可预知的问题。
|
||||
//清除登陆之外的所有信息;
|
||||
// let store=uni.getStorageInfoSync();
|
||||
// store.keys.forEach((val,index,array)=>{
|
||||
// if(val=="tokenTime"){
|
||||
// let time=uni.getStorageSync(val);
|
||||
// if(!time){
|
||||
// time=0;
|
||||
// }
|
||||
// let currTime=new Date().getTime();
|
||||
// if(currTime>=time){
|
||||
// uni.removeStorageSync(val);
|
||||
// uni.removeStorageSync("token");
|
||||
// uni.removeStorageSync("clientID");
|
||||
// }
|
||||
// }
|
||||
// else if(val=="token" || val=="clientID"){
|
||||
// console.log("忽略登陆信息");
|
||||
// }else{
|
||||
// uni.removeStorageSync(val);
|
||||
// }
|
||||
// });
|
||||
let store=uni.getStorageInfoSync();
|
||||
store.keys.forEach((val,index,array)=>{
|
||||
if(val=="tokenTime"){
|
||||
let time=uni.getStorageSync(val);
|
||||
if(!time){
|
||||
time=0;
|
||||
}
|
||||
let currTime=new Date().getTime();
|
||||
if(currTime>=time){
|
||||
uni.removeStorageSync(val);
|
||||
uni.removeStorageSync("token");
|
||||
uni.removeStorageSync("clientID");
|
||||
}
|
||||
}
|
||||
else if(val=="token" || val=="clientID"){
|
||||
console.log("忽略登陆信息");
|
||||
}else{
|
||||
uni.removeStorageSync(val);
|
||||
}
|
||||
});
|
||||
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
||||
|
||||
uni.getSystemInfo({success:function(res){
|
||||
@ -47,21 +47,24 @@
|
||||
|
||||
<style lang="scss">
|
||||
@import 'vk-uview-ui/index.scss';
|
||||
// uni-slider .uni-slider-handle-wrapper {
|
||||
// border-radius: 20rpx;
|
||||
// }
|
||||
// uni-slider .uni-slider-thumb {
|
||||
// width: 66rpx !important;
|
||||
// height: 80rpx !important;
|
||||
// margin-top: -40rpx !important;
|
||||
// border-radius: 16rpx !important;
|
||||
// margin-left: -72rpx !important;
|
||||
/* #ifdef APP-ANDROID */
|
||||
//苹果应用以下样式后Slider不可拖动
|
||||
uni-slider .uni-slider-handle-wrapper {
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
uni-slider .uni-slider-thumb {
|
||||
width: 66rpx !important;
|
||||
height: 80rpx !important;
|
||||
margin-top: -40rpx !important;
|
||||
border-radius: 16rpx !important;
|
||||
margin-left: -72rpx !important;
|
||||
|
||||
}
|
||||
uni-slider .uni-slider-handle-wrapper {
|
||||
height: 88rpx;
|
||||
position: relative;
|
||||
// }
|
||||
// uni-slider .uni-slider-handle-wrapper {
|
||||
// height: 88rpx;
|
||||
// position: relative;
|
||||
// }
|
||||
/* #endif */
|
||||
.custom-file-picker .file-picker__box-content {
|
||||
background: rgba(26, 26, 26, 1);
|
||||
border: none !important;
|
||||
|
||||
@ -6,7 +6,7 @@ const config = {
|
||||
API_PREFIX: '',
|
||||
// MQTT 配置
|
||||
MQTT_HOST: '47.120.79.150',
|
||||
MQTT_PORT: 9083,
|
||||
MQTT_PORT: 8083,
|
||||
MQTT_USERNAME: 'admin',
|
||||
MQTT_PASSWORD: '#YtvpSfCNG'
|
||||
},
|
||||
@ -16,7 +16,7 @@ const config = {
|
||||
API_PREFIX: '',
|
||||
// MQTT 配置
|
||||
MQTT_HOST: '47.120.79.150',
|
||||
MQTT_PORT: 9083,
|
||||
MQTT_PORT: 8083,
|
||||
MQTT_USERNAME: 'admin',
|
||||
MQTT_PASSWORD: '#YtvpSfCNG'
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name" : "星汉物联",
|
||||
"appid" : "__UNI__A21EF43",
|
||||
"description" : "设备管控",
|
||||
"versionName" : "1.0.24",
|
||||
"versionName" : "1.0.25",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
|
||||
42
pages.json
42
pages.json
@ -1,12 +1,7 @@
|
||||
{
|
||||
"pages": [
|
||||
// {
|
||||
// "path": "pages/BlueTooth/ModeSetting/index",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "设备类型"
|
||||
// }
|
||||
// },
|
||||
|
||||
|
||||
|
||||
{
|
||||
"path": "pages/common/login/index",
|
||||
"style": {
|
||||
@ -113,21 +108,21 @@
|
||||
{
|
||||
"path": "pages/common/addBLE/addEquip",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加设备"
|
||||
"navigationBarTitleText": "扫描设备"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/common/addBLE/LinkBle",
|
||||
"style": {
|
||||
"navigationBarTitleText": "扫描到的设备"
|
||||
"navigationBarTitleText": "绑定设备"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/6155/deviceDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "HBY 6155"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/6155/deviceDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "HBY 6155"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/6155/ImgCrop",
|
||||
"style": {
|
||||
@ -197,7 +192,12 @@
|
||||
"navigationBarTitleText": "呼叫"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/BlueTooth/ModeSetting/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设备类型"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/BlueTooth/ModeSetting/VideoSend",
|
||||
"style": {
|
||||
@ -284,10 +284,16 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/BlueTooth/ModeSetting/4877",
|
||||
"path": "pages/BlueTooth/ModeSetting/4877",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/7305/BJQ7305",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : ""
|
||||
"navigationBarTitleText" : "BJQ7305"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">主灯模式</text>
|
||||
<text class="smallTxt">强光模式</text>
|
||||
<text class="smallTxt">{{getMode}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mode marginLeft fleft" v-on:click.stop="ModeSetting('fu')">
|
||||
@ -158,7 +158,7 @@
|
||||
var these = null;
|
||||
var BrighInteval = null;
|
||||
var recei = null;
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TextToHexV1
|
||||
@ -308,6 +308,7 @@
|
||||
// } else {
|
||||
// link();
|
||||
// }
|
||||
console.log("6155");
|
||||
ble.addReceiveCallback(these.bleValueNotify);
|
||||
let eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
@ -316,7 +317,7 @@
|
||||
|
||||
let device = data.data;
|
||||
these.device = device;
|
||||
console.log("收到父页面的参数:" + JSON.stringify(device));
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
if (v.macAddress == device.deviceMac) {
|
||||
console.log("找到设备了", v);
|
||||
@ -328,12 +329,7 @@
|
||||
if (!f) {
|
||||
|
||||
|
||||
these.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
let form = f.formData;
|
||||
@ -381,6 +377,35 @@
|
||||
if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
|
||||
remark = '微弱';
|
||||
}
|
||||
},
|
||||
getMode() {
|
||||
let txt = "关闭";
|
||||
if (this.Status.BottomMenu.type == 'fu') {
|
||||
return txt;
|
||||
}
|
||||
switch (this.formData.mode) {
|
||||
case 0:
|
||||
|
||||
|
||||
txt = "强光模式";
|
||||
|
||||
break;
|
||||
case 1:
|
||||
txt = "弱光模式";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
txt = "爆闪模式";
|
||||
break;
|
||||
case 3:
|
||||
txt = "关闭";
|
||||
break;
|
||||
default:
|
||||
txt = "关闭";
|
||||
break;
|
||||
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -394,12 +419,12 @@
|
||||
return f;
|
||||
},
|
||||
bleValueNotify: function(receive, device, path) {
|
||||
|
||||
let str = recei.ReceiveData(receive, device, pagePath);
|
||||
|
||||
|
||||
let str = recei.ReceiveData(receive, device, path);
|
||||
|
||||
console.log("处理接收到的数据:" + str);
|
||||
return;
|
||||
let data = recei.ReceiveData(receive, device, pagePath);
|
||||
let data = recei.ReceiveData(receive, device, path);
|
||||
let bytes = receive.bytes;
|
||||
|
||||
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
|
||||
@ -504,16 +529,40 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
showBleUnConnect() {
|
||||
this.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
uni.navigateTo({
|
||||
url: "/pages/common/addBLE/addEquip",
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('detailData', {
|
||||
data: these.device
|
||||
})
|
||||
},
|
||||
fail(ex) {
|
||||
console.log("跳转失败", ex);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
checkImgUpload: function() {
|
||||
let f = these.getDevice();
|
||||
|
||||
if (!f) {
|
||||
these.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -595,8 +644,8 @@
|
||||
these.showPop({
|
||||
message: "上传成功",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor : '#BBE600',
|
||||
buttonBgColor : '#BBE600'
|
||||
borderColor: '#BBE600',
|
||||
buttonBgColor: '#BBE600'
|
||||
});
|
||||
|
||||
resolve();
|
||||
@ -766,10 +815,10 @@
|
||||
text: '强光',
|
||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
||||
},
|
||||
{
|
||||
text: '工作光',
|
||||
icon: '/static/images/6155/DeviceDetail/fan.png'
|
||||
},
|
||||
// {
|
||||
// text: '工作光',
|
||||
// icon: '/static/images/6155/DeviceDetail/fan.png'
|
||||
// },
|
||||
{
|
||||
text: '弱光',
|
||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
||||
@ -822,16 +871,11 @@
|
||||
}
|
||||
this.closeMenu();
|
||||
},
|
||||
|
||||
setMode(mode, type) {
|
||||
|
||||
let dataValue = 0;
|
||||
this.setBleFormData();
|
||||
|
||||
|
||||
|
||||
|
||||
this.currentMode = mode;
|
||||
|
||||
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
@ -842,25 +886,25 @@
|
||||
dataValue = 0x01;
|
||||
} else if (type == 'fu') {
|
||||
|
||||
dataValue = 0x0A;
|
||||
dataValue = 0x04;
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
dataValue = 0x04;
|
||||
break;
|
||||
case 2:
|
||||
dataValue = 0x02;
|
||||
break;
|
||||
case 3:
|
||||
// case 2:
|
||||
// dataValue = 0x02;
|
||||
// break;
|
||||
case 2:
|
||||
dataValue = 0x03;
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
dataValue = 0x0B;
|
||||
break;
|
||||
|
||||
}
|
||||
console.log("dataValue=", dataValue)
|
||||
// console.log("dataValue=", dataValue)
|
||||
// 构建数据包
|
||||
var buffer = new ArrayBuffer(6);
|
||||
var dataView = new DataView(buffer);
|
||||
@ -876,12 +920,7 @@
|
||||
// 发送数据
|
||||
|
||||
if (!f) {
|
||||
these.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -890,7 +929,8 @@
|
||||
});
|
||||
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(() => {
|
||||
|
||||
this.formData.mode = mode;
|
||||
this.setBleFormData();
|
||||
}).catch((ex) => {
|
||||
these.showPop({
|
||||
message: "发送失败," + ex.msg,
|
||||
@ -934,38 +974,54 @@
|
||||
|
||||
},
|
||||
HidePop: function() {
|
||||
console.log("1111");
|
||||
if (this.Status.Pop.clickEvt == 'SendUsr') {
|
||||
|
||||
}
|
||||
if (this.Status.Pop.okCallback) {
|
||||
this.Status.Pop.okCallback();
|
||||
}
|
||||
this.Status.Pop.showPop = false;
|
||||
},
|
||||
showPop: function(option) {
|
||||
|
||||
hideLoading(this);
|
||||
let defaultCfg = {
|
||||
showHeader: false,
|
||||
headerTxt: "",
|
||||
showHeader: false,
|
||||
showCancel: false,
|
||||
borderColor: '#BBE600',
|
||||
buttonBgColor: '#BBE600',
|
||||
okCallback: null,
|
||||
cancelCallback: null,
|
||||
popType: 'custom',
|
||||
buttonText: '确定',
|
||||
clickEvt: ''
|
||||
};
|
||||
if (!option) {
|
||||
option = {
|
||||
a: 1
|
||||
};
|
||||
|
||||
}
|
||||
let keys = Object.keys(option);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
these.Status.Pop[key] = option[key];
|
||||
this.Status.Pop[key] = option[key];
|
||||
}
|
||||
if (!option.borderColor) {
|
||||
option.borderColor = '#BBE600';
|
||||
option.buttonBgColor = '#BBE600';
|
||||
keys = Object.keys(defaultCfg);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
if (key in option) {
|
||||
continue;
|
||||
}
|
||||
this.Status.Pop[key] = defaultCfg[key];
|
||||
}
|
||||
these.Status.Pop.showPop = true;
|
||||
|
||||
this.Status.Pop.showPop = true;
|
||||
},
|
||||
sendUsr() {
|
||||
let f = this.getDevice();
|
||||
if (!f) {
|
||||
these.showPop({
|
||||
text: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect()
|
||||
return;
|
||||
}
|
||||
showLoading(these, {
|
||||
@ -1119,19 +1175,19 @@
|
||||
console.log("发送成功");
|
||||
this.showPop({
|
||||
message: "发送成功",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor : '#BBE600',
|
||||
buttonBgColor : '#BBE600'
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
|
||||
borderColor: '#BBE600',
|
||||
buttonBgColor: '#BBE600'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let json = {
|
||||
deviceId: these.device.id,
|
||||
name: these.formData.textLines[2],
|
||||
position: these.formData.textLines[0],
|
||||
unitName: these.formData.textLines[1],
|
||||
deviceId: these.device.id,
|
||||
name: these.formData.textLines[1],
|
||||
position: these.formData.textLines[0],
|
||||
unitName: these.formData.textLines[2],
|
||||
code: ""
|
||||
};
|
||||
usrApi.sendUsr(json)
|
||||
|
||||
@ -293,6 +293,7 @@
|
||||
these = this;
|
||||
recei = BleReceive.getBleReceive();
|
||||
ble = BleTool.getBleTool();
|
||||
console.log("650")
|
||||
ble.addReceiveCallback(these.bleValueNotify);
|
||||
let eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
@ -312,12 +313,7 @@
|
||||
if (!f) {
|
||||
|
||||
|
||||
these.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
let form = f.formData;
|
||||
@ -555,12 +551,7 @@
|
||||
these.setBleFormData();
|
||||
});
|
||||
} else {
|
||||
these.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect();
|
||||
hideLoading(these);
|
||||
}
|
||||
}
|
||||
@ -569,6 +560,34 @@
|
||||
|
||||
|
||||
},
|
||||
showBleUnConnect(){
|
||||
|
||||
this.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText:'去连接',
|
||||
okCallback:function(){
|
||||
console.log("1111");
|
||||
uni.navigateTo({
|
||||
url:"/pages/common/addBLE/addEquip",
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('detailData', { data: these.device })
|
||||
},
|
||||
fail(ex){
|
||||
console.log("跳转失败",ex);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
LampToggle: function() {
|
||||
|
||||
this.formData.cMode = !this.formData.cMode;
|
||||
@ -1143,12 +1162,7 @@
|
||||
|
||||
let f = this.getDevice();
|
||||
if (!f) {
|
||||
these.showPop({
|
||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
these.showBleUnConnect();
|
||||
return;
|
||||
}
|
||||
showLoading(this, {
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
</view>
|
||||
|
||||
<view class="warnnig" v-bind:class="formData.staticWarn?'':'displayNone'">
|
||||
<view>警告!环境存在漏电电源!</view>
|
||||
<view>警告!设备静止报警中!</view>
|
||||
<view class="netContent">
|
||||
<view v-bind:class="getWarnStyle(1)" class="net netone"></view>
|
||||
<view v-bind:class="getWarnStyle(2)" class="net nettwo"></view>
|
||||
@ -55,7 +55,7 @@
|
||||
</view>
|
||||
<view class="warnnig" v-bind:class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'"
|
||||
@click="CloseWarn(true)">
|
||||
<view>设备强制闪烁报警中!</view>
|
||||
<view>设备强制报警中!</view>
|
||||
<view class="netContent">
|
||||
{{Status.staticWarn.time}}s
|
||||
</view>
|
||||
@ -90,7 +90,9 @@
|
||||
:src="formData.SOS=='sg'?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
|
||||
mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="txt">声光报警</view>
|
||||
<view :class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'">
|
||||
报警中{{Status.staticWarn.time}}</view>
|
||||
<view :class="(formData.qzwarn && Status.staticWarn.time)?'displayNone':''" class="txt">声光报警</view>
|
||||
</view>
|
||||
<view class="item" @click="sosSetting('rb')" :class="formData.SOS=='rb'?'active':''">
|
||||
<view class="imgContent center">
|
||||
@ -296,7 +298,8 @@
|
||||
visiblePrompt: false,
|
||||
promptTitle: '设备名称',
|
||||
modelValue: '',
|
||||
visibleClose: false
|
||||
visibleClose: false,
|
||||
|
||||
},
|
||||
BottomMenu: {
|
||||
show: false,
|
||||
@ -344,7 +347,7 @@
|
||||
Lat: "", //纬度
|
||||
address: "", //地址
|
||||
modeCurr: "", //档位
|
||||
SOS: "sg", //sos
|
||||
SOS: "", //sos
|
||||
lightCurr: "qiang", //照明模式
|
||||
company: "", //单位
|
||||
usrname: "", //姓名
|
||||
@ -400,6 +403,7 @@
|
||||
these = this;
|
||||
recei = BleReceive.getBleReceive();
|
||||
ble = BleTool.getBleTool();
|
||||
console.log("670")
|
||||
ble.addReceiveCallback(these.bleValueNotify);
|
||||
let eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
@ -688,9 +692,9 @@
|
||||
if (this.formData.imei) {
|
||||
this.initMQ();
|
||||
}
|
||||
if (these.formData.staticWarn) { //有静止报警
|
||||
if (this.formData.staticWarn) { //有静止报警
|
||||
these.showPop({
|
||||
message: "环境存在漏电电源",
|
||||
message: "设备静止报警中",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
@ -701,7 +705,7 @@
|
||||
|
||||
}
|
||||
|
||||
these.setBleFormData();
|
||||
this.setBleFormData();
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
@ -805,113 +809,97 @@
|
||||
|
||||
setTimeout(task, 0);
|
||||
},
|
||||
CloseWarn: function(ispop) {
|
||||
CloseWarn: function(ispop) { //解除强制报警
|
||||
let closeEvt = () => {
|
||||
{
|
||||
these.Status.Pop.showPop = false;
|
||||
|
||||
these.formData.qzwarn = false;
|
||||
clearInterval(these.Status.staticWarn.inteval);
|
||||
these.Status.Pop.showPop = false;
|
||||
|
||||
let closeSOS = () => {
|
||||
let json = {
|
||||
ins_SOSGrade: [0]
|
||||
};
|
||||
these.formData.qzwarn = false;
|
||||
clearInterval(these.Status.staticWarn.inteval);
|
||||
|
||||
let requestCloseSOS = () => {
|
||||
let json = {
|
||||
ins_SOSGrade: [0]
|
||||
};
|
||||
|
||||
|
||||
this.sendMQ(json).then((res) => {
|
||||
console.log("4g发送成功");
|
||||
}).catch((ex) => {
|
||||
console.log("ex=", ex);
|
||||
these.showPop({
|
||||
message: "通信异常,请检查手机或设备网络",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
this.sendMQ(json).then((res) => {
|
||||
console.log("4g发送成功");
|
||||
|
||||
}).finally(() => {
|
||||
hideLoading(these);
|
||||
these.setBleFormData();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let closeWarn = () => {
|
||||
let json = {
|
||||
ins_ShakeBit: [0]
|
||||
};
|
||||
|
||||
|
||||
this.sendMQ(json).then((res) => {
|
||||
console.log("4g发送成功");
|
||||
}).catch((ex) => {
|
||||
console.log("ex=", ex);
|
||||
these.showPop({
|
||||
message: "通信异常,请检查手机或设备网络",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
|
||||
}).finally(() => {
|
||||
hideLoading(these);
|
||||
these.setBleFormData();
|
||||
});
|
||||
}
|
||||
|
||||
let f = this.getDevice();
|
||||
let buffer = null;
|
||||
if (f) {
|
||||
// 发送数据
|
||||
buffer = new ArrayBuffer(6);
|
||||
let dataView = new DataView(buffer);
|
||||
dataView.setUint8(0, 0x55); // 帧头
|
||||
dataView.setUint8(1, 0x06); // 帧类型
|
||||
dataView.setUint8(2, 0x01); // 包序号
|
||||
dataView.setUint8(3, 0x00); // 数据长度
|
||||
dataView.setUint8(4, 0x01); // 数据长度
|
||||
dataView.setUint8(5, 0x71); // 数据
|
||||
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(
|
||||
() => {
|
||||
console.log("关闭强制报警成功")
|
||||
dataView.setUint8(0, 0x55); // 帧头
|
||||
dataView.setUint8(1, 0x05); // 帧类型
|
||||
dataView.setUint8(2, 0x01); // 包序号
|
||||
dataView.setUint8(3, 0x00); // 数据长度
|
||||
dataView.setUint8(4, 0x01); // 数据长度
|
||||
dataView.setUint8(5, 0x68);
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10)
|
||||
.then(() => {
|
||||
console.log("成功");
|
||||
});
|
||||
}).catch(ex => {
|
||||
closeSOS();
|
||||
// closeWarn();
|
||||
}).catch((ex) => {
|
||||
console.log("ex=", ex);
|
||||
these.showPop({
|
||||
message: "通信异常,请检查手机或设备网络",
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
});
|
||||
|
||||
} else {
|
||||
closeSOS();
|
||||
// closeWarn();
|
||||
}
|
||||
}).finally(() => {
|
||||
hideLoading(these);
|
||||
this.formData.SOS = 'close';
|
||||
these.setBleFormData();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let f = this.getDevice();
|
||||
let buffer = null;
|
||||
if (f) {
|
||||
// 发送数据
|
||||
buffer = new ArrayBuffer(6);
|
||||
let dataView = new DataView(buffer);
|
||||
dataView.setUint8(0, 0x55); // 帧头
|
||||
dataView.setUint8(1, 0x05); // 帧类型
|
||||
dataView.setUint8(2, 0x01); // 包序号
|
||||
dataView.setUint8(3, 0x00); // 数据长度
|
||||
dataView.setUint8(4, 0x01); // 数据长度
|
||||
dataView.setUint8(5, 0x6A); // 数据
|
||||
|
||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(
|
||||
() => {
|
||||
console.log("关闭强制报警成功")
|
||||
|
||||
}).catch(ex => {
|
||||
requestCloseSOS();
|
||||
}).finally(() => {
|
||||
this.formData.SOS = 'close';
|
||||
these.setBleFormData();
|
||||
});
|
||||
|
||||
} else {
|
||||
requestCloseSOS();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (!ispop) {
|
||||
closeEvt();
|
||||
return;
|
||||
}
|
||||
this.showQzWarn(closeEvt);
|
||||
|
||||
},
|
||||
showQzWarn(callback) {
|
||||
let message = '持续报警时间' + this.Status.staticWarn.time;
|
||||
if (this.Status.Pop.clickEvt == 'time' && this.Status.Pop.showPop) {
|
||||
this.Status.Pop.message = message
|
||||
return;
|
||||
}
|
||||
this.showPop({
|
||||
showHeader: true,
|
||||
headerTxt: "强制报警",
|
||||
message: '持续报警时间' + this.Status.staticWarn.time,
|
||||
message: message,
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: "解除报警",
|
||||
okCallback: closeEvt
|
||||
okCallback: callback,
|
||||
clickEvt: 'time'
|
||||
});
|
||||
|
||||
},
|
||||
sosSetting: function(type) {
|
||||
if (this.formData.SOS == type) {
|
||||
@ -922,7 +910,7 @@
|
||||
text: "请稍候..."
|
||||
});
|
||||
let task = () => {
|
||||
this.formData.SOS = type;
|
||||
|
||||
let dic = {
|
||||
ble: {
|
||||
rb: 0x68,
|
||||
@ -944,6 +932,8 @@
|
||||
let requestSend = () => {
|
||||
this.sendMQ(json).then((res) => {
|
||||
console.log("4g发送成功");
|
||||
|
||||
|
||||
}).catch((ex) => {
|
||||
console.log("ex=", ex);
|
||||
these.showPop({
|
||||
@ -961,7 +951,7 @@
|
||||
|
||||
}
|
||||
|
||||
let SendCmd = () => {
|
||||
let bleSendCmd = () => {
|
||||
let f = this.getDevice();
|
||||
let buffer = null;
|
||||
if (f) {
|
||||
@ -979,21 +969,6 @@
|
||||
() => {
|
||||
console.log("蓝牙发送成功了");
|
||||
|
||||
// dic = {
|
||||
// close: 0x71
|
||||
// }
|
||||
// if (type in dic) {
|
||||
// dataView.setUint8(1, 0x06); // 帧类型
|
||||
// dataView.setUint8(5, 0x71); // 数据
|
||||
|
||||
// } else {
|
||||
// dataView.setUint8(1, 0x06); // 帧类型
|
||||
// dataView.setUint8(5, 0x70); // 数据
|
||||
// }
|
||||
// ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId,
|
||||
// 10).then(() => {
|
||||
// console.log("蓝牙发送报警成功", type);
|
||||
// })
|
||||
|
||||
hideLoading(these);
|
||||
these.setBleFormData();
|
||||
@ -1007,45 +982,70 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (type !== 'sg') {
|
||||
SendCmd();
|
||||
} else {
|
||||
let OpenSOS = () => {
|
||||
these.formData.qzwarn = true; //标记为强制报警了
|
||||
|
||||
these.Status.staticWarn.time = 50;
|
||||
this.formData.SOS = type;
|
||||
|
||||
let loopFunc = () => {
|
||||
if (these.Status.staticWarn.inteval === null) {
|
||||
return;
|
||||
}
|
||||
if (these.Status.staticWarn.time === 0) {
|
||||
|
||||
|
||||
clearInterval(these.Status.staticWarn.inteval);
|
||||
these.Status.staticWarn.inteval = null;
|
||||
these.formData.qzwarn = false;
|
||||
these.formData.SOS = 'close';
|
||||
these.CloseWarn(false);
|
||||
return;
|
||||
}
|
||||
these.Status.staticWarn.time = these.Status.staticWarn
|
||||
.time - 1;
|
||||
|
||||
if (these.Status.Pop.clickEvt == 'time' && this.Status.Pop.showPop) {
|
||||
console.log("111111");
|
||||
this.showQzWarn(this.Status.Pop.okCallback);
|
||||
}
|
||||
}
|
||||
these.Status.staticWarn.inteval = setInterval(() => {
|
||||
loopFunc();
|
||||
}, 1000)
|
||||
|
||||
bleSendCmd();
|
||||
}
|
||||
|
||||
|
||||
if (type == 'rb') { //红蓝报警
|
||||
this.formData.SOS = type;
|
||||
bleSendCmd();
|
||||
return;
|
||||
}
|
||||
if (type == 'sg') //强制报警
|
||||
{
|
||||
|
||||
this.showPop({
|
||||
message: '确定开启声光报警模式?',
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
okCallback: function() {
|
||||
these.formData.qzwarn = true;
|
||||
|
||||
these.Status.staticWarn.time = 180;
|
||||
|
||||
|
||||
let loopFunc = () => {
|
||||
if (these.Status.staticWarn.inteval === null) {
|
||||
return;
|
||||
}
|
||||
if (these.Status.staticWarn.time === 0) {
|
||||
console.log("111111");
|
||||
|
||||
clearInterval(these.Status.staticWarn.inteval);
|
||||
these.Status.staticWarn.inteval = null;
|
||||
these.formData.qzwarn = false;
|
||||
these.formData.SOS = 'close';
|
||||
these.CloseWarn(false);
|
||||
return;
|
||||
}
|
||||
these.Status.staticWarn.time = these.Status.staticWarn
|
||||
.time - 1;
|
||||
}
|
||||
these.Status.staticWarn.inteval = setInterval(() => {
|
||||
loopFunc();
|
||||
}, 1000)
|
||||
|
||||
SendCmd();
|
||||
}
|
||||
okCallback: OpenSOS,
|
||||
buttonText: "开启"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (type == 'close') {
|
||||
|
||||
if (this.formData.SOS = 'sg') { //解除声光报警
|
||||
this.CloseWarn(true);
|
||||
} else {
|
||||
this.formData.SOS = type;
|
||||
bleSendCmd();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1522,7 +1522,30 @@
|
||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
buttonText: '去连接',
|
||||
okCallback: function() {
|
||||
console.log("1111");
|
||||
uni.navigateTo({
|
||||
url: "/pages/common/addBLE/addEquip",
|
||||
events: {
|
||||
BindOver: function(data) {
|
||||
console.log(data)
|
||||
}
|
||||
},
|
||||
success: function(res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
res.eventChannel.emit('detailData', {
|
||||
data: these.device
|
||||
})
|
||||
},
|
||||
fail(ex) {
|
||||
console.log("跳转失败", ex);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
let uploadVideo = () => {
|
||||
@ -1747,7 +1770,9 @@
|
||||
buttonBgColor: '#BBE600',
|
||||
okCallback: null,
|
||||
cancelCallback: null,
|
||||
popType: 'custom'
|
||||
popType: 'custom',
|
||||
buttonText: '确定',
|
||||
clickEvt: ''
|
||||
};
|
||||
if (!option) {
|
||||
|
||||
@ -1755,7 +1780,7 @@
|
||||
let keys = Object.keys(option);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
these.Status.Pop[key] = option[key];
|
||||
this.Status.Pop[key] = option[key];
|
||||
}
|
||||
keys = Object.keys(defaultCfg);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
@ -1763,10 +1788,10 @@
|
||||
if (key in option) {
|
||||
continue;
|
||||
}
|
||||
these.Status.Pop[key] = defaultCfg[key];
|
||||
this.Status.Pop[key] = defaultCfg[key];
|
||||
}
|
||||
|
||||
these.Status.Pop.showPop = true;
|
||||
this.Status.Pop.showPop = true;
|
||||
},
|
||||
sendUsr: function(ReSendNo) {
|
||||
|
||||
@ -1873,7 +1898,7 @@
|
||||
|
||||
|
||||
let json = {
|
||||
deviceId: these.device.id,
|
||||
deviceId: these.device.id,
|
||||
name: these.formData.company,
|
||||
position: these.formData.usrname,
|
||||
unitName: these.formData.job,
|
||||
|
||||
1720
pages/7305/BJQ7305.vue
Normal file
1720
pages/7305/BJQ7305.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -226,8 +226,7 @@
|
||||
<script>
|
||||
import gbk from '@/utils/gbk.js';
|
||||
import MqttClient from '@/utils/mqtt.js';
|
||||
import {
|
||||
request,
|
||||
import request,{
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
var videoChannel = null;
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
设备名:{{device.deviceName}}
|
||||
</view>
|
||||
<view class="deviceId">
|
||||
ID:{{device.deviceId}}
|
||||
设备Mac:{{device.macAddress}}
|
||||
</view>
|
||||
<view class="bound" v-bind:class="boundStatu">
|
||||
{{Statu.boundRemark}}
|
||||
@ -86,15 +86,16 @@
|
||||
onLoad(option) {
|
||||
these = this;
|
||||
ble = bleTool.getBleTool();
|
||||
console.log("LinkBle")
|
||||
ble.addReceiveCallback((receive, f, path) => {
|
||||
console.log("收到设备消息,", receive);
|
||||
if (these.device.deviceId == receive.deviceId) {
|
||||
// console.log("11111");
|
||||
console.log("11111:",receive);
|
||||
|
||||
if (receive.bytes[0] == 0xFC || receive.str.indexOf('mac address:') == 0) {
|
||||
if (f && f.macAddress) {
|
||||
these.device.macAddress = f.macAddress;
|
||||
// console.log("222222");
|
||||
console.log("222222");
|
||||
these.initDevice();
|
||||
}
|
||||
}
|
||||
@ -233,7 +234,7 @@
|
||||
v.device[key] = data[key];
|
||||
}
|
||||
|
||||
ble.setBleData();
|
||||
ble.updateCache();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -97,6 +97,7 @@
|
||||
const pagePath="pages/common/addBLE/addEquip";
|
||||
var ble = null;
|
||||
var these = null;
|
||||
var eventChannel=null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -128,7 +129,11 @@
|
||||
|
||||
},
|
||||
PairEquip: [], //已配对设备
|
||||
EquipMents: [] //搜索出来的设备
|
||||
EquipMents: [], //搜索出来的设备
|
||||
device:null,
|
||||
item:{
|
||||
deviceId:''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -145,7 +150,8 @@
|
||||
},
|
||||
onUnload(){
|
||||
ble.StopSearch();
|
||||
|
||||
ble.removeDeviceFound(pagePath);
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
},
|
||||
onLoad() {
|
||||
these = this;
|
||||
@ -170,13 +176,23 @@
|
||||
|
||||
}
|
||||
}
|
||||
},pagePath);
|
||||
// ble.addReceiveCallback((receivData) => {
|
||||
}, pagePath);
|
||||
// console.log("addEquip")
|
||||
// ble.addReceiveCallback((receivData,f,path,arr) => {
|
||||
// console.log("收到数据了:", receivData);//数据格式:{bytes:[109,97],str:"",hexs:"FA 01"}
|
||||
// if (this.item.deviceId == receivData.deviceId) {
|
||||
// console.log("11111:",receivData);
|
||||
|
||||
// // let data=uni.getStorageSync(ble.StorageKey);
|
||||
// console.log("LinkedList=",ble.data.LinkedList);
|
||||
// },pagePath);
|
||||
|
||||
// }
|
||||
|
||||
// });
|
||||
eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel.on('detailData', function(rec) {
|
||||
console.log("接收到父页面的参数:",rec);
|
||||
these.device=rec.data;
|
||||
});
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
@ -223,7 +239,7 @@
|
||||
ble.showBlueSetting(false);
|
||||
},
|
||||
Link: function(item, index) {
|
||||
|
||||
this.item.deviceId=item.deviceId;
|
||||
showLoading(this,{
|
||||
text: "正在连接"
|
||||
});
|
||||
@ -241,6 +257,18 @@
|
||||
these.PairEquip.push(item);
|
||||
}
|
||||
console.log("连接成功");
|
||||
if(these.device){//从设备详情过来的,回设备详情去
|
||||
ble.data.LinkedList.find(v=>{
|
||||
if(v.deviceId==item.deviceId){
|
||||
v.device=these.device;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
ble.updateCache();
|
||||
uni.navigateBack();
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:"/pages/common/addBLE/LinkBle",
|
||||
events:{
|
||||
|
||||
@ -144,6 +144,8 @@
|
||||
deviceUnbind, //删除设备
|
||||
deviceReName
|
||||
} from '@/api/common/index.js'
|
||||
import BleHelper from '@/utils/BleHelper.js';
|
||||
var ble=null;
|
||||
export default {
|
||||
onPullDownRefresh() {
|
||||
// 执行下拉刷新时的操作,比如重新获取数据
|
||||
@ -388,7 +390,9 @@
|
||||
}, 500);
|
||||
this.deleteShow = false
|
||||
// 关闭所有滑动项
|
||||
this.$refs.swipeAction.closeAll();
|
||||
this.$refs.swipeAction.closeAll();
|
||||
|
||||
ble && ble.DropDevice(data.id);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@ -555,6 +559,7 @@
|
||||
console.log('列表收到消息了么');
|
||||
this.onIntall()
|
||||
});
|
||||
ble=BleHelper.getBleTool();
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 组件销毁前移除监听器
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
|
||||
var isReady=false;var onReadyCallbacks=[];
|
||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/6170/callPolice/index","pages/210/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index","pages/common/allType/index","pages/6170/allShare/index","pages/6170/share/index","pages/6170/shareDevices/index","pages/6170/shareManagement/index","pages/210/onlineDevice/index","pages/210/addDevice/index","pages/210/historyRecords/index","pages/210/call/index","pages/BlueTooth/ModeSetting/VideoSend","pages/BlueTooth/ModeSetting/VideoSend_1","pages/BlueTooth/ModeSetting/VideoSend_670","pages/BlueTooth/ModeSetting/HBY650","pages/BlueTooth/ModeSetting/HBY650_1","pages/BlueTooth/ModeSetting/ModeSetting","pages/BlueTooth/ModeSetting/update","pages/BlueTooth/ModeSetting/HBY6155","pages/BlueTooth/ModeSetting/HBY6155V1","pages/BlueTooth/ModeSetting/HBY670V1","pages/670/HBY670","pages/650/HBY650","pages/670/History","pages/BlueTooth/ModeSetting/4877"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"星汉物联","compilerVersion":"4.75","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","enablePullDownRefresh":true}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息","enablePullDownRefresh":true}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/6170/callPolice/index","meta":{},"window":{"navigationBarTitleText":"报警","enablePullDownRefresh":true}},{"path":"/pages/210/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"添加设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}},{"path":"/pages/common/allType/index","meta":{},"window":{"navigationBarTitleText":"所有类型"}},{"path":"/pages/6170/allShare/index","meta":{},"window":{"navigationBarTitleText":"所有分享"}},{"path":"/pages/6170/share/index","meta":{},"window":{"navigationBarTitleText":"分享"}},{"path":"/pages/6170/shareDevices/index","meta":{},"window":{"navigationBarTitleText":"分享设备"}},{"path":"/pages/6170/shareManagement/index","meta":{},"window":{"navigationBarTitleText":"分享管理"}},{"path":"/pages/210/onlineDevice/index","meta":{},"window":{"navigationBarTitleText":"联机设备"}},{"path":"/pages/210/addDevice/index","meta":{},"window":{"navigationBarTitleText":"添加联机设备"}},{"path":"/pages/210/historyRecords/index","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/210/call/index","meta":{},"window":{"navigationBarTitleText":"呼叫"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_1","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_670","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650_1","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/ModeSetting","meta":{},"window":{"navigationBarTitleText":"7307-0.96TFT"}},{"path":"/pages/BlueTooth/ModeSetting/update","meta":{},"window":{"navigationBarTitleText":"版本更新"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155","meta":{},"window":{"navigationBarTitleText":"HBY6155"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155V1","meta":{},"window":{"navigationBarTitleText":"HBY6155_V1"}},{"path":"/pages/BlueTooth/ModeSetting/HBY670V1","meta":{},"window":{"navigationBarTitleText":"HBY670"}},{"path":"/pages/670/HBY670","meta":{},"window":{"navigationBarTitleText":"HBY670","navigationStyle":"custom"}},{"path":"/pages/650/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/670/History","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/BlueTooth/ModeSetting/4877","meta":{},"window":{"navigationBarTitleText":""}}];
|
||||
var __uniConfig = {"pages":["pages/common/login/index","pages/common/index/index","pages/common/user/index","pages/common/scan/scan","pages/common/qrcode/qrcode","pages/common/send/index","pages/common/userAgreement/index","pages/common/privacyAgreement/index","pages/common/aboutUs/index","pages/6170/deviceControl/index","pages/6170/callPolice/index","pages/210/deviceControl/index","pages/common/operationVideo/index","pages/common/addvideo/index","pages/common/operatingInstruct/index","pages/common/productDes/index","pages/common/addBLE/addEquip","pages/common/addBLE/LinkBle","pages/6155/deviceDetail","pages/6155/ImgCrop","pages/common/map/index","pages/common/allType/index","pages/6170/allShare/index","pages/6170/share/index","pages/6170/shareDevices/index","pages/6170/shareManagement/index","pages/210/onlineDevice/index","pages/210/addDevice/index","pages/210/historyRecords/index","pages/210/call/index","pages/BlueTooth/ModeSetting/index","pages/BlueTooth/ModeSetting/VideoSend","pages/BlueTooth/ModeSetting/VideoSend_1","pages/BlueTooth/ModeSetting/VideoSend_670","pages/BlueTooth/ModeSetting/HBY650","pages/BlueTooth/ModeSetting/HBY650_1","pages/BlueTooth/ModeSetting/ModeSetting","pages/BlueTooth/ModeSetting/update","pages/BlueTooth/ModeSetting/HBY6155","pages/BlueTooth/ModeSetting/HBY6155V1","pages/BlueTooth/ModeSetting/HBY670V1","pages/670/HBY670","pages/650/HBY650","pages/670/History","pages/BlueTooth/ModeSetting/4877","pages/7305/BJQ7305"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#121212","backgroundColor":"#121212"},"tabBar":{"color":"#fff","selectedColor":"#BBE600","backgroundColor":"#202020","list":[{"pagePath":"pages/common/index/index","text":"我的设备","iconPath":"/static/tabs/device.png","selectedIconPath":"/static/tabs/device-HL.png"},{"pagePath":"pages/common/user/index","text":"我的","iconPath":"/static/tabs/my.png","selectedIconPath":"/static/tabs/my-HL.png"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"星汉物联","compilerVersion":"4.75","entryPagePath":"pages/common/login/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/common/login/index","meta":{"isQuit":true},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","enablePullDownRefresh":true}},{"path":"/pages/common/user/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/common/scan/scan","meta":{},"window":{"navigationBarTitleText":"扫描"}},{"path":"/pages/common/qrcode/qrcode","meta":{},"window":{"navigationBarTitleText":"扫描到的设备"}},{"path":"/pages/common/send/index","meta":{},"window":{"navigationBarTitleText":"发送信息","enablePullDownRefresh":true}},{"path":"/pages/common/userAgreement/index","meta":{},"window":{"navigationBarTitleText":"用户协议"}},{"path":"/pages/common/privacyAgreement/index","meta":{},"window":{"navigationBarTitleText":"隐私协议"}},{"path":"/pages/common/aboutUs/index","meta":{},"window":{"navigationBarTitleText":"关于我们"}},{"path":"/pages/6170/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/6170/callPolice/index","meta":{},"window":{"navigationBarTitleText":"报警","enablePullDownRefresh":true}},{"path":"/pages/210/deviceControl/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operationVideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addvideo/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/operatingInstruct/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/productDes/index","meta":{},"window":{"navigationStyle":"custom"}},{"path":"/pages/common/addBLE/addEquip","meta":{},"window":{"navigationBarTitleText":"扫描设备"}},{"path":"/pages/common/addBLE/LinkBle","meta":{},"window":{"navigationBarTitleText":"绑定设备"}},{"path":"/pages/6155/deviceDetail","meta":{},"window":{"navigationBarTitleText":"HBY 6155"}},{"path":"/pages/6155/ImgCrop","meta":{},"window":{"navigationBarTitleText":"图像裁剪","navigationStyle":"custom","fullscreen":true}},{"path":"/pages/common/map/index","meta":{},"window":{"navigationBarTitleText":"地图"}},{"path":"/pages/common/allType/index","meta":{},"window":{"navigationBarTitleText":"所有类型"}},{"path":"/pages/6170/allShare/index","meta":{},"window":{"navigationBarTitleText":"所有分享"}},{"path":"/pages/6170/share/index","meta":{},"window":{"navigationBarTitleText":"分享"}},{"path":"/pages/6170/shareDevices/index","meta":{},"window":{"navigationBarTitleText":"分享设备"}},{"path":"/pages/6170/shareManagement/index","meta":{},"window":{"navigationBarTitleText":"分享管理"}},{"path":"/pages/210/onlineDevice/index","meta":{},"window":{"navigationBarTitleText":"联机设备"}},{"path":"/pages/210/addDevice/index","meta":{},"window":{"navigationBarTitleText":"添加联机设备"}},{"path":"/pages/210/historyRecords/index","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/210/call/index","meta":{},"window":{"navigationBarTitleText":"呼叫"}},{"path":"/pages/BlueTooth/ModeSetting/index","meta":{},"window":{"navigationBarTitleText":"设备类型"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_1","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/VideoSend_670","meta":{},"window":{"navigationBarTitleText":"发送视频"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/HBY650_1","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/BlueTooth/ModeSetting/ModeSetting","meta":{},"window":{"navigationBarTitleText":"7307-0.96TFT"}},{"path":"/pages/BlueTooth/ModeSetting/update","meta":{},"window":{"navigationBarTitleText":"版本更新"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155","meta":{},"window":{"navigationBarTitleText":"HBY6155"}},{"path":"/pages/BlueTooth/ModeSetting/HBY6155V1","meta":{},"window":{"navigationBarTitleText":"HBY6155_V1"}},{"path":"/pages/BlueTooth/ModeSetting/HBY670V1","meta":{},"window":{"navigationBarTitleText":"HBY670"}},{"path":"/pages/670/HBY670","meta":{},"window":{"navigationBarTitleText":"HBY670","navigationStyle":"custom"}},{"path":"/pages/650/HBY650","meta":{},"window":{"navigationBarTitleText":"HBY650"}},{"path":"/pages/670/History","meta":{},"window":{"navigationBarTitleText":"历史记录"}},{"path":"/pages/BlueTooth/ModeSetting/4877","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/7305/BJQ7305","meta":{},"window":{"navigationBarTitleText":"BJQ7305"}}];
|
||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||
|
||||
2279
unpackage/dist/dev/app-plus/app-service.js
vendored
2279
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
1752
unpackage/dist/dev/app-plus/app-view.js
vendored
1752
unpackage/dist/dev/app-plus/app-view.js
vendored
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/manifest.json
vendored
2
unpackage/dist/dev/app-plus/manifest.json
vendored
File diff suppressed because one or more lines are too long
@ -40,9 +40,9 @@ class BleHelper {
|
||||
onDeviceFound: [], //发现新设备的事件
|
||||
receivDataCallback: [] //接收到数据的事件
|
||||
}
|
||||
this.addReceiveCallback((a, b, c) => {
|
||||
recei.ReceiveData(a, b, c);
|
||||
}, "BleReceiveData");
|
||||
// this.addReceiveCallback((a, b, c) => {
|
||||
// recei.ReceiveData(a, b, c);
|
||||
// }, "BleReceiveData");
|
||||
this.dic = {
|
||||
errRemarks: [{
|
||||
key: '10000',
|
||||
@ -104,6 +104,36 @@ class BleHelper {
|
||||
}
|
||||
}
|
||||
|
||||
DropDevice(bleId, deviceId) {
|
||||
let flag = false;
|
||||
for (var i = 0; i < this.data.LinkedList.length; i++) {
|
||||
let item = this.data.LinkedList[i];
|
||||
if (bleId) {
|
||||
if (item.deviceId == bleId) {
|
||||
this.data.LinkedList.splice(i, 1);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (item.device && item.device.id) {
|
||||
this.data.LinkedList.splice(i, 1);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
this.updateCache();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updateCache() {
|
||||
console.log("this.StorageKey=", this.StorageKey)
|
||||
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
||||
}
|
||||
|
||||
linkAllDevices() {
|
||||
console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
|
||||
|
||||
@ -162,7 +192,7 @@ class BleHelper {
|
||||
let key = currKey ? currKey : this.getCurrentPagePath();
|
||||
|
||||
if (key) {
|
||||
console.log("key=" + key);
|
||||
// console.log("key=" + key);
|
||||
let f = this.cfg.onDeviceFound.findIndex((v) => {
|
||||
return v.key == key;
|
||||
});
|
||||
@ -205,7 +235,7 @@ class BleHelper {
|
||||
removeReceiveCallback(currKey) {
|
||||
let key = currKey ? currKey : this.getCurrentPagePath();
|
||||
if (key) {
|
||||
console.log("移除消息回调:" + key);
|
||||
// console.log("移除消息回调:" + key);
|
||||
let f = this.cfg.receivDataCallback.findIndex((v) => {
|
||||
return v.key == key;
|
||||
});
|
||||
@ -399,8 +429,8 @@ class BleHelper {
|
||||
v.notifyState = false;
|
||||
return true;
|
||||
});
|
||||
uni.setStorageSync(this.StorageKey, this.data
|
||||
.LinkedList);
|
||||
|
||||
this.updateCache();
|
||||
}
|
||||
});
|
||||
|
||||
@ -417,8 +447,7 @@ class BleHelper {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
uni.setStorageSync(this.StorageKey, this.data
|
||||
.LinkedList);
|
||||
this.updateCache();
|
||||
} else {
|
||||
// console.log("蓝牙连接已恢复,", res);
|
||||
}
|
||||
@ -464,25 +493,26 @@ class BleHelper {
|
||||
|
||||
let header = "mac address:";
|
||||
if (str.indexOf(header) == 0) { //650以文本传输mac
|
||||
|
||||
console.log("str=", str);
|
||||
this.data.LinkedList.find((v) => {
|
||||
if (v.deviceId == receive
|
||||
.deviceId) {
|
||||
str = str.replace(
|
||||
let macStr = str.replace(
|
||||
header, "");
|
||||
if (str.includes(':')) {
|
||||
v.macAddress = str;
|
||||
if (macStr.includes(':')) {
|
||||
v.macAddress = macStr;
|
||||
} else {
|
||||
v.macAddress = str.replace(
|
||||
v.macAddress = macStr
|
||||
.replace(
|
||||
/(.{2})/g, '$1:')
|
||||
.slice(0, -1)
|
||||
}
|
||||
str = header + v.macAddress;
|
||||
console.log("收到mac地址:", v
|
||||
.macAddress)
|
||||
}
|
||||
});
|
||||
uni.setStorageSync(this.StorageKey, this.data
|
||||
.LinkedList);
|
||||
this.updateCache();
|
||||
}
|
||||
|
||||
if (bytes[0] == 0xFC) { //6155以0xFC开头代表mac地址
|
||||
@ -498,8 +528,7 @@ class BleHelper {
|
||||
// console.log("收到mac地址:", str)
|
||||
}
|
||||
});
|
||||
uni.setStorageSync(this.StorageKey, this
|
||||
.data.LinkedList);
|
||||
this.updateCache();
|
||||
}
|
||||
}
|
||||
console.log("str=", str);
|
||||
@ -514,20 +543,26 @@ class BleHelper {
|
||||
str: str,
|
||||
hexs: hexs
|
||||
};
|
||||
console.log("监听到特征值:" + JSON.stringify(recData));
|
||||
// console.log("监听到特征值:" + JSON.stringify(recData));
|
||||
try {
|
||||
if (this.cfg.receivDataCallback) {
|
||||
|
||||
if (this.cfg.receivDataCallback.length > 0) {
|
||||
console.log("有人订阅消息")
|
||||
|
||||
let path = this.getCurrentPagePath();
|
||||
|
||||
console.log("有人订阅消息")
|
||||
this.cfg.receivDataCallback.forEach((
|
||||
rec) => {
|
||||
|
||||
rec) => {
|
||||
console.log("有人订阅消息111",)
|
||||
if (rec.callback) {
|
||||
try{
|
||||
rec.callback(recData, f,
|
||||
path);
|
||||
path, this.cfg
|
||||
.receivDataCallback);
|
||||
}catch(err){
|
||||
console.log("订阅消息出现异常",err);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -692,10 +727,10 @@ class BleHelper {
|
||||
}
|
||||
// console.log("c=", c);
|
||||
let startSubScribe = (id, serviceId, characteristicId) => {
|
||||
console.log("serviceId=", serviceId);
|
||||
console.log("characteristicId=", characteristicId);
|
||||
let p1= new Promise((succ, err) => {
|
||||
|
||||
// console.log("serviceId=", serviceId);
|
||||
// console.log("characteristicId=", characteristicId);
|
||||
let p1 = new Promise((succ, err) => {
|
||||
|
||||
uni.notifyBLECharacteristicValueChange({
|
||||
deviceId: id,
|
||||
serviceId: serviceId,
|
||||
@ -713,8 +748,10 @@ class BleHelper {
|
||||
v.notifyState = state;
|
||||
}
|
||||
});
|
||||
console.log("success SubScribe");
|
||||
succ(res);//见了鬼了,有时候执行了succ但promise永远pending了
|
||||
// console.log("success SubScribe");
|
||||
succ(
|
||||
res
|
||||
); //见了鬼了,有时候执行了succ但promise永远pending了
|
||||
},
|
||||
fail: (ex) => {
|
||||
|
||||
@ -722,22 +759,24 @@ class BleHelper {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let p2=new Promise((succ,err)=>{
|
||||
setTimeout(()=>{
|
||||
err({code:-1});
|
||||
},50);
|
||||
|
||||
let p2 = new Promise((succ, err) => {
|
||||
setTimeout(() => {
|
||||
err({
|
||||
code: -1
|
||||
});
|
||||
}, 50);
|
||||
});
|
||||
return new Promise((succ,err)=>{
|
||||
Promise.race([p1,p2]).then(succ).catch(ex=>{
|
||||
if(ex.code==-1){
|
||||
return new Promise((succ, err) => {
|
||||
Promise.race([p1, p2]).then(succ).catch(ex => {
|
||||
if (ex.code == -1) {
|
||||
succ();
|
||||
return;
|
||||
}
|
||||
err(ex);
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
let promies = new Array();
|
||||
if (c.Characteristics && c.Characteristics.length) {
|
||||
@ -754,27 +793,27 @@ class BleHelper {
|
||||
|
||||
if (promies.length > 0) {
|
||||
|
||||
console.log("234324324324");
|
||||
// console.log("234324324324");
|
||||
Promise.allSettled(promies).then((results) => {
|
||||
console.log("11111");
|
||||
// console.log("11111");
|
||||
results.forEach((result, index) => {
|
||||
if (result.status === "fulfilled") {
|
||||
console.log(`操作${index + 1}成功:`, result.value);
|
||||
// console.log(`操作${index + 1}成功:`, result.value);
|
||||
} else {
|
||||
console.log(`操作${index + 1}失败:`, result.reason
|
||||
.message);
|
||||
// console.log(`操作${index + 1}失败:`, result.reason
|
||||
// .message);
|
||||
}
|
||||
});
|
||||
|
||||
resolve();
|
||||
}).catch((ex) => {
|
||||
console.log("222222");
|
||||
// console.log("222222");
|
||||
reject(ex);
|
||||
}).finally(()=>{
|
||||
console.log("finally")
|
||||
}).finally(() => {
|
||||
// console.log("finally")
|
||||
});
|
||||
} else {
|
||||
console.log("33333");
|
||||
// console.log("33333");
|
||||
resolve();
|
||||
}
|
||||
|
||||
@ -806,8 +845,7 @@ class BleHelper {
|
||||
v.services = res.services;
|
||||
}
|
||||
});
|
||||
uni.setStorageSync(this.StorageKey,
|
||||
this.data.LinkedList);
|
||||
this.updateCache();
|
||||
|
||||
var promises = [];
|
||||
let se = res.services.find((v) => {
|
||||
@ -947,7 +985,7 @@ class BleHelper {
|
||||
|
||||
|
||||
|
||||
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
||||
this.updateCache();
|
||||
resolve(res);
|
||||
},
|
||||
fail: (ex) => {
|
||||
@ -989,12 +1027,12 @@ class BleHelper {
|
||||
var linkDevice = () => {
|
||||
// 添加重试次数限制
|
||||
let retryCount = 0;
|
||||
const maxRetries = 1; // 最大重试次数
|
||||
const maxRetries = 5; // 最大重试次数
|
||||
|
||||
const connect = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (fIndex > -1 && f?.Linked) {
|
||||
console.log("当前已连接,跳过其他步骤");
|
||||
// console.log("当前已连接,跳过其他步骤");
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
@ -1027,10 +1065,9 @@ class BleHelper {
|
||||
this.data.LinkedList.push(cr);
|
||||
}
|
||||
|
||||
uni.setStorageSync(this.StorageKey, this.data
|
||||
.LinkedList);
|
||||
this.updateCache();
|
||||
console.log("LinkedList=", this.data
|
||||
.LinkedList);
|
||||
.LinkedList);
|
||||
|
||||
// 处理 MTU 设置
|
||||
if (plus.os.name === 'Android') {
|
||||
@ -1045,7 +1082,8 @@ class BleHelper {
|
||||
fail: () => {
|
||||
console.log("mtu设置失败");
|
||||
resolve(
|
||||
true); // MTU设置失败不影响连接成功
|
||||
true
|
||||
); // MTU设置失败不影响连接成功
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -1088,15 +1126,15 @@ class BleHelper {
|
||||
}).then((res) => {
|
||||
|
||||
if (res) { //新连接
|
||||
console.log("11111111");
|
||||
// console.log("11111111");
|
||||
if (fIndex == -1) {
|
||||
console.log("开始获取服务", targetServiceId)
|
||||
// console.log("开始获取服务", targetServiceId)
|
||||
return this.getService(deviceId, targetServiceId, writeCharId,
|
||||
notifyCharId); //获取服务
|
||||
} else {
|
||||
if (f.wirteCharactId && f.notifyCharactId) {
|
||||
if (!f.notifyState) {
|
||||
console.log("开始订阅特征");
|
||||
// console.log("开始订阅特征");
|
||||
this.subScribe(deviceId, true);
|
||||
} else {
|
||||
console.log("不订阅消息");
|
||||
@ -1111,7 +1149,7 @@ class BleHelper {
|
||||
|
||||
}
|
||||
} else { //已连接过,直接订阅消息
|
||||
console.log("11111111");
|
||||
// console.log("11111111");
|
||||
if (fIndex > -1 && f && !f.notifyState) {
|
||||
|
||||
this.subScribe(deviceId, true);
|
||||
@ -1120,7 +1158,7 @@ class BleHelper {
|
||||
}
|
||||
|
||||
}).then(() => {
|
||||
console.log("then.....");
|
||||
// console.log("then.....");
|
||||
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
@ -1235,14 +1273,14 @@ class BleHelper {
|
||||
})); //没有找到指定设备
|
||||
return;
|
||||
}
|
||||
console.log("device=", device);
|
||||
// console.log("device=", device);
|
||||
uni.writeBLECharacteristicValue({
|
||||
deviceId: device.deviceId,
|
||||
serviceId: device.writeServiceId,
|
||||
characteristicId: device.wirteCharactId,
|
||||
value: buffer,
|
||||
success: () => {
|
||||
console.log("发送数据成功");
|
||||
// console.log("发送数据成功");
|
||||
succ();
|
||||
},
|
||||
fail: (ex) => {
|
||||
@ -1340,9 +1378,7 @@ class BleHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
setBleData() {
|
||||
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let instance = null;
|
||||
|
||||
@ -44,21 +44,21 @@ class BleReceive {
|
||||
}
|
||||
|
||||
|
||||
ReceiveData(receive,f,path) {
|
||||
ReceiveData(receive,f,path,recArr) {
|
||||
if(f && f.macAddress && f.device && f.device.id){
|
||||
let data={};
|
||||
if(f.device.detailPageUrl=='/pages/6155/deviceDetail'){
|
||||
// console.log("该设备是6155");
|
||||
data= this.Receive_6155(receive,f,path);
|
||||
data= this.Receive_6155(receive,f,path,recArr);
|
||||
}
|
||||
|
||||
if(f.device.detailPageUrl=='/pages/650/HBY650'){
|
||||
// console.log("该设备是650");
|
||||
data= this.Receive_650(receive,f,path);
|
||||
data= this.Receive_650(receive,f,path,recArr);
|
||||
}
|
||||
if(f.device.detailPageUrl=='/pages/670/HBY670'){
|
||||
// console.log("该设备是670");
|
||||
data= this.Receive_670(receive,f,path);
|
||||
data= this.Receive_670(receive,f,path,recArr);
|
||||
}
|
||||
// console.log("收到数据并处理完毕,",data);
|
||||
return data;
|
||||
@ -70,7 +70,7 @@ class BleReceive {
|
||||
|
||||
}
|
||||
|
||||
Receive_650(receive,f,path) {
|
||||
Receive_650(receive,f,path,recArr) {
|
||||
console.log("通用程序正在处理650的数据",receive);
|
||||
|
||||
var parseData = () => {
|
||||
@ -253,8 +253,8 @@ class BleReceive {
|
||||
|
||||
}
|
||||
|
||||
Receive_670(receive,f,path){
|
||||
|
||||
Receive_670(receive,f,path,recArr){
|
||||
console.log("pagh=",path);
|
||||
var todo = (bytes) =>{
|
||||
// console.log("todo",receive);
|
||||
let receiveData = {};
|
||||
@ -316,6 +316,21 @@ class BleReceive {
|
||||
receiveData.staticWarn = staticWarn;
|
||||
receiveData.fourGStrenth = fourGStrenth;
|
||||
receiveData.SOS=sosTxt;
|
||||
|
||||
this.setBleFormData(receiveData,f);
|
||||
console.log("recArr=",recArr);
|
||||
let recCnt=recArr.find(v=>{
|
||||
return v.key == f.device.detailPageUrl;
|
||||
});
|
||||
if(!recCnt){
|
||||
if (this.formData.staticWarn) { //有静止报警
|
||||
uni.showModal({
|
||||
title:"警告",
|
||||
content:"设备静止报警中",
|
||||
showCancel:false
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch(error) {
|
||||
console.log('数据解析错误:', error);
|
||||
}
|
||||
@ -394,7 +409,7 @@ class BleReceive {
|
||||
|
||||
return data;
|
||||
}
|
||||
Receive_6155(receive,f,path) {
|
||||
Receive_6155(receive,f,path,recArr) {
|
||||
let bytes=receive.bytes;
|
||||
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
|
||||
try {
|
||||
|
||||
129
utils/update.js
129
utils/update.js
@ -1,3 +1,5 @@
|
||||
import request,{baseURL} from '@/utils/request.js'
|
||||
|
||||
/**
|
||||
* 检查并执行wgt热更新
|
||||
* @param {String} updateUrl - 检查更新的接口地址
|
||||
@ -13,53 +15,90 @@ function checkAndUpdateWgt(updateUrl) {
|
||||
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
||||
const currentVersion = widgetInfo.version;
|
||||
console.log("当前版本:" + currentVersion);
|
||||
// 2. 调用后端接口检查是否有更新
|
||||
uni.request({
|
||||
url: updateUrl,
|
||||
method: 'GET',
|
||||
data: {
|
||||
currentVersion: currentVersion,
|
||||
platform: uni.getSystemInfoSync().platform
|
||||
},
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
console.log("res=", res)
|
||||
if (res.statusCode === 200) {
|
||||
|
||||
const updateInfo = res.data.data;
|
||||
if (!updateInfo.hasUpdate) {
|
||||
return;
|
||||
}
|
||||
// 3. 显示更新提示
|
||||
uni.showModal({
|
||||
title: '检测到更新',
|
||||
content: updateInfo.description || '有新版本可用,是否立即更新?',
|
||||
confirmText: '立即更新',
|
||||
cancelText: '稍后更新',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
downloadAndInstallWgt(updateInfo.downloadUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '当前已是最新版本',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '检查更新失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
console.error('检查更新失败:', err);
|
||||
request({
|
||||
url:'/app/auth/version',
|
||||
method: 'get'
|
||||
}).then(res=>{
|
||||
console.log("检查版本更新:",res);
|
||||
let os=plus.os.name.toLowerCase();
|
||||
if(res.code!=200){
|
||||
return;
|
||||
}
|
||||
let f=res.data.find(v=>{
|
||||
if(v.dictLabel.toLowerCase()==os){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if(f){
|
||||
if(f.dictValue==currentVersion){
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '检测到更新',
|
||||
content: '当前版本“'+currentVersion+'”,发现新版本“'+f.dictValue+'”,是否立即更新?',
|
||||
confirmText: '立即更新',
|
||||
cancelText: '稍后更新',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
downloadAndInstallWgt(f.remark);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}).catch(ex=>{
|
||||
console.log("检查更新失败:",ex);
|
||||
});
|
||||
// 2. 调用后端接口检查是否有更新
|
||||
// uni.request({
|
||||
// url: updateUrl,
|
||||
// method: 'GET',
|
||||
// data: {
|
||||
// currentVersion: currentVersion,
|
||||
// platform: uni.getSystemInfoSync().platform
|
||||
// },
|
||||
// success: (res) => {
|
||||
// uni.hideLoading();
|
||||
// console.log("res=", res)
|
||||
// if (res.statusCode === 200) {
|
||||
|
||||
// const updateInfo = res.data.data;
|
||||
// if (!updateInfo.hasUpdate) {
|
||||
// return;
|
||||
// }
|
||||
// // 3. 显示更新提示
|
||||
// uni.showModal({
|
||||
// title: '检测到更新',
|
||||
// content: updateInfo.description || '有新版本可用,是否立即更新?',
|
||||
// confirmText: '立即更新',
|
||||
// cancelText: '稍后更新',
|
||||
// success: (modalRes) => {
|
||||
// if (modalRes.confirm) {
|
||||
// downloadAndInstallWgt(updateInfo.downloadUrl);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: '当前已是最新版本',
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// uni.hideLoading();
|
||||
// uni.showToast({
|
||||
// title: '检查更新失败',
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// });
|
||||
// console.error('检查更新失败:', err);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user