@tplc/business 0.2.38 → 0.2.40

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,38 @@
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.2.40](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.38...v0.2.40) (2024-12-27)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.2.39 ([188053e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/188053edc4e98d208740c6a364aba343fa146f18))
11
+
12
+
13
+ ### ✨ Features | 新功能
14
+
15
+ * 支持头像昵称 ([a1061f0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a1061f0646637c797cdd2f5d9dbadd0862256398))
16
+ * 新增测试waterfall ([34b352d](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/34b352dffc3fcc852a658e34ac673bd5d1c77a4d))
17
+ * 更新product ([3fb575b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3fb575b7be9ec92b10c3cd36d19ee9593999bb4a))
18
+
19
+ ### [0.2.39](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.46...v0.2.39) (2024-12-27)
20
+
21
+
22
+ ### 🚀 Chore | 构建/工程依赖/工具
23
+
24
+ * **release:** 0.1.47 ([b785621](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b78562141021c6b4ed0568765004f6e4bc55fa32))
25
+ * **release:** 0.2.37 ([19d81b9](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/19d81b9d3f6022e1c8523b258bf7793a6d3b133a))
26
+ * **release:** 0.2.38 ([5acc214](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5acc214f80be26f5f80bdfe282918019b43315ae))
27
+
28
+
29
+ ### ✨ Features | 新功能
30
+
31
+ * calendar 尺寸 ([5670ca5](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5670ca5fa482d9d0e57d32f15b9f7ab369210c3d))
32
+ * 图片支持渐进式 ([08523e0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/08523e0eb244da1da3b46dca4d999360600edcf5))
33
+ * 增加 lcb-product-item 图片展示类型选择 ([24706b3](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/24706b3e87aee2fc6d02961e35a82147974199c4))
34
+ * 支持头像昵称 ([a1061f0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a1061f0646637c797cdd2f5d9dbadd0862256398))
35
+ * 更新product ([3fb575b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3fb575b7be9ec92b10c3cd36d19ee9593999bb4a))
36
+
5
37
  ### [0.2.38](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.47...v0.2.38) (2024-12-26)
6
38
 
7
39
 
@@ -2,7 +2,7 @@ import { FilterTabsProps } from './components/FilterTabs/type'
2
2
  import { Option } from './types'
3
3
  export interface LcbListInfo {
4
4
  url: string
5
- baseParam: Record<string, unknown>
5
+ baseParam?: Record<string, unknown>
6
6
  }
7
7
  export interface LcbFilterResult {
8
8
  btnComponent: BtnComponent
@@ -18,7 +18,7 @@
18
18
  import { inject, Ref, ref, watch, watchEffect } from 'vue'
19
19
  import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
20
20
  import { FORM_KEY } from '../../../../constants'
21
- import { formatJson, getPageOptions } from '../../../../utils/utils'
21
+ import { getPageOptions } from '../../../../utils/utils'
22
22
  import { LcbFilterListProps } from './type'
23
23
  import useAutoHeight from '../../../../hooks/useAutoHeight'
24
24
 
@@ -40,33 +40,7 @@ const modelValue = defineModel<unknown[]>({
40
40
  default: [],
41
41
  })
42
42
  watchEffect(() => {
43
- const list = dataList.value?.map?.((item: any) => {
44
- return item
45
- // // 以下假数据无效
46
- // // const imgArr = formatJson(item.coverImg, [])
47
- // // const tags = formatJson(item.tags, [])
48
- // // eslint-disable-next-line no-unreachable
49
- // return {
50
- // title: item?.productName,
51
- // addressIntro: item?.address,
52
- // price: item?.price,
53
- // priceSuffix: item?.behindUnit,
54
- // subTitle: '专用通道接送8分钟到候机楼',
55
- // score: 4.7,
56
- // scoreTips: '很好',
57
- // level: 4,
58
- // // imgCornerIcon: 'test',
59
- // // imgBottomIcon: 'test',
60
- // titleIcon: 'I',
61
- // userInteractionInfo: '2991点评 · 8039收藏',
62
- // orderTips: '18分钟前有人预定',
63
- // priceTips: '白银贵宾价 | 十亿豪补 | 2项优惠',
64
- // ...item,
65
- // // coverImg: imgArr?.[1] || imgArr?.[0],
66
- // // tags,
67
- // }
68
- })
69
- modelValue.value = list
43
+ modelValue.value = dataList.value
70
44
  })
71
45
 
72
46
  watch(
@@ -45,6 +45,7 @@
45
45
  <lcb-product v-bind="{ ...attrs, form }" :listType="listType" :items="items" v-else />
46
46
  </template>
47
47
  </FilterList>
48
+ <lcb-map v-else-if="mode === 'map'" v-bind="{ ...info.listInfo, ...attrs }" />
48
49
  </template>
49
50
  </template>
50
51
 
@@ -116,10 +117,6 @@ watch(
116
117
  immediate: true,
117
118
  },
118
119
  )
119
- defineSlots<{
120
- list(props: { items: any }): any
121
- item(props: { item: any }): any
122
- }>()
123
120
  </script>
124
121
 
125
122
  <style lang="scss" scoped>
@@ -1,25 +1,45 @@
1
1
  <template>
2
- <view class="flex-col flex h-full w-full">
2
+ <view class="flex-col flex h-180 w-full">
3
3
  <view class="flex-1 h-0 relative">
4
4
  <map
5
- style="width: 100%; height: 100%"
6
- :latitude="form.latitude"
7
- :longitude="form.longitude"
5
+ :latitude="form.mapLatitude"
6
+ :longitude="form.mapLongitude"
8
7
  :markers="info.covers"
9
8
  show-location
10
9
  show-compass
11
10
  show-scale
11
+ class="w-full h-full"
12
12
  @regionchange="onRegionChange"
13
- @markertap="onMarkerTap"
13
+ @callouttap="onCalloutTap"
14
14
  />
15
15
  <image
16
16
  src="./images/2.png"
17
17
  class="w-36rpx h-66rpx absolute z-1 left-0 top-0 m-auto bottom-0 right-0"
18
18
  />
19
- <view class="absolute bottom-0 left-0 p-3 w-full box-border" v-if="data?.[current]">
20
- <view class="card w-full !p-0">
21
- <lcb-product-item :item="data?.[current]" />
22
- </view>
19
+
20
+ <view class="absolute bottom-0 left-0 p-3 box-border z-1 w-full h-fit" v-if="list[current]">
21
+ <lcb-product-item
22
+ v-bind="{
23
+ ...list[current],
24
+ ...attrs,
25
+ }"
26
+ />
27
+ <wd-icon
28
+ class-prefix="lcb"
29
+ size="28"
30
+ name="youbian"
31
+ custom-class="icon right-0"
32
+ @click="onCurrentChange(1)"
33
+ v-if="list[current + 1]"
34
+ />
35
+ <wd-icon
36
+ class-prefix="lcb"
37
+ size="28"
38
+ name="zuobian"
39
+ custom-class="icon left-0"
40
+ @click="onCurrentChange(-1)"
41
+ v-if="list[current - 1]"
42
+ />
23
43
  </view>
24
44
  </view>
25
45
  </view>
@@ -27,33 +47,11 @@
27
47
 
28
48
  <script lang="ts" setup>
29
49
  import { FORM_KEY } from '@tplc/business/constants'
30
- import { getJsonStrFirstUrl } from '../../utils/transform'
31
- import { reactive, inject, ref } from 'vue'
32
- import { LcbMapProps } from './types'
33
- export interface MapMarker {
34
- id: number
35
- name?: string
36
- longitude: number
37
- latitude: number
38
- iconPath: string
39
- width: number
40
- height: number
41
- poiId: string
42
- anchor?: {
43
- x: number
44
- y: number
45
- }
46
- callout?: {
47
- content: string
48
- color: string
49
- fontSize: number
50
- borderRadius: number
51
- bgColor: string
52
- padding: number
53
- display: 'ALWAYS' | 'BYCLICK'
54
- }
55
- zIndex?: number
56
- }
50
+ import { reactive, inject, ref, useAttrs } from 'vue'
51
+ import { LcbListInfo } from '../lcb-list/api'
52
+ import { getPageOptions } from '../../utils/utils'
53
+ import { MapItem, MapMarker } from './types'
54
+
57
55
  defineOptions({
58
56
  name: 'LcbMap',
59
57
  options: {
@@ -62,7 +60,8 @@ defineOptions({
62
60
  styleIsolation: 'shared',
63
61
  },
64
62
  })
65
- defineProps<LcbMapProps>()
63
+ const attrs = useAttrs()
64
+ const props = defineProps<LcbListInfo>()
66
65
  const scaleRadius: Record<string, number> = {
67
66
  3: 1_000_000,
68
67
  4: 500_000,
@@ -83,19 +82,41 @@ const scaleRadius: Record<string, number> = {
83
82
  19: 10,
84
83
  20: 5,
85
84
  }
85
+ const callout: MapMarker['callout'] = {
86
+ content: '腾讯总部大楼',
87
+ padding: 10,
88
+ display: 'ALWAYS',
89
+ fontSize: 14,
90
+ textAlign: 'center',
91
+ borderRadius: 2,
92
+ borderWidth: 2,
93
+ borderColor: '#3875FF',
94
+ bgColor: '#ffffff',
95
+ color: '#3875FF',
96
+ }
86
97
  const info = reactive({
87
98
  covers: [] as MapMarker[],
88
99
  })
89
- const form = inject<Record<string, any>>(FORM_KEY, {})
100
+ const form = inject<Record<string, any>>(FORM_KEY, {
101
+ mapViewRadius: scaleRadius[16],
102
+ })
90
103
  const current = ref(0)
91
- const data = ref<any[]>([])
104
+ const list = ref<MapItem[]>([])
105
+
92
106
  const getData = async () => {
93
- const { data: list } = await uni.$lcb.http.post<any[]>('/productInfo/map', form.value)
94
- data.value = list
95
- getCurrentData(list[0], list.slice(1, list.length))
107
+ // || props.url
108
+ const { data } = (await uni.$lcb.http.post('/productInfo/map', {
109
+ ...props.baseParam,
110
+ ...form?.value,
111
+ ...getPageOptions(),
112
+ })) as {
113
+ data: MapItem[]
114
+ }
115
+ list.value = data
116
+ getCurrentData(data)
96
117
  }
97
-
98
118
  const getLocation = () => {
119
+ getData()
99
120
  uni.getLocation({
100
121
  type: 'gcj02',
101
122
  success: (res) => {
@@ -132,72 +153,60 @@ const onRegionChange = (e: {
132
153
  getData()
133
154
  }
134
155
  }
135
- const onMarkerTap = (e: { markerId: number }) => {
136
- const marker = info.covers.find((item) => item?.id === e.markerId)
137
- if (marker) {
138
- const item = data.value?.find((item) => item?.poiId === marker.poiId)
139
- const firstMarker = info.covers[0]!
140
- getCurrentData(item, [
141
- {
142
- ...firstMarker,
143
- id: e.markerId,
144
- iconPath: './images/4.png',
145
- width: 26,
146
- height: 26,
147
- },
148
- ...info.covers.filter((item) => ![1, 2, e.markerId].includes(item.id)),
149
- ])
156
+ const onCurrentChange = (p: number) => {
157
+ onCalloutTap({
158
+ detail: {
159
+ markerId: current.value + p,
160
+ },
161
+ })
162
+ }
163
+ const onCalloutTap = (e: { detail: { markerId: number } }) => {
164
+ const pre = info.covers[e.detail.markerId].callout
165
+ const old = info.covers[current.value].callout
166
+ info.covers[e.detail.markerId].callout = {
167
+ ...pre,
168
+ borderColor: '#eeeeee',
169
+ bgColor: '#3875FF',
170
+ color: '#fff',
171
+ }
172
+ info.covers[current.value].callout = {
173
+ ...old,
174
+ borderColor: '#eeeeee',
175
+ bgColor: '#ffffff',
176
+ color: '#3875FF',
150
177
  }
178
+ current.value = e.detail.markerId
151
179
  }
152
- const getCurrentData = (item: any, list: MapMarker[]) => {
153
- uni.downloadFile({
154
- url:
155
- getJsonStrFirstUrl(item.coverImg) +
156
- '?x-oss-process=image/resize,m_fixed,w_64,h_64/circle,r_100/format,png',
157
- success: (res) => {
158
- info.covers = [
159
- {
160
- id: 1,
161
- iconPath: './images/3.png',
162
- width: 42,
163
- height: 49,
164
- anchor: {
165
- x: 0.5,
166
- y: 0.78,
167
- },
168
- poiId: item.poiId,
169
- latitude: item.latitude,
170
- longitude: item.longitude,
171
- },
172
- {
173
- zIndex: 2,
174
- iconPath: res.tempFilePath,
175
- width: 34,
176
- height: 34,
177
- id: 2,
178
- poiId: item.poiId,
179
- latitude: item.latitude,
180
- longitude: item.longitude,
181
- },
182
- ...list.map((item: any, index: number) => ({
183
- id: index + 3,
184
- iconPath: './images/4.png',
185
- width: 26,
186
- height: 26,
187
- poiId: item.poiId,
188
- latitude: item.latitude,
189
- longitude: item.longitude,
190
- })),
191
- ]
192
- console.log(item.poiId, data.value)
193
- current.value = data.value?.findIndex?.(({ poiId }) => item.poiId === poiId) || -1
194
- },
180
+ const getCurrentData = (markers: MapItem[]) => {
181
+ info.covers = markers.map((current, index: number) => {
182
+ const isCurrent = index === 0
183
+ return {
184
+ id: index,
185
+ iconPath: 'https://lycs.eluying.com/default/1319653665276882944/20241226142012/饭店竖图.png',
186
+ width: 1,
187
+ height: 1,
188
+ poiId: current.productId,
189
+ latitude: current.latitude,
190
+ longitude: current.longitude,
191
+ callout: {
192
+ ...callout,
193
+ content: current.mapPriceTips,
194
+ borderColor: '#eeeeee',
195
+ bgColor: isCurrent ? '#3875FF' : '#ffffff',
196
+ color: isCurrent ? '#ffffff' : '#3875FF',
197
+ },
198
+ }
195
199
  })
200
+ current.value = 0
196
201
  }
197
202
  </script>
198
-
199
- <style>
200
- page {
201
- background-color: #f7f7f7;
203
+ <style lang="scss" scoped>
204
+ .icon {
205
+ position: absolute;
206
+ top: 0;
207
+ height: fit-content;
208
+ bottom: 0;
209
+ margin: auto;
210
+ color: #666;
202
211
  }
203
212
  </style>
@@ -1,3 +1,34 @@
1
- export interface LcbMapProps {
2
- // Define the component's prop types here
1
+ export interface MapMarker {
2
+ id: number
3
+ name?: string
4
+ longitude: number
5
+ latitude: number
6
+ iconPath: string
7
+ width: number
8
+ height: number
9
+ poiId: string
10
+ anchor?: {
11
+ x: number
12
+ y: number
13
+ }
14
+
15
+ callout: {
16
+ textAlign: string
17
+ borderWidth: number
18
+ borderColor: string
19
+ content: string
20
+ color: string
21
+ fontSize: number
22
+ borderRadius: number
23
+ bgColor: string
24
+ padding: number
25
+ display: 'ALWAYS' | 'BYCLICK'
26
+ }
27
+ zIndex?: number
28
+ }
29
+ export interface MapItem {
30
+ mapPriceTips: string
31
+ latitude: number
32
+ longitude: number
33
+ productId: string
3
34
  }
@@ -23,6 +23,8 @@ const props = withDefaults(
23
23
  )
24
24
  defineSlots<{
25
25
  coverImg(props: { value: any }): any
26
+ headImg(props: { value: any }): any
27
+ userName(props: { value: any }): any
26
28
  productName(props: { value: any }): any
27
29
  subTitle(props: { value: any }): any
28
30
  price(props: { value: any }): any
@@ -76,7 +78,7 @@ const value = computed(() => {
76
78
  </script>
77
79
 
78
80
  <template>
79
- <template
81
+ <block
80
82
  v-if="
81
83
  visible && (prop === 'coverImg' || (!!value && (isArray(value) ? value?.length > 0 : true)))
82
84
  "
@@ -84,14 +86,26 @@ const value = computed(() => {
84
86
  <!-- 图片 -->
85
87
  <slot :value="value" v-if="prop === 'coverImg'" name="coverImg">
86
88
  <view :class="`relative ${className}`" :style="style">
87
- <image :src="value" class="w-full h-full" mode="aspectFill" />
89
+ <wd-img :src="value" mode="aspectFill" width="100%" height="100%" />
88
90
  <!-- imgBottomIcon -->
89
91
  <view class="absolute bottom-0 left-0 w-full z-1" v-if="itemProps.imgBottomIcon">
90
- <image :src="itemProps.imgBottomIcon" class="w-full h-auto block" mode="widthFix" />
92
+ <wd-img
93
+ :src="itemProps.imgBottomIcon"
94
+ custom-class="block"
95
+ mode="widthFix"
96
+ width="100%"
97
+ height="auto"
98
+ />
91
99
  </view>
92
100
  <!-- imgCornerIcon -->
93
101
  <view class="absolute top-0 left-0 h-8 z-1" v-if="itemProps.imgCornerIcon">
94
- <image :src="itemProps.imgCornerIcon" class="w-auto h-full block" mode="heightFix" />
102
+ <wd-img
103
+ :src="itemProps.imgCornerIcon"
104
+ width="auto"
105
+ height="100%"
106
+ custom-class="block"
107
+ mode="heightFix"
108
+ />
95
109
  </view>
96
110
  <slot></slot>
97
111
  </view>
@@ -274,5 +288,15 @@ const value = computed(() => {
274
288
  <view>{{ value }}</view>
275
289
  </view>
276
290
  </slot>
277
- </template>
291
+ <slot :value="value" v-if="prop === 'headImg'" name="headImg">
292
+ <view :class="className" :style="style" class="w-4 h-4">
293
+ <wd-img :src="value" width="100%" height="100%" radius="50%" mode="aspectFill" />
294
+ </view>
295
+ </slot>
296
+ <slot :value="value" v-if="prop === 'userName'" name="userName">
297
+ <view :class="className" :style="style" class="text-20rpx text-#333 truncate">
298
+ <view>{{ value }}</view>
299
+ </view>
300
+ </slot>
301
+ </block>
278
302
  </template>
@@ -28,6 +28,7 @@ const props = withDefaults(defineProps<LcbProductItemProps>(), {
28
28
  titleVisible: true,
29
29
  subTitleVisible: true,
30
30
  priceVisible: true,
31
+ userInfoVisible: false,
31
32
  priceTipsVisible: true,
32
33
  priceUnitVisible: true,
33
34
  priceSuffixVisible: true,
@@ -47,11 +48,12 @@ const props = withDefaults(defineProps<LcbProductItemProps>(), {
47
48
  distanceVisible: true,
48
49
  })
49
50
  const attrs = useAttrs()
50
-
51
51
  provide('lcb-product-item-props', props)
52
52
 
53
53
  defineSlots<{
54
54
  coverImg(props: { value: any }): any
55
+ userName(props: { value: any }): any
56
+ headImg(props: { value: any }): any
55
57
  productName(props: { value: any }): any
56
58
  subTitle(props: { value: any }): any
57
59
  price(props: { value: any }): any
@@ -238,11 +240,15 @@ defineSlots<{
238
240
  </view>
239
241
  </view>
240
242
  <ItemValue prop="priceTips">
241
- <template #priceTips="{ value }">
243
+ <!-- <template #priceTips="{ value }">
242
244
  <slot name="priceTips" :value="value" />
243
- </template>
245
+ </template> -->
244
246
  </ItemValue>
245
247
  </view>
248
+ <view class="flex gap-2 items-center" v-if="userInfoVisible">
249
+ <ItemValue prop="headImg"></ItemValue>
250
+ <ItemValue prop="userName"></ItemValue>
251
+ </view>
246
252
  </view>
247
253
  <slot name="itemRightSection" />
248
254
  </view>
@@ -398,7 +404,12 @@ defineSlots<{
398
404
  </template>
399
405
  </ItemValue>
400
406
  </view>
407
+ <view class="flex gap-2 items-center" v-if="userInfoVisible">
408
+ <ItemValue prop="headImg"></ItemValue>
409
+ <ItemValue prop="userName"></ItemValue>
410
+ </view>
401
411
  </view>
412
+
402
413
  <slot name="itemBottomSection" />
403
414
  </view>
404
415
  <slot name="itemRightSection" />
@@ -18,6 +18,8 @@ export interface LcbProductItemProps {
18
18
 
19
19
  coverImg?: any
20
20
  productName?: any
21
+ headImg?: string
22
+ userName?: string
21
23
  subTitle?: any
22
24
  price?: any
23
25
  priceUnit?: any
@@ -41,6 +43,7 @@ export interface LcbProductItemProps {
41
43
  coverImgVisible?: boolean
42
44
  titleVisible?: boolean
43
45
  subTitleVisible?: boolean
46
+ userInfoVisible?: boolean
44
47
  priceVisible?: boolean
45
48
  priceUnitVisible?: boolean
46
49
  priceSuffixVisible?: boolean