From 3f9032e92fdd383bfefc87a0bec9b242e1223851 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 09 六月 2026 17:08:44 +0800
Subject: [PATCH] 改bug
---
small-program/shop/pages/storage-point/storage-point.vue | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/small-program/shop/pages/storage-point/storage-point.vue b/small-program/shop/pages/storage-point/storage-point.vue
index 3424755..0a2b6f2 100644
--- a/small-program/shop/pages/storage-point/storage-point.vue
+++ b/small-program/shop/pages/storage-point/storage-point.vue
@@ -32,7 +32,7 @@
:class="{ active: currentDropdown === item.key }"
@click="toggleDropdown(item.key)"
>
- <text :class="{ 'filter-text-bold': isFilterBold(item.key) }">{{ filterLabels[item.key] }}</text>
+ <text :class="{ 'filter-text-bold': isFilterBold(item.key) }">{{ ellipsisText(filterLabels[item.key]) }}</text>
<image :src="currentDropdown === item.key ? '/static/icon/ar_open_sel@2x.png' : '/static/icon/ar_open1@2x.png'" mode="widthFix"></image>
</view>
</view>
@@ -170,8 +170,8 @@
locationTagId: ''
},
mapCenter: {
- latitude: 31.86119,
- longitude: 117.28565
+ latitude: '',
+ longitude: ''
},
filters: [
{ key: 'sortType', label: '缁煎悎鎺掑簭' },
@@ -201,7 +201,8 @@
},
pointList: [],
isRequest: true,
- showLogin: false
+ showLogin: false,
+ firstLoad: true
}
},
computed: {
@@ -244,7 +245,12 @@
},
watch: {
filterLabels: {
+ deep: true,
handler(newVal, oldVal) {
+ if (this.firstLoad) {
+ this.firstLoad = false
+ return
+ }
this.handleSearch()
}
}
@@ -252,7 +258,14 @@
async onLoad() {
await this.$onLaunched
this.getLocationTagList()
- this.getNearbyShopList()
+ // 鑾峰彇褰撳墠浣嶇疆浣滀负鍦板浘涓績
+ this.getCurrentLocation()
+ .then(() => {
+ this.handleSearch()
+ })
+ .catch(() => {
+ uni.showToast({ title: '鑾峰彇浣嶇疆澶辫触锛岃鎺堟潈浣嶇疆鏉冮檺', icon: 'none' })
+ })
uni.$on('city', (city) => {
this.cityNameMine = city.cityName
this.cityIdMine = city.cityId
@@ -265,6 +278,25 @@
this.getNearbyShopList()
},
methods: {
+ ellipsisText(text) {
+ if (!text) return ''
+ return text.length > 4 ? text.slice(0, 4) + '...' : text
+ },
+ getCurrentLocation() {
+ return new Promise((resolve, reject) => {
+ uni.getLocation({
+ type: 'gcj02',
+ success: (res) => {
+ this.mapCenter.latitude = res.latitude
+ this.mapCenter.longitude = res.longitude
+ resolve()
+ },
+ fail: () => {
+ reject()
+ }
+ })
+ })
+ },
toggleExpand() {
this.isExpanded = !this.isExpanded
},
@@ -360,6 +392,7 @@
}
arr.push(obj)
})
+ this.pointList = []
this.pointList = [...this.pointList, ...arr]
this.page++
if (res.data.total <= this.pointList.length) {
--
Gitblit v1.9.3