@tplc/business 0.4.180 → 0.4.182

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,15 @@
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.182](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.181...v0.4.182) (2025-08-01)
6
+
7
+ ### [0.4.181](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.180...v0.4.181) (2025-08-01)
8
+
9
+
10
+ ### 🐛 Bug Fixes | Bug 修复
11
+
12
+ * map 兼容拖动 ([6bd504e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6bd504e2f46f1aee18208466531254909e25d928))
13
+
5
14
  ### [0.4.180](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.176...v0.4.180) (2025-08-01)
6
15
 
7
16
 
@@ -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
@@ -20,7 +18,6 @@
20
18
  class="w-36rpx h-66rpx absolute left-0 top-0 m-auto bottom-0 right-0"
21
19
  />
22
20
  <!-- 重新定位到当前位置 -->
23
-
24
21
  <view class="absolute top-3 right-2 flex flex-col gap-2">
25
22
  <view
26
23
  v-for="item in mapTags"
@@ -84,7 +81,16 @@
84
81
 
85
82
  <script lang="ts" setup>
86
83
  import { FORM_KEY } from '@tplc/business/constants'
87
- import { reactive, inject, ref, useAttrs, watch, onMounted, getCurrentInstance } from 'vue'
84
+ import {
85
+ reactive,
86
+ inject,
87
+ ref,
88
+ useAttrs,
89
+ watch,
90
+ onMounted,
91
+ getCurrentInstance,
92
+ onUnmounted,
93
+ } from 'vue'
88
94
  import { getJsonFromStr, transformValueUnit } from '../../utils/transform'
89
95
  import { MapItem, MapMarker } from './types'
90
96
  import useAutoHeight from '../../hooks/useAutoHeight'
@@ -92,7 +98,6 @@ import { LcbListProps } from '@tplc/business/components/lcb-list/types'
92
98
  import { LcbListInfo } from '@tplc/business/components/lcb-list/api'
93
99
  import { debounce } from '@tplc/wot/components/common/util'
94
100
  import useLocation from '../../hooks/useLocation'
95
- import { nextTick } from 'process'
96
101
  const { height } = useAutoHeight()
97
102
  defineOptions({
98
103
  name: 'LcbMap',
@@ -131,6 +136,7 @@ const current = ref(0)
131
136
  const list = ref<MapItem[]>([])
132
137
  const mapScale = ref(14)
133
138
  const isConfig = ref(false)
139
+ const currentScale = ref(14)
134
140
 
135
141
  const onTagClick = (value: string) => {
136
142
  if (props.mapTagMode === 'single') {
@@ -150,20 +156,26 @@ const onTagClick = (value: string) => {
150
156
 
151
157
  const getData = debounce(() => {
152
158
  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)
159
+ success({ southwest }) {
160
+ if (!southwest) return
161
+ mapContext.value?.getCenterLocation({
162
+ async success({ latitude, longitude }) {
163
+ const { data = [] } = (await uni.$lcb.http.post('/productInfoMap/list', {
164
+ ...props.baseParam,
165
+ ...form?.value,
166
+ mapLatitude: latitude,
167
+ mapLongitude: longitude,
168
+ mapScale: currentScale.value,
169
+ mapCornerLongitude: southwest.longitude,
170
+ mapCornerLatitude: southwest.latitude,
171
+ productTypeList: selectedTag.value.length ? selectedTag.value : undefined,
172
+ })) as {
173
+ data: MapItem[]
174
+ }
175
+ list.value = data as any
176
+ getCurrentData(data)
177
+ },
178
+ })
167
179
  },
168
180
  })
169
181
  }, 50)
@@ -190,17 +202,21 @@ const getConfig = async () => {
190
202
  ...form?.value,
191
203
  ...getJsonFromStr(props.mapConfigParams),
192
204
  })
193
- form.value.userLatitude = mapLatitude
194
- form.value.userLongitude = mapLongitude
195
- mapScale.value = scale
205
+ mapContext.value?.moveToLocation({
206
+ latitude: mapLatitude,
207
+ longitude: mapLongitude,
208
+ })
209
+ getData()
196
210
  }
197
211
 
198
212
  watch(
199
213
  () => userLatLon.value,
200
214
  async (val, old) => {
201
215
  if (!val || JSON.stringify(val) === JSON.stringify(old)) return
202
- form.value.mapLatitude = val.latitude
203
- form.value.mapLongitude = val.longitude
216
+ mapContext.value?.moveToLocation({
217
+ latitude: val.latitude,
218
+ longitude: val.longitude,
219
+ })
204
220
  form.value.userLongitude = val.longitude
205
221
  form.value.userLatitude = val.latitude
206
222
  if (!isConfig.value) {
@@ -213,7 +229,7 @@ watch(
213
229
  },
214
230
  )
215
231
  const getCurrentLocation = async () => {
216
- getLocation(true)
232
+ mapContext.value?.moveToLocation({})
217
233
  }
218
234
  getLocation()
219
235
  const onRegionChange = (e: {
@@ -221,6 +237,7 @@ const onRegionChange = (e: {
221
237
  detail: {
222
238
  causedBy: string
223
239
  scale: number
240
+ gesture: boolean
224
241
  centerLocation: {
225
242
  latitude: number
226
243
  longitude: number
@@ -228,12 +245,8 @@ const onRegionChange = (e: {
228
245
  }
229
246
  }) => {
230
247
  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
248
+ getData()
249
+ currentScale.value = e.detail.scale
237
250
  }
238
251
  }
239
252
  const onCurrentChange = (p: number) => {
@@ -296,6 +309,10 @@ onMounted(() => {
296
309
  mapContext.value = uni.createMapContext('map', proxy)
297
310
  getData()
298
311
  })
312
+
313
+ onUnmounted(() => {
314
+ mapContext.value = undefined
315
+ })
299
316
  </script>
300
317
  <style lang="scss">
301
318
  .icon {
@@ -317,6 +334,7 @@ onMounted(() => {
317
334
  background-color: #fff;
318
335
  box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.1);
319
336
  font-size: 28rpx;
337
+
320
338
  &.map-tag-active {
321
339
  font-weight: 600;
322
340
  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.182",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],