diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index 95fb682..4b8bc8a 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -2,6 +2,7 @@
"version" : "1.0",
"configurations" : [
{
+ "customPlaygroundType" : "local",
"playground" : "standard",
"type" : "uni-app:app-ios"
},
diff --git a/App.vue b/App.vue
index c127c62..e96c1c4 100644
--- a/App.vue
+++ b/App.vue
@@ -15,25 +15,25 @@
console.log("appid=", appid);
if (appid === 'HBuilder') {
- 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" || val == 'phone') {
- 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" || val == 'phone') {
+ // console.log("忽略登陆信息");
+ // } else {
+ // uni.removeStorageSync(val);
+ // }
+ // });
}
@@ -46,6 +46,7 @@
uni.getPushClientId({
success(res) {
+
console.log("推送信息:", res);
uni.setStorageSync('push_cid', res.cid);
},
@@ -65,29 +66,31 @@
//将App角标设置为0,清空app在消息中心的所有消息
uni.setAppBadgeNumber(0);
plus && plus.push.clear();
+ uni.navigateTo({
+ url:'/pages/common/Msgs/deviceMsg',
+ success(r) {
+ console.log("11111");
+ r.eventChannel.emit("pushMsg",res);
+ }
+ });
return;
}
- uni.createPushMessage({
- title: res.data.title,
- content: res.data.content,
- payload: res.data.payload
- });
+ if(res.data.payload && res.data.payload.force==true){
+ console.log("此消息是强制消息")
+ //设备在线,丢弃消息,只显示强制的消息
+ uni.createPushMessage({
+ title: res.data.title,
+ content: res.data.content,
+ payload: res.data.payload
+ });
+ return;
+ }
+ console.error("设备在线,不是强制消息,丢弃此消息");
+
});
- //监听网络变化
- uni.onNetworkStatusChange((res)=>{
- let title='网络连接已断开';
- if(res.isConnected){
- title='网络连接已恢复';
-
- }
- uni.showToast({
- title:title
-
- });
- });
}
if (system.osName == 'android') {
@@ -105,14 +108,16 @@
},
onShow: function() {
console.log('App Show');
- // 取消延迟断开:用户可能只是选文件/录音后返回,不断开蓝牙
+
+
+ //将检查更新换到onshow,因为苹果用户喜欢一直挂着
+ // #ifdef APP|APP-PLUS
+
if (_bleDisconnectTimer) {
clearTimeout(_bleDisconnectTimer);
_bleDisconnectTimer = null;
}
- //将检查更新换到onshow,因为苹果用户喜欢一直挂着
- // #ifdef APP|APP-PLUS
-
+
let appid = plus.runtime.appid;
console.log("appid=", appid);
@@ -123,14 +128,28 @@
uni.setKeepScreenOn({
keepScreenOn: true
}).then(res => {
- console.log("已设置屏幕常亮");
+ console.log("已打开屏幕常亮");
}).catch(ex => {
console.error("设置屏幕常亮失败,ex=", ex)
- })
+ });
+
+ //监听网络变化
+ uni.onNetworkStatusChange((res)=>{
+ let title='网络连接已断开';
+
+ if(res.isConnected){
+ title='网络连接已恢复';
+
+ }
+ uni.showToast({
+ title:title
+
+ });
+ });
// #endif
- },
+ },
onHide: function() {
console.log('App Hide');
// #ifdef APP|APP-PLUS
@@ -157,11 +176,11 @@
if (_bleDisconnectTimer) clearTimeout(_bleDisconnectTimer);
_bleDisconnectTimer = setTimeout(() => {
_bleDisconnectTimer = null;
- let ble2 = bleTool.getBleTool();
- if (ble2) {
+
+ if (ble) {
console.log("App隐藏了,断开所有蓝牙设备,停止搜索");
- ble2.StopSearch().catch(ex => {});
- ble2.disconnectDevice().catch(ex => {});
+ ble.StopSearch().catch(ex => {});
+ ble.disconnectDevice().catch(ex => {});
console.log("断开所有蓝牙设备");
@@ -285,13 +304,22 @@
justify-content: center;
align-items: center;
}
-
+ .colCenter{
+ display: flex;
+ flex-direction: column;
+ flex-wrap: wrap;
+ align-content: center;
+ justify-content: center;
+ align-items: center;
+ }
.navbarRight .img {
width: 35rpx;
height: 35rpx;
margin-right: 30rpx;
}
-
+ .navbarRight .img:last-child{
+ margin-right: 10rpx !important;
+ }
.uni-navbar--fixed {
top: 0rpx;
}
@@ -303,17 +331,19 @@
::v-deep .uni-navbar__placeholder {
display: none !important;
}
-
+ ::v-deep .mescroll-upwarp{
+ text-align: center;
+ }
/* #endif */
- // @font-face {
- // font-family: "PingFang SC";
- // src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
- // }
+ @font-face {
+ font-family: "PingFang SC";
+ src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
+ }
- // @font-face {
- // font-family: "PingFangBold";
- // src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
- // }
+ @font-face {
+ font-family: "PingFangBold";
+ src: url("~@/static/fonts/PingFangSC.ttf") format("opentype");
+ }
\ No newline at end of file
diff --git a/components/MsgBox/MsgBox.vue b/components/MsgBox/MsgBox.vue
index 7f4e0b5..8fbe4e5 100644
--- a/components/MsgBox/MsgBox.vue
+++ b/components/MsgBox/MsgBox.vue
@@ -133,8 +133,10 @@
return json;
},
//弹出预定好的四种弹窗
- showMsg(msg, btnTxt, type, okCallback) {
-
+ showMsg(msg, btnTxt, type, okCallback,showCancel) {
+ if(!showCancel){
+ showCancel=false;
+ }
let cfg = {
error: {
icoUrl: '/static/images/common/uploadErr.png',
@@ -142,7 +144,7 @@
buttonBgColor: "#E03434",
bgColor:'#383934cc',
buttonTextColor:'#FFFFFFde',
- showCancel:true,
+ showCancel:showCancel,
buttonCancelText:'取消'
},
succ: {
@@ -151,35 +153,34 @@
buttonBgColor: "#BBE600",
buttonTextColor:'#232323de',
bgColor:'#383934cc',
- showCancel:true,
+ showCancel:showCancel,
buttonCancelText:'取消'
},
warn: {
icoUrl: '/static/images/common/warning.png',
borderColor: "#FFC84E4d",
buttonBgColor: "#FFC84E",
- buttonTextColor:'#FFFFFFde',
+ buttonTextColor:'#1a1A1A',
bgColor:'#383934cc',
- showCancel:true,
+ showCancel:showCancel,
buttonCancelText:'取消'
},
info:{
- borderColor: "#BBE6004d",
- buttonBgColor: "#BBE600",
- bgColor:'#383934cc',
+ icoUrl: '/static/images/common/ver.png',
+ borderColor: "#FFFFFF4d",
+ buttonBgColor: "#FFFFFFde",
buttonTextColor:'#232323de',
- showCancel:true,
+ bgColor:'#383934cc',
+ showCancel:showCancel,
buttonCancelText:'取消'
},
- prompt:{
-
-
+ prompt:{
borderColor: "#aed6004d",
buttonBgColor: "#aed600",
- bgColor:'#38393466',
+ bgColor:'#383934cc',
buttonTextColor:'#232323de',
showSlot:true,
- showCancel:true,
+ showCancel:showCancel,
buttonCancelText:'取消'
}
}
diff --git a/components/SubStep/SubStep.vue b/components/SubStep/SubStep.vue
new file mode 100644
index 0000000..d11569b
--- /dev/null
+++ b/components/SubStep/SubStep.vue
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+ {{index+1}}
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 794501b..c7dae82 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"name" : "星汉物联",
"appid" : "__UNI__A21EF43",
"description" : "设备管控",
- "versionName" : "1.0.27",
+ "versionName" : "1.0.30",
"versionCode" : 101,
"transformPx" : false,
/* 5+App特有相关 */
diff --git a/pages.json b/pages.json
index ff1d68e..fade1c1 100644
--- a/pages.json
+++ b/pages.json
@@ -168,8 +168,8 @@
{
"path": "pages/common/map/index",
"style": {
- "navigationBarTitleText": "地图"
-
+ "navigationBarTitleText": "地图",
+ "navigationStyle": "custom"
}
},
{
@@ -473,15 +473,15 @@
{
"path": "pages/common/sosSet/TxtMsgSetting",
"style": {
- "navigationBarTitleText": "短信设置",
- "navigationStyle": "custom"
+ "navigationBarTitleText": "短信设置"
+
}
},
{
"path": "pages/common/sosSet/LinkManSetting",
"style": {
- "navigationBarTitleText": "紧急联系人",
- "navigationStyle": "custom"
+ "navigationBarTitleText": "紧急联系人"
+
}
},
{
@@ -495,6 +495,35 @@
"style": {
"navigationBarTitleText": "报警记录"
}
+ },
+ {
+ "path": "pages/common/linkDefence/defence",
+ "style": {
+ "navigationBarTitleText": "预警布防",
+ "navigationStyle": "custom",
+ "app-plus":{
+ "bounce":"none"
+ }
+ }
+ },
+ {
+ "path": "pages/common/linkDefence/addDefence",
+ "style": {
+ "navigationBarTitleText": "编辑预警编组"
+ }
+ },
+ {
+ "path": "pages/common/linkDefence/checkDevice",
+ "style": {
+ "navigationBarTitleText": "",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/Msgs/deviceMsg",
+ "style": {
+ "navigationBarTitleText": "设备消息"
+ }
}
],
diff --git a/pages/008A/HBY008A.vue b/pages/008A/HBY008A.vue
index 31a8807..62dd1e5 100644
--- a/pages/008A/HBY008A.vue
+++ b/pages/008A/HBY008A.vue
@@ -53,23 +53,100 @@
蓝牙名称
{{device.bluetoothName}}
+
+
+ 设备状态
+ {{formData.sta_system}}
+
蓝牙状态
{{getbleStatu}}
- 设备状态
- {{formData.sta_system}}
+ 信道:{{formData.sta_Channel}}
+ 修改
+
+
+
+
+
+
+ M
+
+
+ S
+
+
+
+
+ 开关模式
+
+
+ 总开关
+
+ 左侧
+
+ 右侧
+
+
+
+
+
+
+
+
+
+
+
+ {{item.text}}
+
+
-
+
+
+ 泛光灯
+
+
+ 前置
+ 左侧
+
+ 右侧
+
+
+
+
+
+
+
+
+
+
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
@@ -112,11 +189,11 @@
apiType: "listA",
navbar: {
icons: [{
- type:'msg',
+ type: 'msg',
src: '/static/images/common/msg.png'
},
{
- type:'share',
+ type: 'share',
src: '/static/images/common/shape.png'
}
],
@@ -125,31 +202,25 @@
height: 90
},
usrToggle: true,
- bleLinkCnt: 0
+ bleLinkCnt: 0,
+ warnSwitch: 0,
+ fanSwitch: 0
},
formData: {
- img: '/static/images/common/BJQ6075.png',
- battary: "", //电量
- xuhang: "", //续航
- imei: "", //imei
- Lon: "", //经度
- Lat: "", //纬度
- address: "", //地址
- modeCurr: "", //档位
- SOS: "", //sos
- lightCurr: "qiang", //照明模式
- company: "湖北消防总队", //单位
- usrname: "胡红军", //姓名
- job: "中队长", //职位
- usrid: "", //id
- msgTxt: "", //消息1
- qzwarn: false, //是否强制报警
- warnLevel: "", //报警级别
- staticWarn: false, //静止报警
- fourGStrenth: 0, //4G信号强度
+ img: '/static/images/common/HBY008A.png',
deviceId: "",
- sta_system: "", //设备状态,0关机,1仅充电,2开机未充电,3,开机且充电
- bleStatu: false
+ sta_leftLight: null,
+ sta_rightLight: null,
+ sta_frontFan: null,
+ sta_leftFan: null,
+ sta_rightFan: null,
+ sta_channel: null,
+ sta_Ms: null,
+ sta_PowerPercent: null,
+ sta_PowerTime: null,
+ sta_system: null,
+ bleStatu: null,
+ tmp_Channel: null
},
device: {
id: "",
@@ -170,7 +241,58 @@
detailPageUrl: "/pages/670/HBY670",
showConfirm: false
},
-
+ dic: {
+ fanLight: [{
+ text: '强光',
+ value: 1,
+ img: '/static/images/lightImg/qiang.png',
+ imgA: '/static/images/lightImg/qiangActive.png',
+ },
+ {
+ text: '工作光',
+ value: 2,
+ img: '/static/images/lightImg/work.png',
+ imgA: '/static/images/lightImg/workActive.png',
+ },
+ {
+ text: '爆闪',
+ value: 4,
+ img: '/static/images/lightImg/light.png',
+ imgA: '/static/images/lightImg/lightActive.png',
+ }
+ ],
+ warLight: [{
+ text: '红色长亮',
+ value: 1,
+ img: '/static/images/lightImg/liting.png',
+ imgA: '/static/images/lightImg/litingActive.png',
+ },
+ {
+ text: '红色爆闪',
+ value: 2,
+ img: '/static/images/lightImg/light.png',
+ imgA: '/static/images/lightImg/lightActive.png',
+ },
+ {
+ text: '红蓝双闪',
+ value: 3,
+ img: '/static/images/lightImg/rb.png',
+ imgA: '/static/images/lightImg/rbActive.png',
+ },
+ {
+ text: '黄色长亮',
+ value: 4,
+ img: '/static/images/lightImg/liting.png',
+ imgA: '/static/images/lightImg/litingActive.png',
+ },
+ {
+ text: '黄色爆闪',
+ value: 5,
+ img: '/static/images/lightImg/light.png',
+ imgA: '/static/images/lightImg/lightActive.png',
+ }
+ ]
+ },
permissions: []
}
@@ -250,9 +372,7 @@
}
});
}
- if (these.device.deviceImei) {
- these.initMQ();
- }
+
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == device.deviceMac) {
console.log("找到设备了", v);
@@ -263,7 +383,7 @@
});
if (!f) {
these.showBleUnConnect();
- these.getDetail();
+
return;
}
let form = f.formData;
@@ -275,12 +395,8 @@
these.formData[key] = form[key];
}
}
- if (these.formData['imei'] && !these.device.deviceImei) {
- these.initMQ();
- } else if (these.device.deviceImei) {
- these.formData['imei'] = these.device.deviceImei;
- }
- these.getDetail();
+
+
these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
@@ -294,6 +410,171 @@
},
methods: {
+ btnSetting(val, type) {
+ if (this.Status[type] == val) {
+ return;
+ }
+ this.Status[type] = val;
+ },
+ MsSetting(type) {
+ let f = this.getDevice();
+
+ if (!f) {
+ this.showBleUnConnect();
+ return;
+ }
+
+ let json = {
+ ins_Ms: type
+ };
+ ble.sendString(f.deviceId, json).then(res => {
+ MsgSuccess("发送设置指令成功,等待设备响应", '', this, null, false);
+ }).catch(ex => {
+ MsgError(ex.msg, '', this, null, false);
+ });
+ },
+ ShowChannelEdit() {
+ if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') {
+ MsgError("无操作权限", '', this, null, false);
+ return;
+ }
+
+ let f = this.getDevice();
+
+ if (!f) {
+ this.showBleUnConnect();
+ return;
+ }
+
+ MsgPrompt(this, 'msgEditChannel', () => {
+ let json = {
+ ins_channel: this.formData.tmp_Channel
+ };
+ ble.sendString(f.deviceId, json).then(res => {
+ MsgSuccess("发送设置指令成功,等待设备响应", '', this, null, false);
+ }).catch(ex => {
+ MsgError(ex.msg, '', this, null, false);
+ });
+ }, true, true);
+
+ },
+ lightsetting(item, index, type) {
+ debugger;
+ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
+ MsgError("无操作权限", '', this, null, false);
+ return;
+ }
+ let f = this.getDevice();
+ if (!f) {
+ this.showBleUnConnect();
+ return;
+ }
+
+ let key = type == 'warn' ? 'warnSwitch' : 'fanSwitch'
+ let json = {};
+ switch (this.Status[key]) {
+ case -1: //左
+ if (type == 'warn') {
+ if (this.formData.sta_leftLight == item.value) {
+ json.ins_leftLight = 0;
+ } else {
+ json.ins_leftLight = item.value;
+ }
+ } else {
+ if (this.formData.sta_leftFan == item.value) {
+ json.ins_leftFan = 0;
+ } else {
+ json.ins_leftFan = item.value;
+ }
+ }
+
+
+ break;
+
+ case 0: //总开关
+ if (type == 'warn') {
+ if (this.formData.sta_leftLight == item.value && this.formData.sta_rightLight == item.value) {
+ json.ins_leftLight = 0;
+ json.ins_rightLight = 0;
+ } else {
+ json.ins_leftLight = item.value;
+ json.ins_rightLight = item.value;
+ }
+ } else {
+ if (this.formData.sta_leftFan == item.value && this.formData.sta_rightFan == item.value) {
+ json.ins_frontFan = 0;
+
+ } else {
+ json.ins_frontFan = item.value;
+
+ }
+ }
+ break;
+
+ case 1: //右
+ if (type == 'warn') {
+ if (this.formData.sta_rightLight == item.value) {
+ json.ins_rightLight = 0;
+ } else {
+ json.ins_rightLight = item.value;
+ }
+ } else {
+ if (this.formData.sta_rightFan == item.value) {
+ json.ins_rightFan = 0;
+ } else {
+ json.ins_rightFan = item.value;
+ }
+ }
+ break;
+ }
+
+ ble.sendString(f.deviceId, json).then(res => {
+ let keys = Object.keys(json);
+ for (let i = 0; i < keys.length; i++) {
+ let val = json[keys[i]];
+ let key = keys[i].replace('ins_', 'sta_');
+ this.formData[key] = val;
+ }
+ }).catch(ex => {
+ MsgError(ex.msg, '', this, null, false);
+ });
+
+ },
+ getSwitchActive(item, index, type) {
+
+ let flag = false;
+ let key = type == 'warn' ? 'warnSwitch' : 'fanSwitch'
+
+ switch (this.Status[key]) {
+ case -1: //左
+
+ if (key == 'warnSwitch') {
+ flag = this.formData.sta_leftLight == item.value;
+ } else {
+ flag = this.formData.sta_leftFan == item.value;
+ }
+ break;
+ case 0: //总开关
+ if (key == 'warnSwitch') {
+ flag = this.formData.sta_leftLight == item.value && this.formData.sta_rightLight == item.value;
+ } else {
+ flag = this.formData.sta_frontFan == item.value;
+ }
+ break;
+ case 1: //右
+ if (key == 'warnSwitch') {
+ flag = this.formData.sta_rightLight == item.value;
+ } else {
+ flag = this.formData.sta_rightFan == item.value;
+ }
+ break;
+ }
+ if (flag) {
+ return 'active';
+ }
+ return '';
+ },
+
bleStatuToggle() {
let f = this.getDevice();
if (!f) {
@@ -325,7 +606,11 @@
let f = ble.data.LinkedList.find((v) => {
return v.macAddress == these.device.deviceMac;
});
-
+ // #ifdef WEB
+ f = {
+ deviceId: '123'
+ }
+ // #endif
return f;
},
showBleUnConnect() {
@@ -352,32 +637,7 @@
})
},
- initMQ() {
-
- return new Promise((resolve, reject) => {
- if (mq) {
-
- resolve();
- return;
- }
- console.log("正在初始化MQtt")
- mq = new MqttClient();
- mq.connect(() => {
- console.log("连接成功,开始订阅消息")
- // 订阅来自设备的状态更新
- const statusTopic =
- `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
- mq.subscribe(statusTopic, (payload, receive) => {
- console.log("mq收到消息", payload)
- let json = JSON.parse(payload);
- this.receivData(json);
- });
- resolve();
- });
- });
-
- },
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) {
return;
@@ -413,13 +673,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
@@ -694,10 +948,16 @@
}
.lampMode {
- padding: 30rpx 0rpx;
+ padding: 0rpx 0rpx;
width: 100%;
box-sizing: border-box;
-
+ display: flex;
+ align-content: space-around;
+ justify-content: space-between;
+ align-items: center;
+ justify-items: stretch;
+ flex-direction: row;
+ flex-wrap: wrap;
}
.lampMode .mode {
@@ -713,11 +973,52 @@
justify-content: flex-start;
padding: 30rpx;
box-sizing: border-box;
+ border: 0.5px solid #00000000;
+ height: 140rpx;
}
.lampMode .mode.active {
- border: 1px solid rgba(174, 214, 0, 1);
+ border: 1rpx solid rgba(174, 214, 0, 1);
+ }
+
+ .lampMode .mode.active .bigTxt {
+
+ color: rgba(174, 214, 0, 1) !important;
+ }
+
+ .lampMode .type {
+ border-radius: 75rpx !important;
+ box-sizing: border-box;
+ border-style: solid;
+ border-width: 5rpx;
+ border-color: #00000000;
+ padding: 5rpx;
+ }
+
+ .lampMode .type .txt {
+ color: rgba(255, 255, 255, 0.2);
+ background-color: #00000000;
+ font-family: "PingFang SC";
+ font-size: 50rpx;
+ font-weight: 400;
+ width: 100%;
+ height: 100%;
+ border-radius: 70rpx;
+ }
+
+ .lampMode .type.active {
+ border-color: #AED600 !important;
+ }
+
+ .lampMode .type.active .txt {
+ background-color: #AED600 !important;
+ color: rgba(26, 26, 26, 1) !important;
+ }
+
+ .lampMode .mode.active:not(.type) {
+
+ border: 1rpx solid rgba(174, 214, 0, 1) !important;
}
.lampMode .mode.active .bigTxt {
@@ -729,9 +1030,34 @@
margin-left: 34rpx !important;
}
- .mode .leftImg .img {
+ .mode .leftImg {
width: 70rpx;
height: 70rpx;
+ border-radius: 4px;
+ background: rgba(255, 255, 255, 0.06);
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ align-content: center;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .mode .leftImg .img {
+ width: 40rpx;
+ height: 40rpx;
+ }
+
+ .mode .imageA {
+ display: none;
+ }
+
+ .mode.active .image {
+ display: none !important;
+ }
+
+ .mode.active .imageA {
+ display: block !important;
}
.mode .rightTxt {
@@ -1070,7 +1396,7 @@
text-align: left;
width: 100%;
box-sizing: border-box;
- padding: 30rpx 0rpx 10rpx 30rpx;
+ margin-top: 20rpx;
}
.sosContent {
@@ -1246,4 +1572,153 @@
/deep/ .uni-navbar__placeholder {
display: none !important;
}
+
+ .btn-container {
+ width: 100%;
+ height: 60rpx;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ align-content: center;
+ align-items: center;
+ justify-content: space-between;
+ margin: 20rpx 0rpx;
+ }
+
+ .btn-container .btn {
+ width: 140rpx;
+ height: 100%;
+ border-radius: 8px;
+ background-color: #2A2A2A;
+ color: rgba(255, 255, 255, 0.87);
+ color: rgba(255, 255, 255, 0.87);
+
+ font-family: "PingFang SC";
+ font-style: Medium;
+ font-size: 24rpx;
+ font-weight: 400;
+ line-height: 60rpx;
+ letter-spacing: 0.14rpx;
+ text-align: center;
+ }
+
+ .btn-container .btn.active {
+ background-color: rgba(174, 214, 0, 1) !important;
+ color: rgba(26, 26, 26, 1) !important;
+ }
+
+ .popup-prompt {
+ width: 100%;
+ box-sizing: border-box;
+ padding: 30rpx 15%;
+ }
+
+
+ .popup-prompt-title {
+
+ text-align: center;
+ width: 100%;
+ float: left;
+ box-sizing: border-box;
+ white-space: nowrap;
+ color: rgba(255, 255, 255, 0.87);
+ font-family: PingFang SC;
+ font-size: 28rpx;
+ font-weight: 400;
+ line-height: 40rpx;
+ letter-spacing: 0.14rpx;
+
+
+ }
+
+ .popup-prompt-input {
+
+ width: 100%;
+ height: 60rpx;
+ line-height: 60rpx;
+ color: rgba(255, 255, 255, 0.87);
+ box-sizing: border-box;
+ border-bottom: 2rpx solid rgba(255, 255, 255, 0.4);
+ font-size: 28rpx;
+ font-weight: 400;
+ letter-spacing: 0.14px;
+ }
+
+ .popup-prompt-input-placeHolder {
+ color: rgba(255, 255, 255, 0.4);
+
+ font-family: PingFang SC;
+ font-size: 28rpx;
+ font-weight: 400;
+
+ letter-spacing: 0.14px;
+ text-align: center;
+
+ }
+
+
+ .fanMode {
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ align-content: center;
+ align-items: center;
+ justify-content: space-between;
+ margin-top: 25rpx;
+ }
+
+ .fanMode .fanItem {
+ width: 25%;
+ height: auto;
+ min-height: 180rpx;
+ padding: 24rpx 30rpx 18rpx 30rpx;
+ background-color: rgba(26, 26, 26, 1);
+ border-radius: 16rpx;
+ display: flex;
+ flex-direction: column;
+ flex-wrap: nowrap;
+ align-content: center;
+ align-items: center;
+ justify-content: space-around;
+ white-space: nowrap;
+ color: rgba(255, 255, 255, 0.87);
+ border: 1rpx solid #00000000;
+ font-family: "PingFang SC";
+ font-style: Regular;
+ font-size: 28rpx;
+ font-weight: 400;
+
+ letter-spacing: 0.14rpx;
+ text-align: center;
+ }
+
+ .fanMode .fanItem.active {
+ color: rgba(174, 214, 0, 1) !important;
+ border: 1rpx solid rgba(174, 214, 0, 1);
+ }
+
+ .fanMode .fanItem .imageA {
+ display: none;
+ }
+
+ .fanMode .fanItem.active .imageA {
+ display: inline !important;
+ }
+
+ .fanMode .fanItem.active .image {
+ display: none !important;
+ }
+
+ .fanItem .topImg {
+ width: 60rpx;
+ height: 60rpx;
+ }
+
+ .fanItem .topImg .img {
+ width: 100%;
+ height: 100%;
+ }
+
+ .fanItem .bottomTxt {}
\ No newline at end of file
diff --git a/pages/018A/HBY018A.vue b/pages/018A/HBY018A.vue
index bfd3576..21fcd0e 100644
--- a/pages/018A/HBY018A.vue
+++ b/pages/018A/HBY018A.vue
@@ -84,12 +84,24 @@
-
+
{{ShakeBit}}
+
+
+ 灯光亮度
+ {{formData.sta_brightness}}%
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 关闭静止报警
+ 已关闭
+
+
@@ -182,10 +205,10 @@
showPop,
MsgInfo,
MsgClear
- } from '@/utils/MsgPops.js'
+ } from '@/utils/MsgPops.js';
import request, {
baseURL
- } from '@/utils/request.js'
+ } from '@/utils/request.js';
import lnglatConvert from '@/utils/wgs84_to_gcj02.js';
import Common from '@/utils/Common.js';
@@ -199,7 +222,7 @@
var mq = null;
var instrusionTime = null;
var reGeoTime = null;
-
+ var brightnessTimer=null;
export default {
data() {
@@ -233,7 +256,8 @@
sta_ShakeBit: 0, //报警状态
sta_system: '', //0关机 1关机充电 2开机未充电 3开机充电
bleStatu: '',
-
+ warnStatu:false,
+ sta_brightness:50
},
dic: {
sta_Side_Light: [
@@ -297,9 +321,9 @@
permissions: []
}
},
-created() {
+ created() {
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
- console.log("this.Status.navbar.height=",this.Status.navbar.height);
+ console.log("this.Status.navbar.height=", this.Status.navbar.height);
},
onUnload() {
console.log("页面卸载,释放资源");
@@ -352,13 +376,15 @@ created() {
let key = keys[i];
these.formData[key] = form[key];
}
+ these.device.longitude = form.sta_longitude;
+ these.device.latitude = form.sta_latitude;
}
- these.device.longitude = form.sta_longitude;
- these.device.latitude = form.sta_latitude;
+
+
these.formData.blename = f.name ? f.name : "Unname";
these.formData.deviceName = device.deviceName;
-
+
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
@@ -366,13 +392,13 @@ created() {
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
- });;
+ });
these.formData.sta_IntrusTime = 0;
these.formData.sta_sosadd = "";
these.setBleFormData();
-
+
});
},
@@ -415,7 +441,7 @@ created() {
let dic = {
"1": "设备SOS求救中",
"2": "设备静止报警中",
- "6":"设备遇水报警中"
+ "6": "设备遇水报警中"
};
let keys = Object.keys(dic);
let f = keys.find(key => {
@@ -432,6 +458,61 @@ created() {
},
methods: {
+ sliderChanging(e) {
+ this.formData.sta_brightness = e.detail.value;
+ },
+ sliderChange(e) {
+ this.formData.sta_brightness = e.detail.value;
+
+ // 清除之前的定时器
+ if (brightnessTimer) {
+ clearTimeout(brightnessTimer);
+ }
+
+ // 设置新的定时器,控制发送频率
+ brightnessTimer = setTimeout(() => {
+
+ let json = {
+ ins_brightness: e.detail.value
+ }
+ let f = this.getDevice();
+ if(f){
+ ble.sendString(f.deviceId, json).then(() => {
+
+ }).catch(() => {
+
+ this.mqSend(json).catch(ex=>{
+ MsgError(ex.msg,'',this,null,false);
+ });
+ });
+ }else{
+ this.mqSend(json).catch(ex=>{
+ MsgError(ex.msg,'',this,null,false);
+ });
+ }
+ }, 200);
+ },
+
+ WarnToggle(){
+ let json={ins_stop:1};
+ let f = this.getDevice();
+
+ if(f){
+ ble.sendString(f.deviceId, json).then(() => {
+ this.formData.warnStatu=true;
+ }).catch(() => {
+ // MsgError(ex.msg,'',this,null,false);
+ this.mqSend(json).catch(ex=>{
+ MsgError(ex.msg,'',this,null,false);
+ });
+ });
+ }else{
+ this.mqSend(json).catch(ex=>{
+ MsgError(ex.msg,'',this,null,false);
+ });
+ }
+
+ },
prevPage() {
uni.navigateBack({
@@ -745,7 +826,7 @@ created() {
console.log("this.formData[key] =", this.formData[key]);
}
},
- bleSend(json, validWarn = true,bleLink) {
+ bleSend(json, validWarn = true, bleLink) {
return new Promise((resolve, reject) => {
if (this.formData.sta_ShakeBit != '' && this.formData.sta_ShakeBit != '0' && validWarn) {
reject({
@@ -759,10 +840,10 @@ created() {
reject({
code: -1
});
- if(bleLink){
- this.showBleUnConnect();
+ if (bleLink) {
+ this.showBleUnConnect();
}
-
+
return;
}
@@ -849,6 +930,10 @@ created() {
},
gotoMap() {
+ if (!this.formData) {
+ MsgError("获取设备位置异常", '', these);
+ return;
+ }
if (!this.formData.sta_longitude || !this.formData.sta_latitude) {
MsgError("获取设备位置异常", '', these);
return;
@@ -893,8 +978,8 @@ created() {
let json = {
ins_Side_Light: val
}
- this.bleSend(json, true,false).then(() => {}).catch(ex => {
-
+ this.bleSend(json, true, false).then(() => {}).catch(ex => {
+
console.log("蓝牙发送失败,尝试用mq发送");
this.mqSend(json, true).catch(err => {
if (err.code == -1) {
@@ -922,7 +1007,20 @@ created() {
return;
}
let msg = type == 1 ? "确定开启强制报警" : '确定解除强制报警';
-
+
+ let json = {
+ ins_ShakeBit: type
+ };
+
+ let recordSOS=()=>{
+ request({
+ url: `/app/hby018a/device/ShakeBitSettings`,
+ method: 'post',
+ data: { 'deviceId': this.device.id, 'deviceImei': this.device.deviceImei, 'instructValue': json.ins_ShakeBit }
+ }).then((res) => {
+ console.log("记录强制报警",res);
+ });
+ }
showPop({
message: msg,
@@ -938,19 +1036,21 @@ created() {
MsgClear(these);
},
okCallback: () => {
- let json = {
- ins_ShakeBit: type
- };
-
- this.bleSend(json, false,false).catch(ex => {
+ this.bleSend(json, false, false).then(res=>{
+ recordSOS();
+ }).catch(ex => {
this.mqSend(json, false).catch(err => {
if (err.code == -1) {
return;
}
MsgError(err.msg, '', these);
- })
+
+ recordSOS();
+ }).then(()=>{
+ recordSOS();
+ });
});
}
@@ -974,17 +1074,10 @@ created() {
these.setBleFormData();
},
deviceRecovry(res) {
- console.log("蓝牙连接成功", these.formData);
- console.log("蓝牙连接成功", res);
+
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
@@ -1064,12 +1157,6 @@ created() {
let json = recei.ReceiveData(receive, device, pagePath, recArr);
this.receivData(json);
-
-
-
-
-
-
},
getDevice: function() {
@@ -1102,10 +1189,9 @@ created() {
uni.navigateTo({
url: "/pages/common/addBLE/addEquip",
events: {
- // BindOver: function(data) {
- // console.log(data)
- // these.formData.bleStatu = true;
- // }
+ BindOver(data) {
+ these.formData.bleStatu = true;
+ }
},
success: function(res) {
// 通过eventChannel向被打开页面传送数据
diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue
index 88e875e..da4a35d 100644
--- a/pages/100/HBY100.vue
+++ b/pages/100/HBY100.vue
@@ -164,9 +164,9 @@
}" v-on:click.stop="lightTypeSet(item,index)">
+ src="/static/images/lightImg/light.png" mode="aspectFit">
+ src="/static/images/lightImg/lightActive.png" mode="aspectFit">
@@ -1167,13 +1167,7 @@ onFreqChanging(e){
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue
index 81f0aac..047d3d5 100644
--- a/pages/100J/HBY100-J.vue
+++ b/pages/100J/HBY100-J.vue
@@ -152,9 +152,9 @@
}" v-on:click.stop="lightTypeSet(item, index)">
+ src="/static/images/lightImg/light.png" mode="aspectFit">
+ src="/static/images/lightImg/lightActive.png" mode="aspectFit">
{{ item.name }}
diff --git a/pages/100Y/HBY100Y.vue b/pages/100Y/HBY100Y.vue
index cf244b9..ac9ca0f 100644
--- a/pages/100Y/HBY100Y.vue
+++ b/pages/100Y/HBY100Y.vue
@@ -377,13 +377,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/102/HBY102.vue b/pages/102/HBY102.vue
index fb2f98d..67bc673 100644
--- a/pages/102/HBY102.vue
+++ b/pages/102/HBY102.vue
@@ -331,8 +331,8 @@
key: 'led_flash',
name: '红色爆闪',
show: true,
- img: '/static/images/100/light.png',
- activeImg: '/static/images/100/lightActive.png',
+ img: '/static/images/lightImg/light.png',
+ activeImg: '/static/images/lightImg/lightActive.png',
group: 'sta_LedType',
permission: '1'
},
@@ -349,8 +349,8 @@
key: 'led_steady',
name: '红色常亮',
show: true,
- img: '/static/images/102/liting.png',
- activeImg: '/static/images/102/litingActive.png',
+ img: '/static/images/lightImg/liting.png',
+ activeImg: '/static/images/lightImg/litingActive.png',
group: 'sta_LedType',
permission: '1'
},
@@ -1043,13 +1043,7 @@ created() {
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/210/HBY210.vue b/pages/210/HBY210.vue
index cdf95ba..1218b02 100644
--- a/pages/210/HBY210.vue
+++ b/pages/210/HBY210.vue
@@ -93,6 +93,13 @@
+
+ M
+
+
+ S
+
+
单位:
-
姓名:
-
部门:
-
ID:
-
@@ -369,9 +376,9 @@
address: "", //地址
company: "", //单位
- usrname: "", //姓名
+ name: "", //姓名
job: "", //职位
- usrid: "", //id
+ id: "", //id
sendMsg: '',
deviceId: "",
@@ -388,7 +395,8 @@
sta_ShakeBit: 0, //报警状态
sta_InfraRed: 0,
textLines: ['湖北星汉文化', '有限', '公司', '12345678'],
- sta_BreakNews:''
+ sta_BreakNews: '',
+ sta_Ms: ''
},
device: {
id: "",
@@ -541,7 +549,7 @@
these.device = device;
- these.formData.usrid = device.deviceImei;
+ these.formData.id = device.deviceImei;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
@@ -600,16 +608,16 @@
},
methods: {
- initWatch(){
- this.$watch('formData.sta_BreakNews',(newVal,oldVal)=>{
- if(newVal && newVal=='I get it'){
+ initWatch() {
+ this.$watch('formData.sta_BreakNews', (newVal, oldVal) => {
+ if (newVal && newVal == 'I get it') {
MsgSuccess("用户已确认收到紧急通知", "确定", these);
setTimeout(() => {
these.formData.sta_BreakNews = "";
}, 10);
}
});
-
+
this.$watch("formData.sta_PowerPercent", (newVal, oldVal) => {
console.log("电量发生变化");
if (newVal <= 20 && (this.formData.sta_system === 2 || this.formData.sta_system === 0)) {
@@ -1251,12 +1259,15 @@
this.Status.PictureMenu.show = false;
},
sendUsr() {
+ debugger;
+ console.log("1111111");
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
MsgError('无操作权限', '', these);
return;
}
+ console.log("1111111");
let f = this.getDevice();
if (!f) {
these.showBleUnConnect()
@@ -1266,7 +1277,10 @@
if (!batchTool) {
batchTool = new SendBatchData(these, f, ble);
}
- batchTool.SendUsr(4);
+ console.log("batch",batchTool);
+ // batchTool.SendUsr(4);
+ let txts=[these.formData.company, these.formData.name, these.formData.job,this.formData.id]
+ batchTool.sendUsrByGBK(txts);
return;
@@ -1333,7 +1347,7 @@
let json = {
ins_ShakeBit: 0
};
-
+
if (ble && f) {
ble.sendString(f.deviceId, json).then(res => {
this.formData.sta_ShakeBit = 0;
@@ -1352,6 +1366,41 @@
MsgError('确定解除报警?', '', these, bleSend);
},
+ modeToggle(val) {
+ console.log("old=", this.formData.sta_Ms);
+ let f = these.getDevice();
+ let newVal = null;
+ if (val == these.formData.sta_Ms) {
+ newVal = "0";
+ } else {
+ newVal = val;
+ }
+ console.log("old1=", this.formData.sta_Ms);
+
+ let bleSend = () => {
+ console.log("old2=", this.formData.sta_Ms);
+ let json = {
+ ins_Ms: newVal
+ };
+
+
+
+ console.log("new=", this.formData.sta_Ms);
+ these.setBleFormData();
+ console.log("these.formData.sta_Ms=" + these.formData.sta_Ms);
+
+ if (ble && f) {
+ ble.sendString(f.deviceId, json).then(res=>{
+ these.formData.sta_Ms = newVal;
+ }).catch(ex => {
+ these.mqSend(json);
+ });
+ } else {
+ these.mqSend(json);
+ }
+ };
+ bleSend();
+ },
sosSetting(val) {
console.log("old=", this.formData.sta_SOSGrade);
let f = these.getDevice();
@@ -1374,9 +1423,9 @@
let json = {
ins_SOSGrade: newVal
};
- console.log("json="+JSON.stringify(json));
+ console.log("json=" + JSON.stringify(json));
these.formData.sta_SOSGrade = newVal;
-
+
console.log("new=", this.formData.sta_SOSGrade);
these.setBleFormData();
console.log("these.formData.sta_SOSGrade=" + these.formData.sta_SOSGrade);
@@ -1407,9 +1456,9 @@
let personnelInfo = res.personnelInfo;
if (personnelInfo) {
that.formData.company = personnelInfo.unitName;
- that.formData.usrname = personnelInfo.name;
+ that.formData.name = personnelInfo.name;
that.formData.job = personnelInfo.position;
- that.formData.usrid = personnelInfo.code
+ that.formData.id = personnelInfo.code
return;
}
}
@@ -1418,7 +1467,10 @@
});
},
getDevice: function() {
- let f = ble.data.LinkedList.find((v) => {
+
+ let f ={deviceId:'123'};
+ // #ifdef APP
+ f= ble.data.LinkedList.find((v) => {
if (v.macAddress == these.device.deviceMac) {
if (!this.formData.deviceId) {
this.formData.deviceId = v.deviceId
@@ -1426,6 +1478,8 @@
return true;
}
});
+ // #endif
+
return f;
},
@@ -1463,41 +1517,34 @@
return;
}
-
+ let f = this.getDevice();
this.formData.sendMsg.padStart(16, ' ');
this.formData.textLines = [this.formData.sendMsg.slice(0, 8), this.formData.sendMsg.slice(8, 16)];
-
-
+ if (!batchTool) {
+ batchTool = new SendBatchData(these, f, ble);
+ }
+
+ batchTool.SendMsgByGBK(this.formData.textLines,mq);
+ return;
+
+
showLoading(this, {
text: "发送中"
});
//握手
let holdHand = (hexs, time) => {
return new Promise((resolve, reject) => {
+
+
setTimeout(() => {
resolve(true)
}, time);
});
}
- //画图
- let drawText = () => {
- return new Promise((resolve, reject) => {
- this.$refs.textToHex.drawAndGetPixels().then(allPixels => {
- if (!allPixels) {
- reject("文本初始化失败");
- return;
- }
- console.log("画图成功");
- resolve(allPixels);
- }).catch(compEx => {
- reject(compEx);
- });
-
- });
- }
+
//发送3个分包的数据
let task = (allPixels) => {
try {
@@ -1584,7 +1631,7 @@
}
setTimeout(() => {
- Promise.allSettled([holdHand('word transmit start', 2200), drawText()]).then(
+ Promise.allSettled([holdHand('word transmit start', 2200)]).then(
results => {
console.log("PromiseAll=", results);
if (results[0].status == 'rejected') {
@@ -1594,10 +1641,7 @@
}, 500);
return;
}
- if (results[1].status == 'rejected') {
- console.log("任务1失败了", results[1].reason);
- return;
- }
+
console.log("开始发送数据包");
task(results[1].value);
})
@@ -1607,10 +1651,11 @@
mqSend(json) {
return new Promise((resolve, reject) => {
if (mq) {
-
- mq.publish("B/" + this.device.deviceImei, typeof(json)=='string'?json:JSON.stringify(json)).then(res => {
- json=typeof(json)=='string'?JSON.parse(json):json
- let keys = Object.keys(json);
+
+ mq.publish("B/" + this.device.deviceImei, typeof(json) == 'string' ? json : JSON.stringify(
+ json)).then(res => {
+ json = typeof(json) == 'string' ? JSON.parse(json) : json
+ let keys = Object.keys(json);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
let state = key.replace('ins_', 'sta_');
@@ -1711,13 +1756,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
@@ -2018,9 +2057,39 @@
padding: 30rpx;
box-sizing: border-box;
border: 1rpx solid #00000000;
+ height: 140rpx;
}
- .lampMode .mode.active {
+ .lampMode .type {
+ border-radius: 75rpx !important;
+ box-sizing: border-box;
+ border-style: solid;
+ border-width: 5rpx;
+ border-color: #00000000;
+ padding: 5rpx;
+ }
+
+ .lampMode .type .txt {
+ color: rgba(255, 255, 255, 0.2);
+ background-color: #00000000;
+ font-family: "PingFang SC";
+ font-size: 50rpx;
+ font-weight: 400;
+ width: 100%;
+ height: 100%;
+ border-radius: 70rpx;
+ }
+
+ .lampMode .type.active {
+ border-color: #AED600 !important;
+ }
+
+ .lampMode .type.active .txt {
+ background-color: #AED600 !important;
+ color: rgba(26, 26, 26, 1) !important;
+ }
+
+ .lampMode .mode.active:not(.type) {
border: 1rpx solid rgba(174, 214, 0, 1) !important;
}
diff --git a/pages/4877/BJQ4877.vue b/pages/4877/BJQ4877.vue
index f462be6..02cc5fa 100644
--- a/pages/4877/BJQ4877.vue
+++ b/pages/4877/BJQ4877.vue
@@ -1122,13 +1122,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/4877/BJQ4877V1.vue b/pages/4877/BJQ4877V1.vue
index cb07bc4..62232cf 100644
--- a/pages/4877/BJQ4877V1.vue
+++ b/pages/4877/BJQ4877V1.vue
@@ -572,13 +572,7 @@ import request, { baseURL } from '@/utils/request.js';
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/6075J/BJQ6075J.vue b/pages/6075J/BJQ6075J.vue
index 3c86c7f..3f65de2 100644
--- a/pages/6075J/BJQ6075J.vue
+++ b/pages/6075J/BJQ6075J.vue
@@ -502,7 +502,7 @@
these = this;
this.initActionData();
- this.initWatch();
+
@@ -545,6 +545,7 @@
if (!f) {
these.showBleUnConnect();
these.getDetail();
+ these.initWatch();
return;
}
let form = f.formData;
@@ -564,6 +565,7 @@
});
these.getDetail();
+ these.initWatch();
});
@@ -1280,8 +1282,8 @@
},
getDevice: function() {
- // console.log("LinkedList=", ble.data.LinkedList);
- // console.log("this.device=", this.device);
+ console.log("LinkedList=", ble.data.LinkedList);
+ console.log("this.device=", this.device);
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == these.device.deviceMac) {
if (!this.formData.deviceId) {
@@ -1428,13 +1430,7 @@
this.formData.bleStatu = true;
batchTool = new SendBatchData(this, res, ble);
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/6107/BJQ6107.vue b/pages/6107/BJQ6107.vue
index d56e3fa..90b2e27 100644
--- a/pages/6107/BJQ6107.vue
+++ b/pages/6107/BJQ6107.vue
@@ -680,13 +680,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/6155/BJQ6155.vue b/pages/6155/BJQ6155.vue
index cf0abcb..a29102e 100644
--- a/pages/6155/BJQ6155.vue
+++ b/pages/6155/BJQ6155.vue
@@ -37,7 +37,7 @@
- {{formData.xuhang}}
+ {{formData.xuhang}}
续航时间
@@ -112,7 +112,7 @@
- 开机视频
+ 开机动画
上传
@@ -591,13 +591,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue
index b69937e..e8346b3 100644
--- a/pages/6155/deviceDetail.vue
+++ b/pages/6155/deviceDetail.vue
@@ -558,13 +558,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/6331/BJQ6331.vue b/pages/6331/BJQ6331.vue
index e69a769..ed94335 100644
--- a/pages/6331/BJQ6331.vue
+++ b/pages/6331/BJQ6331.vue
@@ -608,13 +608,7 @@ import request, { baseURL } from '@/utils/request.js';
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue
index 18777a4..73b7edc 100644
--- a/pages/650/HBY650.vue
+++ b/pages/650/HBY650.vue
@@ -477,13 +477,7 @@ created() {
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
@@ -1373,7 +1367,7 @@ created() {
sendUsr: function(ReSendNo) {
- if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
+ if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
showPop({
message: '无操作权限',
diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue
index 245d020..363b117 100644
--- a/pages/670/HBY670.vue
+++ b/pages/670/HBY670.vue
@@ -627,13 +627,7 @@
}
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index d7b22eb..9022c5d 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -490,13 +490,7 @@
if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true;
// 重新连接后状态以设备上报为准
- setTimeout(() => {
- hideLoading(these, 1000);
- });
- uni.showToast({
- icon: 'success',
- title: '蓝牙连接成功'
- });
+
}
},
diff --git a/pages/common/Msgs/deviceMsg.vue b/pages/common/Msgs/deviceMsg.vue
new file mode 100644
index 0000000..4afbbba
--- /dev/null
+++ b/pages/common/Msgs/deviceMsg.vue
@@ -0,0 +1,75 @@
+
+
+ 通知标题:{{payload.title}}
+ 设备信息:{{device.deviceName}}
+ Mac地址:{{device.deviceMac}}
+ 设备IMEI:{{device.deviceImei}}
+ 通知详情:{{payload.content}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/addBLE/LinkBle.vue b/pages/common/addBLE/LinkBle.vue
index 5e30527..b4e8a93 100644
--- a/pages/common/addBLE/LinkBle.vue
+++ b/pages/common/addBLE/LinkBle.vue
@@ -2,7 +2,7 @@
-
+
@@ -46,7 +46,7 @@
var these = null;
var eventChannel = null;
var ble = null;
- var inteval=null;
+ var inteval = null;
export default {
data() {
return {
@@ -54,8 +54,8 @@
bound: null,
timeInteval: null,
isSearch: false,
- pageHide:false,
- isBind:false
+ pageHide: false,
+ isBind: false
},
device: {
"deviceId": "",
@@ -72,9 +72,9 @@
"imei": ""
},
serverDevice: null,
- groupid:null,
- typeList:[],
- uploadStatu:null
+ groupid: null,
+ typeList: [],
+ uploadStatu: null
}
},
computed: {
@@ -110,54 +110,54 @@
}
}
} else {
-
- return "找到有效设备"
-
-
+
+ return "找到有效设备"
+
+
}
return "";
}
},
onShow() {
- this.Statu.pageHide=false;
+ this.Statu.pageHide = false;
},
onHide() {
- this.Statu.pageHide=true;
+ this.Statu.pageHide = true;
},
onUnload() {
console.log("返回取消订阅");
clearInterval(inteval);
ble.removeAllCallback(pagePath);
clearTimeout(this.Statu.timeInteval);
- this.uploadStatu=null;
- if(!this.Statu.isBind && these.device.deviceId){
- ble.disconnectDevice(these.device.deviceId).catch(ex=>{
+ this.uploadStatu = null;
+ if (!this.Statu.isBind && these.device.deviceId) {
+ ble.disconnectDevice(these.device.deviceId).catch(ex => {
console.error("无法断开蓝牙连接");
});
}
},
-
+
onLoad(option) {
these = this;
- this.groupid=new Date().getTime()+"";
-
+ this.groupid = new Date().getTime() + "";
+
ble = bleTool.getBleTool();
ble.addStateBreakCallback(res => {
- if(this.Statu.pageHide){
+ if (this.Statu.pageHide) {
return;
}
these.device.linkStatu = false;
hideLoading(these);
uni.showToast({
- icon:'fail',
- title:'蓝牙已不可用'
+ icon: 'fail',
+ title: '蓝牙已不可用'
})
- },pagePath);
-
+ }, pagePath);
+
ble.addStateRecoveryCallback(res => {
- if(this.Statu.pageHide){
+ if (this.Statu.pageHide) {
return;
}
if (these.device.deviceId) {
@@ -167,9 +167,9 @@
these.reLinkdevice();
}
- },pagePath);
+ }, pagePath);
ble.addDisposeCallback(res => {
- if(this.Statu.pageHide){
+ if (this.Statu.pageHide) {
return;
}
console.log("处理蓝牙断开连接");
@@ -181,59 +181,56 @@
});
these.reLinkdevice();
}
- },pagePath);
+ }, pagePath);
ble.addReceiveCallback((receive, f, path) => {
- if(this.Statu.pageHide){
+ if (this.Statu.pageHide) {
return;
}
console.log("收到设备消息,", receive);
if (these.device.deviceId == receive.deviceId) {
console.log("11111:", receive);
these.device.imei = f.imei;
- let flag=false;
- if (receive.bytes && receive.bytes.length && receive.bytes[0] == 0xFC) {//6155 7305
+ let flag = false;
+ if (receive.bytes && receive.bytes.length && receive.bytes[0] == 0xFC) { //6155 7305
if (f && f.macAddress) {
- flag=true;
- }
- }
- else if(receive.str.indexOf('mac address:') == 0){//650 670
+ flag = true;
+ }
+ } else if (receive.str.indexOf('mac address:') == 0) { //650 670
if (f && f.macAddress) {
- flag=true;
- }
- }
- else{
- try{
- console.log("str=",receive.str)
- let json=JSON.parse(receive.str);
- let key = "sta_address";
- if (key in json) {//100
+ flag = true;
+ }
+ } else {
+ try {
+ console.log("str=", receive.str)
+ let json = JSON.parse(receive.str);
+ let key = "sta_address";
+ if (key in json) { //100
if (f && f.macAddress) {
- flag=true;
+ flag = true;
}
}
- }catch(err){
- console.log("出现异常,",err);
+ } catch (err) {
+ console.log("出现异常,", err);
}
}
-
-
- if(flag){
+
+
+ if (flag) {
these.device.macAddress = f.macAddress;
console.log("222222");
these.Statu.isSearch = false;
these.initDevice();
}
-
+
}
}, pagePath);
eventChannel = this.getOpenerEventChannel();
-
- if(option.mac){
- this.device.macAddress=option.mac;
+
+ if (option.mac) {
+ this.device.macAddress = option.mac;
these.initDevice();
- }
- else{
+ } else {
eventChannel.on('LinkItem', function(data) {
console.log("data=", data);
let f = ble.data.LinkedList.find((v) => {
@@ -244,126 +241,140 @@
keys.forEach((v, index) => {
these.device[v] = f[v];
})
+ these.device.name = data.name;
// console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
- // console.log("获取到设备", these.device);
+ console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
-
+
these.initDevice();
}
} else {
console.log("未获取到设备");
}
})
-
- inteval = setInterval(this.initDevice, 10000);
+
+ inteval = setInterval(this.initDevice, 10000);
}
-
-
+
+
},
methods: {
getDevList() {
- return new Promise((resolve,reject)=>{
+ return new Promise((resolve, reject) => {
let arr = [
-
- ];
- request({
- url: '/app/xinghan/device/typeAll',
- method: 'get'
- }).then(res => {
- if (res && res.code == 200) {
- console.log("获取到类型", res.data);
- arr = res.data;
- this.typeList = arr;
- resolve(arr);
- return;
- }
- reject();
-
- }).catch(ex => {
- console.error("获取设备类型列表失败",ex);
- reject();
- })
- });
-
- },
- uploadItem() {
- if(this.uploadStatu!==null){
- console.error("执行过上传,不再执行");
- return;
- }
-
- this.uploadStatu="start";
- console.log("开始上传设备");
-
- let type=this.device.name.toLowerCase();
- if(type.indexOf("bjq6155-")>-1){//6155特别处理
- type="xh6155"
- }
- if(type.indexOf("bjq6155-")>-1){//6155特别处理
- type="xh6155"
- }
- if(type.indexOf("bjq6075-")>-1){//6075j特别处理
- bype='bjq6075j';
- }
- type=type.replace(/-/g,'');
- let upload=()=>{
- let f=this.typeList.find((v,i)=>{
- if(type.indexOf(v.typeName.replace(/-/g,'').toLowerCase())>-1){
- return true;
- }
- });
-
- if(!f){
- this.uploadStatu="type is valid";
- console.error("找不到此类型名称",type);
- console.error("tpelist=",this.typeList);
- return;
- }
- let json = {
- "deviceType": f.id,
- "deviceName": this.device.name,
- "deviceMac": this.device.macAddress,
- "bluetoothName": this.device.name,
- "deviceImei":this.device.imei?this.device.imei:'',
- "remark": "com.chxhyc.cn auto upload"
- }
+
+ ];
request({
- url: '/app/xinghan/device/add',
- method: 'post',
- data: json
+ url: '/app/xinghan/device/typeAll',
+ method: 'get'
}).then(res => {
if (res && res.code == 200) {
- this.uploadStatu="success";
- console.log("上传成功",res);
- } else {
- this.uploadStatu="upload error";
- console.error("上传失败,",res);
+ console.log("获取到类型", res.data);
+ arr = res.data;
+ this.typeList = arr;
+ resolve(arr);
+ return;
}
+ reject();
+
}).catch(ex => {
- this.uploadStatu="upload error";
- console.error("上传失败,",ex);
- });
- }
-
- let exec = () => {
-
- if(this.typeList.length==0){
- this.getDevList().then(results=>{
- upload();
- }).catch(ex=>{
- this.uploadStatu="get types error";
- console.error("获取类型失败,",ex);
- });
- }else{
- upload();
+ console.error("获取设备类型列表失败", ex);
+ reject();
+ })
+ });
+
+ },
+ uploadItem() {
+ return new Promise((resolve, reject) => {
+ if (this.uploadStatu !== null) {
+ let err = "执行过上传,不再执行";
+ console.error(err);
+ reject(err);
+ return;
}
-
-
- }
-
- setTimeout(exec, 10)
+
+ this.uploadStatu = "start";
+ console.log("开始上传设备");
+
+ let type = this.device.name.toLowerCase();
+
+ if (type.indexOf("bjq6155-") > -1) { //6155特别处理
+ type = "xh6155"
+ }
+ if (type.indexOf("bjq6075-") > -1) { //6075j特别处理
+ type = 'bjq6075j';
+ }
+ type = type.replace(/-/g, '');
+ let upload = () => {
+ let f = this.typeList.find((v, i) => {
+ if (type.indexOf(v.typeName.replace(/-/g, '').toLowerCase()) > -1) {
+ return true;
+ }
+ });
+
+ if (!f) {
+ this.uploadStatu = "type is valid";
+ console.error("找不到此类型名称", type);
+ console.error("tpelist=", this.typeList);
+ reject(this.uploadStatu);
+ return;
+ }
+ let json = {
+ "deviceType": f.id,
+ "deviceName": this.device.name,
+ "deviceMac": this.device.macAddress,
+ "bluetoothName": this.device.name,
+ "remark": "com.chxhyc.cn auto upload"
+ }
+
+ if (this.device.imei) {
+ json.deviceImei = this.device.imei;
+ }
+ request({
+ url: '/app/xinghan/device/add',
+ method: 'post',
+ data: json
+ }).then(res => {
+ if (res && res.code == 200) {
+ this.uploadStatu = "success";
+ console.log("上传成功", res);
+ resolve();
+ } else {
+ this.uploadStatu = "upload error";
+ console.error("上传失败,", res);
+ console.error("上传失败,", json);
+ reject(this.uploadStatu);
+ }
+ }).catch(ex => {
+ this.uploadStatu = "upload error";
+ console.error("上传失败,", ex);
+ reject(this.uploadStatu);
+ });
+ }
+
+ let exec = () => {
+
+ if (this.typeList.length == 0) {
+ this.getDevList().then(results => {
+ upload();
+ }).catch(ex => {
+ this.uploadStatu = "get types error";
+ console.error("获取类型失败,", ex);
+ reject(this.uploadStatu);
+ });
+ } else {
+ upload();
+ }
+
+
+ }
+
+ setTimeout(exec, 10)
+ });
+
+
},
reLinkdevice() {
ble.LinkBlue(these.device.deviceId).then(res => {
@@ -388,10 +399,10 @@
return;
}
//无效的设备回调
- let deviceInvalid = () => {
- these.$set(these.device, "deviceName", "");
-
-
+ let deviceInvalid = () => {
+ these.$set(these.device, "deviceName", "");
+
+
}
clearTimeout(this.Statu.timeInteval);
@@ -427,10 +438,16 @@
clearInterval(inteval);
} else {
deviceInvalid();
- this.uploadItem();
+ if (this.uploadStatu==null) {
+ this.uploadItem().then(res => {
+ this.initDevice();
+ }).catch(err => {
+ console.error("上传失败", err);
+ });
+ }
}
} else {
- this.serverDevice =null;
+ this.serverDevice = null;
deviceInvalid();
}
@@ -447,15 +464,67 @@
},
Bind() {
// 调用绑定设备接口
-
- // let f = ble.data.LinkedList.find((v) => {
- // return v.deviceId == these.device.deviceId;
- // });
- // if (!f) {
- // these.Statu.bound = false;
- // these.Statu.boundRemark = "蓝牙连接不成功";
- // return;
- // }
+
+ let task = () => {
+ these.Statu.bound = null;
+ these.Statu.boundRemark = "";
+ showLoading(these, {
+
+ text: "绑定中..."
+ })
+ let promise = request({
+ url: '/app/device/bind',
+ method: 'POST',
+ data: {
+ deviceImei: '',
+ deviceMac: these.device.macAddress,
+ communicationMode: 1, //0是4g,1是蓝牙,2蓝牙&4G
+ }
+ });
+ promise.then((res) => {
+ console.log("1111" + JSON.stringify(res));
+ if (res.code == 200) {
+ these.Statu.bound = true;
+ these.Statu.boundRemark = "设备绑定成功!";
+ let data = these.serverDevice;
+ let keys = Object.keys(data);
+ ble.data.LinkedList.find((v) => {
+ if (v.deviceId == these.device.deviceId) {
+ for (var i = 0; i < keys.length; i++) {
+ let key = keys[i];
+ if (!v.device) {
+ v.device = {};
+ }
+ v.device[key] = data[key];
+ }
+
+ ble.updateCache();
+ }
+ });
+
+ ble.removeReceiveCallback(pagePath);
+ clearTimeout(this.Statu.timeInteval);
+ this.device.macAddress = null;
+ this.Statu.timeInteval = null;
+ this.Statu.isBind = true;
+ uni.$emit("refreshDeviceList");
+ setTimeout(() => {
+ uni.switchTab({
+ url: "/pages/common/index/index"
+ });
+ }, 500);
+ } else {
+ these.Statu.bound = false;
+ these.Statu.boundRemark = res.msg;
+ }
+ }).catch((ex) => {
+ these.Statu.bound = false;
+ these.Statu.boundRemark = '出现了未知的异常,操作失败';
+ console.log("ex=", ex);
+ }).finally(() => {
+ hideLoading(this);
+ });
+ }
if (!this.device.macAddress) {
these.Statu.bound = false;
these.Statu.boundRemark = "获取设备Mac地址异常";
@@ -466,64 +535,9 @@
these.Statu.boundRemark = "设备未入库";
return;
}
- these.Statu.bound = null;
- these.Statu.boundRemark = "";
- showLoading(these, {
- text: "绑定中..."
- })
- let promise = request({
- url: '/app/device/bind',
- method: 'POST',
- data: {
- deviceImei: '',
- deviceMac: these.device.macAddress,
- communicationMode: 1, //0是4g,1是蓝牙,2蓝牙&4G
- }
- });
- promise.then((res) => {
- console.log("1111" + JSON.stringify(res));
- if (res.code == 200) {
- these.Statu.bound = true;
- these.Statu.boundRemark = "设备绑定成功!";
- let data = these.serverDevice;
- let keys = Object.keys(data);
- ble.data.LinkedList.find((v) => {
- if (v.deviceId == these.device.deviceId) {
- for (var i = 0; i < keys.length; i++) {
- let key = keys[i];
- if (!v.device) {
- v.device = {};
- }
- v.device[key] = data[key];
- }
+ task();
- ble.updateCache();
- }
- });
-
- ble.removeReceiveCallback(pagePath);
- clearTimeout(this.Statu.timeInteval);
- this.device.macAddress = null;
- this.Statu.timeInteval = null;
- this.Statu.isBind=true;
- uni.$emit("refreshDeviceList");
- setTimeout(() => {
- uni.switchTab({
- url: "/pages/common/index/index"
- });
- }, 500);
- } else {
- these.Statu.bound = false;
- these.Statu.boundRemark = res.msg;
- }
- }).catch((ex) => {
- these.Statu.bound = false;
- these.Statu.boundRemark = '出现了未知的异常,操作失败';
- console.log("ex=", ex);
- }).finally(() => {
- hideLoading(this);
- });
}
}
}
diff --git a/pages/common/addDevice/addBle.vue b/pages/common/addDevice/addBle.vue
index d022f12..5111d13 100644
--- a/pages/common/addDevice/addBle.vue
+++ b/pages/common/addDevice/addBle.vue
@@ -991,17 +991,17 @@
});
}
- for (let i = 0; i < this.EquipMents.length; i++) {
- let element = this.EquipMents[i];
- if (!element.isValid) {
- task(element).catch(ex => {
- if (ex === null && element.advertisData) {
- console.log("广播自动入库");
- this.uploadItem(element);
- }
- });
- }
- }
+ // for (let i = 0; i < this.EquipMents.length; i++) {
+ // let element = this.EquipMents[i];
+ // if (!element.isValid) {
+ // task(element).catch(ex => {
+ // if (ex === null && element.advertisData) {
+ // console.log("广播自动入库");
+ // this.uploadItem(element);
+ // }
+ // });
+ // }
+ // }
},
scan() {
@@ -1111,9 +1111,7 @@
this.EquipMents = [];
this.PairEquip = [];
setTimeout(() => {
- ble.StartSearch().then(result => {
-
- }).catch(err => {
+ ble.StartSearch().then(result => {}).catch(err => {
console.error("err=", err);
MsgError("出现错误:" + err.msg, '', these);
}).finally(() => {
@@ -1228,8 +1226,16 @@
these.PairEquip.push(item);
}
- console.log("连接成功", these.device);
+ console.log("连接成功,开始发送识别指令", these.device);
hideLoading(these);
+
+ let json = {
+ ins_disc: 1
+ }
+ ble.sendString(item.deviceId, json, item.writeServiceId, item.wirteCharactId, 30).then(res => {
+ }).catch(ex => {
+ console.error("蓝牙识别指令发送失败", ex);
+ });
}
let execLink = () => {
return new Promise((resolve, reject) => {
diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue
index 34057b7..410f203 100644
--- a/pages/common/index/index.vue
+++ b/pages/common/index/index.vue
@@ -58,7 +58,11 @@
电量:{{item.battery || '0'}}%
-
+
+
+ 识别
+
@@ -158,26 +162,28 @@
deviceInfo,
deviceUnbind, //删除设备
deviceReName
- } from '@/api/common/index.js'
+ } from '@/api/common/index.js'
+ import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue';
import bleTool from '@/utils/BleHelper.js';
- import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
import BleReceive from '@/utils/BleReceive';
import {
- MsgError
+ MsgError, MsgSuccess
} from '@/utils/MsgPops';
import MqttClient from '@/utils/mqtt.js';
var pagePath = 'pages/common/index';
- var ble = null;
+
+ var mq=null;
var timeout = null;
+ var ble = null;
var recei = null;
+ var these=null;
export default {
components: {
MescrollUni
},
computed: {
- showSendFlex() {
- // return this.activeTab && this.activeTab.id !== ''&& (this.activeTabInfo.communicationMode==0 || this.activeTabInfo.communicationMode==2);
+ showSendFlex() {
if (this.showMap || this.ShowSendmessage || this.showWarn) {
return true;
}
@@ -243,6 +249,11 @@
text: '所有分享',
icon: '/static/images/common/share.png',
action: 'share'
+ },
+ {
+ text: '预警布防',
+ icon: '/static/images/common/defence.png',
+ action: 'defence'
}
],
downOption: {
@@ -299,21 +310,14 @@
},
// 下拉刷新
downCallback() {
-
-
if (this.mescroll) {
this.mescroll.resetUpScroll(false);
this.mescroll.scrollTo(0, 0);
}
this.getData();
-
-
},
// 上拉加载
upCallback() {
-
-
-
this.getData();
},
bleStateBreak() {
@@ -325,22 +329,18 @@
console.log("蓝牙适配器恢复可用,重连断开的设备");
ble.linkAllDevices();
}
-
-
},
bleBreak(res) {
console.error("蓝牙断开连接", res);
if (res.deviceId) {
this.updateBleStatu(res.deviceId);
}
-
},
bleRecovery(res) {
// console.log("蓝牙连接成功", res);
if (res.deviceId) {
this.updateBleStatu(res.deviceId);
}
-
},
updateBleStatu() { //更新列表的蓝牙连接状态,电池 电量
@@ -390,6 +390,7 @@
},
// 所有分享,所有类型
handleshareClick(item) {
+ debugger;
this.showshare = false; // 关闭弹窗
var that = this;
switch (item.action) {
@@ -414,8 +415,12 @@
case 'share':
uni.navigateTo({
url: "/pages/common/allShare/index",
-
- })
+ });
+ break;
+ case 'defence':
+ uni.navigateTo({
+ url: "/pages/common/linkDefence/defence"
+ });
break;
}
},
@@ -720,6 +725,8 @@
this.$set(this.deviceList[index], 'showOption', 'none');
},
Disc(item, index) { //发送识别指令
+
+ this.$set(this.deviceList[index], 'isDisc', true);
let json = {
ins_disc: 1
};
@@ -729,51 +736,100 @@
return v.macAddress == item.deviceMac;
});
if (f) {
+ console.log("f=",f);
ble.sendString(f.deviceId, json, f.writeServiceId, f.wirteCharactId, 30).then(res => {
- index++;
- setTimeout(sendNextPacket, 300);
+ MsgSuccess("发送识别指令成功",'',these);
+ this.$set(this.deviceList[index], 'isDisc', false);
}).catch(err => {
+ console.error('err=',err);
if (item.communicationMode == 1) {
MsgError(err.msg, '', this);
+ this.$set(this.deviceList[index], 'isDisc', false);
return;
}
- mqSend();
+ mqSend(true);
});
+ }else{
+ if (item.communicationMode == 1) {
+ MsgError("请连接蓝牙后再试", '去连接', this,()=>{
+ uni.navigateTo({
+ url: "/pages/common/addBLE/addEquip",
+ events: {
+ BindOver(data) {
+ console.log("蓝牙配对成功了");
+ }
+ },
+ success: function(res) {
+ res.eventChannel.emit('detailData', {
+ data: item
+ });
+ }
+ });
+ });
+ this.$set(this.deviceList[index], 'isDisc', false);
+ return;
+ }
+ mqSend(true);
}
}
- let mqSend = () => {
+ let mqSend = (isBle) => {
+
+ if(!item.deviceImei){
+ if(ble){
+ MsgError("发送识别指令,蓝牙发送失败、IMEI缺失4G发送也失败",'',these);
+ }else{
+ MsgError("发送识别指令失败,设备IMEI缺失",'',these);
+ }
+ this.$set(this.deviceList[index], 'isDisc', false);
+ return;
+ }
+
let Send = () => {
+
let flag = mq.publish("B/" + item.deviceImei, JSON.stringify(json));
if (!flag) {
- MsgError("识别设备失败,请检查手机网络连接", '', this);
+ MsgError("发送识别指令失败,请检查手机网络连接", '', this);
+ this.$set(this.deviceList[index], 'isDisc', false);
+ return;
}
+ this.$set(this.deviceList[index], 'isDisc', false);
}
+
if (!mq) {
+
mq = new MqttClient();
mq.connect(() => {
console.log("MQTT连接成功")
Send();
+ },()=>{
+ MsgError("发送识别指令时,无法连接消息服务器");
+ mq.disconnect();
+ mq=null;
+ }).catch(ex=>{
+ console.error("ex=",ex);
+ this.$set(this.deviceList[index], 'isDisc', false);
});
+
return ;
+ }else{
+ console.log("mq=",mq);
+ Send();
}
- Send();
-
-
-
}
- if (item.communicationMode == 1 || item.communicationMode == 2) {
- bleSend.catch(ex => {
- mqSend();
- });
+ setTimeout(()=>{
+ if (item.communicationMode == 1 || item.communicationMode == 2) {
+ bleSend();
return;
}
if (item.communicationMode == 0) {
mqSend();
return;
}
+ },250);
+
},
// 列表跳转
handleFile(item, index) {
@@ -781,6 +837,7 @@
this.$set(this.deviceList[index], 'showOption', 'none');
return;
}
+
this.$set(this.deviceList[index], 'active', true);
setTimeout(() => {
@@ -846,6 +903,7 @@
},
onLoad() {
// console.error("首页加载");
+ these=this;
this.getTab()
this.downCallback();
@@ -914,6 +972,9 @@
console.log("onUnload...");
uni.$off('deviceStatusUpdate');
ble && ble.removeAllCallback(pagePath);
+ if(mq){
+ mq.disconnect();
+ }
}
}
@@ -1387,15 +1448,26 @@
}
.splitLine {
- background: linear-gradient(90.00deg, rgba(0, 0, 0, 0), rgba(255, 255, 255, 1) 44.525%, rgba(255, 254.75, 254.75, 0) 92%);
+ background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(255, 255, 255, 1) 44.525%, rgba(255, 254.75, 254.75, 0) 92%);
opacity: 0.2;
- width: 25rpx;
- height: 4rpx;
- margin: 0rpx 10rpx;
- transform: rotate(90.00deg);
+ width: 4rpx;
+ height: 25rpx;
+ margin: 0rpx 20rpx;
}
.p10 {
padding-left: 20rpx;
}
+ .disc{
+ padding: 5rpx 10rpx;
+ margin-right: -30rpx;
+ }
+ .disc.active{
+ background-color: #2a2a2a !important;;
+ }
+ .discImg{
+ width:24rpx;
+ height: 24rpx;
+ margin-right: 10rpx;
+ }
\ No newline at end of file
diff --git a/pages/common/linkDefence/addDefence.vue b/pages/common/linkDefence/addDefence.vue
new file mode 100644
index 0000000..b65ae55
--- /dev/null
+++ b/pages/common/linkDefence/addDefence.vue
@@ -0,0 +1,447 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加预警主机
+
+
+
+
+
+
+
+
+
+ {{item.deviceName}}
+ ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}
+
+
+
+
+
+
+
+
+
+
+ 添加布防联机
+
+
+
+
+
+
+
+
+ {{item.deviceName}}
+ ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}
+
+
+
+
+
+
+
+
+
+ 添加接收设备
+
+
+
+
+
+
+
+
+ {{item.deviceName}}
+ ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/linkDefence/checkDevice.vue b/pages/common/linkDefence/checkDevice.vue
new file mode 100644
index 0000000..2b32a31
--- /dev/null
+++ b/pages/common/linkDefence/checkDevice.vue
@@ -0,0 +1,882 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{tab.typeName}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 报警中
+
+
+ {{item.bleStatu?'已连接':'未连接'}}
+
+
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/linkDefence/defence.vue b/pages/common/linkDefence/defence.vue
new file mode 100644
index 0000000..9e4f8a7
--- /dev/null
+++ b/pages/common/linkDefence/defence.vue
@@ -0,0 +1,509 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.name?item.name:'预警设防'+index}}
+
+
+ 布防联机:{{item.total}}
+ 接收设备:{{item.notify}}
+
+
+ 布防联机:{{item.sub}}
+ 预警主机:{{item.warn}}
+
+
+
+
+
+
+
+ {{btn.text}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备名称
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/login/index.vue b/pages/common/login/index.vue
index 54c97b8..d469e4d 100644
--- a/pages/common/login/index.vue
+++ b/pages/common/login/index.vue
@@ -68,6 +68,8 @@
login,
resourceSmsCode
} from '@/api/common/login.js';
+ import mqplus from '@/utils/MqPlus.js';
+ var mqcommon=null;
export default {
data() {
return {
@@ -85,6 +87,7 @@
},
onLoad() {
this.phone= uni.getStorageSync('phone');
+ mqcommon=mqplus.getMqPlus();
if (uni.getStorageSync("token") && uni.getStorageSync("clientID")) { //免登陆
let time = uni.getStorageSync("tokenTime");
if (!time) {
@@ -258,10 +261,14 @@
uni.showToast({
title: '登录成功',
icon: 'success'
- })
+ });
+
uni.switchTab({
url: '/pages/common/index/index'
- })
+ });
+ if(mqcommon){
+ mqcommon.sendUsrLogin();
+ }
} else {
uni.showToast({
title: res.msg || '服务器异常,请稍后重试',
@@ -294,8 +301,9 @@
},
// 同意
handleAgree() {
- this.isChecked = !this.isChecked
- this.showAgreement = false
+ this.isChecked = !this.isChecked;
+ this.showAgreement = false;
+ this.handleLogin();
},
},
}
diff --git a/pages/common/map/index.nvue b/pages/common/map/index.nvue
index bae1da2..ed9c8f7 100644
--- a/pages/common/map/index.nvue
+++ b/pages/common/map/index.nvue
@@ -1,6 +1,22 @@
-