@tplc/business 0.2.67 → 0.2.69

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.2.69](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.68...v0.2.69) (2025-01-05)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * product 属性新增 ([7f27bc5](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7f27bc5e8fd88f25a8af1b54f4834ddc5c41e20f))
11
+
12
+ ### [0.2.68](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.67...v0.2.68) (2025-01-05)
13
+
5
14
  ### [0.2.67](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.66...v0.2.67) (2025-01-05)
6
15
 
7
16
 
@@ -32,26 +32,32 @@
32
32
  >
33
33
  <slot name="list" :items="items" v-if="$slots.list" />
34
34
  <template v-else>
35
- <lcb-product v-bind="{ ...$props, form }" :items="items" v-if="$slots.item">
35
+ <lcb-product
36
+ v-bind="{ ...$props, ...attrs, form }"
37
+ :items="items"
38
+ filterList
39
+ v-if="$slots.item"
40
+ >
36
41
  <template #item="{ item }">
37
42
  <slot name="item" :item="item"></slot>
38
43
  </template>
39
44
  </lcb-product>
40
- <lcb-product v-bind="{ ...$props, form }" :items="items" v-else />
45
+ <lcb-product v-bind="{ ...$props, ...attrs, form }" filterList :items="items" v-else />
41
46
  </template>
42
47
  </FilterList>
43
- <lcb-map v-else-if="mode === 'map'" v-bind="{ ...info.listInfo, ...$props }" />
48
+ <lcb-map v-else-if="mode === 'map'" v-bind="{ ...info.listInfo, ...$props, ...attrs }" />
44
49
  </template>
45
50
  </template>
46
51
 
47
52
  <script setup lang="ts">
48
- import { inject, Ref, ref, watch } from 'vue'
53
+ import { inject, Ref, ref, watch, useAttrs } from 'vue'
49
54
  import { getFilterDetail, LcbFilterResult } from './api'
50
55
  import FilterList from './components/FilterList/index.vue'
51
56
  import FilterView from './components/FilterView/index.vue'
52
57
  import { LcbListProps } from './types'
53
58
  import { FORM_KEY } from '../../constants'
54
59
  import './index.scss'
60
+ const attrs = useAttrs()
55
61
  /** 是否悬停 */
56
62
  const sticky = ref(false)
57
63
  const items = ref([])
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, useAttrs, watch } from 'vue'
2
+ import { ref, useAttrs, watch, computed } from 'vue'
3
3
  import UWaterfall from 'uview-plus/components/u-waterfall/u-waterfall.vue'
4
4
  import { LcbProductProps } from './types'
5
5
  import { transformValueUnit } from '../../utils/transform'
@@ -14,13 +14,14 @@ defineOptions({
14
14
  styleIsolation: 'shared',
15
15
  },
16
16
  })
17
+ const attrs = useAttrs()
18
+ const list = ref<Record<string, any>[]>([])
17
19
  const props = withDefaults(defineProps<LcbProductProps>(), {
18
20
  listType: 'list',
19
- items: [],
20
21
  imageWidth: 200,
21
22
  imageHeight: 250,
22
23
  titleLineClamp: 2,
23
- } as any)
24
+ })
24
25
  defineSlots<{
25
26
  item(props: { item: any }): any
26
27
  }>()
@@ -31,6 +32,21 @@ watch(
31
32
  },
32
33
  { deep: true },
33
34
  )
35
+ const getData = async () => {
36
+ if (props.filterList) return
37
+ if (props.items?.length) {
38
+ const { data } = await uni.$lcb.http.post('/productInfo/filteredPage', {
39
+ productIdList: props.items.map((item) => item.productId),
40
+ })
41
+ list.value = data as Record<string, any>[]
42
+ } else {
43
+ list.value = []
44
+ }
45
+ }
46
+ watch(() => props.items, getData, { immediate: true, deep: true })
47
+ const renderList = computed(() => {
48
+ return props.filterList ? props.items : list.value
49
+ })
34
50
  </script>
35
51
 
36
52
  <template>
@@ -38,7 +54,7 @@ watch(
38
54
  <!-- 单列 -->
39
55
  <view class="flex flex-col gap-2 p-3" v-if="listType === 'list'">
40
56
  <lcb-action-view
41
- v-for="(item, index) in items"
57
+ v-for="(item, index) in renderList"
42
58
  :key="`${item?.productId}:${index}`"
43
59
  v-bind="item.link"
44
60
  >
@@ -54,7 +70,7 @@ watch(
54
70
  />
55
71
  <lcb-product-item
56
72
  v-else
57
- v-bind="{ ...item, ...$props }"
73
+ v-bind="{ ...item, ...$props, ...attrs }"
58
74
  :layoutType="layoutType"
59
75
  :coverImgStyle="{
60
76
  width: layoutType === 'vertical' ? '100%' : transformValueUnit(imageWidth),
@@ -70,7 +86,7 @@ watch(
70
86
  <!-- 双列 -->
71
87
  <view class="grid p-3 grid-cols-2 gap-2 box-border" v-if="listType === 'grid'">
72
88
  <lcb-action-view
73
- v-for="(item, index) in items"
89
+ v-for="(item, index) in renderList"
74
90
  :key="`${item?.productId}:${index}`"
75
91
  v-bind="item.link"
76
92
  >
@@ -87,13 +103,13 @@ watch(
87
103
  />
88
104
  <lcb-product-item
89
105
  v-else
90
- v-bind="{ ...item, ...$props }"
106
+ v-bind="{ ...item, ...$props, ...attrs }"
91
107
  layoutType="vertical"
92
108
  :coverImgStyle="{
93
109
  width: '100%',
94
110
  height: transformValueUnit(imageHeight),
95
111
  borderRadius: imageRadius ? transformValueUnit(imageRadius) : undefined,
96
- ...($props?.coverImgStyle ?? {}),
112
+ ...(attrs?.coverImgStyle ?? {}),
97
113
  }"
98
114
  ></lcb-product-item>
99
115
  </slot>
@@ -102,7 +118,7 @@ watch(
102
118
  </view>
103
119
 
104
120
  <view class="lcb-product-waterfall">
105
- <u-waterfall :modelValue="items" v-if="listType === 'waterfall'" ref="uWaterfallRef">
121
+ <u-waterfall :modelValue="renderList" v-if="listType === 'waterfall'" ref="uWaterfallRef">
106
122
  <template #left="{ leftList: list }">
107
123
  <view class="flex flex-col gap-3">
108
124
  <lcb-action-view
@@ -123,7 +139,7 @@ watch(
123
139
  />
124
140
  <lcb-product-item
125
141
  v-else
126
- v-bind="{ ...item, ...$props }"
142
+ v-bind="{ ...item, ...$props, ...attrs }"
127
143
  layoutType="vertical"
128
144
  tag-overflow-wrap
129
145
  >
@@ -155,7 +171,7 @@ watch(
155
171
  />
156
172
  <lcb-product-item
157
173
  v-else
158
- v-bind="{ ...item, ...$props }"
174
+ v-bind="{ ...item, ...$props, ...attrs }"
159
175
  layoutType="vertical"
160
176
  tag-overflow-wrap
161
177
  >
@@ -173,7 +189,7 @@ watch(
173
189
  <scroll-view v-if="listType == 'horizontal'" scroll-x>
174
190
  <view class="p-3 whitespace-nowrap overflow-x-auto">
175
191
  <view
176
- v-for="(item, index) in items"
192
+ v-for="(item, index) in renderList"
177
193
  :key="`${item?.productId}:${index}`"
178
194
  class="inline-block"
179
195
  :style="{
@@ -200,7 +216,7 @@ watch(
200
216
  height: layoutType === 'vertical' ? transformValueUnit(imageHeight) : undefined,
201
217
  minHeight: layoutType !== 'vertical' ? transformValueUnit(imageHeight) : undefined,
202
218
  borderRadius: imageRadius ? transformValueUnit(imageRadius) : undefined,
203
- ...($props?.coverImgStyle ?? {}),
219
+ ...(attrs?.coverImgStyle ?? {}),
204
220
  }"
205
221
  :titleLineClamp="titleLineClamp"
206
222
  ></lcb-product-item>
@@ -6,11 +6,15 @@ export interface LcbProductProps {
6
6
  imageRadius?: number
7
7
  borderRadius?: number
8
8
  itemWidth?: number // 列表项宽度
9
- items?: Record<string, any>[]
9
+ items?: {
10
+ productId: string
11
+ [key: string]: any
12
+ }[]
10
13
  form?: Record<string, any>
11
14
  layoutType?: 'vertical' | 'horizontal' // 布局方式
12
15
  titleLineClamp?: number
13
16
  coverImgStyle?: Record<string, any>
17
+ filterList?: boolean
14
18
  renderItemAbsoluteConfigLayout?: {
15
19
  dataset?: Record<string, any>
16
20
  blocks: any[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.2.67",
3
+ "version": "0.2.69",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -5,7 +5,15 @@ declare function __VLS_template(): Readonly<{
5
5
  item(props: { item: any }): any
6
6
  }
7
7
  declare const __VLS_component: import('vue').DefineComponent<
8
- __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, any>,
8
+ __VLS_WithDefaults<
9
+ __VLS_TypePropsToOption<LcbProductProps>,
10
+ {
11
+ listType: string
12
+ imageWidth: number
13
+ imageHeight: number
14
+ titleLineClamp: number
15
+ }
16
+ >,
9
17
  {},
10
18
  unknown,
11
19
  {},
@@ -17,30 +25,22 @@ declare const __VLS_component: import('vue').DefineComponent<
17
25
  import('vue').PublicProps,
18
26
  Readonly<
19
27
  import('vue').ExtractPropTypes<
20
- __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, any>
28
+ __VLS_WithDefaults<
29
+ __VLS_TypePropsToOption<LcbProductProps>,
30
+ {
31
+ listType: string
32
+ imageWidth: number
33
+ imageHeight: number
34
+ titleLineClamp: number
35
+ }
36
+ >
21
37
  >
22
38
  >,
23
39
  {
24
- form: Record<string, any>
25
- imageRadius: number
26
- items: Record<string, any>[]
27
40
  imageWidth: number
28
- borderRadius: number
29
41
  imageHeight: number
30
42
  listType: 'list' | 'horizontal' | 'grid' | 'waterfall'
31
43
  titleLineClamp: number
32
- layoutType: 'vertical' | 'horizontal'
33
- itemWidth: number
34
- coverImgStyle: Record<string, any>
35
- renderItemAbsoluteConfigLayout: {
36
- dataset?: Record<string, any>
37
- blocks: any[]
38
- canvas: {
39
- width: number
40
- height: number
41
- backgroundColor?: string
42
- }
43
- }
44
44
  },
45
45
  {}
46
46
  >
@@ -5,11 +5,15 @@ export interface LcbProductProps {
5
5
  imageRadius?: number
6
6
  borderRadius?: number
7
7
  itemWidth?: number
8
- items?: Record<string, any>[]
8
+ items?: {
9
+ productId: string
10
+ [key: string]: any
11
+ }[]
9
12
  form?: Record<string, any>
10
13
  layoutType?: 'vertical' | 'horizontal'
11
14
  titleLineClamp?: number
12
15
  coverImgStyle?: Record<string, any>
16
+ filterList?: boolean
13
17
  renderItemAbsoluteConfigLayout?: {
14
18
  dataset?: Record<string, any>
15
19
  blocks: any[]