From 3462a24d1e3f982547f27b146a38ca189f6dbcd4 Mon Sep 17 00:00:00 2001 From: ISFP_T <68358856@qq.com> Date: Thu, 26 Feb 2026 09:16:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/DeviceDetailSkeleton.vue | 187 ++++++++++++++++++++++++++++ config/console.js | 8 +- config/url.js | 4 +- pages/device/detail.vue | 100 +++++++++------ pages/index/index.vue | 4 +- pages/order/detail.vue | 2 +- 6 files changed, 255 insertions(+), 50 deletions(-) create mode 100644 components/DeviceDetailSkeleton.vue diff --git a/components/DeviceDetailSkeleton.vue b/components/DeviceDetailSkeleton.vue new file mode 100644 index 0000000..627e548 --- /dev/null +++ b/components/DeviceDetailSkeleton.vue @@ -0,0 +1,187 @@ + + + + + + diff --git a/config/console.js b/config/console.js index 4fcc19e..2c254eb 100644 --- a/config/console.js +++ b/config/console.js @@ -6,13 +6,13 @@ // 配置项:true 表示打印日志,false 表示不打印日志 export const CONSOLE_CONFIG = { // 是否启用 console.log - enableLog: true, + enableLog: false, // 是否启用 console.warn - enableWarn: true, + enableWarn: false, // 是否启用 console.error - enableError: true, + enableError: false, // 是否启用 console.info - enableInfo: true + enableInfo: false } // 保存原始的 console 方法 diff --git a/config/url.js b/config/url.js index 542c40a..7c6b44d 100644 --- a/config/url.js +++ b/config/url.js @@ -1,6 +1,6 @@ // export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用 -// export const URL = "https://manager.fdzpower.com/api" //正式服务器 -export const URL = "https://fansdev.gxfs123.com/api" //测试服务器 +export const URL = "https://manager.fdzpower.com/api" //正式服务器 +// export const URL = "https://fansdev.gxfs123.com/api" //测试服务器 // export const URL = "http://192.168.5.123:8080" //本地调试 // export const URL = "http://127.0.0.1:8080" //本地调试 diff --git a/pages/device/detail.vue b/pages/device/detail.vue index dff8c8b..f678ba2 100644 --- a/pages/device/detail.vue +++ b/pages/device/detail.vue @@ -1,5 +1,10 @@ @@ -149,12 +154,14 @@ import { useI18n } from '@/utils/i18n.js' + import DeviceDetailSkeleton from '@/components/DeviceDetailSkeleton.vue' const { t } = useI18n() // 响应式状态 + const loading = ref(true) const deviceInfo = ref({}) const deviceId = ref('') const deviceFeeConfig = ref({}) @@ -243,9 +250,9 @@ // 获取到授权code if (e.detail.code) { - uni.showLoading({ - title: t('auth.getting') - }) + // uni.showLoading({ + // title: t('auth.getting') + // }) console.log('获取到的授权code:', e.detail.code) @@ -254,7 +261,7 @@ getUserPhoneNumber(e.detail.code) .then(res => { console.log('获取手机号API响应原始数据:', JSON.stringify(res)) - uni.hideLoading() + // uni.hideLoading() // 不立即抛出错误,而是记录问题并继续处理 if (!res) { @@ -290,7 +297,7 @@ } }) .catch(err => { - uni.hideLoading() + // uni.hideLoading() console.error('获取手机号码失败(catch):', err) // 显示更详细的错误信息 @@ -302,7 +309,7 @@ }) }) } catch (outerError) { - uni.hideLoading() + // uni.hideLoading() console.error('获取手机号外部错误:', outerError) uni.showModal({ title: t('common.unexpectedError'), @@ -320,45 +327,55 @@ // 检查登录状态和订单 const fetchDeviceInfo = async () => { - console.log(deviceId.value); - const res = await getDeviceInfo(deviceId.value) - if (res.code == 200) { - deviceInfo.value = res.data.device || {} + try { + loading.value = true + console.log(deviceId.value); + const res = await getDeviceInfo(deviceId.value) + if (res.code == 200) { + deviceInfo.value = res.data.device || {} - // 保存 position 信息 - if (res.data.position) { - positionInfo.value = res.data.position - } - - // 更新设备位置信息 - if (deviceInfo.value.deviceLocation) { - deviceLocation.value = deviceInfo.value.deviceLocation - } else if (res.data.position && res.data.position.name) { - deviceLocation.value = res.data.position.name - } - - - // 更新设备状态 - if (deviceInfo.value.status) { - if (deviceInfo.value.status === 'online') { - deviceStatus.text = t('device.available') - deviceStatus.class = 'available' - } else if (deviceInfo.value.status === 'offline') { - deviceStatus.text = t('device.offline') - deviceStatus.class = 'offline' + // 保存 position 信息 + if (res.data.position) { + positionInfo.value = res.data.position } - } - if (deviceInfo.value.feeConfig) { - deviceFeeConfig.value = JSON.parse(deviceInfo.value.feeConfig)[0] || {} - console.log('deviceFeeConfig', deviceFeeConfig.value); - } else { - deviceFeeConfig.value = { - maxHourPrice: '5.00', + // 更新设备位置信息 + if (deviceInfo.value.deviceLocation) { + deviceLocation.value = deviceInfo.value.deviceLocation + } else if (res.data.position && res.data.position.name) { + deviceLocation.value = res.data.position.name } + + + // 更新设备状态 + if (deviceInfo.value.status) { + if (deviceInfo.value.status === 'online') { + deviceStatus.text = t('device.available') + deviceStatus.class = 'available' + } else if (deviceInfo.value.status === 'offline') { + deviceStatus.text = t('device.offline') + deviceStatus.class = 'offline' + } + } + + if (deviceInfo.value.feeConfig) { + deviceFeeConfig.value = JSON.parse(deviceInfo.value.feeConfig)[0] || {} + console.log('deviceFeeConfig', deviceFeeConfig.value); + } else { + deviceFeeConfig.value = { + maxHourPrice: '5.00', + } + } + }else{ + uni.reLaunch({ + url:'/pages/index/index' + }) } - - + }catch(error){ + console.error('获取设备信息失败:', error) + } + finally { + } } @@ -394,6 +411,7 @@ if (inUseRes && inUseRes.code === 200 && inUseRes.data) { const order = inUseRes.data // 如果有正在进行的订单,跳转到归还页面,带上设备ID + console.log('1111111111'); uni.redirectTo({ url: `/subPackages/service/return/index?deviceId=${deviceId.value}` }) diff --git a/pages/index/index.vue b/pages/index/index.vue index 87264eb..4520ca0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -72,12 +72,12 @@ @select="selectPositionFromPopup" @navigate="navigateToPosition" /> - + diff --git a/pages/order/detail.vue b/pages/order/detail.vue index f9a6f9e..b489fcf 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -1141,7 +1141,7 @@ // 处理"宝未弹出" - 跳转到反馈页面 const handleDeviceNoEject = () => { uni.navigateTo({ - url: '/pages/feedback/index?selectedType=0' + url: '/subPackages/service/feedback/index?selectedType=0' }) }