@tplc/business 0.4.180 → 0.4.181

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.4.181](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.180...v0.4.181) (2025-08-01)
6
+
7
+
8
+ ### 🐛 Bug Fixes | Bug 修复
9
+
10
+ * map 兼容拖动 ([6bd504e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6bd504e2f46f1aee18208466531254909e25d928))
11
+
5
12
  ### [0.4.180](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.176...v0.4.180) (2025-08-01)
6
13
 
7
14
 
@@ -3,8 +3,6 @@
3
3
  <view class="flex-col flex w-full" :style="{ height }" v-if="height">
4
4
  <view class="flex-1 h-0 relative">
5
5
  <map
6
- :latitude="form.userLatitude"
7
- :longitude="form.userLongitude"
8
6
  :markers="info.covers"
9
7
  show-location
10
8
  show-compass
@@ -15,12 +13,12 @@
15
13
  @regionchange="onRegionChange"
16
14
  @callouttap="onCalloutTap"
17
15
  />
16
+ {{ form.mapLatitude }}
18
17
  <image
19
18
  src="./images/2.png"
20
19
  class="w-36rpx h-66rpx absolute left-0 top-0 m-auto bottom-0 right-0"
21
20
  />
22
21
  <!-- 重新定位到当前位置 -->
23
-
24
22
  <view class="absolute top-3 right-2 flex flex-col gap-2">
25
23
  <view
26
24
  v-for="item in mapTags"
@@ -92,7 +90,6 @@ import { LcbListProps } from '@tplc/business/components/lcb-list/types'
92
90
  import { LcbListInfo } from '@tplc/business/components/lcb-list/api'
93
91
  import { debounce } from '@tplc/wot/components/common/util'
94
92
  import useLocation from '../../hooks/useLocation'
95
- import { nextTick } from 'process'
96
93
  const { height } = useAutoHeight()
97
94
  defineOptions({
98
95
  name: 'LcbMap',
@@ -131,6 +128,7 @@ const current = ref(0)
131
128
  const list = ref<MapItem[]>([])
132
129
  const mapScale = ref(14)
133
130
  const isConfig = ref(false)
131
+ const currentScale = ref(14)
134
132
 
135
133
  const onTagClick = (value: string) => {
136
134
  if (props.mapTagMode === 'single') {
@@ -150,20 +148,26 @@ const onTagClick = (value: string) => {
150
148
 
151
149
  const getData = debounce(() => {
152
150
  mapContext.value?.getRegion({
153
- async success(res) {
154
- if (!res.southwest) return
155
- const { data = [] } = (await uni.$lcb.http.post('/productInfoMap/list', {
156
- ...props.baseParam,
157
- ...form?.value,
158
- mapScale: mapScale.value,
159
- mapCornerLongitude: res.southwest.longitude,
160
- mapCornerLatitude: res.southwest.latitude,
161
- productTypeList: selectedTag.value.length ? selectedTag.value : undefined,
162
- })) as {
163
- data: MapItem[]
164
- }
165
- list.value = data as any
166
- getCurrentData(data)
151
+ success({ southwest }) {
152
+ if (!southwest) return
153
+ mapContext.value?.getCenterLocation({
154
+ async success({ latitude, longitude }) {
155
+ const { data = [] } = (await uni.$lcb.http.post('/productInfoMap/list', {
156
+ ...props.baseParam,
157
+ ...form?.value,
158
+ mapLatitude: latitude,
159
+ mapLongitude: longitude,
160
+ mapScale: currentScale.value,
161
+ mapCornerLongitude: southwest.longitude,
162
+ mapCornerLatitude: southwest.latitude,
163
+ productTypeList: selectedTag.value.length ? selectedTag.value : undefined,
164
+ })) as {
165
+ data: MapItem[]
166
+ }
167
+ list.value = data as any
168
+ getCurrentData(data)
169
+ },
170
+ })
167
171
  },
168
172
  })
169
173
  }, 50)
@@ -190,17 +194,21 @@ const getConfig = async () => {
190
194
  ...form?.value,
191
195
  ...getJsonFromStr(props.mapConfigParams),
192
196
  })
193
- form.value.userLatitude = mapLatitude
194
- form.value.userLongitude = mapLongitude
195
- mapScale.value = scale
197
+ mapContext.value?.moveToLocation({
198
+ latitude: mapLatitude,
199
+ longitude: mapLongitude,
200
+ })
201
+ getData()
196
202
  }
197
203
 
198
204
  watch(
199
205
  () => userLatLon.value,
200
206
  async (val, old) => {
201
207
  if (!val || JSON.stringify(val) === JSON.stringify(old)) return
202
- form.value.mapLatitude = val.latitude
203
- form.value.mapLongitude = val.longitude
208
+ mapContext.value?.moveToLocation({
209
+ latitude: val.latitude,
210
+ longitude: val.longitude,
211
+ })
204
212
  form.value.userLongitude = val.longitude
205
213
  form.value.userLatitude = val.latitude
206
214
  if (!isConfig.value) {
@@ -213,7 +221,7 @@ watch(
213
221
  },
214
222
  )
215
223
  const getCurrentLocation = async () => {
216
- getLocation(true)
224
+ mapContext.value?.moveToLocation({})
217
225
  }
218
226
  getLocation()
219
227
  const onRegionChange = (e: {
@@ -221,6 +229,7 @@ const onRegionChange = (e: {
221
229
  detail: {
222
230
  causedBy: string
223
231
  scale: number
232
+ gesture: boolean
224
233
  centerLocation: {
225
234
  latitude: number
226
235
  longitude: number
@@ -228,12 +237,8 @@ const onRegionChange = (e: {
228
237
  }
229
238
  }) => {
230
239
  if (e.type === 'end') {
231
- if (e.detail.causedBy === 'drag') {
232
- form.value.mapLatitude = e.detail.centerLocation.latitude
233
- form.value.mapLongitude = e.detail.centerLocation.longitude
234
- }
235
-
236
- mapScale.value = e.detail.scale
240
+ getData()
241
+ currentScale.value = e.detail.scale
237
242
  }
238
243
  }
239
244
  const onCurrentChange = (p: number) => {
@@ -317,6 +322,7 @@ onMounted(() => {
317
322
  background-color: #fff;
318
323
  box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.1);
319
324
  font-size: 28rpx;
325
+
320
326
  &.map-tag-active {
321
327
  font-weight: 600;
322
328
  background-color: var(--wot-color-theme);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.180",
3
+ "version": "0.4.181",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],