@tplc/business 0.2.74 → 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 CHANGED
@@ -2,6 +2,27 @@
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
+
5
26
  ### [0.2.74](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.2.73...v0.2.74) (2025-01-06)
6
27
 
7
28
 
@@ -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,9 @@
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'
8
7
 
9
8
  const uWaterfallRef = ref()
10
9
  defineOptions({
@@ -22,8 +21,10 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
22
21
  imageWidth: 200,
23
22
  imageHeight: 250,
24
23
  titleLineClamp: 2,
24
+ column: 2,
25
25
  })
26
26
  const renderList = ref<Record<string, any>[]>([])
27
+ const screenWidth = uni.getSystemInfoSync().screenWidth
27
28
  watchEffect(() => {
28
29
  if (!props.filterList) return
29
30
  renderList.value = props.items as Record<string, any>[]
@@ -34,8 +35,10 @@ defineSlots<{
34
35
  watch(
35
36
  () => props.form,
36
37
  () => {
37
- renderList.value = []
38
- uWaterfallRef.value?.clear()
38
+ if (props.listType === 'waterfall') {
39
+ renderList.value = []
40
+ uWaterfallRef.value?.clear?.()
41
+ }
39
42
  },
40
43
  { deep: true },
41
44
  )
@@ -52,11 +55,13 @@ const getData = async () => {
52
55
  }
53
56
 
54
57
  watch(() => props.items, getData, { immediate: true, deep: true })
55
-
58
+ const columnWidth = (screenWidth - 12 * (1 + props.column)) / 2
56
59
  defineExpose({
57
60
  clear: () => {
58
- renderList.value = []
59
- uWaterfallRef.value?.clear()
61
+ if (props.listType === 'waterfall') {
62
+ renderList.value = []
63
+ uWaterfallRef.value?.clear?.()
64
+ }
60
65
  },
61
66
  })
62
67
  </script>
@@ -130,9 +135,9 @@ defineExpose({
130
135
  </view>
131
136
 
132
137
  <view class="lcb-product-waterfall" v-else-if="listType === 'waterfall'">
133
- <u-waterfall :modelValue="renderList" ref="uWaterfallRef">
138
+ <u-waterfall :addTime="0" :modelValue="renderList" ref="uWaterfallRef">
134
139
  <template #left="{ leftList: list }">
135
- <view class="flex flex-col gap-3">
140
+ <view class="flex flex-col gap-12px">
136
141
  <lcb-action-view
137
142
  v-for="(item, index) in list"
138
143
  :key="`${item?.productId}:${index}`"
@@ -157,14 +162,19 @@ defineExpose({
157
162
  v-else
158
163
  >
159
164
  <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"
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
+ "
166
177
  />
167
- <!-- <wd-img :src="value" width="100%" lazyPlaceWidth="250" height="auto" mode="widthFix" /> -->
168
178
  </template>
169
179
  </lcb-product-item>
170
180
  </slot>
@@ -196,12 +206,18 @@ defineExpose({
196
206
  tag-overflow-wrap
197
207
  >
198
208
  <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)"
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
+ "
205
221
  />
206
222
  </template>
207
223
  </lcb-product-item>
@@ -257,8 +273,8 @@ defineExpose({
257
273
  .lcb-product-waterfall {
258
274
  :deep(.u-waterfall) {
259
275
  display: flex;
260
- gap: 24rpx;
261
- padding: 24rpx;
276
+ gap: 12px;
277
+ padding: 12px;
262
278
  }
263
279
  }
264
280
  </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.75",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -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
+ }