bug修复

This commit is contained in:
tx 2024-12-30 14:31:59 +08:00
parent f8675832cc
commit f1eee059b6
2 changed files with 1695 additions and 1639 deletions

View File

@ -312,13 +312,22 @@
},
watch: {
sncode(newValue, oldValue) {
sncode: {
handler(newValue) {
if (newValue && newValue.length === 7) {
// orderinfo
if (this.orderinfo && this.orderinfo.areaId) {
this.getdevice();
} else {
// orderinfo
setTimeout(() => {
this.getdevice();
}, 500);
}
}
},
immediate: false
}
},
onHide() {
@ -772,26 +781,46 @@
});
},
getdevice() {
this.deviceinfo={}
if (!this.sncode) {
return;
}
//
this.deviceinfo = {};
this.$u.get('/app/device/info?sn=' + this.sncode).then((res) => {
if (res.code == 200) {
if(this.orderinfo.areaId==res.data.areaId){
this.deviceinfo = res.data
// this.deviceinfo.onlineStatus=0
if (res.code === 200 && res.data) {
console.log('当前区域ID:', this.orderinfo.areaId);
console.log('设备区域ID:', res.data.areaId);
//
const currentAreaId = Number(this.orderinfo.areaId);
const deviceAreaId = Number(res.data.areaId);
if (!isNaN(currentAreaId) && !isNaN(deviceAreaId) && currentAreaId === deviceAreaId) {
this.deviceinfo = res.data;
} else {
uni.showToast({
title: '换车设备和当前运营区不同,请使用其他车辆换车',
icon: 'none',
duration: 2000
});
this.sncode = ''; // sn
}
} else {
//
uni.showToast({
title: res.msg || '获取设备信息失败',
icon: 'none',
duration: 2000
});
}
}).catch(error => {
//
console.error('获取设备信息错误:', error);
uni.showToast({
title: '获取设备信息失败',
icon: 'none',
duration: 2000
});
});
},
qrcode() {
@ -799,7 +828,7 @@
onlyFromCamera: true,
scanType: ['qrCode'],
success: res => {
try {
let sn = null;
let queryParams = res.result.split('?')[1];
if (queryParams) {
@ -812,23 +841,47 @@
});
}
this.sncode = sn
console.log(res.result);
if (this.sncode != '') {
this.getdevice()
if (!sn) {
uni.showToast({
title: '无效的二维码',
icon: 'none',
duration: 2000
});
return;
}
this.sncode = sn;
if (this.sncode) {
// orderinfo
if (this.orderinfo && this.orderinfo.areaId) {
this.getdevice();
} else {
// orderinfo
setTimeout(() => {
this.getdevice();
}, 500);
}
}
} catch (error) {
console.error('二维码解析错误:', error);
uni.showToast({
title: '二维码格式错误',
icon: 'none',
duration: 2000
});
}
},
fail: err => {
console.error('扫描失败:', err);
uni.showToast({
title: '扫描失败',
icon: 'none'
icon: 'none',
duration: 2000
});
}
});
},
Binddevice() {
uni.getBluetoothAdapterState({
success: function (res) {

View File

@ -1501,6 +1501,7 @@ export default {
},
deviceInfo(num) {
setTimeout(() => {
if (!this.sn) return;
//
@ -1513,7 +1514,7 @@ export default {
});
return;
}
return
}
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
@ -1577,6 +1578,10 @@ export default {
});
}
});
}, 700);
},
//
getStatusMessage(status) {
@ -2082,8 +2087,6 @@ export default {
console.error("Error fetching parking data:", error);
});
},
totxtpage() {
this.seeDetail = true
uni.navigateTo({
@ -4577,7 +4580,7 @@ export default {
},
convertBoundaryToPolylines(boundaries, num) {
if (num == 1) {
console.log('判断1');
return boundaries.map(boundary => {
if (!boundary) return null;
let coords;