@tplc/business 0.2.73 → 0.2.75
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 +29 -0
- package/components/lcb-list/components/FilterList/index.vue +10 -0
- package/components/lcb-list/lcb-list.vue +10 -1
- package/components/lcb-product/lcb-product.vue +54 -31
- package/components/lcb-product/types.ts +1 -0
- package/package.json +1 -1
- package/types/components/lcb-list/components/FilterList/index.vue.d.ts +2 -0
- package/types/components/lcb-product/lcb-product.vue.d.ts +6 -1
- package/types/components/lcb-product/types.d.ts +1 -0
- package/types/utils/utils.d.ts +8 -0
- package/utils/utils.ts +11 -0
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.2.75](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.69...v0.2.75) (2025-01-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
9
|
+
|
|
10
|
+
* **release:** 0.2.70 ([25208a1](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/25208a1b7c62cf86be34fc10284f8bcbf53fa660))
|
|
11
|
+
* **release:** 0.2.71 ([6e5b105](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6e5b105c4781e0fabbdae76fcfc1a45afc8e8e58))
|
|
12
|
+
* **release:** 0.2.72 ([01d5635](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/01d5635a74cb249bf9224d5e2f87f1b696976454))
|
|
13
|
+
* **release:** 0.2.73 ([fe1c4d4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/fe1c4d436f577a5e6d476c1d72968bfd7e6d5b05))
|
|
14
|
+
* **release:** 0.2.74 ([4685a29](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4685a2978cfc39f834ad286c3a6fd19a943ca828))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### ✨ Features | 新功能
|
|
18
|
+
|
|
19
|
+
* product组件切换为接口 ([520f1ca](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/520f1cad1ce517ee9de12845a513678396039e43))
|
|
20
|
+
* 兼容地图 ([b189928](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b18992884c5e1a6dce947c5f7dbbb6750f5dfb5f))
|
|
21
|
+
* 加载更多 ([ae2ba8b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae2ba8b24334aa2f1bb82c6a702cc72bb16beee1))
|
|
22
|
+
* 处理瀑布流刷新 ([d76fb08](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d76fb088eb287f0a88dfc029f7b9bb287a2b5cd8))
|
|
23
|
+
* 新增types ([b4ceffd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b4ceffdb507c04888370ca4ca0a523d528429a49))
|
|
24
|
+
* 瀑布流 ([a5334a0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a5334a02c4cc3cbecf5822534fabfb899d166f35))
|
|
25
|
+
|
|
26
|
+
### [0.2.74](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.73...v0.2.74) (2025-01-06)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### ✨ Features | 新功能
|
|
30
|
+
|
|
31
|
+
* 加载更多 ([ae2ba8b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae2ba8b24334aa2f1bb82c6a702cc72bb16beee1))
|
|
32
|
+
* 新增types ([b4ceffd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b4ceffdb507c04888370ca4ca0a523d528429a49))
|
|
33
|
+
|
|
5
34
|
### [0.2.73](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.72...v0.2.73) (2025-01-06)
|
|
6
35
|
|
|
7
36
|
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
:fixed="false"
|
|
10
10
|
:use-page-scroll="false"
|
|
11
11
|
:height="height"
|
|
12
|
+
@onRefresh="onRefresh"
|
|
13
|
+
:loading-more-enabled="!refreshed"
|
|
12
14
|
>
|
|
13
15
|
<slot />
|
|
14
16
|
</z-paging>
|
|
@@ -30,11 +32,13 @@ defineOptions({
|
|
|
30
32
|
styleIsolation: 'shared',
|
|
31
33
|
},
|
|
32
34
|
})
|
|
35
|
+
const emits = defineEmits(['refresh'])
|
|
33
36
|
const props = defineProps<LcbFilterListProps>()
|
|
34
37
|
const dataList = ref<unknown[]>([])
|
|
35
38
|
const paging = ref()
|
|
36
39
|
const height = useAutoHeight()
|
|
37
40
|
const form = inject<Ref<Record<string, any>>>(FORM_KEY)
|
|
41
|
+
const refreshed = ref(false)
|
|
38
42
|
useZPaging(paging)
|
|
39
43
|
const modelValue = defineModel<unknown[]>({
|
|
40
44
|
default: [],
|
|
@@ -72,6 +76,7 @@ const queryList = async (page: number, limit: number) => {
|
|
|
72
76
|
const { data } = await uni.$lcb.http.post(props.url, {
|
|
73
77
|
...props.baseParam,
|
|
74
78
|
...form?.value,
|
|
79
|
+
listType: props.listType,
|
|
75
80
|
...getPageOptions(),
|
|
76
81
|
pageSearch: {
|
|
77
82
|
limit,
|
|
@@ -82,6 +87,11 @@ const queryList = async (page: number, limit: number) => {
|
|
|
82
87
|
} catch (error) {
|
|
83
88
|
paging.value.complete(false)
|
|
84
89
|
}
|
|
90
|
+
refreshed.value = false
|
|
91
|
+
}
|
|
92
|
+
const onRefresh = async () => {
|
|
93
|
+
refreshed.value = true
|
|
94
|
+
emits('refresh')
|
|
85
95
|
}
|
|
86
96
|
</script>
|
|
87
97
|
<style lang="scss" scoped>
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
v-bind="{ ...info.listInfo, listType, ...props }"
|
|
29
29
|
:autoHeight="!isSticky"
|
|
30
30
|
v-model="items"
|
|
31
|
+
@refresh="productRef?.clear?.()"
|
|
31
32
|
v-if="mode === 'list'"
|
|
32
33
|
>
|
|
33
34
|
<slot name="list" :items="items" v-if="$slots.list" />
|
|
@@ -36,13 +37,20 @@
|
|
|
36
37
|
v-bind="{ ...$props, ...attrs, form }"
|
|
37
38
|
:items="items"
|
|
38
39
|
filterList
|
|
40
|
+
ref="productRef"
|
|
39
41
|
v-if="$slots.item"
|
|
40
42
|
>
|
|
41
43
|
<template #item="{ item }">
|
|
42
44
|
<slot name="item" :item="item"></slot>
|
|
43
45
|
</template>
|
|
44
46
|
</lcb-product>
|
|
45
|
-
<lcb-product
|
|
47
|
+
<lcb-product
|
|
48
|
+
v-bind="{ ...$props, ...attrs, form }"
|
|
49
|
+
filterList
|
|
50
|
+
:items="items"
|
|
51
|
+
ref="productRef"
|
|
52
|
+
v-else
|
|
53
|
+
/>
|
|
46
54
|
</template>
|
|
47
55
|
</FilterList>
|
|
48
56
|
<lcb-map v-else-if="mode === 'map'" v-bind="{ ...info.listInfo, ...$props, ...attrs }" />
|
|
@@ -61,6 +69,7 @@ const attrs = useAttrs()
|
|
|
61
69
|
/** 是否悬停 */
|
|
62
70
|
const sticky = ref(false)
|
|
63
71
|
const items = ref([])
|
|
72
|
+
const productRef = ref()
|
|
64
73
|
defineOptions({
|
|
65
74
|
name: 'LcbList',
|
|
66
75
|
options: {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, useAttrs, watch,
|
|
2
|
+
import { ref, useAttrs, watch, watchEffect } from 'vue'
|
|
3
3
|
import UWaterfall from 'uview-plus/components/u-waterfall/u-waterfall.vue'
|
|
4
|
-
import ULazyLoad from 'uview-plus/components/u-lazy-load/u-lazy-load.vue'
|
|
5
4
|
import { LcbProductProps } from './types'
|
|
6
5
|
import { transformValueUnit } from '../../utils/transform'
|
|
7
|
-
import {
|
|
6
|
+
import { calculateImageHeight } from '../../utils/utils'
|
|
8
7
|
|
|
9
8
|
const uWaterfallRef = ref()
|
|
10
9
|
defineOptions({
|
|
@@ -17,12 +16,18 @@ defineOptions({
|
|
|
17
16
|
},
|
|
18
17
|
})
|
|
19
18
|
const attrs = useAttrs()
|
|
20
|
-
const list = ref<Record<string, any>[]>([])
|
|
21
19
|
const props = withDefaults(defineProps<LcbProductProps>(), {
|
|
22
20
|
listType: 'list',
|
|
23
21
|
imageWidth: 200,
|
|
24
22
|
imageHeight: 250,
|
|
25
23
|
titleLineClamp: 2,
|
|
24
|
+
column: 2,
|
|
25
|
+
})
|
|
26
|
+
const renderList = ref<Record<string, any>[]>([])
|
|
27
|
+
const screenWidth = uni.getSystemInfoSync().screenWidth
|
|
28
|
+
watchEffect(() => {
|
|
29
|
+
if (!props.filterList) return
|
|
30
|
+
renderList.value = props.items as Record<string, any>[]
|
|
26
31
|
})
|
|
27
32
|
defineSlots<{
|
|
28
33
|
item(props: { item: any }): any
|
|
@@ -30,7 +35,10 @@ defineSlots<{
|
|
|
30
35
|
watch(
|
|
31
36
|
() => props.form,
|
|
32
37
|
() => {
|
|
33
|
-
|
|
38
|
+
if (props.listType === 'waterfall') {
|
|
39
|
+
renderList.value = []
|
|
40
|
+
uWaterfallRef.value?.clear?.()
|
|
41
|
+
}
|
|
34
42
|
},
|
|
35
43
|
{ deep: true },
|
|
36
44
|
)
|
|
@@ -40,15 +48,21 @@ const getData = async () => {
|
|
|
40
48
|
const { data } = await uni.$lcb.http.post('/productInfo/filteredPage', {
|
|
41
49
|
productIdList: props.items.map((item) => item.productId),
|
|
42
50
|
})
|
|
43
|
-
|
|
51
|
+
renderList.value = data as Record<string, any>[]
|
|
44
52
|
} else {
|
|
45
|
-
|
|
53
|
+
renderList.value = []
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
watch(() => props.items, getData, { immediate: true, deep: true })
|
|
50
|
-
const
|
|
51
|
-
|
|
58
|
+
const columnWidth = (screenWidth - 12 * (1 + props.column)) / 2
|
|
59
|
+
defineExpose({
|
|
60
|
+
clear: () => {
|
|
61
|
+
if (props.listType === 'waterfall') {
|
|
62
|
+
renderList.value = []
|
|
63
|
+
uWaterfallRef.value?.clear?.()
|
|
64
|
+
}
|
|
65
|
+
},
|
|
52
66
|
})
|
|
53
67
|
</script>
|
|
54
68
|
|
|
@@ -87,7 +101,7 @@ const renderList = computed(() => {
|
|
|
87
101
|
</lcb-action-view>
|
|
88
102
|
</view>
|
|
89
103
|
<!-- 双列 -->
|
|
90
|
-
<view class="grid p-3 grid-cols-2 gap-2 box-border" v-if="listType === 'grid'">
|
|
104
|
+
<view class="grid p-3 grid-cols-2 gap-2 box-border" v-else-if="listType === 'grid'">
|
|
91
105
|
<lcb-action-view
|
|
92
106
|
v-for="(item, index) in renderList"
|
|
93
107
|
:key="`${item?.productId}:${index}`"
|
|
@@ -120,10 +134,10 @@ const renderList = computed(() => {
|
|
|
120
134
|
</lcb-action-view>
|
|
121
135
|
</view>
|
|
122
136
|
|
|
123
|
-
<view class="lcb-product-waterfall">
|
|
124
|
-
<u-waterfall :
|
|
137
|
+
<view class="lcb-product-waterfall" v-else-if="listType === 'waterfall'">
|
|
138
|
+
<u-waterfall :addTime="0" :modelValue="renderList" ref="uWaterfallRef">
|
|
125
139
|
<template #left="{ leftList: list }">
|
|
126
|
-
<view class="flex flex-col gap-
|
|
140
|
+
<view class="flex flex-col gap-12px">
|
|
127
141
|
<lcb-action-view
|
|
128
142
|
v-for="(item, index) in list"
|
|
129
143
|
:key="`${item?.productId}:${index}`"
|
|
@@ -148,15 +162,19 @@ const renderList = computed(() => {
|
|
|
148
162
|
v-else
|
|
149
163
|
>
|
|
150
164
|
<template #coverImg="{ value }">
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
:
|
|
156
|
-
:
|
|
157
|
-
|
|
165
|
+
<wd-img
|
|
166
|
+
:src="value"
|
|
167
|
+
width="100%"
|
|
168
|
+
mode="aspectFill"
|
|
169
|
+
:lazyPlaceWidth="columnWidth"
|
|
170
|
+
:height="
|
|
171
|
+
calculateImageHeight(
|
|
172
|
+
screenWidth,
|
|
173
|
+
item.coverImgProps?.[0]?.height,
|
|
174
|
+
item.coverImgProps?.[0]?.width,
|
|
175
|
+
)
|
|
176
|
+
"
|
|
158
177
|
/>
|
|
159
|
-
<!-- <wd-img :src="value" width="100%" lazyPlaceWidth="250" height="auto" mode="widthFix" /> -->
|
|
160
178
|
</template>
|
|
161
179
|
</lcb-product-item>
|
|
162
180
|
</slot>
|
|
@@ -188,13 +206,18 @@ const renderList = computed(() => {
|
|
|
188
206
|
tag-overflow-wrap
|
|
189
207
|
>
|
|
190
208
|
<template #coverImg="{ value }">
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
:
|
|
195
|
-
|
|
196
|
-
:
|
|
197
|
-
|
|
209
|
+
<wd-img
|
|
210
|
+
:src="value"
|
|
211
|
+
width="100%"
|
|
212
|
+
:lazyPlaceWidth="columnWidth"
|
|
213
|
+
mode="aspectFill"
|
|
214
|
+
:height="
|
|
215
|
+
calculateImageHeight(
|
|
216
|
+
screenWidth,
|
|
217
|
+
item.coverImgProps?.[0]?.height,
|
|
218
|
+
item.coverImgProps?.[0]?.width,
|
|
219
|
+
)
|
|
220
|
+
"
|
|
198
221
|
/>
|
|
199
222
|
</template>
|
|
200
223
|
</lcb-product-item>
|
|
@@ -205,7 +228,7 @@ const renderList = computed(() => {
|
|
|
205
228
|
</u-waterfall>
|
|
206
229
|
</view>
|
|
207
230
|
|
|
208
|
-
<scroll-view v-if="listType == 'horizontal'" scroll-x>
|
|
231
|
+
<scroll-view v-else-if="listType == 'horizontal'" scroll-x>
|
|
209
232
|
<view class="p-3 whitespace-nowrap overflow-x-auto">
|
|
210
233
|
<view
|
|
211
234
|
v-for="(item, index) in renderList"
|
|
@@ -250,8 +273,8 @@ const renderList = computed(() => {
|
|
|
250
273
|
.lcb-product-waterfall {
|
|
251
274
|
:deep(.u-waterfall) {
|
|
252
275
|
display: flex;
|
|
253
|
-
gap:
|
|
254
|
-
padding:
|
|
276
|
+
gap: 12px;
|
|
277
|
+
padding: 12px;
|
|
255
278
|
}
|
|
256
279
|
}
|
|
257
280
|
</style>
|
package/package.json
CHANGED
|
@@ -16,11 +16,13 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
16
16
|
import('vue').ComponentOptionsMixin,
|
|
17
17
|
{
|
|
18
18
|
'update:modelValue': (modelValue: unknown[]) => void
|
|
19
|
+
refresh: (...args: any[]) => void
|
|
19
20
|
},
|
|
20
21
|
string,
|
|
21
22
|
import('vue').PublicProps,
|
|
22
23
|
Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
|
|
23
24
|
'onUpdate:modelValue'?: ((modelValue: unknown[]) => any) | undefined
|
|
25
|
+
onRefresh?: ((...args: any[]) => any) | undefined
|
|
24
26
|
},
|
|
25
27
|
{},
|
|
26
28
|
{}
|
|
@@ -12,9 +12,12 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
12
12
|
imageWidth: number
|
|
13
13
|
imageHeight: number
|
|
14
14
|
titleLineClamp: number
|
|
15
|
+
column: number
|
|
15
16
|
}
|
|
16
17
|
>,
|
|
17
|
-
{
|
|
18
|
+
{
|
|
19
|
+
clear: () => void
|
|
20
|
+
},
|
|
18
21
|
unknown,
|
|
19
22
|
{},
|
|
20
23
|
{},
|
|
@@ -32,6 +35,7 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
32
35
|
imageWidth: number
|
|
33
36
|
imageHeight: number
|
|
34
37
|
titleLineClamp: number
|
|
38
|
+
column: number
|
|
35
39
|
}
|
|
36
40
|
>
|
|
37
41
|
>
|
|
@@ -39,6 +43,7 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
39
43
|
{
|
|
40
44
|
imageWidth: number
|
|
41
45
|
imageHeight: number
|
|
46
|
+
column: number
|
|
42
47
|
listType: 'list' | 'horizontal' | 'grid' | 'waterfall'
|
|
43
48
|
titleLineClamp: number
|
|
44
49
|
},
|
package/types/utils/utils.d.ts
CHANGED
|
@@ -6,3 +6,11 @@ export declare const getPageOptions: () => Record<string, any>
|
|
|
6
6
|
export declare const getFinalUrl: (url: string, urlParams?: string) => string
|
|
7
7
|
export declare const onPageScrollSelector: (selector: string) => void
|
|
8
8
|
export declare const getPreviewImageUrl: (url: string, width?: number) => string
|
|
9
|
+
/** 根据屏幕宽度 图片高度宽度比例 列数与 间隙宽度 计算图片高度 */
|
|
10
|
+
export declare const calculateImageHeight: (
|
|
11
|
+
screenWidth: number,
|
|
12
|
+
imageHeight?: number,
|
|
13
|
+
imageWidth?: number,
|
|
14
|
+
column?: number,
|
|
15
|
+
gap?: number,
|
|
16
|
+
) => number
|
package/utils/utils.ts
CHANGED
|
@@ -51,3 +51,14 @@ export const getPreviewImageUrl = (url: string, width = 200) => {
|
|
|
51
51
|
: `${sym}x-oss-process=image/resize,m_mfit,w_${width}&imageView2/2/w/${width}`
|
|
52
52
|
return `${url}${width > 0 ? suffix : ''}`
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
/** 根据屏幕宽度 图片高度宽度比例 列数与 间隙宽度 计算图片高度 */
|
|
56
|
+
export const calculateImageHeight = (
|
|
57
|
+
screenWidth: number,
|
|
58
|
+
imageHeight = 176,
|
|
59
|
+
imageWidth = 240,
|
|
60
|
+
column = 2,
|
|
61
|
+
gap = 12,
|
|
62
|
+
) => {
|
|
63
|
+
return ((screenWidth - gap * (2 + column - 1)) / 2) * (imageHeight / imageWidth)
|
|
64
|
+
}
|