@tplc/business 0.5.52 → 0.5.54

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,35 @@
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.5.54](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.7...v0.5.54) (2025-11-21)
6
+
7
+ ### [0.5.53](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.46...v0.5.53) (2025-11-20)
8
+
9
+
10
+ ### 🐛 Bug Fixes | Bug 修复
11
+
12
+ * 修改block ([9abe6cf](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9abe6cfd208f1b62bf806c5e91fd96a3b4d7cf53))
13
+
14
+
15
+ ### 🚀 Chore | 构建/工程依赖/工具
16
+
17
+ * **release:** 0.5.47 ([2f256cb](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/2f256cb03886a9f77fe0166b38b5b091489a7e7a))
18
+ * **release:** 0.5.48 ([9649f8d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9649f8dc7621f0b31689b5cc064bfdd0232f7eb8))
19
+ * **release:** 0.5.49 ([7c0d99d](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/7c0d99dac0fd7ad1cbd6df801b094692da703269))
20
+ * **release:** 0.5.50 ([3325457](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/3325457ae21ca7a2df1b253a71bdf527dece849e))
21
+ * **release:** 0.5.51 ([5c79704](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/5c797046dd407ef9282cd8de5cbcf25e15888c71))
22
+ * **release:** 0.5.52 ([0c95b73](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/0c95b731137dd1476b78770a52d664183255e773))
23
+
24
+
25
+ ### ✨ Features | 新功能
26
+
27
+ * home search tabs允许为空 ([9678a10](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9678a10bb5f4a8b5c5948410d5db4482d8589bcc))
28
+ * 兼容数据结构 ([ebf4369](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ebf4369e46a5a51b5b172ec3db89382036a8a02a))
29
+ * 新增compareType ([dc2fb5e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/dc2fb5ec5a2982a53cd6b880c0a5cba31f333c0c))
30
+ * 新增lcb-light-map ([b18d767](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/b18d767059fccadf5f55400d5fc34e352fa4c55d))
31
+ * 调整预览 ([ed2baed](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ed2baedafa3b05a54803aec024c190185c76902e))
32
+ * 逻辑处理 ([8576a3c](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8576a3ce1f0144980cae7ce25e3f944a87b51c80))
33
+
5
34
  ### [0.5.52](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.51...v0.5.52) (2025-11-15)
6
35
 
7
36
 
@@ -105,7 +105,6 @@
105
105
  <wd-checkbox-group
106
106
  v-else-if="field.frontInputType === 'checkbox'"
107
107
  v-model="form[field.field]"
108
- v-bind="field.props"
109
108
  >
110
109
  <wd-checkbox
111
110
  v-for="item in getColumns(field.frontInputContent)"
@@ -221,9 +220,10 @@ defineOptions({
221
220
  },
222
221
  })
223
222
  const { translate: t } = useTranslate()
224
- const form = defineModel<Record<string, any>>({
223
+ const formData = defineModel<Record<string, any>>({
225
224
  default: { agreement: false },
226
225
  })
226
+ const form = ref(formData.value || { agreement: false })
227
227
 
228
228
  const imgList = ref({})
229
229
  const formRef = ref()
@@ -369,6 +369,13 @@ watch(
369
369
  },
370
370
  { deep: true },
371
371
  )
372
+ watch(
373
+ form,
374
+ (newVal) => {
375
+ formData.value = newVal
376
+ },
377
+ { deep: true },
378
+ )
372
379
  </script>
373
380
 
374
381
  <style lang="scss">
@@ -18,7 +18,12 @@
18
18
  borderRadius: transformValueUnit(imageRadius),
19
19
  }"
20
20
  >
21
- <lcb-action-view v-bind="item.link" custom-class="w-full" v-if="item.url">
21
+ <lcb-action-view
22
+ v-bind="item.link"
23
+ custom-class="w-full"
24
+ v-if="item.url"
25
+ @click="onPreview(item.url)"
26
+ >
22
27
  <wd-img
23
28
  :width="`${styleGroup == 3 ? transformValueUnit(imageSize) : '100%'}`"
24
29
  :src="item.url"
@@ -65,7 +70,13 @@ const props = withDefaults(defineProps<LcbImageProps>(), {
65
70
  imageMargin: 0,
66
71
  })
67
72
  const imagesHeight = ref<number[]>([])
68
-
73
+ const onPreview = (url: string) => {
74
+ if (props.enablePreview) {
75
+ uni.previewImage({
76
+ urls: [url],
77
+ })
78
+ }
79
+ }
69
80
  function getRealSize(size: number = 0) {
70
81
  const mode = props.styleGroup
71
82
  const lens = props.items?.length || 1
@@ -3,15 +3,17 @@
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
+ id="map"
6
7
  :markers="info.covers"
7
8
  show-location
8
9
  show-compass
9
10
  show-scale
10
11
  :scale="mapScale"
11
12
  class="w-full h-full"
12
- id="map"
13
13
  @regionchange="onRegionChange"
14
14
  @callouttap="onCalloutTap"
15
+ :latitude="mapLatLon.latitude"
16
+ :longitude="mapLatLon.longitude"
15
17
  />
16
18
  <image
17
19
  src="./images/2.png"
@@ -85,7 +87,17 @@
85
87
 
86
88
  <script lang="ts" setup>
87
89
  import { FORM_KEY } from '@tplc/business/constants'
88
- import { reactive, inject, ref, useAttrs, watch, getCurrentInstance, onUnmounted } from 'vue'
90
+ import {
91
+ reactive,
92
+ inject,
93
+ ref,
94
+ useAttrs,
95
+ watch,
96
+ getCurrentInstance,
97
+ onUnmounted,
98
+ onMounted,
99
+ nextTick,
100
+ } from 'vue'
89
101
  import { getJsonFromStr, transformValueUnit } from '../../utils/transform'
90
102
  import { MapItem, MapMarker } from './types'
91
103
  import useAutoHeight from '../../hooks/useAutoHeight'
@@ -94,6 +106,7 @@ import { LcbListInfo } from '@tplc/business/components/lcb-list/api'
94
106
  import { debounce } from '@tplc/wot/components/common/util'
95
107
  import useLocation from '../../hooks/useLocation'
96
108
  const { height } = useAutoHeight('pagingTop', 500)
109
+ const mapReady = ref(false)
97
110
  defineOptions({
98
111
  name: 'LcbMap',
99
112
  options: {
@@ -134,6 +147,10 @@ const list = ref<MapItem[]>([])
134
147
  const mapScale = ref(14)
135
148
  const isConfig = ref(false)
136
149
  const currentScale = ref(14)
150
+ const mapLatLon = ref({
151
+ latitude: 0,
152
+ longitude: 0,
153
+ })
137
154
 
138
155
  const onTagClick = (value: string) => {
139
156
  if (props.mapTagMode === 'single') {
@@ -151,40 +168,58 @@ const onTagClick = (value: string) => {
151
168
  }
152
169
  }
153
170
 
154
- const getData = debounce(() => {
155
- mapContext.value?.getRegion({
156
- success({ southwest }) {
157
- if (!southwest) return
158
- mapContext.value?.getCenterLocation({
159
- async success({ latitude, longitude }) {
160
- isLoading.value = true
161
- try {
162
- const { data = [] } = (await uni.$lcb.http.post(
163
- '/productInfoMap/list',
164
- {
165
- ...props.baseParam,
166
- ...form?.value,
167
- mapLatitude: latitude,
168
- mapLongitude: longitude,
169
- mapScale: currentScale.value,
170
- mapCornerLongitude: southwest.longitude,
171
- mapCornerLatitude: southwest.latitude,
172
- productTypeList: selectedTag.value.length ? selectedTag.value : undefined,
173
- },
174
- true,
175
- )) as {
176
- data: MapItem[]
177
- }
178
- list.value = data as any
179
- getCurrentData(data)
180
- } finally {
181
- isLoading.value = false
182
- }
183
- },
184
- })
185
- },
186
- })
187
- }, 50)
171
+ // 存储最新的地图区域信息
172
+ const lastRegionInfo = ref<{
173
+ centerLocation: { latitude: number; longitude: number }
174
+ southwest?: { latitude: number; longitude: number }
175
+ } | null>(null)
176
+
177
+ const getDataCore = async () => {
178
+ // 安全检查:确保地图已就绪
179
+ if (!mapContext.value || !mapReady.value) {
180
+ return
181
+ }
182
+
183
+ // const region = await getMapRegion()
184
+ // lastRegionInfo.value = region
185
+ if (lastRegionInfo.value) {
186
+ await fetchMapData(lastRegionInfo.value)
187
+ }
188
+ }
189
+
190
+ // 请求地图数据
191
+ const fetchMapData = async (regionInfo: {
192
+ centerLocation: { latitude: number; longitude: number }
193
+ southwest?: { latitude: number; longitude: number }
194
+ }) => {
195
+ isLoading.value = true
196
+ try {
197
+ const { data = [] } = (await uni.$lcb.http.post(
198
+ '/productInfoMap/list',
199
+ {
200
+ ...props.baseParam,
201
+ ...form?.value,
202
+ mapLatitude: regionInfo.centerLocation.latitude,
203
+ mapLongitude: regionInfo.centerLocation.longitude,
204
+ mapScale: currentScale.value,
205
+ mapCornerLongitude: regionInfo.southwest?.longitude,
206
+ mapCornerLatitude: regionInfo.southwest?.latitude,
207
+ productTypeList: selectedTag.value.length ? selectedTag.value : undefined,
208
+ },
209
+ true,
210
+ )) as {
211
+ data: MapItem[]
212
+ }
213
+ list.value = data as any
214
+ getCurrentData(data)
215
+ } catch (error) {
216
+ console.error('地图数据请求失败:', error)
217
+ } finally {
218
+ isLoading.value = false
219
+ }
220
+ }
221
+
222
+ const getData = debounce(getDataCore, 50)
188
223
  watch(
189
224
  () => selectedTag.value,
190
225
  () => {
@@ -196,6 +231,21 @@ watch(
196
231
  )
197
232
 
198
233
  const getConfig = async () => {
234
+ // 等待地图就绪
235
+ if (!mapReady.value) {
236
+ await new Promise<void>((resolve) => {
237
+ const unwatch = watch(
238
+ () => mapReady.value,
239
+ (ready) => {
240
+ if (ready) {
241
+ unwatch()
242
+ resolve()
243
+ }
244
+ },
245
+ )
246
+ })
247
+ }
248
+
199
249
  isConfig.value = true
200
250
  const {
201
251
  data: { mapLatitude, mapLongitude, mapScale: scale },
@@ -208,28 +258,31 @@ const getConfig = async () => {
208
258
  ...form?.value,
209
259
  ...getJsonFromStr(props.mapConfigParams),
210
260
  })
211
- mapContext.value = uni.createMapContext('map', proxy)
212
- mapContext.value?.moveToLocation({
213
- latitude: mapLatitude,
214
- longitude: mapLongitude,
215
- })
261
+
262
+ if (mapLatitude && `${mapLatitude}` !== '0') {
263
+ mapLatLon.value = {
264
+ latitude: mapLatitude,
265
+ longitude: mapLongitude,
266
+ }
267
+ }
268
+
216
269
  mapScale.value = scale
217
270
  currentScale.value = scale
218
- getData()
219
271
  }
220
272
 
221
273
  watch(
222
274
  () => userLatLon.value,
223
275
  async (val, old) => {
224
276
  if (!val || JSON.stringify(val) === JSON.stringify(old)) return
225
- mapContext.value?.moveToLocation({
226
- latitude: val.latitude,
227
- longitude: val.longitude,
228
- })
229
277
  form.value.userLongitude = val.longitude
230
278
  form.value.userLatitude = val.latitude
231
279
  if (!isConfig.value) {
232
280
  getConfig()
281
+ } else {
282
+ mapLatLon.value = {
283
+ latitude: val.latitude,
284
+ longitude: val.longitude,
285
+ }
233
286
  }
234
287
  },
235
288
  {
@@ -246,16 +299,25 @@ const onRegionChange = (e: {
246
299
  detail: {
247
300
  causedBy: string
248
301
  scale: number
249
- gesture: boolean
250
302
  centerLocation: {
251
303
  latitude: number
252
304
  longitude: number
253
305
  }
306
+ region: {
307
+ northeast: { latitude: number; longitude: number }
308
+ southwest: { latitude: number; longitude: number }
309
+ }
254
310
  }
255
311
  }) => {
312
+ // 更新当前缩放级别
313
+ currentScale.value = e.detail.scale
314
+
256
315
  if (e.type === 'end') {
316
+ lastRegionInfo.value = {
317
+ centerLocation: e.detail.centerLocation,
318
+ southwest: e.detail.region.southwest,
319
+ }
257
320
  getData()
258
- currentScale.value = e.detail.scale
259
321
  }
260
322
  }
261
323
  const onCurrentChange = (p: number) => {
@@ -317,12 +379,26 @@ watch(
317
379
  deep: true,
318
380
  },
319
381
  )
320
- // onMounted(() => {
321
- // mapContext.value = uni.createMapContext('map', proxy)
322
- // })
382
+ onMounted(() => {
383
+ // 延迟创建 mapContext,确保 DOM 完全渲染
384
+ nextTick(() => {
385
+ setTimeout(() => {
386
+ try {
387
+ mapContext.value = uni.createMapContext('map', proxy)
388
+ if (mapContext.value) {
389
+ mapReady.value = true
390
+ }
391
+ } catch (error) {
392
+ console.error('地图初始化异常:', error)
393
+ }
394
+ }, 500)
395
+ })
396
+ })
323
397
 
324
398
  onUnmounted(() => {
325
399
  mapContext.value = undefined
400
+ mapReady.value = false
401
+ lastRegionInfo.value = null
326
402
  })
327
403
  </script>
328
404
  <style lang="scss">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.52",
3
+ "version": "0.5.54",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "vue": ">=3.2.47",
14
- "@tplc/wot": "1.0.6"
14
+ "@tplc/wot": "1.0.7"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=18",