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

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>
@ -74,12 +75,12 @@
<view class="h50">
<view class="workMode">
<view class="item" @click.stop="highSpeedSetting(item,index,true)"
:class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
:class="{'active':formData.sta_highSpeed && formData.sta_LedType===item.key}">
<view class="checkbox"></view>
<text>强光</text>
</view>
<view class="item " @click.stop="highSpeedSetting(item,index,false)"
:class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
:class="{'active':formData.sta_highSpeed===false && formData.sta_LedType===item.key}">
<view class="checkbox "></view>
<text>工作光</text>
</view>
@ -93,7 +94,7 @@
<view class="mode fleft marginLeft" :class="{'rbActive':formData.SOS}" v-on:click.stop="sosSetting()">
<view class="leftImg">
<image class="img" :src="formData.SOS?'/static/images/670/sgActive.png':'/static/images/670/sg.png'"
mode="aspectFit">
mode="aspectFit">
</image>
</view>
<view class="rightTxt">
@ -114,9 +115,9 @@
<view class="mode fleft " @click.stop="playVolume()" :class="{'active':formData.isPlay}">
<view class="leftImg">
<image class="img" :class="{'displayNone':formData.isPlay}" src="/static/images/common/play.png"
mode="aspectFit"></image>
mode="aspectFit"></image>
<image class="img" :class="{'displayNone':!formData.isPlay}"
src="/static/images/common/playingActive.png" mode="aspectFit"></image>
src="/static/images/common/playingActive.png" mode="aspectFit"></image>
</view>
<view class="rightTxt">
<text class="bigTxt">{{formData.isPlay?'正在播放':'播放语音'}}</text>
@ -183,7 +184,7 @@
</view>
</view>
<view style="padding-bottom: 20rpx;">
<view style="padding-bottom: 20rpx;">
<view class="proinfo lamp">
@ -208,11 +209,11 @@
</view>
<!-- 弹窗通知 -->
<MessagePopup v-for="item,key in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
:buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
:buttonText="item.buttonText" @buttonClick="item.okCallback(item)" :visiblePrompt="item.visiblePrompt"
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="closePop(item)" />
<!-- 下方菜单 -->
@ -226,7 +227,7 @@
<view class="header">
<uni-icons @click.stop="Status.showVolumPop=false" type="closeempty" size="15"
color="#FFFFFFde"></uni-icons>
color="#FFFFFFde"></uni-icons>
</view>
<view class="txtContent">
<view class="volTxt">
@ -239,8 +240,8 @@
<view class="slider-container">
<slider min="0" max="100" step="1" :disabled="false" :value="formData.volumn" activeColor="#bbe600"
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
@changing="volumechange" class="custom-slider" />
backgroundColor="#686767" block-size="20" block-color="#ffffffde" @change="volumechange"
@changing="volumechange" class="custom-slider" />
</view>
@ -248,7 +249,7 @@
</view>
</view>
<MsgBox ref="msgPop" />
</view>
</template>
@ -265,7 +266,16 @@
baseURL
} 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";
var ble = null;
@ -419,7 +429,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.setBleFormData();
@ -439,7 +452,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: {
@ -551,7 +567,7 @@
this.closePop(item);
}
if (msg) {
this.showPop({
showPop({
key: Common.guid(),
message: msg,
iconUrl: "/static/images/common/playingActive.png",
@ -561,7 +577,7 @@
buttonText: '确定',
buttonCancelText: '取消',
showCancel: true
});
},these);
} else {
exec();
}
@ -667,7 +683,7 @@
// },500)
}
this.showPop({
showPop({
key: key,
message: msg,
iconUrl: "/static/images/common/uploadErr.png",
@ -677,7 +693,7 @@
buttonText: '确定',
buttonCancelText: '取消',
showCancel: true
});
},these);
},
deviceRecovry(res) {
@ -742,7 +758,8 @@
}).catch(ex => {
updateLoading(these, {
text: ex.msg
})
});
these.formData.bleStatu = 'err';
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@ -838,7 +855,7 @@
},
showBleUnConnect() {
this.showPop({
showPop({
key: Common.guid(),
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png",
@ -867,7 +884,7 @@
}
})
}
});
},these);
},
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) {
let cfg = {
@ -1008,7 +974,7 @@
buttonText: '确定',
okCallback: this.closePop
};
this.showPop(options);
showPop(options,these);
}
}
}