@tplc/business 0.2.74 → 0.2.76

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,43 @@
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.76](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.74...v0.2.76) (2025-01-07)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.1.53 ([3f2435c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3f2435c86a660da4c1f1a926ca95728f12cc0d1b))
11
+ * **release:** 0.2.75 ([51ad472](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/51ad472341b6f3b0a9025f65646696e16ffe4fa7))
12
+
13
+
14
+ ### ✨ Features | 新功能
15
+
16
+ * img block ([abbbb87](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/abbbb871b340d33e071dc78cc67e313aa3f4932b))
17
+ * 兼容引擎 ([7b6fc3c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7b6fc3cfe4ecba868c3fb095b1f9b103b724d9f7))
18
+ * 处理瀑布流刷新 ([d76fb08](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d76fb088eb287f0a88dfc029f7b9bb287a2b5cd8))
19
+ * 瀑布流调整策略 ([a7988e0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a7988e037342c211e45369ae4c324566b4b50f4a))
20
+
21
+ ### [0.2.75](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.69...v0.2.75) (2025-01-06)
22
+
23
+
24
+ ### 🚀 Chore | 构建/工程依赖/工具
25
+
26
+ * **release:** 0.2.70 ([25208a1](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/25208a1b7c62cf86be34fc10284f8bcbf53fa660))
27
+ * **release:** 0.2.71 ([6e5b105](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6e5b105c4781e0fabbdae76fcfc1a45afc8e8e58))
28
+ * **release:** 0.2.72 ([01d5635](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/01d5635a74cb249bf9224d5e2f87f1b696976454))
29
+ * **release:** 0.2.73 ([fe1c4d4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/fe1c4d436f577a5e6d476c1d72968bfd7e6d5b05))
30
+ * **release:** 0.2.74 ([4685a29](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4685a2978cfc39f834ad286c3a6fd19a943ca828))
31
+
32
+
33
+ ### ✨ Features | 新功能
34
+
35
+ * product组件切换为接口 ([520f1ca](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/520f1cad1ce517ee9de12845a513678396039e43))
36
+ * 兼容地图 ([b189928](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b18992884c5e1a6dce947c5f7dbbb6750f5dfb5f))
37
+ * 加载更多 ([ae2ba8b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ae2ba8b24334aa2f1bb82c6a702cc72bb16beee1))
38
+ * 处理瀑布流刷新 ([d76fb08](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d76fb088eb287f0a88dfc029f7b9bb287a2b5cd8))
39
+ * 新增types ([b4ceffd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b4ceffdb507c04888370ca4ca0a523d528429a49))
40
+ * 瀑布流 ([a5334a0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/a5334a02c4cc3cbecf5822534fabfb899d166f35))
41
+
5
42
  ### [0.2.74](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.73...v0.2.74) (2025-01-06)
6
43
 
7
44
 
@@ -76,6 +76,7 @@ const queryList = async (page: number, limit: number) => {
76
76
  const { data } = await uni.$lcb.http.post(props.url, {
77
77
  ...props.baseParam,
78
78
  ...form?.value,
79
+ listType: props.listType,
79
80
  ...getPageOptions(),
80
81
  pageSearch: {
81
82
  limit,
@@ -1,10 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { ref, useAttrs, watch, computed, watchEffect } from 'vue'
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 { getPreviewImageUrl } from '../../utils/utils'
6
+ import { calculateImageHeight } from '../../utils/utils'
7
+ import { isH5 } from '@tplc/wot/components/common/util'
8
8
 
9
9
  const uWaterfallRef = ref()
10
10
  defineOptions({
@@ -22,8 +22,10 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
22
22
  imageWidth: 200,
23
23
  imageHeight: 250,
24
24
  titleLineClamp: 2,
25
+ column: 2,
25
26
  })
26
27
  const renderList = ref<Record<string, any>[]>([])
28
+ const screenWidth = isH5 ? window.innerWidth : uni.getWindowInfo().screenWidth
27
29
  watchEffect(() => {
28
30
  if (!props.filterList) return
29
31
  renderList.value = props.items as Record<string, any>[]
@@ -34,8 +36,10 @@ defineSlots<{
34
36
  watch(
35
37
  () => props.form,
36
38
  () => {
37
- renderList.value = []
38
- uWaterfallRef.value?.clear()
39
+ if (props.listType === 'waterfall') {
40
+ renderList.value = []
41
+ uWaterfallRef.value?.clear?.()
42
+ }
39
43
  },
40
44
  { deep: true },
41
45
  )
@@ -52,11 +56,13 @@ const getData = async () => {
52
56
  }
53
57
 
54
58
  watch(() => props.items, getData, { immediate: true, deep: true })
55
-
59
+ const columnWidth = (screenWidth - 12 * (1 + props.column)) / 2
56
60
  defineExpose({
57
61
  clear: () => {
58
- renderList.value = []
59
- uWaterfallRef.value?.clear()
62
+ if (props.listType === 'waterfall') {
63
+ renderList.value = []
64
+ uWaterfallRef.value?.clear?.()
65
+ }
60
66
  },
61
67
  })
62
68
  </script>
@@ -130,9 +136,9 @@ defineExpose({
130
136
  </view>
131
137
 
132
138
  <view class="lcb-product-waterfall" v-else-if="listType === 'waterfall'">
133
- <u-waterfall :modelValue="renderList" ref="uWaterfallRef">
139
+ <u-waterfall :addTime="0" :modelValue="renderList" ref="uWaterfallRef">
134
140
  <template #left="{ leftList: list }">
135
- <view class="flex flex-col gap-3">
141
+ <view class="flex flex-col gap-12px">
136
142
  <lcb-action-view
137
143
  v-for="(item, index) in list"
138
144
  :key="`${item?.productId}:${index}`"
@@ -157,14 +163,19 @@ defineExpose({
157
163
  v-else
158
164
  >
159
165
  <template #coverImg="{ value }">
160
- <u-lazy-load
161
- threshold="-800"
162
- :border-radius="imageRadius"
163
- :image="value"
164
- :loading-img="getPreviewImageUrl(value)"
165
- :index="index"
166
+ <wd-img
167
+ :src="value"
168
+ width="100%"
169
+ mode="aspectFill"
170
+ :lazyPlaceWidth="columnWidth"
171
+ :height="
172
+ calculateImageHeight(
173
+ screenWidth,
174
+ item.coverImgProps?.[0]?.height,
175
+ item.coverImgProps?.[0]?.width,
176
+ )
177
+ "
166
178
  />
167
- <!-- <wd-img :src="value" width="100%" lazyPlaceWidth="250" height="auto" mode="widthFix" /> -->
168
179
  </template>
169
180
  </lcb-product-item>
170
181
  </slot>
@@ -196,12 +207,18 @@ defineExpose({
196
207
  tag-overflow-wrap
197
208
  >
198
209
  <template #coverImg="{ value }">
199
- <u-lazy-load
200
- threshold="-800"
201
- :border-radius="imageRadius"
202
- :image="value"
203
- :index="index"
204
- :loading-img="getPreviewImageUrl(value)"
210
+ <wd-img
211
+ :src="value"
212
+ width="100%"
213
+ :lazyPlaceWidth="columnWidth"
214
+ mode="aspectFill"
215
+ :height="
216
+ calculateImageHeight(
217
+ screenWidth,
218
+ item.coverImgProps?.[0]?.height,
219
+ item.coverImgProps?.[0]?.width,
220
+ )
221
+ "
205
222
  />
206
223
  </template>
207
224
  </lcb-product-item>
@@ -235,8 +252,7 @@ defineExpose({
235
252
  />
236
253
  <lcb-product-item
237
254
  v-else
238
- v-bind="item"
239
- :layoutType="layoutType"
255
+ v-bind="{ ...item, ...$props, ...attrs }"
240
256
  :coverImgStyle="{
241
257
  width: layoutType === 'vertical' ? '100%' : transformValueUnit(imageWidth),
242
258
  height: layoutType === 'vertical' ? transformValueUnit(imageHeight) : undefined,
@@ -244,7 +260,6 @@ defineExpose({
244
260
  borderRadius: imageRadius ? transformValueUnit(imageRadius) : undefined,
245
261
  ...(attrs?.coverImgStyle ?? {}),
246
262
  }"
247
- :titleLineClamp="titleLineClamp"
248
263
  ></lcb-product-item>
249
264
  </slot>
250
265
  </view>
@@ -257,8 +272,8 @@ defineExpose({
257
272
  .lcb-product-waterfall {
258
273
  :deep(.u-waterfall) {
259
274
  display: flex;
260
- gap: 24rpx;
261
- padding: 24rpx;
275
+ gap: 12px;
276
+ padding: 12px;
262
277
  }
263
278
  }
264
279
  </style>
@@ -5,6 +5,7 @@ export interface LcbProductProps {
5
5
  imageHeight?: number
6
6
  imageRadius?: number
7
7
  borderRadius?: number
8
+ column?: number
8
9
  itemWidth?: number // 列表项宽度
9
10
  items?: {
10
11
  productId: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.2.74",
3
+ "version": "0.2.76",
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": "0.1.52"
14
+ "@tplc/wot": "0.1.53"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=18",
@@ -12,6 +12,7 @@ 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
  {
@@ -34,6 +35,7 @@ declare const __VLS_component: import('vue').DefineComponent<
34
35
  imageWidth: number
35
36
  imageHeight: number
36
37
  titleLineClamp: number
38
+ column: number
37
39
  }
38
40
  >
39
41
  >
@@ -41,6 +43,7 @@ declare const __VLS_component: import('vue').DefineComponent<
41
43
  {
42
44
  imageWidth: number
43
45
  imageHeight: number
46
+ column: number
44
47
  listType: 'list' | 'horizontal' | 'grid' | 'waterfall'
45
48
  titleLineClamp: number
46
49
  },
@@ -4,6 +4,7 @@ export interface LcbProductProps {
4
4
  imageHeight?: number
5
5
  imageRadius?: number
6
6
  borderRadius?: number
7
+ column?: number
7
8
  itemWidth?: number
8
9
  items?: {
9
10
  productId: string
@@ -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
+ }