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

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,17 +10,17 @@
<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>
</view>
</view>
</uni-nav-bar>
<view class="eq">
<view class="leftImg" @click.stop="previewImg(device.devicePic?device.devicePic:formData.img)">
<image class="img" :src="device.devicePic?device.devicePic:formData.img" mode="aspectFit"></image>
@ -78,19 +78,19 @@
<view class="modeSetting">
<view class="item" :class="formData.modeCurr=='smalllow'?'active':''"
@click="MainModeSetting('smalllow','staticBattery')">
@click="MainModeSetting('smalllow','staticBattery')">
<view class="p100 center">前置</view>
</view>
<view class="item" :class="formData.modeCurr=='low'?'active':''"
@click="MainModeSetting('low','staticBattery')">
@click="MainModeSetting('low','staticBattery')">
<view class="p100 center">低档</view>
</view>
<view class="item " :class="formData.modeCurr=='center'?'active':''"
@click="MainModeSetting('center','staticBattery')">
@click="MainModeSetting('center','staticBattery')">
<view class="p100 center">中档</view>
</view>
<view class="item " :class="formData.modeCurr=='hight'?'active':''"
@click="MainModeSetting('hight','staticBattery')">
@click="MainModeSetting('hight','staticBattery')">
<view class="p100 center">高档</view>
</view>
@ -98,9 +98,9 @@
<!-- <view class="item " :class="formData.modeCurr=='close'?'active':''"
@click="MainModeSetting('close','staticBattery')">
<view class="p100 center">关闭</view>
</view> -->
@click="MainModeSetting('close','staticBattery')">
<view class="p100 center">关闭</view>
</view> -->
</view>
<view class="lampMode">
<view class="mode fleft" :class="formData.cMode?'active':''" v-on:click.stop="LampToggle()">
@ -114,7 +114,7 @@
</view>
<view class="mode marginLeft fleft" :class="formData.cMode=='mode'?'':'active'"
v-on:click.stop="ShowUpload()">
v-on:click.stop="ShowUpload()">
<view class="leftImg">
<image class="img" src="/static/images/6155/DeviceDetail/open.png" mode="aspectFit"></image>
</view>
@ -177,17 +177,11 @@
</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"
@btnClick="btnClick">
@btnClick="btnClick">
<view>
<view class="addIco">
<view class="icoContent center" v-on:click.stop="checkImgUpload()">
@ -198,6 +192,7 @@
</BottomSlideMenuPlus>
<global-loading ref="loading" />
<MsgBox ref="msgPop" />
</view>
</template>
@ -213,7 +208,15 @@
} from '@/utils/loading.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";
var ble = null;
@ -234,24 +237,7 @@ import request, { baseURL } from '@/utils/request.js';
},
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: {
show: false,
showHeader: true,
@ -404,7 +390,10 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.bleStatu='connecting';
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();
console.error("222222");
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 => {
console.log("连接成功")
these.formData.bleStatu = true;
});
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});;
}
},
computed: {
@ -466,6 +458,7 @@ import request, { baseURL } from '@/utils/request.js';
these.formData.bleStatu = true;
}).catch(ex=>{
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
});
return;
}
@ -569,7 +562,8 @@ import request, { baseURL } from '@/utils/request.js';
}).catch(ex => {
updateLoading(these, {
text: ex.msg
})
});
MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@ -655,12 +649,12 @@ import request, { baseURL } from '@/utils/request.js';
}
if (these.formData.iswarn) {
these.showPop({
showPop({
message: "环境存在漏电电源",
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
}
these.setBleFormData();
@ -733,14 +727,14 @@ import request, { baseURL } from '@/utils/request.js';
if (!this.permissions.includes('41') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
@ -813,12 +807,12 @@ import request, { baseURL } from '@/utils/request.js';
console.log("发送成功了");
}).catch((ex) => {
these.showPop({
showPop({
message: ex.msg,
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
}).finally(() => {
@ -838,7 +832,7 @@ import request, { baseURL } from '@/utils/request.js';
},
showBleUnConnect() {
this.showPop({
showPop({
message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
@ -866,19 +860,19 @@ import request, { baseURL } from '@/utils/request.js';
}
})
}
});
},these);
},
LampToggle: function() {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
this.formData.cMode = !this.formData.cMode;
@ -932,11 +926,11 @@ import request, { baseURL } from '@/utils/request.js';
if (currentPacket > totalPackets) {
hideLoading(these);
these.Status.BottomMenu.show = false;
these.showPop({
showPop({
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png",
});
},these);
if (!ReSendNo) {
setTimeout(() => {
these.HoldYouHand("transmit complete", 0, f
@ -1005,23 +999,23 @@ import request, { baseURL } from '@/utils/request.js';
})
currentPacket++;
setTimeout(sendNextPacket, 0);
setTimeout(sendNextPacket, 80);
}).catch(err => {
console.log("发送数据包失败了" + JSON.stringify(err));
if (err.code == '10007') {
setTimeout(sendNextPacket, 0);
setTimeout(sendNextPacket, 500);
return;
}
these.Status.BottomMenu.show = false;
these.showPop({
showPop({
message: err.msg,
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
hideLoading(these);
reject(err);
});
@ -1037,12 +1031,12 @@ import request, { baseURL } from '@/utils/request.js';
sendNextPacket();
}).catch((err) => {
console.log("握手没有成功");
these.showPop({
showPop({
message: err.msg,
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
hideLoading(these);
reject(err);
});
@ -1114,11 +1108,11 @@ import request, { baseURL } from '@/utils/request.js';
}
these.Status.BottomMenu.show = false;
hideLoading(these);
these.showPop({
showPop({
showPop: true,
message: "上传成功",
iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png"
});
},these);
@ -1188,14 +1182,14 @@ import request, { baseURL } from '@/utils/request.js';
these.Status.BottomMenu.show = false;
hideLoading(these);
these.showPop({
showPop({
showPop: true,
message: err.msg + ",发送失败了",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
buttonText: "确定",
iconUrl: "/static/images/common/uploadErr.png"
});
},these);
reject(err);
return;
}
@ -1290,23 +1284,23 @@ import request, { baseURL } from '@/utils/request.js';
console.log("服务器未返回正确的数据");
these.showPop({
showPop({
message: "与服务器连接出现异常,请检查网络设置",
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
}
}).catch((ex) => {
hideLoading(these);
these.showPop({
showPop({
message: "出现异常," + ex.msg,
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
})
}
let f = these.getDevice();
@ -1373,14 +1367,14 @@ import request, { baseURL } from '@/utils/request.js';
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
//上传开机画面
@ -1422,84 +1416,19 @@ import request, { baseURL } from '@/utils/request.js';
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) {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
this.showPop({
showPop({
message: '无操作权限',
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
okCallback: null,
buttonText: "确定"
})
},these)
return;
}
@ -1543,7 +1472,7 @@ import request, { baseURL } from '@/utils/request.js';
}
these.showPop({
showPop({
showPop: true, //是否显示弹窗
popType: 'custom',
bgColor: '#383934bd',
@ -1559,7 +1488,7 @@ import request, { baseURL } from '@/utils/request.js';
promptTitle: '',
modelValue: '',
visibleClose: true
});
},these);
these.setBleFormData();
@ -1617,12 +1546,12 @@ import request, { baseURL } from '@/utils/request.js';
setTimeout(sendNextPacket, 0);
}).catch(err => {
these.showPop({
showPop({
message: "文字发送失败," + err.msg,
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
}).finally(() => {
hideLoading(these);
});
@ -1651,12 +1580,12 @@ import request, { baseURL } from '@/utils/request.js';
}).catch((ex) => {
console.log("握手没有成功", ex);
hideLoading(these);
these.showPop({
showPop({
message: ex.msg,
iconUrl: "/static/images/common/uploadErr.png",
borderColor: "#e034344d",
buttonBgColor: "#E03434",
});
},these);
});
}, 0);