体验优化添加失败时的提醒

This commit is contained in:
liub
2026-04-03 08:48:00 +08:00
parent 222c578f2c
commit aef68d5968
19 changed files with 851 additions and 1046 deletions

View File

@ -325,6 +325,9 @@
these.formData.bleStatu = 'connecting'; these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
}); });
@ -351,6 +354,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -480,6 +484,8 @@
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) })
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);

View File

@ -16,7 +16,8 @@
<view class="row"> <view class="row">
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image> <image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
<view class="txt"> <view class="txt">
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} <view class="bigTxt">
{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}
</view> </view>
<view class="smallTxt">设备状态</view> <view class="smallTxt">设备状态</view>
</view> </view>
@ -118,21 +119,13 @@
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
<!-- 下方菜单 --> <!-- 下方菜单 -->
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -144,7 +137,15 @@
showLoading, showLoading,
hideLoading, hideLoading,
updateLoading updateLoading
} from '@/utils/loading.js' } from '@/utils/loading.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
import request, { import request, {
baseURL baseURL
} from '@/utils/request.js' } from '@/utils/request.js'
@ -167,26 +168,7 @@
curr: 0, curr: 0,
total: 0, total: 0,
pageHide: false, pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '您确定要这样做吗?',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '设备名称',
modelValue: '',
visibleClose: false,
okCallback: null,
buttonCancelText: '',
showCancel: false,
},
usrToggle: false, usrToggle: false,
}, },
@ -340,7 +322,10 @@
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.formData.sta_IntrusTime = 0; these.formData.sta_IntrusTime = 0;
these.formData.sta_sosadd = ""; these.formData.sta_sosadd = "";
these.setBleFormData(); these.setBleFormData();
@ -362,7 +347,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
computed: { computed: {
@ -401,7 +389,7 @@
these.setBleFormData(); these.setBleFormData();
}).catch(ex => { }).catch(ex => {
this.showMsg(ex.msg); MsgError(ex.msg,'',these);
}); });
}, },
@ -443,7 +431,7 @@
these.setBleFormData(); these.setBleFormData();
resolve(); resolve();
}).catch(ex => { }).catch(ex => {
this.showMsg(ex.msg); MsgError(ex.msg,'',these);
reject(ex); reject(ex);
}); });
}); });
@ -451,7 +439,7 @@
} }
if (item.key == 'led_alarm') { if (item.key == 'led_alarm') {
this.showPop({ showPop({
message: '确定开启声光报警?', message: '确定开启声光报警?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -462,10 +450,10 @@
buttonText: "开启", buttonText: "开启",
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} else { } else {
if (this.formData.sta_LedType == 'led_alarm') { if (this.formData.sta_LedType == 'led_alarm') {
this.showPop({ showPop({
message: '确定解除声光报警模式?', message: '确定解除声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -482,7 +470,7 @@
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} else { } else {
task(item.key); task(item.key);
} }
@ -559,7 +547,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -620,7 +609,7 @@
if (msg.length > 0) { if (msg.length > 0) {
this.showMsg(msg.join(',')); MsgError(msg.join(','),'',these);
} }
these.setBleFormData(); these.setBleFormData();
@ -655,7 +644,7 @@
}, },
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -683,7 +672,7 @@
} }
}) })
} }
}); },these);
}, },
proParam: function() { proParam: function() {
@ -714,90 +703,10 @@
closePop: function() {
this.Status.Pop.showPop = false;
if (this.Status.Pop.cancelCallback) {
this.Status.Pop.cancelCallback();
}
},
HidePop: function() {
if (this.Status.Pop.clickEvt == 'SendUsr') {
}
this.Status.Pop.showPop = false;
if (this.Status.Pop.okCallback) {
this.Status.Pop.okCallback();
}
},
showPop: function(option) {
// hideLoading(this);
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
showMsg(msg, isSucc) {
let icoUrl = '/static/images/common/uploadErr.png';
let borderColor = "#e034344d";
let buttonBgColor = "#E03434";
if (isSucc) {
icoUrl = '/static/images/common/success.png';
borderColor = "#BBE600";
buttonBgColor = "#BBE600";
}
this.showPop({
message: msg,
iconUrl: icoUrl,
borderColor: borderColor,
buttonBgColor: buttonBgColor,
buttonText: '确定',
okCallback: null
});
}
} }
} }
</script> </script>

View File

@ -97,7 +97,8 @@
<view class="arrow" @click.stop="openVolume(item,index)" v-if="item.show" <view class="arrow" @click.stop="openVolume(item,index)" v-if="item.show"
v-for="item,index in dic.sta_VoiceType" :class="{'active':formData.sta_VoiceType===item.key, v-for="item,index in dic.sta_VoiceType" :class="{'active':formData.sta_VoiceType===item.key,
'displayNone':!Status.usrToggle && index>3 'displayNone' :!Status.usrToggle && index>
3
}"> }">
<view class="outCircle"> <view class="outCircle">
<view class="item"> <view class="item">
@ -246,27 +247,9 @@
</view> </view>
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
<!-- 下方菜单 -->
<!-- <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@btnClick="btnClick">
<view>
<view class="addIco">
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
<image mode="aspectFit" class="img" src="/static/images/6155/DeviceDetail/add.png"></image>
</view>
</view>
</view>
</BottomSlideMenuPlus> -->
<MsgBox ref="msgPop" />
<global-loading ref="loading" /> <global-loading ref="loading" />
</view> </view>
</template> </template>
@ -279,7 +262,15 @@
showLoading, showLoading,
hideLoading, hideLoading,
updateLoading updateLoading
} from '@/utils/loading.js' } from '@/utils/loading.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js';
import request, { import request, {
baseURL baseURL
} from '@/utils/request.js'; } from '@/utils/request.js';
@ -311,26 +302,7 @@
curr: 0, curr: 0,
total: 0, total: 0,
pageHide: false, pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '您确定要这样做吗?',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '设备名称',
modelValue: '',
visibleClose: false,
okCallback: null,
buttonCancelText: '',
showCancel: false,
},
BottomMenu: { BottomMenu: {
show: false, show: false,
showHeader: true, showHeader: true,
@ -520,7 +492,7 @@
this.$watch("formData.sta_battery", (newVal, oldVal) => { this.$watch("formData.sta_battery", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system == 2) { if (newVal <= 20 && this.formData.sta_system == 2) {
this.showMsg("设备电量低"); MsgError("设备电量低",'',these);
} }
}); });
@ -582,6 +554,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
these.setBleFormData(); these.setBleFormData();
@ -602,7 +575,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
computed: { computed: {
@ -656,14 +632,14 @@
audioManager() { audioManager() {
if (!this.permissions.includes('52') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('52') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
uni.navigateTo({ uni.navigateTo({
@ -846,7 +822,7 @@
text: "握手成功,等待设备响应" text: "握手成功,等待设备响应"
}); });
}).catch(ex => { }).catch(ex => {
this.showMsg(ex.msg); MsgError(ex.msg,'',these);
}); });
}, },
@ -991,14 +967,14 @@ onFreqChanging(e){
if (!this.permissions.includes('51') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('51') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
let f = this.getDevice(); let f = this.getDevice();
@ -1043,14 +1019,14 @@ onFreqChanging(e){
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -1083,12 +1059,12 @@ onFreqChanging(e){
this.formData.sta_VoiceType = val; this.formData.sta_VoiceType = val;
these.setBleFormData(); these.setBleFormData();
}).catch(ex => { }).catch(ex => {
this.showMsg(ex.msg); MsgError(ex.msg,'',these);
}); });
}, },
showUnWarn(val) { showUnWarn(val) {
this.showPop({ showPop({
message: '确定解除声光报警模式?', message: '确定解除声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1102,20 +1078,20 @@ onFreqChanging(e){
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
}, },
sosSetting(item, isOk) { sosSetting(item, isOk) {
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -1164,7 +1140,7 @@ onFreqChanging(e){
}) })
.catch(ex => { .catch(ex => {
this.showMsg(ex.msg); MsgError(ex.msg,'',these);
}); });
} }
@ -1173,7 +1149,7 @@ onFreqChanging(e){
this.showUnWarn(0); this.showUnWarn(0);
} else { } else {
this.showPop({ showPop({
message: '确定开启强制报警?', message: '确定开启强制报警?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1182,7 +1158,7 @@ onFreqChanging(e){
buttonText: "开启", buttonText: "开启",
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} }
@ -1371,6 +1347,7 @@ onFreqChanging(e){
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -1393,7 +1370,7 @@ onFreqChanging(e){
}, },
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1421,7 +1398,7 @@ onFreqChanging(e){
} }
}) })
} }
}); },these);
}, },
proParam: function() { proParam: function() {
@ -1452,93 +1429,8 @@ onFreqChanging(e){
closePop: function() {
this.Status.Pop.showPop = false;
if (this.Status.Pop.cancelCallback) {
this.Status.Pop.cancelCallback();
}
},
HidePop: function() {
if (this.Status.Pop.clickEvt == 'SendUsr') {
}
this.Status.Pop.showPop = false;
if (this.Status.Pop.okCallback) {
this.Status.Pop.okCallback();
}
},
showPop: function(option) {
// hideLoading(this);
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
showMsg(msg, isSucc) {
let icoUrl = '/static/images/common/uploadErr.png';
let borderColor = "#e034344d";
let buttonBgColor = "#E03434";
if (isSucc) {
icoUrl = '/static/images/common/success.png';
borderColor = "#BBE600";
buttonBgColor = "#BBE600";
}
this.showPop({
message: msg,
iconUrl: icoUrl,
borderColor: borderColor,
buttonBgColor: buttonBgColor,
buttonText: '确定',
okCallback: null
});
},
btnClick() {
}
} }
} }
</script> </script>

View File

@ -37,7 +37,8 @@
<view class="row"> <view class="row">
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image> <image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
<view class="txt"> <view class="txt">
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} <view class="bigTxt">
{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}
</view> </view>
<view class="smallTxt">设备状态</view> <view class="smallTxt">设备状态</view>
</view> </view>
@ -194,6 +195,7 @@
<BottomSlideMenuPlus :config="Status.BottomMenu" @itemClick="btnClick" @close="closeActionSheet"> <BottomSlideMenuPlus :config="Status.BottomMenu" @itemClick="btnClick" @close="closeActionSheet">
</BottomSlideMenuPlus> </BottomSlideMenuPlus>
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -211,6 +213,14 @@
} from '@/utils/request.js' } from '@/utils/request.js'
import Common from '@/utils/Common.js' import Common from '@/utils/Common.js'
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "/pages/102/HBY102"; const pagePath = "/pages/102/HBY102";
var ble = null; var ble = null;
@ -502,6 +512,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
these.formData.sta_IntrusTime = 0; these.formData.sta_IntrusTime = 0;
these.formData.sta_sosadd = ""; these.formData.sta_sosadd = "";
@ -524,7 +535,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
this.getWarns(); this.getWarns();
// this.getLinkedCnt(); // this.getLinkedCnt();
@ -596,14 +610,14 @@
if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -772,14 +786,14 @@
if (!this.permissions.includes(item.permission) && this.Status.apiType !== 'listA') { if (!this.permissions.includes(item.permission) && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -840,7 +854,7 @@
if (val === 'E49_on') { if (val === 'E49_on') {
this.showPop({ showPop({
message: '确定开启联机模式?', message: '确定开启联机模式?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -852,7 +866,7 @@
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} else { } else {
task(); task();
} }
@ -922,7 +936,7 @@
} }
if (val == 'status_off') { if (val == 'status_off') {
this.showPop({ showPop({
message: '确定关闭物体感应功能?', message: '确定关闭物体感应功能?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -934,7 +948,7 @@
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} else { } else {
task(); task();
} }
@ -945,17 +959,16 @@
sosSetting(item, isOk) { sosSetting(item, isOk) {
debugger;
if (!this.permissions.includes('46') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('46') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -993,7 +1006,7 @@ debugger;
these.setBleFormData(); these.setBleFormData();
resolve(); resolve();
}).catch(ex => { }).catch(ex => {
this.showMsg(ex.msg); MsgError(ex.msg,null,these);
reject(ex); reject(ex);
}); });
}); });
@ -1001,7 +1014,7 @@ debugger;
} }
if (item.key == 'led_alarm') { if (item.key == 'led_alarm') {
this.showPop({ showPop({
message: '确定开启强制报警?', message: '确定开启强制报警?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1012,10 +1025,10 @@ debugger;
buttonText: "开启", buttonText: "开启",
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} else { } else {
if (this.formData.sta_LedType == 'led_alarm') { if (this.formData.sta_LedType == 'led_alarm') {
this.showPop({ showPop({
message: '确定解除声光报警模式?', message: '确定解除声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1032,7 +1045,7 @@ debugger;
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} else { } else {
let newval=this.formData.sta_LedType===item.key?'led_off':item.key; let newval=this.formData.sta_LedType===item.key?'led_off':item.key;
task(newval); task(newval);
@ -1202,7 +1215,7 @@ debugger;
name: deviceName name: deviceName
}); });
} }
this.showMsg(msg.join(',')); MsgError(msg.join(','),'',these);
}); });
return; return;
// clearInterval(instrusionTime); // clearInterval(instrusionTime);
@ -1222,7 +1235,7 @@ debugger;
// this.formData.sta_IntrusTime = 0; // this.formData.sta_IntrusTime = 0;
} }
if (msg.length > 0) { if (msg.length > 0) {
this.showMsg(msg.join(',')); MsgError(msg.join(','),'',these);
} }
@ -1346,6 +1359,7 @@ debugger;
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -1367,7 +1381,7 @@ debugger;
}, },
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1395,7 +1409,7 @@ debugger;
} }
}) })
} }
}); },these);
}, },
proParam: function() { proParam: function() {
@ -1423,9 +1437,6 @@ debugger;
} }
}); });
}, },
closePop: function() { closePop: function() {
this.Status.Pop.showPop = false; this.Status.Pop.showPop = false;
@ -1445,7 +1456,7 @@ debugger;
} }
}, },
showPop: function(option) { showPop: function(option) {
// hideLoading(this); hideLoading(this);
let def = { let def = {
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
popType: 'custom', popType: 'custom',
@ -1491,25 +1502,11 @@ debugger;
option.buttonBgColor = '#BBE600'; option.buttonBgColor = '#BBE600';
} }
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
},
showMsg(msg, isSucc) {
let icoUrl = '/static/images/common/uploadErr.png';
let borderColor = "#e034344d";
let buttonBgColor = "#E03434";
if (isSucc) {
icoUrl = '/static/images/common/success.png';
borderColor = "#BBE600";
buttonBgColor = "#BBE600";
}
this.showPop({
message: msg,
iconUrl: icoUrl,
borderColor: borderColor,
buttonBgColor: buttonBgColor,
buttonText: '确定',
okCallback: null
});
} }
} }
} }
</script> </script>

View File

@ -281,7 +281,7 @@
</MessagePopup> </MessagePopup>
<MsgBox ref="msgPop" />
<global-loading ref="loading" /> <global-loading ref="loading" />
</view> </view>
</template> </template>
@ -304,7 +304,14 @@
} from '@/api/4877/BJQ4877.js'; } from '@/api/4877/BJQ4877.js';
import MqTool from '@/utils/MqHelper.js' import MqTool from '@/utils/MqHelper.js'
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "/pages/4877/BJQ4877"; const pagePath = "/pages/4877/BJQ4877";
var ble = null; var ble = null;
@ -711,14 +718,14 @@
if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('55') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -749,7 +756,7 @@
cancelCallback: () => { cancelCallback: () => {
this.Status.ShowEditChannel = false; this.Status.ShowEditChannel = false;
} }
}); },these);
}, },
onChannelChanging() { onChannelChanging() {
let regex = /^(0|([1-9]\d?)|1[01]\d|12[0-5])$/; let regex = /^(0|([1-9]\d?)|1[01]\d|12[0-5])$/;
@ -792,14 +799,14 @@
if (!this.permissions.includes('53') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('53') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -855,14 +862,14 @@
groupCheck() { groupCheck() {
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
uni.navigateTo({ uni.navigateTo({
@ -916,7 +923,7 @@
showUnWarn(val) { showUnWarn(val) {
// this.showPop({ // showPop({
// message: '确定解除声光报警模式?', // message: '确定解除声光报警模式?',
// iconUrl: "/static/images/common/uploadErr.png", // iconUrl: "/static/images/common/uploadErr.png",
// borderColor: "#e034344d", // borderColor: "#e034344d",
@ -938,14 +945,14 @@
if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('54') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -997,14 +1004,14 @@
sosSetting(item, index) { sosSetting(item, index) {
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
let f = this.getDevice(); let f = this.getDevice();
@ -1037,7 +1044,7 @@
let confirmTask = () => { let confirmTask = () => {
this.showPop({ showPop({
message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?', message: '确定' + (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启') + '声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1046,7 +1053,7 @@
buttonText: (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启'), buttonText: (this.formData.sta_SOSType === 'sos' ? '关闭' : '开启'),
showCancel: true, showCancel: true,
buttonCancelText: '取消' buttonCancelText: '取消'
}); },these);
} }
if (item.val === 'sos') { if (item.val === 'sos') {
confirmTask(); confirmTask();
@ -1258,7 +1265,7 @@
}, },
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -1286,7 +1293,7 @@
} }
}) })
} }
}); },these);
}, },
proParam: function() { proParam: function() {
@ -1383,6 +1390,8 @@
} }
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
}, },
showMsg(msg, isSucc) { showMsg(msg, isSucc) {
let icoUrl = '/static/images/common/uploadErr.png'; let icoUrl = '/static/images/common/uploadErr.png';
let borderColor = "#e034344d"; let borderColor = "#e034344d";
@ -1392,17 +1401,14 @@
borderColor = "#BBE600"; borderColor = "#BBE600";
buttonBgColor = "#BBE600"; buttonBgColor = "#BBE600";
} }
this.showPop({ showPop({
message: msg, message: msg,
iconUrl: icoUrl, iconUrl: icoUrl,
borderColor: borderColor, borderColor: borderColor,
buttonBgColor: buttonBgColor, buttonBgColor: buttonBgColor,
buttonText: '确定', buttonText: '确定',
okCallback: null okCallback: null
}); },this);
},
btnClick() {
} }
} }
} }

View File

@ -501,7 +501,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
onHide: function() { onHide: function() {
@ -569,7 +572,10 @@
these.formData.bleStatu = 'connecting'; these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
}); });
@ -2074,7 +2080,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -2102,6 +2109,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }

View File

@ -16,7 +16,8 @@
<view class="row"> <view class="row">
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image> <image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
<view class="txt"> <view class="txt">
<view class="bigTxt">{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }} <view class="bigTxt">
{{formData.sta_charge?dic.sta_charge[formData.sta_charge+'']:"未充电" }}
</view> </view>
<view class="smallTxt">设备状态</view> <view class="smallTxt">设备状态</view>
</view> </view>
@ -248,7 +249,7 @@
</view> </view>
</view> </view>
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -265,7 +266,16 @@
baseURL baseURL
} from '@/utils/request.js' } from '@/utils/request.js'
import Common from '@/utils/Common.js' import Common from '@/utils/Common.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "/pages/018A/HBY018A"; const pagePath = "/pages/018A/HBY018A";
var ble = null; var ble = null;
@ -419,7 +429,10 @@
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.setBleFormData(); these.setBleFormData();
@ -439,7 +452,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
computed: { computed: {
@ -551,7 +567,7 @@
this.closePop(item); this.closePop(item);
} }
if (msg) { if (msg) {
this.showPop({ showPop({
key: Common.guid(), key: Common.guid(),
message: msg, message: msg,
iconUrl: "/static/images/common/playingActive.png", iconUrl: "/static/images/common/playingActive.png",
@ -561,7 +577,7 @@
buttonText: '确定', buttonText: '确定',
buttonCancelText: '取消', buttonCancelText: '取消',
showCancel: true showCancel: true
}); },these);
} else { } else {
exec(); exec();
} }
@ -667,7 +683,7 @@
// },500) // },500)
} }
this.showPop({ showPop({
key: key, key: key,
message: msg, message: msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
@ -677,7 +693,7 @@
buttonText: '确定', buttonText: '确定',
buttonCancelText: '取消', buttonCancelText: '取消',
showCancel: true showCancel: true
}); },these);
}, },
deviceRecovry(res) { deviceRecovry(res) {
@ -742,7 +758,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -838,7 +855,7 @@
}, },
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
key: Common.guid(), key: Common.guid(),
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
@ -867,7 +884,7 @@
} }
}) })
} }
}); },these);
}, },
proParam: function() { proParam: function() {
@ -918,58 +935,7 @@
} }
}, },
//根据传入的配置,自定义一个弹窗
showPop: function(option) {
let def = {
key: '',
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
cancelCallback: null
}
let json = {};
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
json[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
json[key] = option[key];
}
}
if (!json.borderColor) {
json.borderColor = '#BBE600';
json.buttonBgColor = '#BBE600';
}
json.showPop = true;
if (!('key' in json)) {
json.key = Common.guid();
}
this.Msgboxs.push(json);
},
showMsg(msg, type) { showMsg(msg, type) {
let cfg = { let cfg = {
@ -1008,7 +974,7 @@
buttonText: '确定', buttonText: '确定',
okCallback: this.closePop okCallback: this.closePop
}; };
this.showPop(options); showPop(options,these);
} }
} }
} }

View File

@ -162,13 +162,7 @@
</view> </view>
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" />
<!-- 下方菜单 --> <!-- 下方菜单 -->
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick" <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@ -182,6 +176,7 @@
</BottomSlideMenuPlus> </BottomSlideMenuPlus>
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -201,6 +196,14 @@
} from '@/utils/request.js'; } from '@/utils/request.js';
var pagePath = "/pages/6155/BJQ6155"; var pagePath = "/pages/6155/BJQ6155";
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
var ble = null; var ble = null;
var these = null; var these = null;
@ -413,7 +416,10 @@
these.formData.bleStatu = 'connecting'; these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.setBleFormData(); these.setBleFormData();
these.getDetail(); these.getDetail();
@ -433,7 +439,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
onBackPress(e) { onBackPress(e) {
@ -480,6 +489,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -640,7 +650,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -769,11 +780,11 @@
return; return;
} }
let os = plus.os.name; let os = plus.os.name;
// 分包发送图片数据 // 分包发送图片数据
var sendImagePackets = function(ReSendNo) { var sendImagePackets = function(ReSendNo) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 总数据包数 // 总数据包数
let totalPackets = os=='Android'?52:200; let totalPackets = os=='Android'?52:200;
let currentPacket = 1; let currentPacket = 1;
@ -808,11 +819,7 @@
// 计算当前包的数据 // 计算当前包的数据
let packetSize = os == 'Android' ? 250 : 64; let packetSize = os == 'Android' ? 250 : 64;
// if (currentPacket <= 51) {
// packetSize = 250; // 前51个包每个500字节
// } else {
// packetSize = 50; // 最后一个包100字节
// }
// 创建数据包 // 创建数据包
let startIndex = (currentPacket - 1) * packetSize; let startIndex = (currentPacket - 1) * packetSize;
@ -824,7 +831,7 @@
let packetData = these.rgb565Data.slice(startIndex, let packetData = these.rgb565Data.slice(startIndex,
endIndex); endIndex);
// 构建数据包 // 构建数据包
let bufferSize = os ==packetSize.length*2+5; // 5 + packetData.length * 2; // 头部5字节 + 数据部分 let bufferSize = packetData.length * 2+5; // 头部5字节 + 数据部分
let buffer = new ArrayBuffer(bufferSize); let buffer = new ArrayBuffer(bufferSize);
let dataView = new DataView(buffer); let dataView = new DataView(buffer);
@ -911,8 +918,9 @@
console.log("data=", data); console.log("data=", data);
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
these.rgb565Data = Common.convertToRGB565(data.piexls); these.rgb565Data = Common.convertToRGB565(data.piexls);
console.log("1111111111")
setTimeout(function() { setTimeout(function() {
console.log("1111111111")
sendImagePackets().catch(() => { sendImagePackets().catch(() => {
}); });
@ -1540,6 +1548,7 @@
option.buttonBgColor = '#BBE600'; option.buttonBgColor = '#BBE600';
} }
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
showPop(option, these);
}, },
sendUsr() { sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {

View File

@ -163,13 +163,7 @@
</view> </view>
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" />
<!-- 下方菜单 --> <!-- 下方菜单 -->
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick" <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@ -183,6 +177,7 @@
</BottomSlideMenuPlus> </BottomSlideMenuPlus>
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -202,6 +197,14 @@
} from '@/utils/request.js'; } from '@/utils/request.js';
var pagePath = "/pages/6155/deviceDetail"; var pagePath = "/pages/6155/deviceDetail";
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
var ble = null; var ble = null;
var these = null; var these = null;
@ -383,6 +386,9 @@
these.formData.bleStatu = 'connecting'; these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
these.setBleFormData(); these.setBleFormData();
these.getDetail(); these.getDetail();
@ -403,7 +409,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
onBackPress(e) { onBackPress(e) {
@ -450,6 +459,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -621,7 +631,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -1625,6 +1636,7 @@
option.buttonBgColor = '#BBE600'; option.buttonBgColor = '#BBE600';
} }
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
showPop(option,this);
}, },
sendUsr() { sendUsr() {

View File

@ -471,6 +471,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:"+ex.msg,"确定",these);
}); });
return; return;
} }
@ -583,6 +584,8 @@
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) })
these.formData.bleStatu = 'err';
MsgError("连接错误:"+ex.msg,"确定",these);
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -2023,6 +2026,9 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then( ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(
res => { res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex=>{
these.formData.bleStatu = 'err';
MsgError("连接错误:"+ex.msg,"确定",these);
}); });
} }
} }
@ -2043,6 +2049,8 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
this.formData.bleStatu = true; this.formData.bleStatu = true;
}).catch(ex=>{
MsgError("连接错误:"+ex.msg,"确定",these);
}); });
} }
}, },

View File

@ -221,7 +221,7 @@
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -236,7 +236,15 @@
} from '@/utils/loading.js' } from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js'; import request, { baseURL } from '@/utils/request.js';
import usrApi from '@/api/670/HBY670.js' import usrApi from '@/api/670/HBY670.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "pages/6331/BJQ6331"; const pagePath = "pages/6331/BJQ6331";
var ble = null; var ble = null;
@ -401,7 +409,10 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.deviceId = f.deviceId; these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.setBleFormData(); these.setBleFormData();
these.getDetail(); these.getDetail();
@ -420,7 +431,10 @@ import request, { baseURL } from '@/utils/request.js';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
computed: { computed: {
@ -452,7 +466,7 @@ import request, { baseURL } from '@/utils/request.js';
let play = () => { let play = () => {
alert('正在播放中'); alert('正在播放中');
} }
this.showPop({ showPop({
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
popType: 'custom', popType: 'custom',
bgColor: '#383934bd', bgColor: '#383934bd',
@ -469,7 +483,7 @@ import request, { baseURL } from '@/utils/request.js';
modelValue: '', modelValue: '',
visibleClose: true, visibleClose: true,
okCallback: play okCallback: play
}); },these);
}, },
audioManage() { //语音管理 audioManage() { //语音管理
uni.navigateTo({ uni.navigateTo({
@ -594,12 +608,12 @@ import request, { baseURL } from '@/utils/request.js';
ble.sendHexs(f.deviceId, array, f.writeServiceId, f.wirteCharactId, 100).catch(ex => { ble.sendHexs(f.deviceId, array, f.writeServiceId, f.wirteCharactId, 100).catch(ex => {
these.showPop({ showPop({
message: "发送失败," + ex.msg, message: "发送失败," + ex.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}); });
}, },
@ -670,7 +684,8 @@ import request, { baseURL } from '@/utils/request.js';
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -734,7 +749,7 @@ import request, { baseURL } from '@/utils/request.js';
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -762,7 +777,7 @@ import request, { baseURL } from '@/utils/request.js';
} }
}) })
} }
}); },these);

View File

@ -177,13 +177,7 @@
</view> </view>
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" />
<!-- 下方菜单 --> <!-- 下方菜单 -->
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick" <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@ -198,6 +192,7 @@
</BottomSlideMenuPlus> </BottomSlideMenuPlus>
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -213,7 +208,15 @@
} from '@/utils/loading.js' } from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js'; import request, { baseURL } from '@/utils/request.js';
import usrApi from '@/api/670/HBY670.js' import usrApi from '@/api/670/HBY670.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "/pages/650/HBY650"; const pagePath = "/pages/650/HBY650";
var ble = null; var ble = null;
@ -234,24 +237,7 @@ import request, { baseURL } from '@/utils/request.js';
}, },
pageHide: false, pageHide: false,
Pop: {
showPop: false, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '您确定要这样做吗?',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '设备名称',
modelValue: '',
visibleClose: false,
okCallback: null
},
BottomMenu: { BottomMenu: {
show: false, show: false,
showHeader: true, showHeader: true,
@ -404,7 +390,10 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.bleStatu='connecting'; these.formData.bleStatu='connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.setBleFormData(); these.setBleFormData();
console.error("222222"); console.error("222222");
these.getDetail(); these.getDetail();
@ -425,7 +414,10 @@ import request, { baseURL } from '@/utils/request.js';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
computed: { computed: {
@ -466,6 +458,7 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex=>{ }).catch(ex=>{
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -569,7 +562,8 @@ import request, { baseURL } from '@/utils/request.js';
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -655,12 +649,12 @@ import request, { baseURL } from '@/utils/request.js';
} }
if (these.formData.iswarn) { if (these.formData.iswarn) {
these.showPop({ showPop({
message: "环境存在漏电电源", message: "环境存在漏电电源",
iconUrl: "/static/images/6155/DeviceDetail/warnning.png", iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
} }
these.setBleFormData(); these.setBleFormData();
@ -733,14 +727,14 @@ import request, { baseURL } from '@/utils/request.js';
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -813,12 +807,12 @@ import request, { baseURL } from '@/utils/request.js';
console.log("发送成功了"); console.log("发送成功了");
}).catch((ex) => { }).catch((ex) => {
these.showPop({ showPop({
message: ex.msg, message: ex.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
@ -838,7 +832,7 @@ import request, { baseURL } from '@/utils/request.js';
}, },
showBleUnConnect() { showBleUnConnect() {
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -866,19 +860,19 @@ import request, { baseURL } from '@/utils/request.js';
} }
}) })
} }
}); },these);
}, },
LampToggle: function() { LampToggle: function() {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
this.formData.cMode = !this.formData.cMode; this.formData.cMode = !this.formData.cMode;
@ -932,11 +926,11 @@ import request, { baseURL } from '@/utils/request.js';
if (currentPacket > totalPackets) { if (currentPacket > totalPackets) {
hideLoading(these); hideLoading(these);
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
these.showPop({ showPop({
showPop: true, showPop: true,
message: "上传成功", message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
}); },these);
if (!ReSendNo) { if (!ReSendNo) {
setTimeout(() => { setTimeout(() => {
these.HoldYouHand("transmit complete", 0, f these.HoldYouHand("transmit complete", 0, f
@ -1005,23 +999,23 @@ import request, { baseURL } from '@/utils/request.js';
}) })
currentPacket++; currentPacket++;
setTimeout(sendNextPacket, 0); setTimeout(sendNextPacket, 80);
}).catch(err => { }).catch(err => {
console.log("发送数据包失败了" + JSON.stringify(err)); console.log("发送数据包失败了" + JSON.stringify(err));
if (err.code == '10007') { if (err.code == '10007') {
setTimeout(sendNextPacket, 0); setTimeout(sendNextPacket, 500);
return; return;
} }
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
these.showPop({ showPop({
message: err.msg, message: err.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
hideLoading(these); hideLoading(these);
reject(err); reject(err);
}); });
@ -1037,12 +1031,12 @@ import request, { baseURL } from '@/utils/request.js';
sendNextPacket(); sendNextPacket();
}).catch((err) => { }).catch((err) => {
console.log("握手没有成功"); console.log("握手没有成功");
these.showPop({ showPop({
message: err.msg, message: err.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
hideLoading(these); hideLoading(these);
reject(err); reject(err);
}); });
@ -1114,11 +1108,11 @@ import request, { baseURL } from '@/utils/request.js';
} }
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
showPop: true, showPop: true,
message: "上传成功", message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
}); },these);
@ -1188,14 +1182,14 @@ import request, { baseURL } from '@/utils/request.js';
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
showPop: true, showPop: true,
message: err.msg + ",发送失败了", message: err.msg + ",发送失败了",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
buttonText: "确定", buttonText: "确定",
iconUrl: "/static/images/common/uploadErr.png" iconUrl: "/static/images/common/uploadErr.png"
}); },these);
reject(err); reject(err);
return; return;
} }
@ -1290,23 +1284,23 @@ import request, { baseURL } from '@/utils/request.js';
console.log("服务器未返回正确的数据"); console.log("服务器未返回正确的数据");
these.showPop({ showPop({
message: "与服务器连接出现异常,请检查网络设置", message: "与服务器连接出现异常,请检查网络设置",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
} }
}).catch((ex) => { }).catch((ex) => {
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
message: "出现异常," + ex.msg, message: "出现异常," + ex.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}) })
} }
let f = these.getDevice(); let f = these.getDevice();
@ -1373,14 +1367,14 @@ import request, { baseURL } from '@/utils/request.js';
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
//上传开机画面 //上传开机画面
@ -1422,84 +1416,19 @@ import request, { baseURL } from '@/utils/request.js';
this.Status.BottomMenu.activeIndex = index; this.Status.BottomMenu.activeIndex = index;
}, },
closePop: function() {
this.Status.Pop.showPop = false;
if (this.Status.Pop.cancelCallback) {
this.Status.Pop.cancelCallback();
}
},
HidePop: function() {
if (this.Status.Pop.clickEvt == 'SendUsr') {
}
this.Status.Pop.showPop = false;
if (this.Status.Pop.okCallback) {
this.Status.Pop.okCallback();
}
},
showPop: function(option) {
hideLoading(this);
let def = {
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
borderColor: '#BBE600',
textColor: '#ffffffde',
buttonBgColor: '#BBE600',
buttonTextColor: '#232323DE',
iconUrl: '',
message: '',
buttonText: '确定',
clickEvt: '',
visiblePrompt: false,
promptTitle: '',
modelValue: '',
visibleClose: false,
okCallback: null,
showSlot: false,
buttonCancelText: '',
showCancel: false,
}
let keys = Object.keys(def);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
if (key in option) {
continue;
}
this.Status.Pop[key] = def[key];
}
if (option) {
keys = Object.keys(option);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
this.Status.Pop[key] = option[key];
}
}
if (!option.borderColor) {
option.borderColor = '#BBE600';
option.buttonBgColor = '#BBE600';
}
these.Status.Pop.showPop = true;
},
sendUsr: function(ReSendNo) { sendUsr: function(ReSendNo) {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -1543,7 +1472,7 @@ import request, { baseURL } from '@/utils/request.js';
} }
these.showPop({ showPop({
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
popType: 'custom', popType: 'custom',
bgColor: '#383934bd', bgColor: '#383934bd',
@ -1559,7 +1488,7 @@ import request, { baseURL } from '@/utils/request.js';
promptTitle: '', promptTitle: '',
modelValue: '', modelValue: '',
visibleClose: true visibleClose: true
}); },these);
these.setBleFormData(); these.setBleFormData();
@ -1617,12 +1546,12 @@ import request, { baseURL } from '@/utils/request.js';
setTimeout(sendNextPacket, 0); setTimeout(sendNextPacket, 0);
}).catch(err => { }).catch(err => {
these.showPop({ showPop({
message: "文字发送失败," + err.msg, message: "文字发送失败," + err.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
hideLoading(these); hideLoading(these);
}); });
@ -1651,12 +1580,12 @@ import request, { baseURL } from '@/utils/request.js';
}).catch((ex) => { }).catch((ex) => {
console.log("握手没有成功", ex); console.log("握手没有成功", ex);
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
message: ex.msg, message: ex.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}); });
}, 0); }, 0);

View File

@ -2,9 +2,11 @@
<view class="content contentBg"> <view class="content contentBg">
<uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true" <uni-nav-bar :border="false" @clickLeft="prevPage" fixed="true" statusBar="true"
background-color="#121212" color="#FFFFFF" :title="Status.navbar.title"> background-color="#121212" color="#FFFFFF" :title="Status.navbar.title">
<template v-slot:left><view> <template v-slot:left>
<view>
<uni-icons type="left" size="24" color="#FFFFFF"></uni-icons> <uni-icons type="left" size="24" color="#FFFFFF"></uni-icons>
</view></template> </view>
</template>
<block slot="right"> <block slot="right">
<view class="navbarRight center"> <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> <image @click.stop="handleRightClick(index,item)" v-for="item,index in Status.navbar.icons" class="img" :src="item.src" mode="aspectFit"></image>
@ -142,7 +144,8 @@
mode="aspectFit"></image> mode="aspectFit"></image>
</view> </view>
<view :class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'"> <view :class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'">
报警中{{Status.staticWarn.time}}</view> 报警中{{Status.staticWarn.time}}
</view>
<view :class="(formData.qzwarn && Status.staticWarn.time)?'displayNone':''" class="txt">声光报警</view> <view :class="(formData.qzwarn && Status.staticWarn.time)?'displayNone':''" class="txt">声光报警</view>
</view> </view>
<view class="item" @click="sosSetting('rb')" :class="formData.SOS=='rb'?'active':''"> <view class="item" @click="sosSetting('rb')" :class="formData.SOS=='rb'?'active':''">
@ -267,14 +270,6 @@
</view> </view>
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" @closePop="closePop" @cancelPop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" :showCancel="Status.Pop.showCancel"
:buttonCancelText="Status.Pop.buttonCancelText" />
<!-- 下方菜单 --> <!-- 下方菜单 -->
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick" <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@ -288,7 +283,17 @@
</view> </view>
</BottomSlideMenuPlus> </BottomSlideMenuPlus>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" @closePop="closePop" @cancelPop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" :showCancel="Status.Pop.showCancel"
:buttonCancelText="Status.Pop.buttonCancelText" />
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -306,7 +311,14 @@
} from '@/utils/loading.js' } from '@/utils/loading.js'
import request, { baseURL } from '@/utils/request.js'; import request, { baseURL } from '@/utils/request.js';
import lnglatConvert from '@/utils/wgs84_to_gcj02.js'; import lnglatConvert from '@/utils/wgs84_to_gcj02.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
const pagePath = "/pages/670/HBY670"; const pagePath = "/pages/670/HBY670";
var ble = null; var ble = null;
var these = null; var these = null;
@ -491,7 +503,7 @@
ble = BleTool.getBleTool(); ble = BleTool.getBleTool();
this.$watch("formData.battary", (newVal, oldVal) => { this.$watch("formData.battary", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system == 2) { if (newVal <= 20 && this.formData.sta_system == 2) {
this.showMsg("设备电量低"); MsgError("设备电量低",'',these);
} }
}); });
@ -555,7 +567,10 @@
these.formData.bleStatu='connecting'; these.formData.bleStatu='connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
}); });
}, },
@ -568,7 +583,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
onHide: function() { onHide: function() {
@ -615,6 +633,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex=>{ }).catch(ex=>{
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -693,7 +712,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -715,7 +735,7 @@
if (this.Status.bleLinkCnt > 3) { if (this.Status.bleLinkCnt > 3) {
return; return;
} }
this.showPop({ showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消" + (4 - this.Status.bleLinkCnt) + "次后不再提醒", message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备,取消" + (4 - this.Status.bleLinkCnt) + "次后不再提醒",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
@ -747,7 +767,7 @@
} }
}) })
} }
}); },these);
}, },
gotoMap() { gotoMap() {
let promise = lnglatConvert.wgs84_to_gcj02(this.formData.Lon, this.formData.Lat); let promise = lnglatConvert.wgs84_to_gcj02(this.formData.Lon, this.formData.Lat);
@ -943,11 +963,11 @@
// } // }
if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知 if (keys.indexOf('sta_BreakNews') > -1) { //紧急通知
if(json.sta_BreakNews=='I get it'){ if(json.sta_BreakNews=='I get it'){
these.showPop({ showPop({
showPop: true, showPop: true,
message: "用户已确认收到紧急通知", message: "用户已确认收到紧急通知",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
}); },these);
} }
} }
@ -1129,14 +1149,14 @@
msgs.push("设备静止报警中"); msgs.push("设备静止报警中");
} }
if (msgs.length > 0) { if (msgs.length > 0) {
this.showPop({ showPop({
message: msgs.join(";"), message: msgs.join(";"),
iconUrl: "/static/images/6155/DeviceDetail/warnning.png", iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
buttonText: "确定", buttonText: "确定",
clickEvt: "staticWarn" clickEvt: "staticWarn"
}); },these);
} }
@ -1169,14 +1189,14 @@
lightSetting: function(type) { lightSetting: function(type) {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
if (this.formData.lightCurr == type) { if (this.formData.lightCurr == type) {
@ -1212,12 +1232,12 @@
console.log("4g发送成功"); console.log("4g发送成功");
}).catch((ex) => { }).catch((ex) => {
console.log("ex=", ex); console.log("ex=", ex);
these.showPop({ showPop({
message: "通信异常,请检查手机或设备网络", message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
hideLoading(these); hideLoading(these);
@ -1260,9 +1280,10 @@
CloseWarn: function(ispop) { //解除强制报警 CloseWarn: function(ispop) { //解除强制报警
let closeEvt = () => { let closeEvt = () => {
these.Status.Pop.showPop = false;
these.formData.qzwarn = false; these.formData.qzwarn = false;
these.Status.staticWarn.inteval=null
clearInterval(these.Status.staticWarn.inteval); clearInterval(these.Status.staticWarn.inteval);
let requestCloseSOS = () => { let requestCloseSOS = () => {
@ -1276,12 +1297,12 @@
}).catch((ex) => { }).catch((ex) => {
console.log("ex=", ex); console.log("ex=", ex);
these.showPop({ showPop({
message: "通信异常,请检查手机或设备网络", message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
hideLoading(these); hideLoading(these);
@ -1352,20 +1373,20 @@
this.Status.Pop.okCallback = null; this.Status.Pop.okCallback = null;
}, },
clickEvt: 'time' clickEvt: 'time'
}); },these);
}, },
sosSetting: function(type) { sosSetting: function(type) {
debugger; debugger;
if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('42') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -1374,9 +1395,7 @@
type = "close"; type = "close";
} }
showLoading(this, {
text: "请稍候..."
});
let task = () => { let task = () => {
let dic = { let dic = {
@ -1432,12 +1451,12 @@
} }
}).catch((ex) => { }).catch((ex) => {
console.log("ex=", ex); console.log("ex=", ex);
these.showPop({ showPop({
message: "通信异常,请检查手机或设备网络", message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
hideLoading(these); hideLoading(these);
@ -1484,7 +1503,11 @@
} }
let OpenSOS = () => { let OpenSOS = () => {
showLoading(this, {
text: "请稍候..."
});
let execSos = () => { let execSos = () => {
these.formData.qzwarn = true; //标记为强制报警了 these.formData.qzwarn = true; //标记为强制报警了
these.Status.staticWarn.time = 180; these.Status.staticWarn.time = 180;
@ -1550,17 +1573,18 @@
} else if (type == 'sg') //强制报警 } else if (type == 'sg') //强制报警
{ {
this.showPop({ showPop({
message: '确定开启声光报警模式?', message: '确定开启声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: OpenSOS, okCallback: OpenSOS,
buttonText: "开启" buttonText: "开启"
}); },these);
return; return;
} else if (type == 'close') { } else if (type == 'close') {
console.log("this.formData.SOS=",this.formData.SOS);
console.log("inteval=",this.Status.staticWarn.inteval);
if (this.formData.SOS = 'sg' && this.Status.staticWarn.inteval) { //解除声光报警 if (this.formData.SOS = 'sg' && this.Status.staticWarn.inteval) { //解除声光报警
this.CloseWarn(true); this.CloseWarn(true);
} else { } else {
@ -1578,14 +1602,14 @@
GearSetting: function(type) { //档位设置 GearSetting: function(type) { //档位设置
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
if (this.formData.modeCurr == type) { if (this.formData.modeCurr == type) {
@ -1620,12 +1644,12 @@
console.log("4g发送成功"); console.log("4g发送成功");
}).catch((ex) => { }).catch((ex) => {
console.log("ex=", ex) console.log("ex=", ex)
these.showPop({ showPop({
message: "通信异常,请检查手机或设备网络", message: "通信异常,请检查手机或设备网络",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
hideLoading(these); hideLoading(these);
@ -1676,14 +1700,14 @@
proDetail: function(type) { proDetail: function(type) {
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
uni.navigateTo({ uni.navigateTo({
@ -1706,21 +1730,21 @@
deviceImei: these.device.deviceImei deviceImei: these.device.deviceImei
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
these.showPop({ showPop({
showPop: true, showPop: true,
message: "上传成功", message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
}); },these);
resolve(); resolve();
return; return;
} else { } else {
these.showPop({ showPop({
message: res.errMsg ? res.errMsg : "未知的原因上传失败了", message: res.errMsg ? res.errMsg : "未知的原因上传失败了",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
reject(res); reject(res);
} }
}).catch((ex) => { }).catch((ex) => {
@ -1752,11 +1776,11 @@
if (currentPacket > totalPackets) { if (currentPacket > totalPackets) {
hideLoading(these); hideLoading(these);
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
these.showPop({ showPop({
showPop: true, showPop: true,
message: "上传成功", message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
}); },these);
if (!ReSendNo) { if (!ReSendNo) {
setTimeout(() => { setTimeout(() => {
these.HoldYouHand("transmit complete", 0, f these.HoldYouHand("transmit complete", 0, f
@ -1826,11 +1850,11 @@
}); });
currentPacket++; currentPacket++;
setTimeout(sendNextPacket, 0); setTimeout(sendNextPacket, 80);
}).catch(err => { }).catch(err => {
console.log("发送数据包失败了" + JSON.stringify(err)); console.log("发送数据包失败了" + JSON.stringify(err));
if (err.code == '10007') { if (err.code == '10007') {
setTimeout(sendNextPacket, 0); setTimeout(sendNextPacket, 500);
return; return;
} else { } else {
updateLoading(these, { updateLoading(these, {
@ -1839,7 +1863,7 @@
sendImgByRequest().then(resolve).catch(reject); sendImgByRequest().then(resolve).catch(reject);
} }
// these.Status.BottomMenu.show = false; // these.Status.BottomMenu.show = false;
// these.showPop({ // showPop({
// message: err.msg, // message: err.msg,
// iconUrl: "/static/images/common/uploadErr.png", // iconUrl: "/static/images/common/uploadErr.png",
// borderColor: "#e034344d", // borderColor: "#e034344d",
@ -1937,11 +1961,11 @@
} }
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
showPop: true, showPop: true,
message: "上传成功", message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png" iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
}); },these);
@ -1989,7 +2013,7 @@
let inteval = 30; let inteval = 50;
console.log("开始发送一段视频"); // console.log("开始发送一段视频"); //
ble.sendData(f.deviceId, buffer, f.writeServiceId, f ble.sendData(f.deviceId, buffer, f.writeServiceId, f
.wirteCharactId, 10).then(() => { .wirteCharactId, 10).then(() => {
@ -2013,14 +2037,14 @@
these.Status.BottomMenu.show = false; these.Status.BottomMenu.show = false;
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
showPop: true, showPop: true,
message: err.msg + ",发送失败了", message: err.msg + ",发送失败了",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
buttonText: "确定", buttonText: "确定",
iconUrl: "/static/images/common/uploadErr.png" iconUrl: "/static/images/common/uploadErr.png"
}); },these);
reject(err); reject(err);
return; return;
} }
@ -2117,23 +2141,23 @@
console.log("服务器未返回正确的数据", arr); console.log("服务器未返回正确的数据", arr);
these.showPop({ showPop({
message: "与服务器连接出现异常,请检查网络设置", message: "与服务器连接出现异常,请检查网络设置",
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
} }
}).catch((ex) => { }).catch((ex) => {
hideLoading(these); hideLoading(these);
these.showPop({ showPop({
message: "出现异常," + ex.msg, message: "出现异常," + ex.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}) })
} }
@ -2199,14 +2223,14 @@
ShowUpload: function() { ShowUpload: function() {
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
//上传开机画面 //上传开机画面
@ -2320,14 +2344,14 @@
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
@ -2343,7 +2367,7 @@
code: this.formData.usrid code: this.formData.usrid
}; };
api.sendUsr(json).then((res) => { api.sendUsr(json).then((res) => {
these.showPop({ showPop({
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
popType: 'custom', popType: 'custom',
bgColor: '#383934bd', bgColor: '#383934bd',
@ -2359,15 +2383,15 @@
promptTitle: '', promptTitle: '',
modelValue: '', modelValue: '',
visibleClose: true visibleClose: true
}); },these);
these.setBleFormData(); these.setBleFormData();
}).catch((ex) => { }).catch((ex) => {
these.showPop({ showPop({
message: "文字发送失败," + ex.msg, message: "文字发送失败," + ex.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
}).finally(() => { }).finally(() => {
hideLoading(these); hideLoading(these);
}); });
@ -2415,7 +2439,7 @@
} }
these.showPop({ showPop({
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
popType: 'custom', popType: 'custom',
bgColor: '#383934bd', bgColor: '#383934bd',
@ -2431,7 +2455,7 @@
promptTitle: '', promptTitle: '',
modelValue: '', modelValue: '',
visibleClose: true visibleClose: true
}); },these);
these.setBleFormData(); these.setBleFormData();
hideLoading(these); hideLoading(these);
@ -2522,7 +2546,7 @@
requestSend(); requestSend();
// console.log("握手没有成功", ex); // console.log("握手没有成功", ex);
// hideLoading(these); // hideLoading(these);
// these.showPop({ // showPop({
// message: ex.msg, // message: ex.msg,
// iconUrl: "/static/images/common/uploadErr.png", // iconUrl: "/static/images/common/uploadErr.png",
// borderColor: "#e034344d", // borderColor: "#e034344d",
@ -2538,14 +2562,14 @@
if (!this.permissions.includes('5') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('5') && this.Status.apiType !== 'listA') {
this.showPop({ showPop({
message: '无操作权限', message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
okCallback: null, okCallback: null,
buttonText: "确定" buttonText: "确定"
}) },these)
return; return;
} }
if (!this.formData.msgTxt) { if (!this.formData.msgTxt) {
@ -2573,7 +2597,7 @@
}).then((res) => { }).then((res) => {
console.log("res=", res) console.log("res=", res)
if (res.code == 200) { if (res.code == 200) {
these.showPop({ showPop({
showPop: true, //是否显示弹窗 showPop: true, //是否显示弹窗
popType: 'custom', popType: 'custom',
bgColor: '#383934bd', bgColor: '#383934bd',
@ -2589,7 +2613,7 @@
promptTitle: '', promptTitle: '',
modelValue: '', modelValue: '',
visibleClose: true visibleClose: true
}); },these);
// clearInterval(this.Status.msgOkIntval); // clearInterval(this.Status.msgOkIntval);
@ -2605,12 +2629,12 @@
} else { } else {
these.showPop({ showPop({
message: res.msg, message: res.msg,
iconUrl: "/static/images/common/uploadErr.png", iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d", borderColor: "#e034344d",
buttonBgColor: "#E03434", buttonBgColor: "#E03434",
}); },these);
} }
}).finally(() => { }).finally(() => {
hideLoading(this); hideLoading(this);

View File

@ -119,15 +119,15 @@
<view class="item"> <view class="item">
<text class="lbl">单位</text> <text class="lbl">单位</text>
<input class="value" v-model="formData.inputLines[0]" placeholder="请输入单位" placeholder-class="usrplace" /> <input class="value" maxlength="5" v-model="formData.inputLines[0]" placeholder="请输入单位" placeholder-class="usrplace" />
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">部门</text> <text class="lbl">部门</text>
<input class="value" v-model="formData.inputLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" /> <input class="value" maxlength="5" v-model="formData.inputLines[1]" placeholder="请输入姓名" placeholder-class="usrplace" />
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">姓名</text> <text class="lbl">姓名</text>
<input class="value" v-model="formData.inputLines[2]" placeholder="请输入职位" placeholder-class="usrplace" /> <input class="value" maxlength="5" v-model="formData.inputLines[2]" placeholder="请输入职位" placeholder-class="usrplace" />
</view> </view>
</view> </view>
@ -149,13 +149,7 @@
</view> </view>
</view> </view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" @closePop="closePop" :visiblePrompt="Status.Pop.visiblePrompt"
:promptTitle="Status.Pop.promptTitle" v-model="Status.Pop.modelValue" />
<!-- 下方菜单 --> <!-- 下方菜单 -->
<BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick" <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@ -169,6 +163,7 @@
</BottomSlideMenuPlus> </BottomSlideMenuPlus>
<global-loading ref="loading" /> <global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view> </view>
</template> </template>
@ -183,7 +178,14 @@
} from '@/utils/loading.js' } from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive'; import BleReceive from '@/utils/BleReceive';
import Common from '@/utils/Common.js'; import Common from '@/utils/Common.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js'
var ble = null; var ble = null;
var these = null; var these = null;
var BrighInteval = null; var BrighInteval = null;
@ -363,7 +365,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.setBleFormData(); these.setBleFormData();
these.getDetail(); these.getDetail();
@ -384,7 +389,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => { ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功") console.log("连接成功")
these.formData.bleStatu = true; these.formData.bleStatu = true;
}); }).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
} }
}, },
computed: { computed: {
@ -452,6 +460,7 @@
these.formData.bleStatu = true; these.formData.bleStatu = true;
}).catch(ex => { }).catch(ex => {
these.formData.bleStatu = 'err'; these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}); });
return; return;
} }
@ -560,7 +569,8 @@
}).catch(ex => { }).catch(ex => {
updateLoading(these, { updateLoading(these, {
text: ex.msg text: ex.msg
}) });
these.formData.bleStatu = 'err';
}).finally(() => { }).finally(() => {
setTimeout(() => { setTimeout(() => {
hideLoading(these); hideLoading(these);
@ -1177,6 +1187,7 @@ debugger;
option.buttonBgColor = '#BBE600'; option.buttonBgColor = '#BBE600';
} }
these.Status.Pop.showPop = true; these.Status.Pop.showPop = true;
showPop(option,this);
}, },
sendUsr() { sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') { if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {

View File

@ -282,9 +282,9 @@
} }
//无效的设备回调 //无效的设备回调
let deviceInvalid = () => { let deviceInvalid = () => {
these.$set(these.device, "deviceName", ""); these.$set(these.device, "deviceName", "");
} }
clearTimeout(this.Statu.timeInteval); clearTimeout(this.Statu.timeInteval);

View File

@ -767,6 +767,9 @@
if (index == total) { if (index == total) {
console.log("连接了N次都没连上"); console.log("连接了N次都没连上");
reject(ex); reject(ex);
updateLoading(this, {
text: ex.msg
})
return; return;
} }
index++; index++;

View File

@ -887,6 +887,7 @@
ble.StopSearch().finally(res => { ble.StopSearch().finally(res => {
setTimeout(()=>{
this.EquipMents = []; this.EquipMents = [];
this.PairEquip = []; this.PairEquip = [];
ble.StartSearch().then(result => { ble.StartSearch().then(result => {
@ -895,6 +896,8 @@
console.error("err=", err); console.error("err=", err);
MsgError("出现错误:" + err.msg, '', these); MsgError("出现错误:" + err.msg, '', these);
}); });
},200);
}).catch(ex => { }).catch(ex => {
console.error("ex=", ex); console.error("ex=", ex);
MsgError("出现错误:" + ex.msg, '', these); MsgError("出现错误:" + ex.msg, '', these);
@ -1023,6 +1026,9 @@
}).catch((ex) => { }).catch((ex) => {
if (index == total) { if (index == total) {
console.log("连接了N次都没连上"); console.log("连接了N次都没连上");
updateLoading(this, {
text: ex.msg
});
reject(ex); reject(ex);
return; return;
} }

View File

@ -252,8 +252,12 @@
activeTabInfo: '', activeTabInfo: '',
dic: { dic: {
showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'], //需要发送消息的类型 showMsgTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'BJQ6075J'], //需要发送消息的类型
showMapTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J', 'HBY008A','HBY100-Y'], //需要显示地图的类型 showMapTypes: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J', 'HBY008A',
showCallPolice: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J','HBY008A', 'HBY100-Y'] //需要发送报警的类型 'HBY100-Y'
], //需要显示地图的类型
showCallPolice: ['BJQ6170', 'HBY210', 'HBY670', 'BJQ6075', 'HBY018A', 'HBY100-J', 'BJQ6075J',
'HBY008A', 'HBY100-Y'
] //需要发送报警的类型
}, },
isPageShow: true isPageShow: true
} }

View File

@ -909,7 +909,7 @@ class BleHelper {
this.updateCache(); this.updateCache();
} }
}, 500); }, 100);
}); });
@ -1157,7 +1157,7 @@ class BleHelper {
//停止搜索 //停止搜索
StopSearch() { StopSearch() {
if (this.data.platform == 'web' || !this.data.discovering) { if (this.data.platform == 'web' || !this.data.discovering) {
console.error("web平台或当前没有搜索,直接返回"); console.error("web平台或当前没有搜索,直接返回",this.data.discovering);
return Promise.resolve(); return Promise.resolve();
} }
let p1 = new Promise((resolve, reject) => { let p1 = new Promise((resolve, reject) => {