From 2a249d04da90d0358dc83601db66b9eacf7e4e31 Mon Sep 17 00:00:00 2001
From: ISFP_T <68358856@qq.com>
Date: Fri, 28 Nov 2025 09:21:37 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=B0=E5=9B=BE=E5=AE=9A?=
=?UTF-8?q?=E4=BD=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/MapComponent.vue | 33 +-
config/url.js | 3 +-
locale/en-US.js | 9 +
locale/zh-CN.js | 9 +
pages/device/detail.vue | 15 +-
pages/feedback/index.vue | 67 ++--
pages/index/index.vue | 587 ++++++++++++++++++------------------
pages/search/index.vue | 149 +++++----
pages/userProfile/index.vue | 4 +-
static/location-icon.png | Bin 3337 -> 4033 bytes
utils/mapUtils.js | 167 ++++++++--
11 files changed, 602 insertions(+), 441 deletions(-)
diff --git a/components/MapComponent.vue b/components/MapComponent.vue
index 585acf3..9935b2d 100644
--- a/components/MapComponent.vue
+++ b/components/MapComponent.vue
@@ -19,15 +19,12 @@
-
-
-
@@ -180,7 +177,6 @@
// 移动地图到指定位置(直接更新地图中心坐标)
const moveToLocation = (location) => {
if (!location || !location.longitude || !location.latitude) {
- console.warn('moveToLocation: 无效的位置参数', location)
return
}
@@ -188,9 +184,7 @@
longitude: Number(location.longitude),
latitude: Number(location.latitude)
}
-
- console.log('移动地图到:', newCenter)
-
+
// 直接更新地图中心,触发地图组件的视图更新
mapCenter.value = newCenter
@@ -207,7 +201,6 @@
oldLocation.latitude !== newLocation.latitude
if (isChanged) {
- console.log('用户位置变化:', newLocation)
mapCenter.value = {
longitude: newLocation.longitude,
latitude: newLocation.latitude
@@ -234,25 +227,15 @@
// 地图区域变化事件(带防抖优化)
const onMapRegionChange = (e) => {
- console.log('regionchange事件:', e)
// 只处理结束事件
if (!e || e.type !== 'end') {
return
}
- // 获取事件原因
- // 微信小程序:e.causedBy 可能的值:
- // - 'gesture': 手势拖动
- // - 'scale': 缩放
- // - 'update': 调用更新接口(如 setCenterOffset 等)
const causedBy = e.causedBy || e.detail?.causedBy
- console.log('地图变化原因:', causedBy, '完整事件:', e)
-
- // 只在用户手动操作(拖动或缩放)结束时触发查询
- // 排除程序调用(update)导致的变化,避免定位按钮触发多余查询
- if (causedBy === 'gesture' || causedBy === 'scale' || causedBy === 'drag') {
+ if (causedBy === 'gesture' || causedBy === 'scale' || causedBy === 'drag'||causedBy==='update') {
// 清除之前的定时器
if (regionChangeTimer) {
clearTimeout(regionChangeTimer)
@@ -269,14 +252,13 @@
latitude: Number(centerLocation.latitude)
}
- mapCenter.value = newCenter
- console.log('地图中心变化,触发查询:', newCenter, '原因:', causedBy)
+ mapCenter.value = newCenter;
+
// 触发父组件查询新位置的场地
emit('mapCenterChange', newCenter)
}, 500)
} else {
- console.warn('未能从事件中获取中心点位置,尝试使用API获取')
// 兜底方案:如果事件中没有centerLocation,才使用API获取
regionChangeTimer = setTimeout(() => {
if (mapContext.value) {
@@ -288,7 +270,6 @@
latitude: res.latitude
}
mapCenter.value = newCenter
- console.log('地图中心变化(API获取):', newCenter, '原因:', causedBy)
emit('mapCenterChange', newCenter)
}
},
@@ -299,9 +280,7 @@
}
}, 500)
}
- } else {
- console.log('跳过查询,原因:', causedBy)
- }
+ }
}
// 标记点点击事件
@@ -505,7 +484,7 @@ const handleSearch = () => {
.center-marker-icon {
width: 60rpx;
- height: 80rpx;
+ height: 60rpx;
display: block;
}
diff --git a/config/url.js b/config/url.js
index fe70554..38433ce 100644
--- a/config/url.js
+++ b/config/url.js
@@ -1,4 +1,5 @@
-// 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://fansdev.gxfs123.com/api" //测试服务器
// export const URL = "http://192.168.5.149:8080" //本地调试
// export const URL = "http://127.0.0.1:8080" //本地调试
diff --git a/locale/en-US.js b/locale/en-US.js
index 068e68d..a32e62d 100644
--- a/locale/en-US.js
+++ b/locale/en-US.js
@@ -298,6 +298,15 @@ export default {
authCodeFailed: 'Auth failed'
},
+ permission: {
+ locationTitle: 'Location Permission',
+ locationNeed: 'We need your location to show nearby devices. Please enable location access in “Settings > Permissions”.',
+ locationDenied: 'Location access is disabled. You can enable it later in “Settings > Permissions” to continue.',
+ goToSettings: 'Open Settings',
+ later: 'Not now',
+ gotIt: 'Got it'
+ },
+
payment: {
paymentAmount: 'Amount',
paymentMethod: 'Method',
diff --git a/locale/zh-CN.js b/locale/zh-CN.js
index 29f28ac..cb2c09c 100644
--- a/locale/zh-CN.js
+++ b/locale/zh-CN.js
@@ -298,6 +298,15 @@ export default {
authCodeFailed: '获取授权码失败'
},
+ permission: {
+ locationTitle: '位置信息授权',
+ locationNeed: '需要获取您的位置信息以展示附近设备,请在“设置-权限管理”中开启定位权限。',
+ locationDenied: '未授权定位,将无法展示附近设备。您可以稍后在“设置-权限管理”中重新开启定位权限。',
+ goToSettings: '去设置',
+ later: '暂不',
+ gotIt: '知道了'
+ },
+
payment: {
paymentAmount: '支付金额',
paymentMethod: '支付方式',
diff --git a/pages/device/detail.vue b/pages/device/detail.vue
index d9bc0a6..6571683 100644
--- a/pages/device/detail.vue
+++ b/pages/device/detail.vue
@@ -384,9 +384,12 @@
// 获取价格单位文本
const getPriceUnit = () => {
+ console.log(deviceInfo.value);
// 按分钟计费
if (deviceInfo.value && deviceInfo.value.feeType === 'minute') {
return '分钟'
+ }else if(deviceInfo.value && deviceFeeConfig.value.hourPrice == '0.5'){
+ return '30分钟'
}
// 按小时计费(默认)
return $t('time.hour')
@@ -417,7 +420,7 @@
// 按小时计费
const hourPrice = parseFloat(deviceFeeConfig.value.hourPrice || 1)
- const unitPrice = maxHourPrice * hourPrice
+ const unitPrice = maxHourPrice
return unitPrice.toFixed(2)
}
@@ -439,11 +442,7 @@
// 按小时计费
const unitMinutes = getBillingUnitMinutes()
- if (unitMinutes === 30) {
- return `${unitPrice}元/${unitMinutes}分钟,${maxHourPrice}元/小时`
- } else {
- return `${maxHourPrice}元/小时`
- }
+ return deviceInfo.value.remark;
}
// 生成详细说明文本
@@ -454,11 +453,11 @@
// 按分钟计费
if (deviceInfo.value && deviceInfo.value.feeType === 'minute') {
- return `前${freeMinutes}分钟内归还免费,不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
+ return `不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
}
// 按小时计费
- return `前${freeMinutes}分钟内归还免费,不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
+ return `不足${unitMinutes}分钟按${unitMinutes}分钟计费,封顶${depositAmount}元,持续计费至${depositAmount}元视为买断`
}
// 提交租借订单
diff --git a/pages/feedback/index.vue b/pages/feedback/index.vue
index c6a4721..dd5e521 100644
--- a/pages/feedback/index.vue
+++ b/pages/feedback/index.vue
@@ -4,13 +4,13 @@
{{ $t('feedback.issueType') }}
-
-
- {{ $t(type) }}
+
+
+ {{ $t(type) }}
+
-
@@ -23,23 +23,23 @@
{{ $t('feedback.imageUpload') }}
-
-
-
- ×
-
+
+
+
+ ×
+
+
{{ $t('feedback.uploadImage') }}
-
+
{{ $t('feedback.contactInfo') }}
-
+
@@ -55,6 +55,9 @@
ref,
onMounted
} from 'vue'
+ import {
+ onLoad
+ } from "@dcloudio/uni-app"
import {
URL,
appid
@@ -65,9 +68,12 @@
import {
addUserFeedback
} from '../../config/api/feedback'
- import { useI18n } from '@/utils/i18n.js'
-
- const { t: $t } = useI18n()
+ import {
+ useI18n
+ } from '@/utils/i18n.js'
+ const {
+ t: $t
+ } = useI18n()
onMounted(() => {
uni.setNavigationBarTitle({
@@ -75,6 +81,12 @@
})
})
+ onLoad(() => {
+ if (uni.getStorageSync("userInfo").phone) {
+ contact.value = uni.getStorageSync('userInfo').phone;
+ }
+ })
+
// 响应式数据
const types = ref(['feedback.deviceFault', 'feedback.chargingIssue', 'feedback.usageSuggestion', 'feedback.other'])
const selectedType = ref(-1)
@@ -89,6 +101,7 @@
selectedType.value = index
}
+
const chooseImage = () => {
uni.chooseImage({
count: 3 - images.value.length,
@@ -109,7 +122,10 @@
if (idx !== -1) {
images.value.splice(idx, 1)
}
- uni.showToast({ title: '图片上传失败', icon: 'none' })
+ uni.showToast({
+ title: '图片上传失败',
+ icon: 'none'
+ })
}
}
}
@@ -145,11 +161,12 @@
return
}
- if (types.value[selectedType.value] === 'feedback.deviceFault' || types.value[selectedType.value] === 'feedback.chargingIssue') {
- paramsType.value = 'complain'
- } else {
- paramsType.value = 'suggestion'
- }
+ if (types.value[selectedType.value] === 'feedback.deviceFault' || types.value[selectedType.value] ===
+ 'feedback.chargingIssue') {
+ paramsType.value = 'complain'
+ } else {
+ paramsType.value = 'suggestion'
+ }
// 构建反馈数据
const feedbackData = {
@@ -172,7 +189,8 @@
dataType: 'json',
success: (res) => {
// 兼容后端返回 { code: 200 } 或 HTTP 200 情况
- if ((res.statusCode === 200) && ((res.data && res.data.code === 200) || res.data === true || res.data?.success === true)) {
+ if ((res.statusCode === 200) && ((res.data && res.data.code === 200) || res.data ===
+ true || res.data?.success === true)) {
uni.showToast({
title: $t('feedback.submitSuccess'),
icon: 'success'
@@ -183,7 +201,8 @@
return
}
uni.showToast({
- title: (res.data && (res.data.msg || res.data.message)) || $t('feedback.submitFailed'),
+ title: (res.data && (res.data.msg || res.data.message)) || $t(
+ 'feedback.submitFailed'),
icon: 'none'
})
},
diff --git a/pages/index/index.vue b/pages/index/index.vue
index c626327..b99ff37 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,41 +1,40 @@
-
-
-
- {{ $t('home.title') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('common.loadingLocation') }}
+
+
+
+ {{ $t('home.title') }}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('common.loadingLocation') }}
+
+
+
+
+
-
+
@@ -107,90 +99,82 @@
-
-
-
+
+
+
+
-
-
-
-
-
+
+