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

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

@ -16,7 +16,8 @@
<view class="row">
<image class="img" src="/static/images/common/time.png" mode="aspectFit"></image>
<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 class="smallTxt">设备状态</view>
</view>
@ -54,7 +55,7 @@
<view class="lampMode">
<view class="sosContent">
<view class="btnSos openSos center" :class="{active:formData.sta_LedType==='led_alarm'}"
@click="sosSetting(dic.sta_LightType[4],4)">
@click="sosSetting(dic.sta_LightType[4],4)">
{{formData.sta_LedType==='led_alarm'?'报警中':'声光报警'}}
</view>
<view class="btnSos closeSos center" @click="sosSetting(dic.sta_LightType[3],3)">解除</view>
@ -72,7 +73,7 @@
<view class="lampMode">
<view class="mode fleft " v-for="item,index in dic.sta_LightType.filter(v=>{return v.group=='sta_LedType'})"
:class="{'active':formData[item.group]===item.key,
:class="{'active':formData[item.group]===item.key,
'marginLeft':index%2===1,
'displayNone':!item.show
}" v-on:click.stop="LighSetting(item,index)">
@ -118,21 +119,13 @@
</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" />
<MsgBox ref="msgPop" />
</view>
</template>
@ -144,7 +137,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'
@ -167,26 +168,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,
},
usrToggle: false,
},
@ -340,7 +322,10 @@
these.formData.deviceId = f.deviceId;
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
these.formData.sta_IntrusTime = 0;
these.formData.sta_sosadd = "";
these.setBleFormData();
@ -362,7 +347,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: {
@ -401,7 +389,7 @@
these.setBleFormData();
}).catch(ex => {
this.showMsg(ex.msg);
MsgError(ex.msg,'',these);
});
},
@ -443,7 +431,7 @@
these.setBleFormData();
resolve();
}).catch(ex => {
this.showMsg(ex.msg);
MsgError(ex.msg,'',these);
reject(ex);
});
});
@ -451,7 +439,7 @@
}
if (item.key == 'led_alarm') {
this.showPop({
showPop({
message: '确定开启声光报警?',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -462,10 +450,10 @@
buttonText: "开启",
showCancel: true,
buttonCancelText: '取消'
});
},these);
} else {
if (this.formData.sta_LedType == 'led_alarm') {
this.showPop({
showPop({
message: '确定解除声光报警模式?',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -482,7 +470,7 @@
showCancel: true,
buttonCancelText: '取消'
});
},these);
} else {
task(item.key);
}
@ -559,7 +547,8 @@
}).catch(ex => {
updateLoading(these, {
text: ex.msg
})
});
these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@ -620,7 +609,7 @@
if (msg.length > 0) {
this.showMsg(msg.join(','));
MsgError(msg.join(','),'',these);
}
these.setBleFormData();
@ -655,7 +644,7 @@
},
showBleUnConnect() {
this.showPop({
showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -683,7 +672,7 @@
}
})
}
});
},these);
},
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>