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

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

@ -10,7 +10,7 @@
<view slot="right">
<view class="navbarRight center">
<view class="imgContent" :class="{'visibilityHidden':Status.apiType!=item.apiType}"
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
@click.stop="handleRightClick(item,index)" v-for="item,index in Status.navbar.icons">
<image class="img" :src="item.src" mode="aspectFit"></image>
<view class="baber" v-if="item.math">{{item.math>9?'9+':item.math}}</view>
</view>
@ -62,9 +62,9 @@
<text class="value" :class="formData.bleStatu?'green':'red'">{{getbleStatu}}</text>
</view>
<!-- <view class="item">
<text class="lbl">设备状态</text>
<text class="value">{{formData.sta_system?dic.sta_system[formData.sta_system]:"" }}</text>
</view> -->
<text class="lbl">设备状态</text>
<text class="value">{{formData.sta_system?dic.sta_system[formData.sta_system]:"" }}</text>
</view> -->
</view>
<view class="lampMode">
@ -96,9 +96,10 @@
<view class="modeSetting">
<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,
'displayNone':!Status.usrToggle && index>3
}">
v-for="item,index in dic.sta_VoiceType" :class="{'active':formData.sta_VoiceType===item.key,
'displayNone' :!Status.usrToggle && index>
3
}">
<view class="outCircle">
<view class="item">
<view class="text">{{item.name}}</view>
@ -121,12 +122,12 @@
<view class="lampMode">
<view class="mode fleft " v-on:click.stop="openVolume(null,'8')"
:class="{'active':formData.sta_VoiceType==='8'}">
:class="{'active':formData.sta_VoiceType==='8'}">
<view class="leftImg">
<image class="img" :class="{'displayNone':formData.sta_VoiceType==='8'}"
src="/static/images/common/play.png" mode="aspectFit"></image>
src="/static/images/common/play.png" mode="aspectFit"></image>
<image class="img" :class="{'displayNone':formData.sta_VoiceType!=='8'}"
src="/static/images/common/pauseActive.png" mode="aspectFit"></image>
src="/static/images/common/pauseActive.png" mode="aspectFit"></image>
</view>
<view class="rightTxt">
<text class="bigTxt">播放语音</text>
@ -163,9 +164,9 @@
}" v-on:click.stop="lightTypeSet(item,index)">
<view class="leftImg">
<image class="img" :class="{'displayNone':formData.sta_LightType===item.key}"
src="/static/images/100/light.png" mode="aspectFit"></image>
src="/static/images/100/light.png" mode="aspectFit"></image>
<image class="img" :class="{'displayNone':formData.sta_LightType!==item.key}"
src="/static/images/100/lightActive.png" mode="aspectFit"></image>
src="/static/images/100/lightActive.png" mode="aspectFit"></image>
</view>
<view class="rightTxt">
@ -193,8 +194,8 @@
<view class="slider-container">
<slider min="10" max="100" step="10" :disabled="false" :value="formData.sta_LightDimmer"
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onBrightnessChanged" @changing="onBrightnessChanging" class="custom-slider" />
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onBrightnessChanged" @changing="onBrightnessChanging" class="custom-slider" />
</view>
<view class="line"></view>
@ -205,8 +206,8 @@
<view class="slider-container">
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.sta_LightFreq"
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onFreqChanged" @changing="onFreqChanging" class="custom-slider" />
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onFreqChanged" @changing="onFreqChanging" class="custom-slider" />
</view>
<view class="line"></view>
@ -217,8 +218,8 @@
<view class="slider-container">
<slider min="1" max="8" step="1" :disabled="false" :value="formData.sta_VoiceVolume"
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onVolumeChanged" @changing="onVolumeChanging" class="custom-slider" />
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
@change="onVolumeChanged" @changing="onVolumeChanging" class="custom-slider" />
</view>
@ -246,27 +247,9 @@
</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" />
</view>
</template>
@ -279,7 +262,15 @@
showLoading,
hideLoading,
updateLoading
} from '@/utils/loading.js'
} from '@/utils/loading.js';
import {
MsgSuccess,
MsgError,
MsgClose,
MsgWarning,
showPop,
MsgInfo
} from '@/utils/MsgPops.js';
import request, {
baseURL
} from '@/utils/request.js';
@ -311,26 +302,7 @@
curr: 0,
total: 0,
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: {
show: false,
showHeader: true,
@ -520,7 +492,7 @@
this.$watch("formData.sta_battery", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system == 2) {
this.showMsg("设备电量低");
MsgError("设备电量低",'',these);
}
});
@ -582,6 +554,7 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});
these.setBleFormData();
@ -602,7 +575,10 @@
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功")
these.formData.bleStatu = true;
});
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
}
},
computed: {
@ -656,14 +632,14 @@
audioManager() {
if (!this.permissions.includes('52') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
uni.navigateTo({
@ -846,7 +822,7 @@
text: "握手成功,等待设备响应"
});
}).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') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
let f = this.getDevice();
@ -1043,14 +1019,14 @@ onFreqChanging(e){
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
@ -1083,12 +1059,12 @@ onFreqChanging(e){
this.formData.sta_VoiceType = val;
these.setBleFormData();
}).catch(ex => {
this.showMsg(ex.msg);
MsgError(ex.msg,'',these);
});
},
showUnWarn(val) {
this.showPop({
showPop({
message: '确定解除声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -1102,20 +1078,20 @@ onFreqChanging(e){
showCancel: true,
buttonCancelText: '取消'
});
},these);
},
sosSetting(item, isOk) {
if (!this.permissions.includes('50') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
@ -1164,7 +1140,7 @@ onFreqChanging(e){
})
.catch(ex => {
this.showMsg(ex.msg);
MsgError(ex.msg,'',these);
});
}
@ -1173,7 +1149,7 @@ onFreqChanging(e){
this.showUnWarn(0);
} else {
this.showPop({
showPop({
message: '确定开启强制报警?',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -1182,7 +1158,7 @@ onFreqChanging(e){
buttonText: "开启",
showCancel: true,
buttonCancelText: '取消'
});
},these);
}
@ -1371,6 +1347,7 @@ onFreqChanging(e){
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});
return;
}
@ -1393,7 +1370,7 @@ onFreqChanging(e){
},
showBleUnConnect() {
this.showPop({
showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -1421,7 +1398,7 @@ onFreqChanging(e){
}
})
}
});
},these);
},
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>