|
@@ -72,22 +72,29 @@ export default {
|
|
|
安装位置: "radio",
|
|
|
第二域名: "string",
|
|
|
});
|
|
|
- console.log(this.list);
|
|
|
- try {
|
|
|
- const E013 = this.list.find((v) => v.paramName == "E013");
|
|
|
- if (E013) {
|
|
|
- this.$refs.refCD.send(
|
|
|
- { password: E013.params.options[0].value },
|
|
|
- E013
|
|
|
- );
|
|
|
- }
|
|
|
- } catch (error) {}
|
|
|
-
|
|
|
+ setTimeout(() => {
|
|
|
+ this.authentication();
|
|
|
+ }, 100);
|
|
|
this.$refs.refCD.init();
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ authentication() {
|
|
|
+ try {
|
|
|
+ uni.showLoading({
|
|
|
+ title: "身份验证中...",
|
|
|
+ mask: true,
|
|
|
+ });
|
|
|
+ const E013 = this.list.find((v) => v.paramName == "E013");
|
|
|
+ if (E013) {
|
|
|
+ this.$refs.refCD.send(
|
|
|
+ { password: E013.params.options[0].value },
|
|
|
+ E013
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
onClick(item) {
|
|
|
this.$refs.MyInput.openInput(item);
|
|
|
},
|
|
@@ -121,34 +128,42 @@ export default {
|
|
|
},
|
|
|
onFeedback(res) {
|
|
|
console.log("onFeedback", res);
|
|
|
-
|
|
|
const index = res.node
|
|
|
? this.list.findIndex((v) => res.node == v.paramName)
|
|
|
: this.list.findIndex((v) => v.msgid == res.msgid);
|
|
|
-
|
|
|
+ uni.hideLoading();
|
|
|
+ let that = this;
|
|
|
if (index != -1) {
|
|
|
let item = this.list[index];
|
|
|
let MyInput = this.$refs.MyInput;
|
|
|
MyInput.loading = false;
|
|
|
if (res.status == 1) {
|
|
|
if (res.node) {
|
|
|
- item.params.lastvalue = res.v;
|
|
|
+ item.params.lastvalue = res.v;
|
|
|
} else if (res.msgid) {
|
|
|
- item.params.lastvalue = item.msg.d[item.params.param];
|
|
|
+ try {
|
|
|
+ item.params.lastvalue = item.msg.d[item.params.param];
|
|
|
+ } catch (error) {}
|
|
|
}
|
|
|
MyInput.show = false;
|
|
|
MyInput.stepIsCalculate = null;
|
|
|
} else if (res.status == 0) {
|
|
|
if (item.paramName == "E013") {
|
|
|
uni.showModal({
|
|
|
- title: "失败",
|
|
|
- content: `身份验证失败,将断开连接`,
|
|
|
- showCancel: false,
|
|
|
- });
|
|
|
- uni.closeBLEConnection({
|
|
|
- deviceId: that.connected
|
|
|
+ content: `身份验证失败`,
|
|
|
+ confirmText: "重新验证",
|
|
|
+ cancelText: "断开连接",
|
|
|
+ complete: ({ confirm }) => {
|
|
|
+ if (confirm) {
|
|
|
+ that.authentication();
|
|
|
+ } else {
|
|
|
+ uni.closeBLEConnection({
|
|
|
+ deviceId: that.connected,
|
|
|
+ });
|
|
|
+ uni.closeBluetoothAdapter();
|
|
|
+ }
|
|
|
+ },
|
|
|
});
|
|
|
- uni.closeBluetoothAdapter();
|
|
|
} else {
|
|
|
uni.showModal({
|
|
|
title: "失败",
|