diff --git a/src/pages/devicesSearch/codeSearch.vue b/src/pages/devicesSearch/codeSearch.vue index aae68e2..96e220c 100644 --- a/src/pages/devicesSearch/codeSearch.vue +++ b/src/pages/devicesSearch/codeSearch.vue @@ -155,8 +155,10 @@ const onCodeSearch = () => { const getCodeDeviceInfoData = async () => { console.log(queryCodeParams.value) // const res = await getCodeDeviceListAPI(queryCodeParams.value) + uni.showLoading({ title: '加载中...', mask: true }) getDeviceListAPI({'maCode': queryCodeParams.value.maCode}).then(response => { console.log("xxxxxxxxxxx",response) + uni.hideLoading() if (response.data && response.data.length !== 0) { optionList.value = response.data.map(option => ({ value: option.maId, @@ -172,6 +174,9 @@ const getCodeDeviceInfoData = async () => { duration: 2000 }) } + }).catch(error => { + console.error("获取设备信息失败", error) + uni.hideLoading() }) } diff --git a/src/pages/devicesSearch/qrSearch.vue b/src/pages/devicesSearch/qrSearch.vue index 249cde0..5670258 100644 --- a/src/pages/devicesSearch/qrSearch.vue +++ b/src/pages/devicesSearch/qrSearch.vue @@ -139,6 +139,7 @@ onShow(() => { // 扫码识别按钮点击事件 const scanStart = () => { qrCodeScan.value = '' + codeData.value = {} if (scanQrCodeRef.value) { scanQrCodeRef.value.scanQrCode() } @@ -166,21 +167,28 @@ const handleScanError = (error) => { //查看是否是该规格型号 const getMaInfoScan = async () => { - let param = { - qrCode: qrCodeScan.value, - } - console.log(param) - const res = await getScanCodeAPI(param) - console.log(res) - if (res.code == 200) { - if (res.data) { - codeData.value = res.data - }else{ - uni.showToast({ title: res.data.msg, icon: 'none'}) - } - } else { - uni.showToast({ title: res.data.msg, icon: 'none' }) - } + try { + uni.showLoading({ title: '加载中...', mask: true }) + let param = { + qrCode: qrCodeScan.value, + } + console.log(param) + const res = await getScanCodeAPI(param) + console.log(res) + if (res.code == 200) { + if (res.data) { + codeData.value = res.data + }else{ + uni.showToast({ title: res.data.msg, icon: 'none'}) + } + } else { + uni.showToast({ title: res.data.msg, icon: 'none' }) + } + } catch (error) { + console.log('🚀 ~ getMaInfoScan ~ error:', error) + } finally { + uni.hideLoading() + } }