完成008A功能开发
This commit is contained in:
@ -53,23 +53,100 @@
|
||||
<text class="lbl">蓝牙名称</text>
|
||||
<text class="value valueFont">{{device.bluetoothName}}</text>
|
||||
</view>
|
||||
|
||||
<view class="item">
|
||||
<text class="lbl">设备状态</text>
|
||||
<text class="value valueFont">{{formData.sta_system}}</text>
|
||||
</view>
|
||||
<view class="item" @click.top="bleStatuToggle">
|
||||
<text class="lbl">蓝牙状态</text>
|
||||
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">设备状态</text>
|
||||
<text class="value valueFont">{{formData.sta_system}}</text>
|
||||
<text class="lbl">信道:{{formData.sta_Channel}}</text>
|
||||
<text class="value green" @click.stop="ShowChannelEdit()">修改</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="lampMode">
|
||||
<view class="mode type " :class="{'active':formData.sta_Ms=='M'}" @click.stop="MsSetting('M')">
|
||||
<view class="txt center">M</view>
|
||||
</view>
|
||||
<view class="mode type" :class="{'active':formData.sta_Ms=='S'}" @click.stop="MsSetting('S')">
|
||||
<view class="txt center">S</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="optTitle">
|
||||
开关模式
|
||||
</view>
|
||||
<view class="btn-container">
|
||||
<view class="btn" @click.stop="btnSetting(0,'warnSwitch')" :class="{'active':Status.warnSwitch==0}">总开关
|
||||
</view>
|
||||
<view class="btn" @click.stop="btnSetting(-1,'warnSwitch')" :class="{'active':Status.warnSwitch==-1}">左侧
|
||||
</view>
|
||||
<view class="btn" @click.stop="btnSetting(1,'warnSwitch')" :class="{'active':Status.warnSwitch==1}">右侧
|
||||
</view>
|
||||
</view>
|
||||
<view class="lampMode">
|
||||
|
||||
<view class="mode " :class="getSwitchActive(item,index,'warn')" v-for="item,index in dic.warLight"
|
||||
v-on:click.stop="lightsetting(item,index,'warn')">
|
||||
<view class="leftImg">
|
||||
|
||||
<image class="img image" :src="item.img" mode="aspectFit"></image>
|
||||
<image class="img imageA" :src="item.imgA" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">{{item.text}}</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="optTitle">
|
||||
泛光灯
|
||||
</view>
|
||||
<view class="btn-container">
|
||||
<view class="btn" @click.stop="btnSetting(0,'fanSwitch')" :class="{'active':Status.fanSwitch==0}">前置</view>
|
||||
<view class="btn" @click.stop="btnSetting(-1,'fanSwitch')" :class="{'active':Status.fanSwitch==-1}">左侧
|
||||
</view>
|
||||
<view class="btn" @click.stop="btnSetting(1,'fanSwitch')" :class="{'active':Status.fanSwitch==1}">右侧</view>
|
||||
</view>
|
||||
|
||||
<view class="fanMode">
|
||||
<view class="fanItem" :class="getSwitchActive(item,index,'fan')" v-for="item,index in dic.fanLight"
|
||||
v-on:click.stop="lightsetting(item,index,'fan')">
|
||||
<view class="topImg">
|
||||
|
||||
<image class="img image" :src="item.img" mode="aspectFit"></image>
|
||||
<image class="img imageA" :src="item.imgA" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="bottomTxt">
|
||||
<text class="bigTxt">{{item.text}}</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<ProParams :id="device.id"></ProParams>
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
|
||||
<global-loading ref="loading" />
|
||||
|
||||
<MsgBox ref="msgEditChannel">
|
||||
<view class="popup-prompt">
|
||||
<text class="popup-prompt-title">修改信道</text>
|
||||
<input class="popup-prompt-input" type="number" placeholder="大于0的整数"
|
||||
placeholder-class="popup-prompt-input-placeHolder" v-model="formData.tmp_Channel" />
|
||||
|
||||
</view>
|
||||
</MsgBox>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -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 {}
|
||||
</style>
|
||||
@ -84,12 +84,24 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="warnnig" v-show="formData.sta_ShakeBit==1 && formData.sta_ShakeBit==2"
|
||||
@click="showAction('map')">
|
||||
<view class="warnnig" v-show="formData.sta_ShakeBit==1 && formData.sta_ShakeBit==2" @click="showAction('map')">
|
||||
<view>{{ShakeBit}}</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="lamp">
|
||||
<view class="title">
|
||||
<text>灯光亮度</text>
|
||||
<text>{{formData.sta_brightness}}%</text>
|
||||
</view>
|
||||
|
||||
<view class="slider-container">
|
||||
<slider min="50" max="100" step="1" :disabled="false" :value="formData.sta_brightness"
|
||||
activeColor="#bbe600" backgroundColor="#00000000" block-size="20" block-color="#ffffffde"
|
||||
@change="sliderChange" @changing="sliderChanging" class="custom-slider" />
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="lampMode">
|
||||
<view class="sosContent">
|
||||
<view class="btnSos openSos center"
|
||||
@ -147,6 +159,17 @@
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="mode fleft " @click.stop="WarnToggle()" :class="{active:formData.warnStatu}">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/common/linkMan.png" mode="aspectFit">
|
||||
</image>
|
||||
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">关闭静止报警</text>
|
||||
<text class="smallTxt" v-show="formData.warnStatu">已关闭</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
@ -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向被打开页面传送数据
|
||||
|
||||
@ -164,9 +164,9 @@
|
||||
}" v-on:click.stop="lightTypeSet(item,index)">
|
||||
<view class="leftImg">
|
||||
<image class="img" :class="{'displayNone':formData.sta_LightType===item.key}"
|
||||
src="/static/images/100/light.png" mode="aspectFit"></image>
|
||||
src="/static/images/lightImg/light.png" mode="aspectFit"></image>
|
||||
<image class="img" :class="{'displayNone':formData.sta_LightType!==item.key}"
|
||||
src="/static/images/100/lightActive.png" mode="aspectFit"></image>
|
||||
src="/static/images/lightImg/lightActive.png" mode="aspectFit"></image>
|
||||
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
@ -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: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -152,9 +152,9 @@
|
||||
}" v-on:click.stop="lightTypeSet(item, index)">
|
||||
<view class="leftImg">
|
||||
<image class="img" :class="{ 'displayNone': formData.sta_LightType === item.key }"
|
||||
src="/static/images/100/light.png" mode="aspectFit"></image>
|
||||
src="/static/images/lightImg/light.png" mode="aspectFit"></image>
|
||||
<image class="img" :class="{ 'displayNone': formData.sta_LightType !== item.key }"
|
||||
src="/static/images/100/lightActive.png" mode="aspectFit"></image>
|
||||
src="/static/images/lightImg/lightActive.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">{{ item.name }}</text>
|
||||
|
||||
@ -377,13 +377,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -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: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -93,6 +93,13 @@
|
||||
|
||||
|
||||
<view class="lampMode">
|
||||
<view class="mode type " :class="{'active':formData.sta_Ms=='M'}" @click.stop="modeToggle('M')">
|
||||
<view class="txt center">M</view>
|
||||
</view>
|
||||
<view class="mode type" :class="{'active':formData.sta_Ms=='S'}" @click.stop="modeToggle('S')">
|
||||
<view class="txt center">S</view>
|
||||
</view>
|
||||
|
||||
<view class="mode " :class="{active:formData.sta_SOSGrade==2}" v-on:click.stop="sosSetting(2)">
|
||||
<view class="leftImg">
|
||||
<image v-show="formData.sta_SOSGrade!=2" class="img" src="/static/images/670/rb.png"
|
||||
@ -170,23 +177,23 @@
|
||||
|
||||
<view class="item">
|
||||
<text class="lbl">单位:</text>
|
||||
<input class="value" v-model.trim="formData.company" placeholder="请输入单位" maxlength="6"
|
||||
<input class="value" v-model.trim="formData.company" placeholder="请输入单位" maxlength="8"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">姓名:</text>
|
||||
<input class="value" v-model.trim="formData.usrname" placeholder="请输入职位" maxlength="6"
|
||||
<input class="value" v-model.trim="formData.name" placeholder="请输入职位" maxlength="8"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">部门:</text>
|
||||
<input class="value" v-model.trim="formData.job" placeholder="请输入姓名" maxlength="6"
|
||||
<input class="value" v-model.trim="formData.job" placeholder="请输入姓名" maxlength="8"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
|
||||
<view class="item">
|
||||
<text class="lbl">ID:</text>
|
||||
<input class="value" v-model.trim="formData.usrid" placeholder="ID" maxlength="6"
|
||||
<input class="value" v-model.trim="formData.id" placeholder="ID" maxlength="16"
|
||||
placeholder-class="usrplace" />
|
||||
</view>
|
||||
</view>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -1122,13 +1122,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -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: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -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: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -680,13 +680,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<view class="row">
|
||||
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
|
||||
<view class="txt">
|
||||
<view class="bigTxt">{{formData.xuhang}}</view>
|
||||
<view class="bigTxt" v-show="getMode('main')!='关闭'||getMode('fu')!='关闭'">{{formData.xuhang}}</view>
|
||||
<view class="smallTxt">续航时间</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -112,7 +112,7 @@
|
||||
<image class="img" src="/static/images/common/video.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">开机视频</text>
|
||||
<text class="bigTxt">开机动画</text>
|
||||
<text class="smallTxt">上传</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -591,13 +591,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -558,13 +558,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -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: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -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: '无操作权限',
|
||||
|
||||
@ -627,13 +627,7 @@
|
||||
}
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -490,13 +490,7 @@
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
this.formData.bleStatu = true;
|
||||
// 重新连接后状态以设备上报为准
|
||||
setTimeout(() => {
|
||||
hideLoading(these, 1000);
|
||||
});
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '蓝牙连接成功'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
75
pages/common/Msgs/deviceMsg.vue
Normal file
75
pages/common/Msgs/deviceMsg.vue
Normal file
@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<view class="maincontent contentBg">
|
||||
<view>通知标题:{{payload.title}}</view>
|
||||
<view>设备信息:{{device.deviceName}}</view>
|
||||
<view>Mac地址:{{device.deviceMac}}</view>
|
||||
<view>设备IMEI:{{device.deviceImei}}</view>
|
||||
<view>通知详情:{{payload.content}}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {deviceInfo} from '@/api/common/index.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
payload: {
|
||||
device_mac: '',
|
||||
device_imei: '',
|
||||
content: '',
|
||||
title: ''
|
||||
},
|
||||
device: {
|
||||
"id": "",
|
||||
"deviceName": "",
|
||||
"deviceImei": "",
|
||||
"deviceMac": "",
|
||||
"communicationMode": null,
|
||||
"devicePic": "",
|
||||
"typeName": "",
|
||||
"bluetoothName": "",
|
||||
"deviceStatus": null,
|
||||
"bindingTime": "",
|
||||
"onlineStatus": null,
|
||||
"battery": "",
|
||||
"latitude": "",
|
||||
"longitude": "",
|
||||
"alarmStatus": null,
|
||||
"detailPageUrl": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
var eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel.on('pushMsg', (res) => {
|
||||
this.payload.content = res.data.content;
|
||||
this.payload.title = res.data.payload.title;
|
||||
this.payload.device_mac = res.data.payload.device_mac;
|
||||
this.payload.device_imei = res.data.payload.device_imei;
|
||||
|
||||
this.getDevice();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getDevice() {
|
||||
deviceInfo({
|
||||
pageNum: 1,
|
||||
pageSize: 1,
|
||||
deviceMac: this.payload.device_mac
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.rows && res.rows.length) {
|
||||
let device=res.rows[0];
|
||||
this.device=device;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@ -2,7 +2,7 @@
|
||||
<view class="content">
|
||||
<view class="deviceDetail">
|
||||
<view class="imgContent">
|
||||
<image src="/static/images/BLEAdd/addBleDevice.png" class="titleIco" mode="aspectFit">
|
||||
<image src="/static/images/common/svg.png" class="titleIco" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
<view class="deviceName">
|
||||
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -58,7 +58,11 @@
|
||||
<view>电量:{{item.battery || '0'}}%</view>
|
||||
</view>
|
||||
|
||||
<!-- <view @click.stop="Disc()">识别</view> -->
|
||||
<view @click.stop="Disc(item,index)" class="disc center" :class="{active:item.isDisc}">
|
||||
<image src="/static/images/common/disc.png"
|
||||
class="discImg" mode="aspectFit"></image>
|
||||
<text>识别</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -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;
|
||||
}
|
||||
</style>
|
||||
447
pages/common/linkDefence/addDefence.vue
Normal file
447
pages/common/linkDefence/addDefence.vue
Normal file
@ -0,0 +1,447 @@
|
||||
<template>
|
||||
<view class="content contentBg">
|
||||
|
||||
<SubStep :steps="Status.steps.list" :height="'140rpx'" :curr="Status.steps.curr" @stepClick="stepClick">
|
||||
</SubStep>
|
||||
|
||||
|
||||
<view class="mainPanel" v-show="Status.steps.curr===0">
|
||||
<view class="main">
|
||||
<uni-easyinput maxlength="30" class="txteare" v-model="formData.name" :trim="true" placeholder="输入编组名称"
|
||||
type="textarea" autoHeight :inputBorder="false" :border="false"></uni-easyinput>
|
||||
</view>
|
||||
<button class="btnNext" :disabled="!formData.name" :class="{'active':formData.name}"
|
||||
@click="gotoStep(1)">下一步</button>
|
||||
</view>
|
||||
|
||||
<view class="mainPanel" v-show="Status.steps.curr===1">
|
||||
<view class="btnAdd" @click="goCheckDevice('main')">
|
||||
<image class="img" mode="aspectFit" src="/static/images/common/add.png"></image>
|
||||
<text>添加预警主机</text>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y="true" scroll-with-animation class="checkedList" v-show="formData.main.length>0">
|
||||
<view class="item " v-for="item,index in formData.main">
|
||||
<view class="panel imgContent center" @click.stop="imgView(item,index)">
|
||||
<image class="img" :src="item.devicePic" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
<view class="panel centerCol lbl">
|
||||
<view class="LargeTxt">{{item.deviceName}}</view>
|
||||
<view class="smallTxt">ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<button class="btnNext" :class="{'active':formData.main.length>0}" :disabled="formData.main.length==0"
|
||||
@click="gotoStep(1)">下一步</button>
|
||||
</view>
|
||||
|
||||
<view class="mainPanel" v-show="Status.steps.curr===2">
|
||||
<view class="btnAdd" @click="goCheckDevice('sub')">
|
||||
<image class="img" mode="aspectFit" src="/static/images/common/add.png"></image>
|
||||
<text>添加布防联机</text>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" scroll-with-animation class="checkedList" v-show="formData.sub.length>0">
|
||||
<view class="item center" v-for="item,index in formData.sub">
|
||||
<view class="panel imgContent center" @click.stop="imgView(item,index)">
|
||||
<image class="img" :src="item.devicePic" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
<view class="panel centerCol lbl">
|
||||
<view class="LargeTxt">{{item.deviceName}}</view>
|
||||
<view class="smallTxt">ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<button class="btnNext" :class="{'active':formData.sub.length>0}" :disabled="formData.sub.length==0"
|
||||
@click="gotoStep(1)">下一步</button>
|
||||
</view>
|
||||
|
||||
<view class="mainPanel" v-show="Status.steps.curr===3">
|
||||
<view class="btnAdd" @click="goCheckDevice('notify')">
|
||||
<image class="img" mode="aspectFit" src="/static/images/common/add.png"></image>
|
||||
<text>添加接收设备</text>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" scroll-with-animation class="checkedList" v-show="formData.notify.length>0">
|
||||
<view class="item" v-for="item,index in formData.notify">
|
||||
<view class="panel imgContent center" @click.stop="imgView(item,index)">
|
||||
<image class="img" :src="item.devicePic" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
<view class="panel centerCol lbl">
|
||||
<view class="LargeTxt">{{item.deviceName}}</view>
|
||||
<view class="smallTxt">ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<button class="btnNext" :class="{'active':formData.notify.length>0}" :disabled="formData.notify.length==0"
|
||||
@click="Send">发送</button>
|
||||
</view>
|
||||
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
<global-loading ref="loading" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request.js';
|
||||
import {
|
||||
showLoading,
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js';
|
||||
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo
|
||||
} from '@/utils/MsgPops.js'
|
||||
import Common from '@/utils/Common.js';
|
||||
|
||||
var these = null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
Status: {
|
||||
steps: {
|
||||
list: [{
|
||||
text: '设置名称'
|
||||
},
|
||||
{
|
||||
text: '设置主机'
|
||||
},
|
||||
{
|
||||
text: '设置联机'
|
||||
},
|
||||
{
|
||||
text: '发送编组'
|
||||
}
|
||||
],
|
||||
curr: 0
|
||||
}
|
||||
},
|
||||
formData: {
|
||||
id: '',
|
||||
name: '',
|
||||
main: [], //通知设备
|
||||
sub: [], //预警设备
|
||||
notify: [] //发送设备
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
|
||||
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.Status.steps.curr > 0) {
|
||||
this.gotoStep(-1);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
onLoad(opt) {
|
||||
these = this;
|
||||
let eventChannel = this.getOpenerEventChannel();
|
||||
|
||||
eventChannel.on('detailData', (res) => {
|
||||
let data = res.data;
|
||||
if (data) {
|
||||
this.formData.id = data.id;
|
||||
this.formData.name = data.name;
|
||||
this.formData.main = [];
|
||||
this.formData.sub = [];
|
||||
this.formData.notify = [];
|
||||
setTimeout(this.initData, 0);
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
imgView(item,index){
|
||||
if(!item.devicePic){
|
||||
return;
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
urls: [item.devicePic]
|
||||
});
|
||||
},
|
||||
goCheckDevice(type) {
|
||||
let json = {
|
||||
type: type,
|
||||
formData:this.formData
|
||||
};
|
||||
Object.assign(json, this.formData);
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/linkDefence/checkDevice',
|
||||
success(res) {
|
||||
res.eventChannel.emit("detailData", {
|
||||
data: json
|
||||
});
|
||||
},
|
||||
events: {
|
||||
checkOver(res) {
|
||||
these.$set(these.formData, res.type, res.arr)
|
||||
}
|
||||
},
|
||||
fail(ex) {
|
||||
console.error("出现异常", ex);
|
||||
}
|
||||
});
|
||||
},
|
||||
initData() {
|
||||
|
||||
if (!this.formData.id) {
|
||||
return;
|
||||
}
|
||||
let url = '';
|
||||
if (!url) {
|
||||
MsgWarning('后端未开发此接口,敬请期待', '', this);
|
||||
return;
|
||||
}
|
||||
request({
|
||||
url: url,
|
||||
data: {
|
||||
id: this.formData.id
|
||||
},
|
||||
method: 'POST'
|
||||
}).then(res => {
|
||||
if (res && res.code == 200) {
|
||||
console.log("请求数据成功", res);
|
||||
this.formData.main = res.data.filter(v => {
|
||||
return v.type == 'notify';
|
||||
});
|
||||
this.formData.sub = res.data.filter(v => {
|
||||
return v.type == 'warn';
|
||||
});
|
||||
} else {
|
||||
MsgError(res.msg, '', this);
|
||||
}
|
||||
}).catch(ex => {
|
||||
console.log("ex=", ex);
|
||||
MsgError(ex.errMsg, '', this);
|
||||
});
|
||||
|
||||
},
|
||||
stepClick(item, index) {
|
||||
console.log("步骤被点击:", item);
|
||||
},
|
||||
Send() {
|
||||
showLoading(these, {
|
||||
text: '发送中'
|
||||
});
|
||||
let task = () => {
|
||||
hideLoading(these);
|
||||
MsgSuccess("敬请期待", '', these);
|
||||
}
|
||||
|
||||
setTimeout(task, 800);
|
||||
},
|
||||
gotoStep(intval) {
|
||||
if (this.Status.steps.curr + intval > this.Status.steps.list.length - 1) {
|
||||
return;
|
||||
} else if (this.Status.steps.curr + intval < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.Status.steps.curr += intval;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
/* #ifdef APP */
|
||||
.content {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
/* #ifdef WEB|H5 */
|
||||
.content {
|
||||
height: calc(100vh - 44px);
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.mainPanel {
|
||||
width: 100%;
|
||||
height: calc(100% - 140rpx);
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #FFFFFF00;
|
||||
}
|
||||
|
||||
.mainPanel .btnNext {
|
||||
width: 90%;
|
||||
transform: translateX(5%);
|
||||
position: absolute;
|
||||
bottom: 0rpx;
|
||||
border-radius: 45rpx;
|
||||
background: #1A1A1A;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
font-family: "PingFang SC";
|
||||
height: 80rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 80rpx;
|
||||
letter-spacing: 0px;
|
||||
text-align: center;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.mainPanel .btnNext.active {
|
||||
background: #BBE600;
|
||||
color: #232323;
|
||||
}
|
||||
|
||||
/deep/ .uni-easyinput__content,
|
||||
.uni-easyinput__content {
|
||||
background-color: #1A1A1A !important;
|
||||
border-radius: 16rpx;
|
||||
color: #FFFFFF;
|
||||
text-indent: 10rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/deep/ .uni-textarea-placeholder,
|
||||
.uni-textarea-placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.14rpx;
|
||||
}
|
||||
|
||||
.mainPanel .main {
|
||||
transform: translateY(30rpx);
|
||||
}
|
||||
|
||||
.mainPanel .btnAdd {
|
||||
|
||||
width: 100%;
|
||||
height: 150rpx;
|
||||
border-radius: 16rpx;
|
||||
background: rgba(26, 26, 26, 1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.14rpx;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.mainPanel .btnAdd .img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.mainPanel .checkedList {
|
||||
width: 100%;
|
||||
height: calc(100% - 300rpx);
|
||||
transform: translateY(20rpx);
|
||||
border-radius: 16rpx;
|
||||
background-color: #1A1A1A;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.mainPanel .checkedList .item {
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
.mainPanel .checkedList .item .panel{
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
.mainPanel .checkedList .item .lbl{
|
||||
width: calc(100% - 120rpx);
|
||||
height: 100%;
|
||||
transform: translateX(24rpx);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
align-items: flex-start;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
.mainPanel .checkedList .item .imgContent {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background-color: #2A2A2A;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.mainPanel .checkedList .item .img {
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
.checkedList .LargeTxt{
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.checkedList .smallTxt{
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
|
||||
letter-spacing: 0.14rpx;
|
||||
|
||||
}
|
||||
</style>
|
||||
882
pages/common/linkDefence/checkDevice.vue
Normal file
882
pages/common/linkDefence/checkDevice.vue
Normal file
@ -0,0 +1,882 @@
|
||||
<template>
|
||||
<view class="maincontent contentBg">
|
||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true" background-color="#121212"
|
||||
color="#FFFFFF" :title="Status.navbar.title">
|
||||
<template v-slot:left>
|
||||
<view>
|
||||
<uni-icons type="left" size="24" color="#FFFFFF"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
<block slot="right">
|
||||
<view class="navbarRight center">
|
||||
<image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons"
|
||||
class="img" :src="item.src" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
</uni-nav-bar>
|
||||
<view class="tab-bar-wrap" v-show="!Status.Search">
|
||||
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
|
||||
<view class="tab-container">
|
||||
<view v-for="(tab, index) in tabs" :key="index"
|
||||
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
|
||||
{{tab.typeName}}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="tab-more" @click="Status.Search=!Status.Search">
|
||||
<image src="/static/images/common/search.png" mode="aspectFit" class="more"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="searchRow" v-show="Status.Search">
|
||||
<view class="ipt">
|
||||
<uni-easyinput class="txteare" maxlength="30" v-model="filter.txt" :trim="true" placeholder="搜索设备"
|
||||
type="text" :inputBorder="false" :border="false"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<view class="btn" @click.stop="Status.Search=false">取消</view>
|
||||
<view class="clear"></view>
|
||||
</view>
|
||||
<view class="listContent">
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
:down="downOption" :fixed="false">
|
||||
<view class="listItem center" v-for="item,index in deviceList">
|
||||
<view class="opt center">
|
||||
<view class="checkbox center" @click.stop="checkToggle(item,index)"
|
||||
:class="{active:checks.find((v,i)=>{return v.id===item.id})}">
|
||||
<uni-icons class="icon" type="checkmarkempty" size="17" color="#000000"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="main">
|
||||
<view class="device-header">
|
||||
<view class="deviceIMG" @click.stop="imgView(item,index)">
|
||||
<image :src="item.devicePic" class="IMG" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="device-name">
|
||||
<view>设备:{{item.deviceName}}</view>
|
||||
|
||||
<view class="ID">
|
||||
ID:{{item.deviceImei?item.deviceImei:item.deviceMac}}
|
||||
</view>
|
||||
|
||||
|
||||
<view class="ID">
|
||||
|
||||
<view class="center ">
|
||||
<view :class="{'onlines':item.onlineStatus==1,'offlines':item.onlineStatus==0}">
|
||||
{{item.onlineStatus==1?'在线':'离线'}}
|
||||
</view>
|
||||
<view class="splitLine"></view>
|
||||
|
||||
<view>电量:{{item.battery || '0'}}%</view>
|
||||
</view>
|
||||
|
||||
<view @click.stop="Disc(item,index)" class="disc center"
|
||||
:class="{active:item.isDisc}">
|
||||
<image src="/static/images/common/disc.png" class="discImg" mode="aspectFit">
|
||||
</image>
|
||||
<text>识别</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="device-callpolice"
|
||||
v-if="item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1">
|
||||
报警中</view>
|
||||
<view v-if="item.communicationMode==1 || item.communicationMode==2">
|
||||
<view class="device-status" :class="item.bleStatu?'online':'unline'">
|
||||
{{item.bleStatu?'已连接':'未连接'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
|
||||
<view :class="{active:checks.length>0}" class="btnOK" @click.stop="OkCheck()">确定</view>
|
||||
<global-loading ref="loading" />
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var timeout = null;
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
var ble = null;
|
||||
var recei = null;
|
||||
var pagePath = "pages/common/linkDefence/checkDevice";
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
import {
|
||||
showLoading,
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js';
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo,
|
||||
MsgClear,
|
||||
MsgPrompt
|
||||
} from '@/utils/MsgPops.js';
|
||||
import {
|
||||
deviceInfo,
|
||||
deviceTypeList
|
||||
} from '@/api/common/index.js'
|
||||
import Common from '@/utils/Common.js';
|
||||
import bleTool from '@/utils/BleHelper.js';
|
||||
import BleReceive from '@/utils/BleReceive';
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
filter: {
|
||||
txt: ''
|
||||
},
|
||||
Status: {
|
||||
navbar: {
|
||||
icons: [{
|
||||
src: '/static/images/common/add.png',
|
||||
type: 'add'
|
||||
}],
|
||||
title: '选择设备',
|
||||
showBack: true,
|
||||
height: 90,
|
||||
|
||||
},
|
||||
type: null,
|
||||
Search: false
|
||||
|
||||
},
|
||||
|
||||
mescroll: null,
|
||||
downOption: {
|
||||
auto: false,
|
||||
autoShowLoading: false,
|
||||
},
|
||||
upOption: {
|
||||
auto: false,
|
||||
noMoreSize: 0,
|
||||
offset: 10,
|
||||
isLock: false,
|
||||
empty: {
|
||||
tip: '暂无数据',
|
||||
hideScroll: false,
|
||||
icon: '/static/images/common/empty.png'
|
||||
},
|
||||
textNoMore: '没有更多数据了'
|
||||
},
|
||||
deviceList: [],
|
||||
checks: [],
|
||||
tabs: [],
|
||||
activeTabInfo: '',
|
||||
activeTab: 0,
|
||||
formData: {
|
||||
id: '',
|
||||
name: '',
|
||||
main: [], //通知设备
|
||||
sub: [], //预警设备
|
||||
notify: [] //发送设备
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||
},
|
||||
onLoad() {
|
||||
this.getTab();
|
||||
these = this;
|
||||
this.$watch("filter.txt",(newVal,oldVal)=>{
|
||||
if(this.mescroll){
|
||||
this.mescroll.triggerDownScroll();
|
||||
}
|
||||
});
|
||||
eventChannel = this.getOpenerEventChannel();
|
||||
eventChannel.on('detailData', (res) => {
|
||||
let data = res.data;
|
||||
console.log("收到上级页面传参", data);
|
||||
this.Status.type = data.type;
|
||||
let keys = Object.keys(data.formData);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
this.formData[key] = data.formData[key];
|
||||
}
|
||||
if (data.type == 'main') {
|
||||
this.checks = data.main;
|
||||
this.Status.navbar.title = "选择预警主机";
|
||||
} else if (data.type == 'sub') {
|
||||
this.checks = data.sub;
|
||||
this.Status.navbar.title = "选择布防联机";
|
||||
} else if (data.type == 'notify') {
|
||||
this.checks = data.notify;
|
||||
this.Status.navbar.title = "选择接收设备";
|
||||
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (this.mescroll) {
|
||||
this.mescroll.triggerDownScroll();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
});
|
||||
|
||||
|
||||
ble = bleTool.getBleTool();
|
||||
|
||||
recei = BleReceive.getBleReceive();
|
||||
//蓝牙连接成功的回调
|
||||
ble.addRecoveryCallback((res) => {
|
||||
// console.log("蓝牙连接成功的回调");
|
||||
this.bleRecovery(res);
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙断开连接的回调
|
||||
ble.addDisposeCallback((res) => {
|
||||
console.log("蓝牙断开连接的回调");
|
||||
this.bleBreak(res);
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙适配器恢复可用的回调,一般是重连设备
|
||||
ble.addStateRecoveryCallback(res => {
|
||||
// console.log("蓝牙适配器恢复可用的回调");
|
||||
this.bleStateRecovery();
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙适配器不可用的回调
|
||||
ble.addStateBreakCallback(res => {
|
||||
// console.error("蓝牙适配器不可用的回调");
|
||||
this.bleStateBreak();
|
||||
}, pagePath);
|
||||
|
||||
//接收到消息的回调
|
||||
ble.addReceiveCallback((receive, device, path, recArr) => {
|
||||
// console.error("首页收到消息了");
|
||||
let json = recei.ReceiveData(receive, device, path, recArr);
|
||||
// console.error("消息内容",json);
|
||||
this.updateBleStatu();
|
||||
}, pagePath);
|
||||
// eventChannel.emit('checkOver', {type:'',arr:[]});//
|
||||
},
|
||||
methods: {
|
||||
imgView(item, index) {
|
||||
if (!item.devicePic) {
|
||||
return;
|
||||
}
|
||||
|
||||
uni.previewImage({
|
||||
urls: [item.devicePic]
|
||||
});
|
||||
},
|
||||
checkToggle(item, index) {
|
||||
|
||||
let f = this.checks.find((v, i) => {
|
||||
if (v.id === item.id) {
|
||||
this.checks.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!f) {
|
||||
this.checks.push({
|
||||
id: item.id,
|
||||
deviceName: item.deviceName,
|
||||
deviceImei: item.deviceImei,
|
||||
deviceMac: item.deviceMac,
|
||||
devicePic: item.devicePic
|
||||
});
|
||||
}
|
||||
|
||||
console.log("checks=", this.checks);
|
||||
},
|
||||
bleStateBreak() {
|
||||
console.error("蓝牙适配器不可用");
|
||||
this.updateBleStatu();
|
||||
},
|
||||
bleStateRecovery() {
|
||||
if (this.isPageShow) {
|
||||
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() { //更新列表的蓝牙连接状态,电池 电量
|
||||
if (ble) {
|
||||
|
||||
for (var i = 0; i < this.deviceList.length; i++) {
|
||||
|
||||
|
||||
let f = null;
|
||||
if (ble.data && ble.data.LinkedList) {
|
||||
f = ble.data.LinkedList.find(v => {
|
||||
|
||||
if (v.macAddress && v.device && v.device.id) {
|
||||
return v.device.id == this.deviceList[i].id;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if (f) {
|
||||
|
||||
this.$set(this.deviceList[i], 'bleStatu', f.Linked);
|
||||
if (f.formData) {
|
||||
let battary = 0;
|
||||
if ('battary' in f.formData) {
|
||||
battary = f.formData.battary;
|
||||
} else if ('sta_PowerPercent' in f.formData) {
|
||||
battary = f.formData.sta_PowerPercent;
|
||||
} else if ('sta_battery' in f.formData) {
|
||||
battary = f.formData.sta_battery;
|
||||
}
|
||||
this.$set(this.deviceList[i], 'battery', battary);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
console.error("ble is null")
|
||||
},
|
||||
getTab() {
|
||||
deviceTypeList({}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
//console.log("deviceTypeList=" + JSON.stringify(res.data));
|
||||
this.tabs = [{
|
||||
id: '',
|
||||
name: '全部设备',
|
||||
typeName: '全部设备'
|
||||
},
|
||||
...res.data.map(item => ({
|
||||
id: item.id,
|
||||
name: item.typeName,
|
||||
typeName: item.typeName,
|
||||
communicationMode: item.communicationMode
|
||||
}))
|
||||
];
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
isChecked(item, index) {
|
||||
let f = this.checks.find((v, i) => {
|
||||
return v.id == item.id;
|
||||
});
|
||||
if (f) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
OkCheck() {
|
||||
if (this.checks.length == 0) {
|
||||
return;
|
||||
}
|
||||
eventChannel.emit('checkOver', {
|
||||
type: this.Status.type,
|
||||
arr: this.checks
|
||||
});
|
||||
uni.navigateBack();
|
||||
},
|
||||
onClick(btn, i, item, index) {
|
||||
if (btn.type == 'rename') {
|
||||
console.log("执行重命名");
|
||||
MsgPrompt(this, btn.type, () => {
|
||||
console.log("确定被点击");
|
||||
}, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (btn.type == 'drop') {
|
||||
console.log("执行删除");
|
||||
MsgError('删除后不可恢复,您确认删除"' + item + '"吗?', '确定', this, () => {
|
||||
this.deviceList.splice(index, 1);
|
||||
}, true);
|
||||
return;
|
||||
}
|
||||
},
|
||||
change(event) {
|
||||
console.log('改变事件', event);
|
||||
},
|
||||
swipeChange(e, index) {
|
||||
console.log('当前状态:' + e + ',下标:' + index)
|
||||
},
|
||||
gotoDetail(item, index) {
|
||||
console.log("item=", item);
|
||||
},
|
||||
mescrollInit(mescroll) {
|
||||
this.mescroll = mescroll;
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback() {
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll(false);
|
||||
this.mescroll.scrollTo(0, 0);
|
||||
}
|
||||
this.getData();
|
||||
},
|
||||
// 上拉加载
|
||||
upCallback() {
|
||||
this.getData();
|
||||
},
|
||||
getData() {
|
||||
var task = () => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this.Status.type) {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
let data = {
|
||||
pageNum: this.mescroll.num,
|
||||
pageSize: 10,
|
||||
deviceType: this.activeTabInfo ? this.activeTabInfo.id : '', // 使用传入的设备类型
|
||||
isAsc: 'desc',
|
||||
orderByColumn: 'bindingTime',
|
||||
deviceName:this.filter.txt
|
||||
}
|
||||
if (!data.pageNum) {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
let method = deviceInfo;
|
||||
if (this.Status.type == 'notify') {
|
||||
method = () => {
|
||||
let rows=this.formData.main;
|
||||
rows=rows.concat(this.formData.sub);
|
||||
rows=rows.filter(v=>{
|
||||
return v.deviceName.toLowerCase().indexOf(this.filter.txt.toLowerCase())>-1;
|
||||
})
|
||||
let json = {
|
||||
code: 200,
|
||||
rows: rows
|
||||
};
|
||||
|
||||
return Promise.resolve(json);
|
||||
}
|
||||
}
|
||||
method(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
||||
const newDevices = res.rows.map(device => ({
|
||||
...device,
|
||||
showConfirm: false
|
||||
}));
|
||||
|
||||
// 如果是第一页或切换分类,替换数据
|
||||
if (data.pageNum === 1) {
|
||||
this.deviceList = newDevices
|
||||
} else {
|
||||
//防止后端返回的数据包含已有数据
|
||||
for (var i = 0; i < newDevices.length; i++) {
|
||||
let device = newDevices[i];
|
||||
let f = this.deviceList.find(v => {
|
||||
return v.id === device.id;
|
||||
});
|
||||
if (!f) {
|
||||
this.deviceList.push(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.updateBleStatu();
|
||||
|
||||
|
||||
// 判断是否加载完成
|
||||
let hasNext = true;
|
||||
if (res.rows.length < data.pageSize || this.deviceList.length >= this
|
||||
.total) {
|
||||
hasNext = false;
|
||||
} else {
|
||||
hasNext = true;
|
||||
}
|
||||
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||
} else {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
}
|
||||
}).finally(() => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
clearTimeout(timeout);
|
||||
//防止下拉刷新的同时会调用一次上拉加载的问题
|
||||
timeout = setTimeout(task, 50);
|
||||
|
||||
},
|
||||
prevPage() {
|
||||
uni.navigateBack({
|
||||
|
||||
});
|
||||
},
|
||||
handleRightClick(s, e) {
|
||||
|
||||
if (s === 0) {
|
||||
|
||||
} else if (s === 1) {
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.maincontent {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.listContent {
|
||||
height: calc(100% - 270rpx);
|
||||
transform: translateY(20rpx);
|
||||
}
|
||||
|
||||
.listItem {
|
||||
width: 100%;
|
||||
min-height: 140rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.swipBtn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-swipe .icon,
|
||||
/deep/ .uni-swipe .icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
|
||||
.uni-swipe .txt,
|
||||
/deep/ .uni-swipe .txt {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
|
||||
letter-spacing: 0.14rpx;
|
||||
|
||||
}
|
||||
|
||||
.uni-swipe,
|
||||
/deep/ .uni-swipe {
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab-bar-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin-top: 90rpx;
|
||||
height: 66rpx;
|
||||
}
|
||||
|
||||
.tab-bar {
|
||||
width: 100%;
|
||||
color: rgb(255, 255, 255);
|
||||
white-space: nowrap;
|
||||
/* 禁止换行 */
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.tab-container {
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
padding-right: 80rpx;
|
||||
/* 预留更多按钮空间 */
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
font-size: 28rpx;
|
||||
padding: 0 30rpx;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
color: #bbe600;
|
||||
|
||||
height: 66rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tab-item.active::before {
|
||||
content: "";
|
||||
background-color: #bbe600;
|
||||
position: absolute;
|
||||
top: 90%;
|
||||
left: 35%;
|
||||
width: 30%;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.tab-more {
|
||||
margin-left: 10rpx;
|
||||
/* 与Tab的间距 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: linear-gradient(-88.60deg, rgba(18, 18, 18, 1), rgba(18, 18, 18, 0) 100%);
|
||||
height: 66rpx;
|
||||
}
|
||||
|
||||
.more {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
|
||||
.listItem .opt {
|
||||
width: 70rpx;
|
||||
height: 210rpx;
|
||||
|
||||
}
|
||||
|
||||
.listItem .opt .checkbox {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(255, 255, 255, 0.4);
|
||||
border-radius: 8rpx;
|
||||
background-color: #00000000;
|
||||
}
|
||||
|
||||
.listItem .opt .checkbox .icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.listItem .opt .checkbox.active {
|
||||
background-color: #AED600 !important;
|
||||
}
|
||||
|
||||
.listItem .opt .checkbox.active .icon {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.listItem .main {
|
||||
width: calc(100% - 70rpx);
|
||||
height: 210rpx;
|
||||
}
|
||||
|
||||
.device-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
padding: 30rpx 0 10rpx 30rpx;
|
||||
background: rgba(26, 26, 26, 1);
|
||||
}
|
||||
|
||||
.device-name {
|
||||
font-size: 32rpx;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
margin-left: 24rpx;
|
||||
line-height: 50rpx;
|
||||
width: 75%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ID {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 26rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
|
||||
.deviceIMG {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 16rpx;
|
||||
position: relative;
|
||||
background-color: rgba(42, 42, 42, 0.6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.p10 {
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.splitLine {
|
||||
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: 4rpx;
|
||||
height: 25rpx;
|
||||
margin: 0rpx 20rpx;
|
||||
}
|
||||
|
||||
.disc {
|
||||
padding: 5rpx 10rpx;
|
||||
margin-right: -30rpx;
|
||||
}
|
||||
|
||||
.disc.active {
|
||||
background-color: #2a2a2a !important;
|
||||
;
|
||||
}
|
||||
|
||||
.discImg {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.IMG {
|
||||
width: 68rpx;
|
||||
height: 50rpx;
|
||||
margin-left: 17%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.device-callpolice {
|
||||
width: 122rpx;
|
||||
height: 52rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 0px 8px 0px 8px;
|
||||
background-color: rgba(224, 52, 52, 1);
|
||||
position: absolute;
|
||||
top: 0rpx;
|
||||
right: -4rpx;
|
||||
text-align: center;
|
||||
line-height: 52rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.device-status {
|
||||
width: 122rpx;
|
||||
height: 52rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 0px 8px 0px 8px;
|
||||
background-color: rgb(42, 42, 42);
|
||||
position: absolute;
|
||||
top: 0rpx;
|
||||
right: 0rpx;
|
||||
text-align: center;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.online {
|
||||
color: rgb(187, 230, 0);
|
||||
}
|
||||
|
||||
.unline {
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
|
||||
.btnOK.active {
|
||||
background: rgba(187, 230, 0, 1) !important;
|
||||
color: rgba(35, 35, 35, 1) !important;
|
||||
}
|
||||
|
||||
.btnOK {
|
||||
/* 矩形 7 */
|
||||
width: 80%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 90rpx;
|
||||
text-align: center;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
background: rgba(26, 26, 26, 1);
|
||||
font-family: "PingFang SC";
|
||||
font-style: Bold;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
box-shadow: 0px 0px 2px 0px rgb(255 255 255 / 30%);
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
bottom: 50rpx;
|
||||
left: 10%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.searchRow {
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
margin-top: 90rpx;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.searchRow .ipt {
|
||||
width: calc(100% - 80rpx);
|
||||
height: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.searchRow .btn {
|
||||
width: 80rpx;
|
||||
height: 100%;
|
||||
line-height: 70rpx;
|
||||
text-align: right;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.14rpx;
|
||||
float: left;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/deep/ .uni-easyinput__content,
|
||||
.uni-easyinput__content {
|
||||
background-color: #1A1A1A !important;
|
||||
border-radius: 70rpx;
|
||||
color: #FFFFFF;
|
||||
text-indent: 10rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/deep/ .uni-textarea-placeholder,
|
||||
.uni-textarea-placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.14rpx;
|
||||
}
|
||||
</style>
|
||||
509
pages/common/linkDefence/defence.vue
Normal file
509
pages/common/linkDefence/defence.vue
Normal file
@ -0,0 +1,509 @@
|
||||
<template>
|
||||
<view class="maincontent contentBg">
|
||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true" background-color="#121212"
|
||||
color="#FFFFFF" :title="Status.navbar.title">
|
||||
<template v-slot:left>
|
||||
<view>
|
||||
<uni-icons type="left" size="24" color="#FFFFFF"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
<block slot="right">
|
||||
<view class="navbarRight center">
|
||||
<image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons"
|
||||
class="img" :src="item.src" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
</uni-nav-bar>
|
||||
|
||||
|
||||
<view class="listContent">
|
||||
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
|
||||
:down="downOption" :fixed="false">
|
||||
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item v-for="item,index in deviceList" @click="onClick"
|
||||
@change="swipeChange($event, 0)" :autoClose="false">
|
||||
<view class="listItem" @click.stop="gotoDetail(item,index)">
|
||||
<view class="itemMain">
|
||||
|
||||
|
||||
<view class="title">{{item.name?item.name:'预警设防'+index}}</view>
|
||||
<view class="splitLine"></view>
|
||||
<view class="row">
|
||||
<view class="lbl">布防联机:{{item.total}}</view>
|
||||
<view class="lbl">接收设备:{{item.notify}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="lbl">布防联机:{{item.sub}}</view>
|
||||
<view class="lbl">预警主机:{{item.warn}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-slot:right>
|
||||
<view class="swipBtn" @click.stop="onClick(btn,i,item,index)"
|
||||
v-for="btn,i in Status.SwipOptions"
|
||||
:style="{'backgroundColor':btn.style.backgroundColor,'width':btn.style.width}">
|
||||
|
||||
<image :src="btn.style.icon" mode="aspectFit" class="icon"
|
||||
:style="{'filter':btn.style.filter}"></image>
|
||||
<text class="txt">{{btn.text}}</text>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
</uni-swipe-action-item>
|
||||
|
||||
</uni-swipe-action>
|
||||
|
||||
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
|
||||
<global-loading ref="loading" />
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
|
||||
<MsgBox ref="rename">
|
||||
<view class="renamePop center">
|
||||
<view class="lbl">设备名称</view>
|
||||
<input class="txt" v-model="cEdit.name" type="text" placeholder="输入名称" maxlength="20"
|
||||
placeholder-class="txtplace" />
|
||||
</view>
|
||||
</MsgBox>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request, {
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
import {
|
||||
showLoading,
|
||||
hideLoading,
|
||||
updateLoading
|
||||
} from '@/utils/loading.js';
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo,
|
||||
MsgClear,
|
||||
MsgPrompt
|
||||
} from '@/utils/MsgPops.js';
|
||||
import Common from '@/utils/Common.js';
|
||||
|
||||
var timeout = null;
|
||||
var these = null;
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Status: {
|
||||
navbar: {
|
||||
icons: [{
|
||||
src: '/static/images/common/add.png',
|
||||
type: 'add'
|
||||
}],
|
||||
title: '预警布防',
|
||||
showBack: true,
|
||||
height: 90
|
||||
},
|
||||
SwipOptions: [{
|
||||
type: "rename",
|
||||
text: '重命名',
|
||||
style: {
|
||||
backgroundColor: '#E09319',
|
||||
icon: '/static/images/common/rename.png',
|
||||
width: '120rpx', // 初始宽度
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'drop',
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: 'rgb(240, 60, 60)',
|
||||
icon: '/static/images/common/dell.png',
|
||||
width: '120rpx', // 初始宽度
|
||||
filter: 'brightness(0) invert(0.87)'
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
mescroll: null,
|
||||
downOption: {
|
||||
auto: true,
|
||||
autoShowLoading: false,
|
||||
},
|
||||
upOption: {
|
||||
auto: false,
|
||||
noMoreSize: 0,
|
||||
offset: 10,
|
||||
isLock: false,
|
||||
empty: {
|
||||
tip: '暂无数据',
|
||||
hideScroll: false,
|
||||
icon: '/static/images/common/empty.png'
|
||||
},
|
||||
textNoMore: '没有更多数据了'
|
||||
},
|
||||
deviceList: [],
|
||||
cEdit: {
|
||||
id: null,
|
||||
name: null,
|
||||
total: null,
|
||||
notify: null,
|
||||
sub: null,
|
||||
warn: null
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.Status.navbar.height = uni.getSystemInfoSync().statusBarHeight + 44;
|
||||
},
|
||||
onLoad() {
|
||||
these = this;
|
||||
},
|
||||
methods: {
|
||||
ReName() {
|
||||
if (!this.cEdit.name) {
|
||||
MsgError('请输入名称', '', these, null, false);
|
||||
return;
|
||||
}
|
||||
let ok = () => {
|
||||
this.deviceList.find((v, i) => {
|
||||
if (v.id == this.cEdit.id) {
|
||||
this.$set(this.deviceList[i], "name", this.cEdit.name)
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
let url = '';
|
||||
if (url) {
|
||||
request({
|
||||
url: url,
|
||||
data: this.cEdit,
|
||||
method: 'update'
|
||||
}).then(res => {
|
||||
if (res && res.code == 200) {
|
||||
ok();
|
||||
}
|
||||
}).catch(ex => {
|
||||
MsgError(ex.msg, '', these);
|
||||
});
|
||||
} else {
|
||||
ok();
|
||||
}
|
||||
},
|
||||
onClick(btn, i, item, index) {
|
||||
if (btn.type == 'rename') {
|
||||
these.cEdit = Object.assign(these.cEdit, item);
|
||||
console.log("执行重命名");
|
||||
MsgPrompt(this, btn.type, this.ReName, false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (btn.type == 'drop') {
|
||||
console.log("执行删除");
|
||||
MsgError('删除后不可恢复,您确认删除"' + item.name + '"吗?', '确定', this, () => {
|
||||
this.deviceList.splice(index, 1);
|
||||
}, true);
|
||||
return;
|
||||
}
|
||||
},
|
||||
change(event) {
|
||||
console.log('改变事件', event);
|
||||
},
|
||||
swipeChange(e, index) {
|
||||
console.log('当前状态:' + e + ',下标:' + index)
|
||||
},
|
||||
gotoDetail(item, index) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/linkDefence/addDefence',
|
||||
success(res) {
|
||||
res.eventChannel.emit('detailData',{data:item})
|
||||
}
|
||||
});
|
||||
},
|
||||
mescrollInit(mescroll) {
|
||||
this.mescroll = mescroll;
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback() {
|
||||
|
||||
|
||||
if (this.mescroll) {
|
||||
this.mescroll.resetUpScroll(false);
|
||||
this.mescroll.scrollTo(0, 0);
|
||||
}
|
||||
this.getData();
|
||||
|
||||
|
||||
},
|
||||
// 上拉加载
|
||||
upCallback() {
|
||||
this.getData();
|
||||
},
|
||||
getData() {
|
||||
let task = () => {
|
||||
|
||||
let data = {
|
||||
pageNum: this.mescroll.num,
|
||||
pageSize: 10,
|
||||
}
|
||||
|
||||
if (!data.pageNum) {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let result = (res) => {
|
||||
|
||||
// 分页处理
|
||||
if (data.pageNum === 1) {
|
||||
this.deviceList = res.rows;
|
||||
} else {
|
||||
this.deviceList = this.deviceList.concat(res.rows);
|
||||
}
|
||||
|
||||
let hasNext = true;
|
||||
|
||||
if (res.rows.length < data.pageSize || this.deviceList.length >= res.total) {
|
||||
|
||||
hasNext = false;
|
||||
} else {
|
||||
|
||||
hasNext = true;
|
||||
}
|
||||
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||
}
|
||||
let url = ''; //请求地址
|
||||
if (url) {
|
||||
request({
|
||||
url: url,
|
||||
data: data,
|
||||
method: 'GET'
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
result(res);
|
||||
} else {
|
||||
this.mescroll.endSuccess(0, false);
|
||||
}
|
||||
}).catch(ex => {
|
||||
MsgError(ex.errMsg, '', this);
|
||||
this.mescroll.endSuccess(0, false);
|
||||
});
|
||||
} else {
|
||||
if (data.pageNum === 1) {
|
||||
//开发时做假数据模拟成功
|
||||
MsgWarning("这是测试数据,非真实场景,真实功能敬请期待", '', this, true, null, false);
|
||||
}
|
||||
let res = {
|
||||
code: 200,
|
||||
total: 108,
|
||||
rows: []
|
||||
};
|
||||
let currLen = this.deviceList.length;
|
||||
|
||||
for (let i = 0; i < data.pageSize; i++) {
|
||||
if (currLen + i + 1 >= res.total) {
|
||||
break;
|
||||
}
|
||||
let json = {
|
||||
id: Common.guid(),
|
||||
name: '预警设防 ' + (i + (data.pageNum - 1) * data.pageSize + 1),
|
||||
total: (Math.random() * 100).toFixed(0),
|
||||
notify: (Math.random() * 100).toFixed(0),
|
||||
sub: (Math.random() * 100).toFixed(0),
|
||||
warn: (Math.random() * 100).toFixed(0)
|
||||
};
|
||||
res.rows.push(json);
|
||||
}
|
||||
result(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(task, 50);
|
||||
|
||||
},
|
||||
prevPage() {
|
||||
uni.navigateBack({
|
||||
|
||||
});
|
||||
},
|
||||
handleRightClick(s, e) {
|
||||
|
||||
if (s === 0) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/linkDefence/addDefence'
|
||||
})
|
||||
} else if (s === 1) {
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.maincontent {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.listContent {
|
||||
height: calc(100% - 90rpx);
|
||||
margin-top: 90rpx;
|
||||
}
|
||||
|
||||
.listItem {
|
||||
|
||||
|
||||
background: rgba(26, 26, 26, 1);
|
||||
width: 100%;
|
||||
min-height: 140rpx;
|
||||
height: auto;
|
||||
|
||||
box-sizing: border-box;
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.listItem .itemMain {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.listItem .title {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
|
||||
letter-spacing: 0.14rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.listItem .splitLine {
|
||||
border-bottom: 1rpx solid rgba(255, 255, 255, 1);
|
||||
width: 10000px;
|
||||
height: 0rpx;
|
||||
margin-top: 15rpx;
|
||||
margin-bottom: 15rpx;
|
||||
transform: scale(0.1);
|
||||
margin-left: -5000px;
|
||||
}
|
||||
|
||||
.listItem .row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15rpx;
|
||||
|
||||
color: rgba(255, 255, 255, 1);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 200;
|
||||
|
||||
letter-spacing: 0.07px;
|
||||
|
||||
}
|
||||
|
||||
/* .listItem .row .lbl{
|
||||
padding: 0rpx 30rpx 0rpx 0rpx;
|
||||
text-align: left;
|
||||
} */
|
||||
.listItem .row:last-of-type {
|
||||
margin-bottom: 0rpx;
|
||||
}
|
||||
|
||||
.swipBtn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-swipe .icon,
|
||||
/deep/ .uni-swipe .icon {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
|
||||
.uni-swipe .txt,
|
||||
/deep/ .uni-swipe .txt {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
|
||||
letter-spacing: 0.14rpx;
|
||||
|
||||
}
|
||||
|
||||
.uni-swipe,
|
||||
/deep/ .uni-swipe {
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.renamePop {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
padding: 60rpx 0rpx 30rpx 0rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.renamePop .lbl {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
font-family: "PingFang SC";
|
||||
font-style: Regular;
|
||||
font-size: 26rpx;
|
||||
letter-spacing: 0.14rpx;
|
||||
width: auto;
|
||||
padding: 0rpx 10rpx 0rpx 0rpx;
|
||||
}
|
||||
|
||||
.renamePop .txt {
|
||||
flex: 1;
|
||||
height: 60rpx;
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.4);
|
||||
border-radius: 8rpx;
|
||||
text-align: left;
|
||||
text-indent: 10rpx;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
|
||||
font-size: 28rpx;
|
||||
|
||||
letter-spacing: 0.14rpx;
|
||||
|
||||
}
|
||||
|
||||
.txtplace {
|
||||
color: rgba(255, 255, 255, 0.43);
|
||||
|
||||
font-family: "PingFang SC";
|
||||
|
||||
font-size: 26rpx;
|
||||
}
|
||||
</style>
|
||||
@ -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();
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,6 +1,22 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<map class="map" :latitude="latitude" :longitude="longitude" :markers="covers" @markertap="onMarkerTap"
|
||||
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true" background-color="#121212"
|
||||
color="#FFFFFF" :title="Status.navbar.title">
|
||||
<template v-slot:left>
|
||||
<view>
|
||||
<uni-icons type="left" size="24" color="#FFFFFF"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
<block slot="right">
|
||||
<view class="navbarRight center">
|
||||
<image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons"
|
||||
class="img" :src="item.src" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
</uni-nav-bar>
|
||||
|
||||
<map id="map" ref="map" class="map" :latitude="latitude" :longitude="longitude" :markers="covers" @markertap="onMarkerTap"
|
||||
:scale="16"></map>
|
||||
|
||||
<!-- 加载提示 -->
|
||||
@ -13,6 +29,7 @@
|
||||
|
||||
<script>
|
||||
import Common from "@/utils/Common.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -79,6 +96,17 @@
|
||||
showMask: true,
|
||||
maskBgColor: '#00000066',
|
||||
showClose: false
|
||||
},
|
||||
navbar: {
|
||||
icons: [
|
||||
// {
|
||||
// type:'msg',
|
||||
// src: '/static/images/common/guiji.png'
|
||||
// }
|
||||
],
|
||||
title: '查看位置',
|
||||
showBack: true,
|
||||
height: 90
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,9 +141,20 @@
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
prevPage() {
|
||||
uni.navigateBack({
|
||||
|
||||
});
|
||||
},
|
||||
handleRightClick: function(s, e) {
|
||||
|
||||
console.log("敬请期待");
|
||||
},
|
||||
showAction() {
|
||||
|
||||
let gd=plus.runtime.isApplicationExist({
|
||||
@ -277,4 +316,22 @@
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.uni-navbar--fixed {
|
||||
top: 0rpx;
|
||||
}
|
||||
|
||||
.uni-navbar--fixed {
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.uni-navbar__placeholder {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@ -53,8 +53,11 @@
|
||||
MsgPrompt
|
||||
} from '@/utils/MsgPops.js'
|
||||
import Common from '@/utils/Common.js';
|
||||
import api from '@/api/670/HBY670.js';
|
||||
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
import {deviceInfo} from '@/api/common/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -86,7 +89,9 @@
|
||||
longitude: null,
|
||||
alarmStatus: null,
|
||||
detailPageUrl: "/pages/650/HBY650",
|
||||
showConfirm: false
|
||||
showConfirm: false,
|
||||
contact1Phone:null,
|
||||
contact2Phone:null
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -125,14 +130,41 @@
|
||||
console.log("收到父页面的参数:" + JSON.stringify(data));
|
||||
these.device = data;
|
||||
|
||||
this.list[0] = data.contact1Phone;
|
||||
this.list[1] = data.contact2Phone;
|
||||
|
||||
|
||||
this.init();
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
api.getDetail(this.device.id).then(res => {
|
||||
|
||||
if (res && res.code == 200) {
|
||||
let data = res.data;
|
||||
if(data.length){
|
||||
data=data[0];
|
||||
}
|
||||
let keys = Object.keys(data);
|
||||
let dKeys = Object.keys(this.device);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
|
||||
let dk = dKeys.find(k => {
|
||||
return key.toLowerCase() == k.toLowerCase();
|
||||
});
|
||||
if (dk) {
|
||||
this.$set(this.device, dk, data[key]);
|
||||
} else {
|
||||
this.$set(this.device, key, data[key]);
|
||||
}
|
||||
}
|
||||
|
||||
this.list[0] = data.contact1Phone;
|
||||
this.list[1] = data.contact2Phone;
|
||||
}
|
||||
});
|
||||
},
|
||||
notifyPrevPage(){//通知上一个页面
|
||||
if (eventChannel) {
|
||||
eventChannel.emit('linkManOver', this.list);
|
||||
@ -231,9 +263,7 @@
|
||||
|
||||
let requestCall = () => {
|
||||
|
||||
this.$set(this.list, this.cEdit.index, this.cEdit.txt)
|
||||
|
||||
|
||||
this.$set(this.list, this.cEdit.index, this.cEdit.txt)
|
||||
this.cEdit.txt = "";
|
||||
this.cEdit.index = -1;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
MsgInfo
|
||||
} from '@/utils/MsgPops.js'
|
||||
import Common from '@/utils/Common.js';
|
||||
|
||||
import api from '@/api/670/HBY670.js';
|
||||
|
||||
var these = null;
|
||||
var eventChannel = null;
|
||||
@ -67,7 +67,8 @@
|
||||
longitude: null,
|
||||
alarmStatus: null,
|
||||
detailPageUrl: "",
|
||||
showConfirm: false
|
||||
showConfirm: false,
|
||||
sosSmsMsg:null
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -101,11 +102,24 @@
|
||||
if(data.sosSmsMsg){
|
||||
this.txt=data.sosSmsMsg;
|
||||
}
|
||||
this.init();
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
api.getDetail(this.device.id).then(res => {
|
||||
|
||||
if (res && res.code == 200) {
|
||||
let data = res.data;
|
||||
if(data.length){
|
||||
data=data[0];
|
||||
}
|
||||
this.txt=data.sosSmsMsg;
|
||||
}
|
||||
});
|
||||
},
|
||||
copyTo(item, index) {
|
||||
this.txt = item;
|
||||
},
|
||||
|
||||
@ -27,6 +27,12 @@
|
||||
<text class="title">版本更新 ({{appVersion}})</text>
|
||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||
</view>
|
||||
<view class="menu-item" @click="clearCatch">
|
||||
<image src="/static/images/common/clear.png" class="icon"></image>
|
||||
<text class="title">清理缓存</text>
|
||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||
</view>
|
||||
|
||||
<view class="menu-item" @click="sendCounsel">
|
||||
<image src="/static/images/common/yijianfankui.png" class="icon"></image>
|
||||
<text class="title">举报反馈</text>
|
||||
@ -37,16 +43,11 @@
|
||||
<text class="title">关于我们</text>
|
||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||
</view>
|
||||
<!-- <view class="menu-item" @click="logOff">
|
||||
<image src="/static/images/common/zhuxiao.png" class="icon"></image>
|
||||
<text class="title">注销账号</text>
|
||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||
</view> -->
|
||||
<view class="menu-item" @click="account">
|
||||
<image src="/static/images/common/wm.png" class="icon"></image>
|
||||
<text class="title">账号</text>
|
||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||
</view>
|
||||
<view class="menu-item" @click="account">
|
||||
<image src="/static/images/common/wm.png" class="icon"></image>
|
||||
<text class="title">账号</text>
|
||||
<uni-icons type="right" size="25" color="rgba(255, 255, 255, 0.4)" class="uniIcon"></uni-icons>
|
||||
</view>
|
||||
<view class="btn_footer">
|
||||
<button class="logout" @click="logout">退出登录</button>
|
||||
</view>
|
||||
@ -69,6 +70,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<MsgBox ref="msgPop" />
|
||||
</view>
|
||||
|
||||
</template>
|
||||
@ -78,6 +81,15 @@
|
||||
Logout
|
||||
} from '@/api/common/login.js'
|
||||
import bleTool from '@/utils/BleHelper.js';
|
||||
import {
|
||||
MsgSuccess,
|
||||
MsgError,
|
||||
MsgClose,
|
||||
MsgWarning,
|
||||
showPop,
|
||||
MsgInfo,
|
||||
MsgClear
|
||||
} from '@/utils/MsgPops.js'
|
||||
var ble=null;
|
||||
export default {
|
||||
data() {
|
||||
@ -106,6 +118,32 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
clearCatch(){
|
||||
MsgWarning("将清除以下缓存数据:设备配对、网络缓存、音频、视频,清除后下次使用将重新加载,您确认清除?",'确定',this,true,()=>{
|
||||
let store = uni.getStorageInfoSync();
|
||||
store.keys.forEach((val, index, array) => {
|
||||
if (val == "linkedDevices") {
|
||||
//设备配对只保留已连接的数据
|
||||
if(ble){
|
||||
let linked=ble.data.LinkedList.filter((v,i)=>{
|
||||
return v.Linked;
|
||||
});
|
||||
|
||||
ble.data.LinkedList=linked;
|
||||
ble.updateCache();
|
||||
}
|
||||
|
||||
} else if (val == "tokenTime" || val == "token" || val == "clientID" || val == 'phone') {
|
||||
console.log("忽略登陆信息");
|
||||
} else {
|
||||
uni.removeStorageSync(val);
|
||||
}
|
||||
});
|
||||
|
||||
MsgSuccess("清理成功",'',this);
|
||||
},true);
|
||||
|
||||
},
|
||||
//版本更新
|
||||
gotoAppStore(){
|
||||
let os=uni.getSystemInfoSync().platform;
|
||||
@ -196,6 +234,7 @@
|
||||
url: '/pages/common/account/index'
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user