fix:修复bug

This commit is contained in:
2026-02-26 09:16:35 +08:00
parent 99872dd6df
commit 3462a24d1e
6 changed files with 255 additions and 50 deletions
+187
View File
@@ -0,0 +1,187 @@
<template>
<view class="skeleton-container">
<!-- 设备信息卡片骨架 -->
<view class="card skeleton-card">
<view class="device-location-skeleton">
<view class="location-left-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="32rpx" rowsHeight="32rpx"
borderRadius="50%"></uv-skeleton>
<view style="margin-left: 12rpx;">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="200rpx" rowsHeight="28rpx">
</uv-skeleton>
</view>
</view>
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="100rpx" rowsHeight="40rpx"
borderRadius="30rpx"></uv-skeleton>
</view>
<view class="device-info-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="300rpx" rowsHeight="26rpx">
</uv-skeleton>
</view>
<view class="device-info-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="350rpx" rowsHeight="26rpx">
</uv-skeleton>
</view>
</view>
<!-- 计费规则卡片骨架 -->
<view class="card skeleton-card">
<view class="card-header-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="150rpx" rowsHeight="32rpx">
</uv-skeleton>
</view>
<view class="pricing-banner-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="200rpx" rowsHeight="64rpx">
</uv-skeleton>
<view style="margin-top: 16rpx;">
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="120rpx" rowsHeight="40rpx"
borderRadius="30rpx"></uv-skeleton>
</view>
</view>
<view class="pricing-info-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="100%" rowsHeight="26rpx">
</uv-skeleton>
</view>
<view class="pricing-info-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="100%" rowsHeight="26rpx">
</uv-skeleton>
</view>
</view>
<!-- 使用说明卡片骨架 -->
<view class="card skeleton-card">
<view class="card-header-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="150rpx" rowsHeight="32rpx">
</uv-skeleton>
</view>
<view class="notice-item-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="12rpx" rowsHeight="12rpx"
borderRadius="50%"></uv-skeleton>
<view style="flex: 1; margin-left: 16rpx;">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="100%" rowsHeight="28rpx">
</uv-skeleton>
</view>
</view>
<view class="notice-item-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="12rpx" rowsHeight="12rpx"
borderRadius="50%"></uv-skeleton>
<view style="flex: 1; margin-left: 16rpx;">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="100%" rowsHeight="28rpx">
</uv-skeleton>
</view>
</view>
<view class="notice-item-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="12rpx" rowsHeight="12rpx"
borderRadius="50%"></uv-skeleton>
<view style="flex: 1; margin-left: 16rpx;">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="100%" rowsHeight="28rpx">
</uv-skeleton>
</view>
</view>
</view>
<!-- 促销提示框骨架 -->
<view class="promotion-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="100%" rowsHeight="60rpx"
borderRadius="22rpx"></uv-skeleton>
</view>
<!-- 底部按钮骨架 -->
<view class="footer-skeleton">
<uv-skeleton :loading="true" :animate="true" rows="0" rowsWidth="100%" rowsHeight="96rpx"
borderRadius="48rpx"></uv-skeleton>
<view style="margin-top: 16rpx;">
<uv-skeleton :loading="true" :animate="true" rows="1" rowsWidth="200rpx" rowsHeight="24rpx">
</uv-skeleton>
</view>
</view>
</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
.skeleton-container {
min-height: 100vh;
background-color: #f5f7fa;
padding: 30rpx 30rpx 300rpx;
box-sizing: border-box;
}
.card {
background-color: #fff;
border-radius: 24rpx;
box-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.04);
padding: 30rpx;
margin-bottom: 30rpx;
}
.skeleton-card {
.device-location-skeleton {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.location-left-skeleton {
display: flex;
align-items: center;
}
}
.device-info-skeleton {
margin-bottom: 12rpx;
}
.card-header-skeleton {
margin-bottom: 24rpx;
}
.pricing-banner-skeleton {
background: #E6F7EC;
border-radius: 20rpx;
padding: 40rpx 30rpx;
margin-bottom: 24rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.pricing-info-skeleton {
margin-bottom: 16rpx;
}
.notice-item-skeleton {
display: flex;
align-items: flex-start;
margin-bottom: 20rpx;
&:last-child {
margin-bottom: 0;
}
}
}
.promotion-skeleton {
margin-bottom: 30rpx;
}
.footer-skeleton {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: #fff;
padding: 24rpx 30rpx;
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
z-index: 100;
display: flex;
flex-direction: column;
align-items: center;
}
</style>
+4 -4
View File
@@ -6,13 +6,13 @@
// 配置项:true 表示打印日志,false 表示不打印日志 // 配置项:true 表示打印日志,false 表示不打印日志
export const CONSOLE_CONFIG = { export const CONSOLE_CONFIG = {
// 是否启用 console.log // 是否启用 console.log
enableLog: true, enableLog: false,
// 是否启用 console.warn // 是否启用 console.warn
enableWarn: true, enableWarn: false,
// 是否启用 console.error // 是否启用 console.error
enableError: true, enableError: false,
// 是否启用 console.info // 是否启用 console.info
enableInfo: true enableInfo: false
} }
// 保存原始的 console 方法 // 保存原始的 console 方法
+2 -2
View File
@@ -1,6 +1,6 @@
// export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用 // export const URL = "https://my.gxfs123.com/api" //正式服务器-弃用
// export const URL = "https://manager.fdzpower.com/api" //正式服务器 export const URL = "https://manager.fdzpower.com/api" //正式服务器
export const URL = "https://fansdev.gxfs123.com/api" //测试服务器 // export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
// export const URL = "http://192.168.5.123:8080" //本地调试 // export const URL = "http://192.168.5.123:8080" //本地调试
// export const URL = "http://127.0.0.1:8080" //本地调试 // export const URL = "http://127.0.0.1:8080" //本地调试
+59 -41
View File
@@ -1,5 +1,10 @@
<template> <template>
<view class="container"> <view class="container">
<!-- 骨架屏 -->
<DeviceDetailSkeleton v-if="loading&&!deviceInfo" />
<!-- 实际内容 -->
<view v-else>
<!-- 设备信息卡片 --> <!-- 设备信息卡片 -->
<view class="card device-info-card"> <view class="card device-info-card">
<view class="device-location"> <view class="device-location">
@@ -19,7 +24,6 @@
<text class="id-label">{{ $t('device.deviceNo') }}</text> <text class="id-label">{{ $t('device.deviceNo') }}</text>
<text class="id-value">{{ deviceId }}</text> <text class="id-value">{{ deviceId }}</text>
</view> </view>
</view> </view>
<!-- 计费规则 --> <!-- 计费规则 -->
@@ -117,6 +121,7 @@
</view> </view>
</view> </view>
</view> </view>
</view>
</view> </view>
</template> </template>
@@ -149,12 +154,14 @@
import { import {
useI18n useI18n
} from '@/utils/i18n.js' } from '@/utils/i18n.js'
import DeviceDetailSkeleton from '@/components/DeviceDetailSkeleton.vue'
const { const {
t t
} = useI18n() } = useI18n()
// 响应式状态 // 响应式状态
const loading = ref(true)
const deviceInfo = ref({}) const deviceInfo = ref({})
const deviceId = ref('') const deviceId = ref('')
const deviceFeeConfig = ref({}) const deviceFeeConfig = ref({})
@@ -243,9 +250,9 @@
// 获取到授权code // 获取到授权code
if (e.detail.code) { if (e.detail.code) {
uni.showLoading({ // uni.showLoading({
title: t('auth.getting') // title: t('auth.getting')
}) // })
console.log('获取到的授权code:', e.detail.code) console.log('获取到的授权code:', e.detail.code)
@@ -254,7 +261,7 @@
getUserPhoneNumber(e.detail.code) getUserPhoneNumber(e.detail.code)
.then(res => { .then(res => {
console.log('获取手机号API响应原始数据:', JSON.stringify(res)) console.log('获取手机号API响应原始数据:', JSON.stringify(res))
uni.hideLoading() // uni.hideLoading()
// 不立即抛出错误,而是记录问题并继续处理 // 不立即抛出错误,而是记录问题并继续处理
if (!res) { if (!res) {
@@ -290,7 +297,7 @@
} }
}) })
.catch(err => { .catch(err => {
uni.hideLoading() // uni.hideLoading()
console.error('获取手机号码失败(catch):', err) console.error('获取手机号码失败(catch):', err)
// 显示更详细的错误信息 // 显示更详细的错误信息
@@ -302,7 +309,7 @@
}) })
}) })
} catch (outerError) { } catch (outerError) {
uni.hideLoading() // uni.hideLoading()
console.error('获取手机号外部错误:', outerError) console.error('获取手机号外部错误:', outerError)
uni.showModal({ uni.showModal({
title: t('common.unexpectedError'), title: t('common.unexpectedError'),
@@ -320,45 +327,55 @@
// 检查登录状态和订单 // 检查登录状态和订单
const fetchDeviceInfo = async () => { const fetchDeviceInfo = async () => {
console.log(deviceId.value); try {
const res = await getDeviceInfo(deviceId.value) loading.value = true
if (res.code == 200) { console.log(deviceId.value);
deviceInfo.value = res.data.device || {} const res = await getDeviceInfo(deviceId.value)
if (res.code == 200) {
deviceInfo.value = res.data.device || {}
// 保存 position 信息 // 保存 position 信息
if (res.data.position) { if (res.data.position) {
positionInfo.value = 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'
} }
}
if (deviceInfo.value.feeConfig) { // 更新设备位置信息
deviceFeeConfig.value = JSON.parse(deviceInfo.value.feeConfig)[0] || {} if (deviceInfo.value.deviceLocation) {
console.log('deviceFeeConfig', deviceFeeConfig.value); deviceLocation.value = deviceInfo.value.deviceLocation
} else { } else if (res.data.position && res.data.position.name) {
deviceFeeConfig.value = { deviceLocation.value = res.data.position.name
maxHourPrice: '5.00',
} }
// 更新设备状态
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) { if (inUseRes && inUseRes.code === 200 && inUseRes.data) {
const order = inUseRes.data const order = inUseRes.data
// 如果有正在进行的订单,跳转到归还页面,带上设备ID // 如果有正在进行的订单,跳转到归还页面,带上设备ID
console.log('1111111111');
uni.redirectTo({ uni.redirectTo({
url: `/subPackages/service/return/index?deviceId=${deviceId.value}` url: `/subPackages/service/return/index?deviceId=${deviceId.value}`
}) })
+2 -2
View File
@@ -72,12 +72,12 @@
@select="selectPositionFromPopup" @navigate="navigateToPosition" /> @select="selectPositionFromPopup" @navigate="navigateToPosition" />
<!-- 加载状态 --> <!-- 加载状态 -->
<view class="loading-overlay" v-if="isLoading"> <!-- <view class="loading-overlay" v-if="isLoading">
<view class="loading-content"> <view class="loading-content">
<view class="loading-spinner"></view> <view class="loading-spinner"></view>
<text>{{ $t('common.loadingPosition') }}</text> <text>{{ $t('common.loadingPosition') }}</text>
</view> </view>
</view> </view> -->
<!-- 手机号授权弹窗 --> <!-- 手机号授权弹窗 -->
<view class="phone-auth-popup" v-if="showPhoneAuthPopup"> <view class="phone-auth-popup" v-if="showPhoneAuthPopup">
+1 -1
View File
@@ -1141,7 +1141,7 @@
// 处理"宝未弹出" - 跳转到反馈页面 // 处理"宝未弹出" - 跳转到反馈页面
const handleDeviceNoEject = () => { const handleDeviceNoEject = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/feedback/index?selectedType=0' url: '/subPackages/service/feedback/index?selectedType=0'
}) })
} }