完成7305,添加在详情页去绑定蓝牙设备
This commit is contained in:
69
App.vue
69
App.vue
@ -6,26 +6,26 @@
|
|||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
//以下代码仅在开发时使用,否则会出现不可预知的问题。
|
//以下代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
//清除登陆之外的所有信息;
|
//清除登陆之外的所有信息;
|
||||||
// let store=uni.getStorageInfoSync();
|
let store=uni.getStorageInfoSync();
|
||||||
// store.keys.forEach((val,index,array)=>{
|
store.keys.forEach((val,index,array)=>{
|
||||||
// if(val=="tokenTime"){
|
if(val=="tokenTime"){
|
||||||
// let time=uni.getStorageSync(val);
|
let time=uni.getStorageSync(val);
|
||||||
// if(!time){
|
if(!time){
|
||||||
// time=0;
|
time=0;
|
||||||
// }
|
}
|
||||||
// let currTime=new Date().getTime();
|
let currTime=new Date().getTime();
|
||||||
// if(currTime>=time){
|
if(currTime>=time){
|
||||||
// uni.removeStorageSync(val);
|
uni.removeStorageSync(val);
|
||||||
// uni.removeStorageSync("token");
|
uni.removeStorageSync("token");
|
||||||
// uni.removeStorageSync("clientID");
|
uni.removeStorageSync("clientID");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// else if(val=="token" || val=="clientID"){
|
else if(val=="token" || val=="clientID"){
|
||||||
// console.log("忽略登陆信息");
|
console.log("忽略登陆信息");
|
||||||
// }else{
|
}else{
|
||||||
// uni.removeStorageSync(val);
|
uni.removeStorageSync(val);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
//以上代码仅在开发时使用,否则会出现不可预知的问题。
|
||||||
|
|
||||||
uni.getSystemInfo({success:function(res){
|
uni.getSystemInfo({success:function(res){
|
||||||
@ -47,21 +47,24 @@
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import 'vk-uview-ui/index.scss';
|
@import 'vk-uview-ui/index.scss';
|
||||||
// uni-slider .uni-slider-handle-wrapper {
|
/* #ifdef APP-ANDROID */
|
||||||
// border-radius: 20rpx;
|
//苹果应用以下样式后Slider不可拖动
|
||||||
// }
|
uni-slider .uni-slider-handle-wrapper {
|
||||||
// uni-slider .uni-slider-thumb {
|
border-radius: 20rpx;
|
||||||
// width: 66rpx !important;
|
}
|
||||||
// height: 80rpx !important;
|
uni-slider .uni-slider-thumb {
|
||||||
// margin-top: -40rpx !important;
|
width: 66rpx !important;
|
||||||
// border-radius: 16rpx !important;
|
height: 80rpx !important;
|
||||||
// margin-left: -72rpx !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 {
|
/* #endif */
|
||||||
// height: 88rpx;
|
|
||||||
// position: relative;
|
|
||||||
// }
|
|
||||||
.custom-file-picker .file-picker__box-content {
|
.custom-file-picker .file-picker__box-content {
|
||||||
background: rgba(26, 26, 26, 1);
|
background: rgba(26, 26, 26, 1);
|
||||||
border: none !important;
|
border: none !important;
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const config = {
|
|||||||
API_PREFIX: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: '47.120.79.150',
|
MQTT_HOST: '47.120.79.150',
|
||||||
MQTT_PORT: 9083,
|
MQTT_PORT: 8083,
|
||||||
MQTT_USERNAME: 'admin',
|
MQTT_USERNAME: 'admin',
|
||||||
MQTT_PASSWORD: '#YtvpSfCNG'
|
MQTT_PASSWORD: '#YtvpSfCNG'
|
||||||
},
|
},
|
||||||
@ -16,7 +16,7 @@ const config = {
|
|||||||
API_PREFIX: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: '47.120.79.150',
|
MQTT_HOST: '47.120.79.150',
|
||||||
MQTT_PORT: 9083,
|
MQTT_PORT: 8083,
|
||||||
MQTT_USERNAME: 'admin',
|
MQTT_USERNAME: 'admin',
|
||||||
MQTT_PASSWORD: '#YtvpSfCNG'
|
MQTT_PASSWORD: '#YtvpSfCNG'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name" : "星汉物联",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.24",
|
"versionName" : "1.0.25",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|||||||
26
pages.json
26
pages.json
@ -1,11 +1,6 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
// {
|
|
||||||
// "path": "pages/BlueTooth/ModeSetting/index",
|
|
||||||
// "style": {
|
|
||||||
// "navigationBarTitleText": "设备类型"
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/common/login/index",
|
"path": "pages/common/login/index",
|
||||||
@ -113,13 +108,13 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/common/addBLE/addEquip",
|
"path": "pages/common/addBLE/addEquip",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "添加设备"
|
"navigationBarTitleText": "扫描设备"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/common/addBLE/LinkBle",
|
"path": "pages/common/addBLE/LinkBle",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "扫描到的设备"
|
"navigationBarTitleText": "绑定设备"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -197,7 +192,12 @@
|
|||||||
"navigationBarTitleText": "呼叫"
|
"navigationBarTitleText": "呼叫"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/BlueTooth/ModeSetting/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "设备类型"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/BlueTooth/ModeSetting/VideoSend",
|
"path": "pages/BlueTooth/ModeSetting/VideoSend",
|
||||||
"style": {
|
"style": {
|
||||||
@ -285,9 +285,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/BlueTooth/ModeSetting/4877",
|
"path": "pages/BlueTooth/ModeSetting/4877",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/7305/BJQ7305",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : ""
|
"navigationBarTitleText" : "BJQ7305"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="rightTxt">
|
<view class="rightTxt">
|
||||||
<text class="bigTxt">主灯模式</text>
|
<text class="bigTxt">主灯模式</text>
|
||||||
<text class="smallTxt">强光模式</text>
|
<text class="smallTxt">{{getMode}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mode marginLeft fleft" v-on:click.stop="ModeSetting('fu')">
|
<view class="mode marginLeft fleft" v-on:click.stop="ModeSetting('fu')">
|
||||||
@ -308,6 +308,7 @@
|
|||||||
// } else {
|
// } else {
|
||||||
// link();
|
// link();
|
||||||
// }
|
// }
|
||||||
|
console.log("6155");
|
||||||
ble.addReceiveCallback(these.bleValueNotify);
|
ble.addReceiveCallback(these.bleValueNotify);
|
||||||
let eventChannel = this.getOpenerEventChannel();
|
let eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
@ -316,7 +317,7 @@
|
|||||||
|
|
||||||
let device = data.data;
|
let device = data.data;
|
||||||
these.device = device;
|
these.device = device;
|
||||||
console.log("收到父页面的参数:" + JSON.stringify(device));
|
|
||||||
let f = ble.data.LinkedList.find((v) => {
|
let f = ble.data.LinkedList.find((v) => {
|
||||||
if (v.macAddress == device.deviceMac) {
|
if (v.macAddress == device.deviceMac) {
|
||||||
console.log("找到设备了", v);
|
console.log("找到设备了", v);
|
||||||
@ -328,12 +329,7 @@
|
|||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
these.showPop({
|
these.showBleUnConnect();
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let form = f.formData;
|
let form = f.formData;
|
||||||
@ -381,6 +377,35 @@
|
|||||||
if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
|
if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
|
||||||
remark = '微弱';
|
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: {
|
methods: {
|
||||||
@ -395,11 +420,11 @@
|
|||||||
},
|
},
|
||||||
bleValueNotify: function(receive, device, path) {
|
bleValueNotify: function(receive, device, path) {
|
||||||
|
|
||||||
let str = recei.ReceiveData(receive, device, pagePath);
|
let str = recei.ReceiveData(receive, device, path);
|
||||||
|
|
||||||
console.log("处理接收到的数据:" + str);
|
console.log("处理接收到的数据:" + str);
|
||||||
return;
|
return;
|
||||||
let data = recei.ReceiveData(receive, device, pagePath);
|
let data = recei.ReceiveData(receive, device, path);
|
||||||
let bytes = receive.bytes;
|
let bytes = receive.bytes;
|
||||||
|
|
||||||
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
|
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
|
||||||
@ -504,16 +529,40 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
checkImgUpload: function() {
|
showBleUnConnect() {
|
||||||
let f = these.getDevice();
|
this.showPop({
|
||||||
|
|
||||||
if (!f) {
|
|
||||||
these.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",
|
||||||
|
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.showBleUnConnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,10 +815,10 @@
|
|||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
text: '工作光',
|
// text: '工作光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png'
|
// icon: '/static/images/6155/DeviceDetail/fan.png'
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
||||||
@ -822,15 +871,10 @@
|
|||||||
}
|
}
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode(mode, type) {
|
setMode(mode, type) {
|
||||||
|
|
||||||
let dataValue = 0;
|
let dataValue = 0;
|
||||||
this.setBleFormData();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.currentMode = mode;
|
|
||||||
|
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
@ -842,25 +886,25 @@
|
|||||||
dataValue = 0x01;
|
dataValue = 0x01;
|
||||||
} else if (type == 'fu') {
|
} else if (type == 'fu') {
|
||||||
|
|
||||||
dataValue = 0x0A;
|
dataValue = 0x04;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
dataValue = 0x04;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
dataValue = 0x02;
|
dataValue = 0x02;
|
||||||
break;
|
break;
|
||||||
case 3:
|
// case 2:
|
||||||
|
// dataValue = 0x02;
|
||||||
|
// break;
|
||||||
|
case 2:
|
||||||
dataValue = 0x03;
|
dataValue = 0x03;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 3:
|
||||||
dataValue = 0x0B;
|
dataValue = 0x0B;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log("dataValue=", dataValue)
|
// console.log("dataValue=", dataValue)
|
||||||
// 构建数据包
|
// 构建数据包
|
||||||
var buffer = new ArrayBuffer(6);
|
var buffer = new ArrayBuffer(6);
|
||||||
var dataView = new DataView(buffer);
|
var dataView = new DataView(buffer);
|
||||||
@ -876,12 +920,7 @@
|
|||||||
// 发送数据
|
// 发送数据
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showPop({
|
these.showBleUnConnect();
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +929,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(() => {
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 30).then(() => {
|
||||||
|
this.formData.mode = mode;
|
||||||
|
this.setBleFormData();
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
these.showPop({
|
these.showPop({
|
||||||
message: "发送失败," + ex.msg,
|
message: "发送失败," + ex.msg,
|
||||||
@ -934,38 +974,54 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
HidePop: function() {
|
HidePop: function() {
|
||||||
|
console.log("1111");
|
||||||
if (this.Status.Pop.clickEvt == 'SendUsr') {
|
if (this.Status.Pop.clickEvt == 'SendUsr') {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this.Status.Pop.okCallback) {
|
||||||
|
this.Status.Pop.okCallback();
|
||||||
}
|
}
|
||||||
this.Status.Pop.showPop = false;
|
this.Status.Pop.showPop = false;
|
||||||
},
|
},
|
||||||
showPop: function(option) {
|
showPop: function(option) {
|
||||||
|
|
||||||
if (!option) {
|
hideLoading(this);
|
||||||
option = {
|
let defaultCfg = {
|
||||||
a: 1
|
showHeader: false,
|
||||||
|
headerTxt: "",
|
||||||
|
showHeader: false,
|
||||||
|
showCancel: false,
|
||||||
|
borderColor: '#BBE600',
|
||||||
|
buttonBgColor: '#BBE600',
|
||||||
|
okCallback: null,
|
||||||
|
cancelCallback: null,
|
||||||
|
popType: 'custom',
|
||||||
|
buttonText: '确定',
|
||||||
|
clickEvt: ''
|
||||||
};
|
};
|
||||||
|
if (!option) {
|
||||||
|
|
||||||
}
|
}
|
||||||
let keys = Object.keys(option);
|
let keys = Object.keys(option);
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
these.Status.Pop[key] = option[key];
|
this.Status.Pop[key] = option[key];
|
||||||
}
|
}
|
||||||
if (!option.borderColor) {
|
keys = Object.keys(defaultCfg);
|
||||||
option.borderColor = '#BBE600';
|
for (var i = 0; i < keys.length; i++) {
|
||||||
option.buttonBgColor = '#BBE600';
|
let key = keys[i];
|
||||||
|
if (key in option) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
these.Status.Pop.showPop = true;
|
this.Status.Pop[key] = defaultCfg[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Status.Pop.showPop = true;
|
||||||
},
|
},
|
||||||
sendUsr() {
|
sendUsr() {
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showPop({
|
these.showBleUnConnect()
|
||||||
text: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showLoading(these, {
|
showLoading(these, {
|
||||||
@ -1129,9 +1185,9 @@
|
|||||||
|
|
||||||
let json = {
|
let json = {
|
||||||
deviceId: these.device.id,
|
deviceId: these.device.id,
|
||||||
name: these.formData.textLines[2],
|
name: these.formData.textLines[1],
|
||||||
position: these.formData.textLines[0],
|
position: these.formData.textLines[0],
|
||||||
unitName: these.formData.textLines[1],
|
unitName: these.formData.textLines[2],
|
||||||
code: ""
|
code: ""
|
||||||
};
|
};
|
||||||
usrApi.sendUsr(json)
|
usrApi.sendUsr(json)
|
||||||
|
|||||||
@ -293,6 +293,7 @@
|
|||||||
these = this;
|
these = this;
|
||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
|
console.log("650")
|
||||||
ble.addReceiveCallback(these.bleValueNotify);
|
ble.addReceiveCallback(these.bleValueNotify);
|
||||||
let eventChannel = this.getOpenerEventChannel();
|
let eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
@ -312,12 +313,7 @@
|
|||||||
if (!f) {
|
if (!f) {
|
||||||
|
|
||||||
|
|
||||||
these.showPop({
|
these.showBleUnConnect();
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let form = f.formData;
|
let form = f.formData;
|
||||||
@ -555,12 +551,7 @@
|
|||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
these.showPop({
|
these.showBleUnConnect();
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
hideLoading(these);
|
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() {
|
LampToggle: function() {
|
||||||
|
|
||||||
this.formData.cMode = !this.formData.cMode;
|
this.formData.cMode = !this.formData.cMode;
|
||||||
@ -1143,12 +1162,7 @@
|
|||||||
|
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
if (!f) {
|
if (!f) {
|
||||||
these.showPop({
|
these.showBleUnConnect();
|
||||||
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
|
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
|
||||||
borderColor: "#e034344d",
|
|
||||||
buttonBgColor: "#E03434",
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showLoading(this, {
|
showLoading(this, {
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="warnnig" v-bind:class="formData.staticWarn?'':'displayNone'">
|
<view class="warnnig" v-bind:class="formData.staticWarn?'':'displayNone'">
|
||||||
<view>警告!环境存在漏电电源!</view>
|
<view>警告!设备静止报警中!</view>
|
||||||
<view class="netContent">
|
<view class="netContent">
|
||||||
<view v-bind:class="getWarnStyle(1)" class="net netone"></view>
|
<view v-bind:class="getWarnStyle(1)" class="net netone"></view>
|
||||||
<view v-bind:class="getWarnStyle(2)" class="net nettwo"></view>
|
<view v-bind:class="getWarnStyle(2)" class="net nettwo"></view>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="warnnig" v-bind:class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'"
|
<view class="warnnig" v-bind:class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'"
|
||||||
@click="CloseWarn(true)">
|
@click="CloseWarn(true)">
|
||||||
<view>设备强制闪烁报警中!</view>
|
<view>设备强制报警中!</view>
|
||||||
<view class="netContent">
|
<view class="netContent">
|
||||||
{{Status.staticWarn.time}}s
|
{{Status.staticWarn.time}}s
|
||||||
</view>
|
</view>
|
||||||
@ -90,7 +90,9 @@
|
|||||||
:src="formData.SOS=='sg'?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
|
:src="formData.SOS=='sg'?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
</view>
|
</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>
|
||||||
<view class="item" @click="sosSetting('rb')" :class="formData.SOS=='rb'?'active':''">
|
<view class="item" @click="sosSetting('rb')" :class="formData.SOS=='rb'?'active':''">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
@ -296,7 +298,8 @@
|
|||||||
visiblePrompt: false,
|
visiblePrompt: false,
|
||||||
promptTitle: '设备名称',
|
promptTitle: '设备名称',
|
||||||
modelValue: '',
|
modelValue: '',
|
||||||
visibleClose: false
|
visibleClose: false,
|
||||||
|
|
||||||
},
|
},
|
||||||
BottomMenu: {
|
BottomMenu: {
|
||||||
show: false,
|
show: false,
|
||||||
@ -344,7 +347,7 @@
|
|||||||
Lat: "", //纬度
|
Lat: "", //纬度
|
||||||
address: "", //地址
|
address: "", //地址
|
||||||
modeCurr: "", //档位
|
modeCurr: "", //档位
|
||||||
SOS: "sg", //sos
|
SOS: "", //sos
|
||||||
lightCurr: "qiang", //照明模式
|
lightCurr: "qiang", //照明模式
|
||||||
company: "", //单位
|
company: "", //单位
|
||||||
usrname: "", //姓名
|
usrname: "", //姓名
|
||||||
@ -400,6 +403,7 @@
|
|||||||
these = this;
|
these = this;
|
||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
|
console.log("670")
|
||||||
ble.addReceiveCallback(these.bleValueNotify);
|
ble.addReceiveCallback(these.bleValueNotify);
|
||||||
let eventChannel = this.getOpenerEventChannel();
|
let eventChannel = this.getOpenerEventChannel();
|
||||||
|
|
||||||
@ -688,9 +692,9 @@
|
|||||||
if (this.formData.imei) {
|
if (this.formData.imei) {
|
||||||
this.initMQ();
|
this.initMQ();
|
||||||
}
|
}
|
||||||
if (these.formData.staticWarn) { //有静止报警
|
if (this.formData.staticWarn) { //有静止报警
|
||||||
these.showPop({
|
these.showPop({
|
||||||
message: "环境存在漏电电源",
|
message: "设备静止报警中",
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
@ -701,7 +705,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
these.setBleFormData();
|
this.setBleFormData();
|
||||||
},
|
},
|
||||||
getDevice: function() {
|
getDevice: function() {
|
||||||
|
|
||||||
@ -805,15 +809,15 @@
|
|||||||
|
|
||||||
setTimeout(task, 0);
|
setTimeout(task, 0);
|
||||||
},
|
},
|
||||||
CloseWarn: function(ispop) {
|
CloseWarn: function(ispop) { //解除强制报警
|
||||||
let closeEvt = () => {
|
let closeEvt = () => {
|
||||||
{
|
|
||||||
these.Status.Pop.showPop = false;
|
these.Status.Pop.showPop = false;
|
||||||
|
|
||||||
these.formData.qzwarn = false;
|
these.formData.qzwarn = false;
|
||||||
clearInterval(these.Status.staticWarn.inteval);
|
clearInterval(these.Status.staticWarn.inteval);
|
||||||
|
|
||||||
let closeSOS = () => {
|
let requestCloseSOS = () => {
|
||||||
let json = {
|
let json = {
|
||||||
ins_SOSGrade: [0]
|
ins_SOSGrade: [0]
|
||||||
};
|
};
|
||||||
@ -821,6 +825,7 @@
|
|||||||
|
|
||||||
this.sendMQ(json).then((res) => {
|
this.sendMQ(json).then((res) => {
|
||||||
console.log("4g发送成功");
|
console.log("4g发送成功");
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("ex=", ex);
|
console.log("ex=", ex);
|
||||||
these.showPop({
|
these.showPop({
|
||||||
@ -832,34 +837,15 @@
|
|||||||
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
hideLoading(these);
|
hideLoading(these);
|
||||||
|
this.formData.SOS = 'close';
|
||||||
these.setBleFormData();
|
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 f = this.getDevice();
|
||||||
let buffer = null;
|
let buffer = null;
|
||||||
if (f) {
|
if (f) {
|
||||||
@ -867,51 +853,53 @@
|
|||||||
buffer = new ArrayBuffer(6);
|
buffer = new ArrayBuffer(6);
|
||||||
let dataView = new DataView(buffer);
|
let dataView = new DataView(buffer);
|
||||||
dataView.setUint8(0, 0x55); // 帧头
|
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(1, 0x05); // 帧类型
|
||||||
dataView.setUint8(2, 0x01); // 包序号
|
dataView.setUint8(2, 0x01); // 包序号
|
||||||
dataView.setUint8(3, 0x00); // 数据长度
|
dataView.setUint8(3, 0x00); // 数据长度
|
||||||
dataView.setUint8(4, 0x01); // 数据长度
|
dataView.setUint8(4, 0x01); // 数据长度
|
||||||
dataView.setUint8(5, 0x68);
|
dataView.setUint8(5, 0x6A); // 数据
|
||||||
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10)
|
|
||||||
.then(() => {
|
ble.sendData(f.deviceId, buffer, f.writeServiceId, f.wirteCharactId, 10).then(
|
||||||
console.log("成功");
|
() => {
|
||||||
});
|
console.log("关闭强制报警成功")
|
||||||
|
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
closeSOS();
|
requestCloseSOS();
|
||||||
// closeWarn();
|
}).finally(() => {
|
||||||
|
this.formData.SOS = 'close';
|
||||||
|
these.setBleFormData();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
closeSOS();
|
requestCloseSOS();
|
||||||
// closeWarn();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!ispop) {
|
if (!ispop) {
|
||||||
closeEvt();
|
closeEvt();
|
||||||
return;
|
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({
|
this.showPop({
|
||||||
showHeader: true,
|
showHeader: true,
|
||||||
headerTxt: "强制报警",
|
headerTxt: "强制报警",
|
||||||
message: '持续报警时间' + this.Status.staticWarn.time,
|
message: message,
|
||||||
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
buttonBgColor: "#E03434",
|
||||||
buttonText: "解除报警",
|
buttonText: "解除报警",
|
||||||
okCallback: closeEvt
|
okCallback: callback,
|
||||||
|
clickEvt: 'time'
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
sosSetting: function(type) {
|
sosSetting: function(type) {
|
||||||
if (this.formData.SOS == type) {
|
if (this.formData.SOS == type) {
|
||||||
@ -922,7 +910,7 @@
|
|||||||
text: "请稍候..."
|
text: "请稍候..."
|
||||||
});
|
});
|
||||||
let task = () => {
|
let task = () => {
|
||||||
this.formData.SOS = type;
|
|
||||||
let dic = {
|
let dic = {
|
||||||
ble: {
|
ble: {
|
||||||
rb: 0x68,
|
rb: 0x68,
|
||||||
@ -944,6 +932,8 @@
|
|||||||
let requestSend = () => {
|
let requestSend = () => {
|
||||||
this.sendMQ(json).then((res) => {
|
this.sendMQ(json).then((res) => {
|
||||||
console.log("4g发送成功");
|
console.log("4g发送成功");
|
||||||
|
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("ex=", ex);
|
console.log("ex=", ex);
|
||||||
these.showPop({
|
these.showPop({
|
||||||
@ -961,7 +951,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let SendCmd = () => {
|
let bleSendCmd = () => {
|
||||||
let f = this.getDevice();
|
let f = this.getDevice();
|
||||||
let buffer = null;
|
let buffer = null;
|
||||||
if (f) {
|
if (f) {
|
||||||
@ -979,21 +969,6 @@
|
|||||||
() => {
|
() => {
|
||||||
console.log("蓝牙发送成功了");
|
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);
|
hideLoading(these);
|
||||||
these.setBleFormData();
|
these.setBleFormData();
|
||||||
@ -1007,27 +982,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type !== 'sg') {
|
let OpenSOS = () => {
|
||||||
SendCmd();
|
these.formData.qzwarn = true; //标记为强制报警了
|
||||||
} else {
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
|
these.Status.staticWarn.time = 50;
|
||||||
|
this.formData.SOS = type;
|
||||||
|
|
||||||
let loopFunc = () => {
|
let loopFunc = () => {
|
||||||
if (these.Status.staticWarn.inteval === null) {
|
if (these.Status.staticWarn.inteval === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (these.Status.staticWarn.time === 0) {
|
if (these.Status.staticWarn.time === 0) {
|
||||||
console.log("111111");
|
|
||||||
|
|
||||||
clearInterval(these.Status.staticWarn.inteval);
|
clearInterval(these.Status.staticWarn.inteval);
|
||||||
these.Status.staticWarn.inteval = null;
|
these.Status.staticWarn.inteval = null;
|
||||||
@ -1038,14 +1004,48 @@
|
|||||||
}
|
}
|
||||||
these.Status.staticWarn.time = these.Status.staticWarn
|
these.Status.staticWarn.time = these.Status.staticWarn
|
||||||
.time - 1;
|
.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(() => {
|
these.Status.staticWarn.inteval = setInterval(() => {
|
||||||
loopFunc();
|
loopFunc();
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
SendCmd();
|
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: 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",
|
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
|
||||||
borderColor: "#e034344d",
|
borderColor: "#e034344d",
|
||||||
buttonBgColor: "#E03434",
|
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;
|
return;
|
||||||
}
|
}
|
||||||
let uploadVideo = () => {
|
let uploadVideo = () => {
|
||||||
@ -1747,7 +1770,9 @@
|
|||||||
buttonBgColor: '#BBE600',
|
buttonBgColor: '#BBE600',
|
||||||
okCallback: null,
|
okCallback: null,
|
||||||
cancelCallback: null,
|
cancelCallback: null,
|
||||||
popType: 'custom'
|
popType: 'custom',
|
||||||
|
buttonText: '确定',
|
||||||
|
clickEvt: ''
|
||||||
};
|
};
|
||||||
if (!option) {
|
if (!option) {
|
||||||
|
|
||||||
@ -1755,7 +1780,7 @@
|
|||||||
let keys = Object.keys(option);
|
let keys = Object.keys(option);
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
these.Status.Pop[key] = option[key];
|
this.Status.Pop[key] = option[key];
|
||||||
}
|
}
|
||||||
keys = Object.keys(defaultCfg);
|
keys = Object.keys(defaultCfg);
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
@ -1763,10 +1788,10 @@
|
|||||||
if (key in option) {
|
if (key in option) {
|
||||||
continue;
|
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) {
|
sendUsr: function(ReSendNo) {
|
||||||
|
|
||||||
|
|||||||
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>
|
<script>
|
||||||
import gbk from '@/utils/gbk.js';
|
import gbk from '@/utils/gbk.js';
|
||||||
import MqttClient from '@/utils/mqtt.js';
|
import MqttClient from '@/utils/mqtt.js';
|
||||||
import {
|
import request,{
|
||||||
request,
|
|
||||||
baseURL
|
baseURL
|
||||||
} from '@/utils/request.js';
|
} from '@/utils/request.js';
|
||||||
var videoChannel = null;
|
var videoChannel = null;
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
设备名:{{device.deviceName}}
|
设备名:{{device.deviceName}}
|
||||||
</view>
|
</view>
|
||||||
<view class="deviceId">
|
<view class="deviceId">
|
||||||
ID:{{device.deviceId}}
|
设备Mac:{{device.macAddress}}
|
||||||
</view>
|
</view>
|
||||||
<view class="bound" v-bind:class="boundStatu">
|
<view class="bound" v-bind:class="boundStatu">
|
||||||
{{Statu.boundRemark}}
|
{{Statu.boundRemark}}
|
||||||
@ -86,15 +86,16 @@
|
|||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
these = this;
|
these = this;
|
||||||
ble = bleTool.getBleTool();
|
ble = bleTool.getBleTool();
|
||||||
|
console.log("LinkBle")
|
||||||
ble.addReceiveCallback((receive, f, path) => {
|
ble.addReceiveCallback((receive, f, path) => {
|
||||||
console.log("收到设备消息,", receive);
|
console.log("收到设备消息,", receive);
|
||||||
if (these.device.deviceId == receive.deviceId) {
|
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 (receive.bytes[0] == 0xFC || receive.str.indexOf('mac address:') == 0) {
|
||||||
if (f && f.macAddress) {
|
if (f && f.macAddress) {
|
||||||
these.device.macAddress = f.macAddress;
|
these.device.macAddress = f.macAddress;
|
||||||
// console.log("222222");
|
console.log("222222");
|
||||||
these.initDevice();
|
these.initDevice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +234,7 @@
|
|||||||
v.device[key] = data[key];
|
v.device[key] = data[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
ble.setBleData();
|
ble.updateCache();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -97,6 +97,7 @@
|
|||||||
const pagePath="pages/common/addBLE/addEquip";
|
const pagePath="pages/common/addBLE/addEquip";
|
||||||
var ble = null;
|
var ble = null;
|
||||||
var these = null;
|
var these = null;
|
||||||
|
var eventChannel=null;
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -128,7 +129,11 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
PairEquip: [], //已配对设备
|
PairEquip: [], //已配对设备
|
||||||
EquipMents: [] //搜索出来的设备
|
EquipMents: [], //搜索出来的设备
|
||||||
|
device:null,
|
||||||
|
item:{
|
||||||
|
deviceId:''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -145,7 +150,8 @@
|
|||||||
},
|
},
|
||||||
onUnload(){
|
onUnload(){
|
||||||
ble.StopSearch();
|
ble.StopSearch();
|
||||||
|
ble.removeDeviceFound(pagePath);
|
||||||
|
ble.removeReceiveCallback(pagePath);
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
these = this;
|
these = this;
|
||||||
@ -171,12 +177,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, pagePath);
|
}, pagePath);
|
||||||
// ble.addReceiveCallback((receivData) => {
|
// console.log("addEquip")
|
||||||
|
// ble.addReceiveCallback((receivData,f,path,arr) => {
|
||||||
// console.log("收到数据了:", receivData);//数据格式:{bytes:[109,97],str:"",hexs:"FA 01"}
|
// 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() {
|
onShow: function() {
|
||||||
@ -223,7 +239,7 @@
|
|||||||
ble.showBlueSetting(false);
|
ble.showBlueSetting(false);
|
||||||
},
|
},
|
||||||
Link: function(item, index) {
|
Link: function(item, index) {
|
||||||
|
this.item.deviceId=item.deviceId;
|
||||||
showLoading(this,{
|
showLoading(this,{
|
||||||
text: "正在连接"
|
text: "正在连接"
|
||||||
});
|
});
|
||||||
@ -241,6 +257,18 @@
|
|||||||
these.PairEquip.push(item);
|
these.PairEquip.push(item);
|
||||||
}
|
}
|
||||||
console.log("连接成功");
|
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({
|
uni.navigateTo({
|
||||||
url:"/pages/common/addBLE/LinkBle",
|
url:"/pages/common/addBLE/LinkBle",
|
||||||
events:{
|
events:{
|
||||||
|
|||||||
@ -144,6 +144,8 @@
|
|||||||
deviceUnbind, //删除设备
|
deviceUnbind, //删除设备
|
||||||
deviceReName
|
deviceReName
|
||||||
} from '@/api/common/index.js'
|
} from '@/api/common/index.js'
|
||||||
|
import BleHelper from '@/utils/BleHelper.js';
|
||||||
|
var ble=null;
|
||||||
export default {
|
export default {
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
// 执行下拉刷新时的操作,比如重新获取数据
|
// 执行下拉刷新时的操作,比如重新获取数据
|
||||||
@ -389,6 +391,8 @@
|
|||||||
this.deleteShow = false
|
this.deleteShow = false
|
||||||
// 关闭所有滑动项
|
// 关闭所有滑动项
|
||||||
this.$refs.swipeAction.closeAll();
|
this.$refs.swipeAction.closeAll();
|
||||||
|
|
||||||
|
ble && ble.DropDevice(data.id);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
@ -555,6 +559,7 @@
|
|||||||
console.log('列表收到消息了么');
|
console.log('列表收到消息了么');
|
||||||
this.onIntall()
|
this.onIntall()
|
||||||
});
|
});
|
||||||
|
ble=BleHelper.getBleTool();
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
// 组件销毁前移除监听器
|
// 组件销毁前移除监听器
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
var isReady=false;var onReadyCallbacks=[];
|
var isReady=false;var onReadyCallbacks=[];
|
||||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
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 __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/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 __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.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()})}});
|
__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}}}});
|
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}}}});
|
||||||
|
|||||||
2275
unpackage/dist/dev/app-plus/app-service.js
vendored
2275
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: [], //发现新设备的事件
|
onDeviceFound: [], //发现新设备的事件
|
||||||
receivDataCallback: [] //接收到数据的事件
|
receivDataCallback: [] //接收到数据的事件
|
||||||
}
|
}
|
||||||
this.addReceiveCallback((a, b, c) => {
|
// this.addReceiveCallback((a, b, c) => {
|
||||||
recei.ReceiveData(a, b, c);
|
// recei.ReceiveData(a, b, c);
|
||||||
}, "BleReceiveData");
|
// }, "BleReceiveData");
|
||||||
this.dic = {
|
this.dic = {
|
||||||
errRemarks: [{
|
errRemarks: [{
|
||||||
key: '10000',
|
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() {
|
linkAllDevices() {
|
||||||
console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
|
console.log("模块启动时,自动连接已连接过的设备", this.data.LinkedList);
|
||||||
|
|
||||||
@ -162,7 +192,7 @@ class BleHelper {
|
|||||||
let key = currKey ? currKey : this.getCurrentPagePath();
|
let key = currKey ? currKey : this.getCurrentPagePath();
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
console.log("key=" + key);
|
// console.log("key=" + key);
|
||||||
let f = this.cfg.onDeviceFound.findIndex((v) => {
|
let f = this.cfg.onDeviceFound.findIndex((v) => {
|
||||||
return v.key == key;
|
return v.key == key;
|
||||||
});
|
});
|
||||||
@ -205,7 +235,7 @@ class BleHelper {
|
|||||||
removeReceiveCallback(currKey) {
|
removeReceiveCallback(currKey) {
|
||||||
let key = currKey ? currKey : this.getCurrentPagePath();
|
let key = currKey ? currKey : this.getCurrentPagePath();
|
||||||
if (key) {
|
if (key) {
|
||||||
console.log("移除消息回调:" + key);
|
// console.log("移除消息回调:" + key);
|
||||||
let f = this.cfg.receivDataCallback.findIndex((v) => {
|
let f = this.cfg.receivDataCallback.findIndex((v) => {
|
||||||
return v.key == key;
|
return v.key == key;
|
||||||
});
|
});
|
||||||
@ -399,8 +429,8 @@ class BleHelper {
|
|||||||
v.notifyState = false;
|
v.notifyState = false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
uni.setStorageSync(this.StorageKey, this.data
|
|
||||||
.LinkedList);
|
this.updateCache();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -417,8 +447,7 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
uni.setStorageSync(this.StorageKey, this.data
|
this.updateCache();
|
||||||
.LinkedList);
|
|
||||||
} else {
|
} else {
|
||||||
// console.log("蓝牙连接已恢复,", res);
|
// console.log("蓝牙连接已恢复,", res);
|
||||||
}
|
}
|
||||||
@ -464,25 +493,26 @@ class BleHelper {
|
|||||||
|
|
||||||
let header = "mac address:";
|
let header = "mac address:";
|
||||||
if (str.indexOf(header) == 0) { //650以文本传输mac
|
if (str.indexOf(header) == 0) { //650以文本传输mac
|
||||||
|
console.log("str=", str);
|
||||||
this.data.LinkedList.find((v) => {
|
this.data.LinkedList.find((v) => {
|
||||||
if (v.deviceId == receive
|
if (v.deviceId == receive
|
||||||
.deviceId) {
|
.deviceId) {
|
||||||
str = str.replace(
|
let macStr = str.replace(
|
||||||
header, "");
|
header, "");
|
||||||
if (str.includes(':')) {
|
if (macStr.includes(':')) {
|
||||||
v.macAddress = str;
|
v.macAddress = macStr;
|
||||||
} else {
|
} else {
|
||||||
v.macAddress = str.replace(
|
v.macAddress = macStr
|
||||||
|
.replace(
|
||||||
/(.{2})/g, '$1:')
|
/(.{2})/g, '$1:')
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
}
|
}
|
||||||
|
str = header + v.macAddress;
|
||||||
console.log("收到mac地址:", v
|
console.log("收到mac地址:", v
|
||||||
.macAddress)
|
.macAddress)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.setStorageSync(this.StorageKey, this.data
|
this.updateCache();
|
||||||
.LinkedList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes[0] == 0xFC) { //6155以0xFC开头代表mac地址
|
if (bytes[0] == 0xFC) { //6155以0xFC开头代表mac地址
|
||||||
@ -498,8 +528,7 @@ class BleHelper {
|
|||||||
// console.log("收到mac地址:", str)
|
// console.log("收到mac地址:", str)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.setStorageSync(this.StorageKey, this
|
this.updateCache();
|
||||||
.data.LinkedList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("str=", str);
|
console.log("str=", str);
|
||||||
@ -514,20 +543,26 @@ class BleHelper {
|
|||||||
str: str,
|
str: str,
|
||||||
hexs: hexs
|
hexs: hexs
|
||||||
};
|
};
|
||||||
console.log("监听到特征值:" + JSON.stringify(recData));
|
// console.log("监听到特征值:" + JSON.stringify(recData));
|
||||||
try {
|
try {
|
||||||
if (this.cfg.receivDataCallback) {
|
if (this.cfg.receivDataCallback) {
|
||||||
|
|
||||||
if (this.cfg.receivDataCallback.length > 0) {
|
if (this.cfg.receivDataCallback.length > 0) {
|
||||||
console.log("有人订阅消息")
|
|
||||||
let path = this.getCurrentPagePath();
|
|
||||||
|
|
||||||
|
let path = this.getCurrentPagePath();
|
||||||
|
console.log("有人订阅消息")
|
||||||
this.cfg.receivDataCallback.forEach((
|
this.cfg.receivDataCallback.forEach((
|
||||||
rec) => {
|
rec) => {
|
||||||
|
console.log("有人订阅消息111",)
|
||||||
if (rec.callback) {
|
if (rec.callback) {
|
||||||
|
try{
|
||||||
rec.callback(recData, f,
|
rec.callback(recData, f,
|
||||||
path);
|
path, this.cfg
|
||||||
|
.receivDataCallback);
|
||||||
|
}catch(err){
|
||||||
|
console.log("订阅消息出现异常",err);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -692,8 +727,8 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
// console.log("c=", c);
|
// console.log("c=", c);
|
||||||
let startSubScribe = (id, serviceId, characteristicId) => {
|
let startSubScribe = (id, serviceId, characteristicId) => {
|
||||||
console.log("serviceId=", serviceId);
|
// console.log("serviceId=", serviceId);
|
||||||
console.log("characteristicId=", characteristicId);
|
// console.log("characteristicId=", characteristicId);
|
||||||
let p1 = new Promise((succ, err) => {
|
let p1 = new Promise((succ, err) => {
|
||||||
|
|
||||||
uni.notifyBLECharacteristicValueChange({
|
uni.notifyBLECharacteristicValueChange({
|
||||||
@ -713,8 +748,10 @@ class BleHelper {
|
|||||||
v.notifyState = state;
|
v.notifyState = state;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("success SubScribe");
|
// console.log("success SubScribe");
|
||||||
succ(res);//见了鬼了,有时候执行了succ但promise永远pending了
|
succ(
|
||||||
|
res
|
||||||
|
); //见了鬼了,有时候执行了succ但promise永远pending了
|
||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
|
|
||||||
@ -725,7 +762,9 @@ class BleHelper {
|
|||||||
|
|
||||||
let p2 = new Promise((succ, err) => {
|
let p2 = new Promise((succ, err) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
err({code:-1});
|
err({
|
||||||
|
code: -1
|
||||||
|
});
|
||||||
}, 50);
|
}, 50);
|
||||||
});
|
});
|
||||||
return new Promise((succ, err) => {
|
return new Promise((succ, err) => {
|
||||||
@ -754,27 +793,27 @@ class BleHelper {
|
|||||||
|
|
||||||
if (promies.length > 0) {
|
if (promies.length > 0) {
|
||||||
|
|
||||||
console.log("234324324324");
|
// console.log("234324324324");
|
||||||
Promise.allSettled(promies).then((results) => {
|
Promise.allSettled(promies).then((results) => {
|
||||||
console.log("11111");
|
// console.log("11111");
|
||||||
results.forEach((result, index) => {
|
results.forEach((result, index) => {
|
||||||
if (result.status === "fulfilled") {
|
if (result.status === "fulfilled") {
|
||||||
console.log(`操作${index + 1}成功:`, result.value);
|
// console.log(`操作${index + 1}成功:`, result.value);
|
||||||
} else {
|
} else {
|
||||||
console.log(`操作${index + 1}失败:`, result.reason
|
// console.log(`操作${index + 1}失败:`, result.reason
|
||||||
.message);
|
// .message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("222222");
|
// console.log("222222");
|
||||||
reject(ex);
|
reject(ex);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
console.log("finally")
|
// console.log("finally")
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("33333");
|
// console.log("33333");
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,8 +845,7 @@ class BleHelper {
|
|||||||
v.services = res.services;
|
v.services = res.services;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.setStorageSync(this.StorageKey,
|
this.updateCache();
|
||||||
this.data.LinkedList);
|
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
let se = res.services.find((v) => {
|
let se = res.services.find((v) => {
|
||||||
@ -947,7 +985,7 @@ class BleHelper {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
this.updateCache();
|
||||||
resolve(res);
|
resolve(res);
|
||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
@ -989,12 +1027,12 @@ class BleHelper {
|
|||||||
var linkDevice = () => {
|
var linkDevice = () => {
|
||||||
// 添加重试次数限制
|
// 添加重试次数限制
|
||||||
let retryCount = 0;
|
let retryCount = 0;
|
||||||
const maxRetries = 1; // 最大重试次数
|
const maxRetries = 5; // 最大重试次数
|
||||||
|
|
||||||
const connect = () => {
|
const connect = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (fIndex > -1 && f?.Linked) {
|
if (fIndex > -1 && f?.Linked) {
|
||||||
console.log("当前已连接,跳过其他步骤");
|
// console.log("当前已连接,跳过其他步骤");
|
||||||
resolve(false);
|
resolve(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1027,8 +1065,7 @@ class BleHelper {
|
|||||||
this.data.LinkedList.push(cr);
|
this.data.LinkedList.push(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.setStorageSync(this.StorageKey, this.data
|
this.updateCache();
|
||||||
.LinkedList);
|
|
||||||
console.log("LinkedList=", this.data
|
console.log("LinkedList=", this.data
|
||||||
.LinkedList);
|
.LinkedList);
|
||||||
|
|
||||||
@ -1045,7 +1082,8 @@ class BleHelper {
|
|||||||
fail: () => {
|
fail: () => {
|
||||||
console.log("mtu设置失败");
|
console.log("mtu设置失败");
|
||||||
resolve(
|
resolve(
|
||||||
true); // MTU设置失败不影响连接成功
|
true
|
||||||
|
); // MTU设置失败不影响连接成功
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -1088,15 +1126,15 @@ class BleHelper {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|
||||||
if (res) { //新连接
|
if (res) { //新连接
|
||||||
console.log("11111111");
|
// console.log("11111111");
|
||||||
if (fIndex == -1) {
|
if (fIndex == -1) {
|
||||||
console.log("开始获取服务", targetServiceId)
|
// console.log("开始获取服务", targetServiceId)
|
||||||
return this.getService(deviceId, targetServiceId, writeCharId,
|
return this.getService(deviceId, targetServiceId, writeCharId,
|
||||||
notifyCharId); //获取服务
|
notifyCharId); //获取服务
|
||||||
} else {
|
} else {
|
||||||
if (f.wirteCharactId && f.notifyCharactId) {
|
if (f.wirteCharactId && f.notifyCharactId) {
|
||||||
if (!f.notifyState) {
|
if (!f.notifyState) {
|
||||||
console.log("开始订阅特征");
|
// console.log("开始订阅特征");
|
||||||
this.subScribe(deviceId, true);
|
this.subScribe(deviceId, true);
|
||||||
} else {
|
} else {
|
||||||
console.log("不订阅消息");
|
console.log("不订阅消息");
|
||||||
@ -1111,7 +1149,7 @@ class BleHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else { //已连接过,直接订阅消息
|
} else { //已连接过,直接订阅消息
|
||||||
console.log("11111111");
|
// console.log("11111111");
|
||||||
if (fIndex > -1 && f && !f.notifyState) {
|
if (fIndex > -1 && f && !f.notifyState) {
|
||||||
|
|
||||||
this.subScribe(deviceId, true);
|
this.subScribe(deviceId, true);
|
||||||
@ -1120,7 +1158,7 @@ class BleHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
console.log("then.....");
|
// console.log("then.....");
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resolve();
|
resolve();
|
||||||
@ -1235,14 +1273,14 @@ class BleHelper {
|
|||||||
})); //没有找到指定设备
|
})); //没有找到指定设备
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("device=", device);
|
// console.log("device=", device);
|
||||||
uni.writeBLECharacteristicValue({
|
uni.writeBLECharacteristicValue({
|
||||||
deviceId: device.deviceId,
|
deviceId: device.deviceId,
|
||||||
serviceId: device.writeServiceId,
|
serviceId: device.writeServiceId,
|
||||||
characteristicId: device.wirteCharactId,
|
characteristicId: device.wirteCharactId,
|
||||||
value: buffer,
|
value: buffer,
|
||||||
success: () => {
|
success: () => {
|
||||||
console.log("发送数据成功");
|
// console.log("发送数据成功");
|
||||||
succ();
|
succ();
|
||||||
},
|
},
|
||||||
fail: (ex) => {
|
fail: (ex) => {
|
||||||
@ -1340,9 +1378,7 @@ class BleHelper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
setBleData() {
|
|
||||||
uni.setStorageSync(this.StorageKey, this.data.LinkedList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let instance = null;
|
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){
|
if(f && f.macAddress && f.device && f.device.id){
|
||||||
let data={};
|
let data={};
|
||||||
if(f.device.detailPageUrl=='/pages/6155/deviceDetail'){
|
if(f.device.detailPageUrl=='/pages/6155/deviceDetail'){
|
||||||
// console.log("该设备是6155");
|
// 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'){
|
if(f.device.detailPageUrl=='/pages/650/HBY650'){
|
||||||
// console.log("该设备是650");
|
// 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'){
|
if(f.device.detailPageUrl=='/pages/670/HBY670'){
|
||||||
// console.log("该设备是670");
|
// console.log("该设备是670");
|
||||||
data= this.Receive_670(receive,f,path);
|
data= this.Receive_670(receive,f,path,recArr);
|
||||||
}
|
}
|
||||||
// console.log("收到数据并处理完毕,",data);
|
// console.log("收到数据并处理完毕,",data);
|
||||||
return data;
|
return data;
|
||||||
@ -70,7 +70,7 @@ class BleReceive {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Receive_650(receive,f,path) {
|
Receive_650(receive,f,path,recArr) {
|
||||||
console.log("通用程序正在处理650的数据",receive);
|
console.log("通用程序正在处理650的数据",receive);
|
||||||
|
|
||||||
var parseData = () => {
|
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) =>{
|
var todo = (bytes) =>{
|
||||||
// console.log("todo",receive);
|
// console.log("todo",receive);
|
||||||
let receiveData = {};
|
let receiveData = {};
|
||||||
@ -316,6 +316,21 @@ class BleReceive {
|
|||||||
receiveData.staticWarn = staticWarn;
|
receiveData.staticWarn = staticWarn;
|
||||||
receiveData.fourGStrenth = fourGStrenth;
|
receiveData.fourGStrenth = fourGStrenth;
|
||||||
receiveData.SOS=sosTxt;
|
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) {
|
} catch(error) {
|
||||||
console.log('数据解析错误:', error);
|
console.log('数据解析错误:', error);
|
||||||
}
|
}
|
||||||
@ -394,7 +409,7 @@ class BleReceive {
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
Receive_6155(receive,f,path) {
|
Receive_6155(receive,f,path,recArr) {
|
||||||
let bytes=receive.bytes;
|
let bytes=receive.bytes;
|
||||||
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
|
if (bytes[0] == 0xFB && bytes[1] == 0x64 && bytes.length >= 8) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
107
utils/update.js
107
utils/update.js
@ -1,3 +1,5 @@
|
|||||||
|
import request,{baseURL} from '@/utils/request.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查并执行wgt热更新
|
* 检查并执行wgt热更新
|
||||||
* @param {String} updateUrl - 检查更新的接口地址
|
* @param {String} updateUrl - 检查更新的接口地址
|
||||||
@ -13,53 +15,90 @@ function checkAndUpdateWgt(updateUrl) {
|
|||||||
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
||||||
const currentVersion = widgetInfo.version;
|
const currentVersion = widgetInfo.version;
|
||||||
console.log("当前版本:" + currentVersion);
|
console.log("当前版本:" + currentVersion);
|
||||||
// 2. 调用后端接口检查是否有更新
|
request({
|
||||||
uni.request({
|
url:'/app/auth/version',
|
||||||
url: updateUrl,
|
method: 'get'
|
||||||
method: 'GET',
|
}).then(res=>{
|
||||||
data: {
|
console.log("检查版本更新:",res);
|
||||||
currentVersion: currentVersion,
|
let os=plus.os.name.toLowerCase();
|
||||||
platform: uni.getSystemInfoSync().platform
|
if(res.code!=200){
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
uni.hideLoading();
|
|
||||||
console.log("res=", res)
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
|
|
||||||
const updateInfo = res.data.data;
|
|
||||||
if (!updateInfo.hasUpdate) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 3. 显示更新提示
|
let f=res.data.find(v=>{
|
||||||
|
if(v.dictLabel.toLowerCase()==os){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if(f){
|
||||||
|
if(f.dictValue==currentVersion){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '检测到更新',
|
title: '检测到更新',
|
||||||
content: updateInfo.description || '有新版本可用,是否立即更新?',
|
content: '当前版本“'+currentVersion+'”,发现新版本“'+f.dictValue+'”,是否立即更新?',
|
||||||
confirmText: '立即更新',
|
confirmText: '立即更新',
|
||||||
cancelText: '稍后更新',
|
cancelText: '稍后更新',
|
||||||
success: (modalRes) => {
|
success: (modalRes) => {
|
||||||
if (modalRes.confirm) {
|
if (modalRes.confirm) {
|
||||||
downloadAndInstallWgt(updateInfo.downloadUrl);
|
downloadAndInstallWgt(f.remark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: '当前已是最新版本',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
uni.hideLoading();
|
|
||||||
uni.showToast({
|
|
||||||
title: '检查更新失败',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
console.error('检查更新失败:', err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}).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