@tplc/business 0.5.53 → 0.5.55

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,32 @@
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.55](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.52...v0.5.55) (2025-11-24)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.5.53 ([d196f57](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/d196f57b4459a8348c433ea1e14a42389ebd0ba9))
11
+ * **release:** 0.5.54 ([08b6691](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/08b669104bd401efcaad993017f7b96b0cdd610b))
12
+ * **release:** 1.0.7 ([f8ce5c4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/f8ce5c455187ed95257ee8976a93c83c69519542))
13
+
14
+
15
+ ### ✨ Features | 新功能
16
+
17
+ * map ([49b348b](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/49b348b1e537c77f8efd2e07866f5958fbef5c72))
18
+ * webp 调整 ([8bcb6c8](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8bcb6c89a725f44b687fa1d5d459a4f0c2dc03d7))
19
+ * 修改数据 ([0b3c765](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/0b3c76502422df7f460dce3cc68c20d2496c8461))
20
+ * 兼容数据结构 ([ebf4369](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ebf4369e46a5a51b5b172ec3db89382036a8a02a))
21
+ * 新增判断 ([197736a](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/197736a34c0a5aed9b172b2dd5d7a6718affcaab))
22
+
23
+
24
+ ### 🐛 Bug Fixes | Bug 修复
25
+
26
+ * 兼容list为空 ([a6e0af9](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/a6e0af9a21548192572d94abba9bcd8d7c1053c1))
27
+ * 图片版本 ([4ec8bc2](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/4ec8bc20925733debdc1911a5dde272eab8b8913))
28
+
29
+ ### [0.5.54](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.7...v0.5.54) (2025-11-21)
30
+
5
31
  ### [0.5.53](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.46...v0.5.53) (2025-11-20)
6
32
 
7
33
 
@@ -69,7 +69,7 @@ interface UnconditionedLayoutConfig {
69
69
  recommendIcon: string
70
70
  }
71
71
 
72
- const list = inject(LIST_FORM_CHOOSER_VALUES) as Ref<ListFormChooserValues>
72
+ const list = inject(LIST_FORM_CHOOSER_VALUES, {}) as Ref<ListFormChooserValues>
73
73
  const form = inject(FORM_KEY) as Ref<Record<string, any>>
74
74
  const props = withDefaults(
75
75
  defineProps<{
@@ -98,6 +98,7 @@ const itemStyle = computed(() => {
98
98
  })
99
99
 
100
100
  const options = computed(() => {
101
+ if (!list || !list.value) return []
101
102
  return Object.keys(list.value)
102
103
  .filter((v) => list.value[v])
103
104
  .map((v) => {
@@ -128,6 +129,7 @@ const removeTag = (value: string, key: string, length: number) => {
128
129
  */
129
130
  const handleClearAll = () => {
130
131
  form.value.keywords = undefined
132
+ if (!list || !list.value) return
131
133
  Object.keys(list.value).forEach((v) => {
132
134
  form.value[v] = undefined
133
135
  list.value[v] = []
@@ -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">
@@ -3,6 +3,7 @@ import { computed, provide, useAttrs } from 'vue'
3
3
  import { LcbProductItemProps } from './types'
4
4
  import ItemValue from './components/ItemValue.vue'
5
5
  import { transformValueUnit } from '../../utils/transform'
6
+ import { videoPreviewProps } from '@tplc/wot/types/components/wd-video-preview/types'
6
7
  defineOptions({
7
8
  name: 'LcbProductItem',
8
9
  options: {
@@ -220,7 +221,12 @@ const itemStyle = computed(() => {
220
221
 
221
222
  <view class="flex gap-1 items-center">
222
223
  <ItemValue prop="orderSkuCountTips" />
223
- <view class="text-3.5 text-#969696" v-if="orderSkuCountTips && orderTips">·</view>
224
+ <view
225
+ class="text-3.5 text-#969696"
226
+ v-if="orderSkuCountTips && orderTips && orderTipsVisible && orderSkuCountTipsVisible"
227
+ >
228
+ ·
229
+ </view>
224
230
  <ItemValue prop="orderTips" />
225
231
  </view>
226
232
 
@@ -373,7 +379,12 @@ const itemStyle = computed(() => {
373
379
  </ItemValue>
374
380
  <view class="flex gap-1 items-center">
375
381
  <ItemValue prop="orderSkuCountTips"></ItemValue>
376
- <view class="text-3.5 text-#969696" v-if="orderSkuCountTips && orderTips">·</view>
382
+ <view
383
+ class="text-3.5 text-#969696"
384
+ v-if="orderSkuCountTips && orderTips && orderTipsVisible && orderSkuCountTipsVisible"
385
+ >
386
+ ·
387
+ </view>
377
388
  <ItemValue prop="orderTips">
378
389
  <!-- <template #orderTips="{ value }">
379
390
  <slot name="orderTips" :value="value" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.53",
3
+ "version": "0.5.55",
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",