@tplc/business 0.5.11 → 0.5.13

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,32 @@
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.5.13](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.10...v0.5.13) (2025-10-11)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.5.11 ([8526502](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8526502f1d0a576033c5da7ce58baa1306911d4c))
11
+ * **release:** 0.5.12 ([07c36dd](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/07c36dd73a94d9a4900d20565e8821e59bc4a691))
12
+
13
+
14
+ ### ✨ Features | 新功能
15
+
16
+ * t同步constant ([9f4c637](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9f4c6374935e04bc6de4c3f26c149b42c98237eb))
17
+ * 删除多余依赖 ([84abd86](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/84abd860f693cbacb74c6bc0ef27fe552784df1d))
18
+ * 图片圆角 ([a68898e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/a68898ec76b518fa16e4038936c0bea4a815ae7a))
19
+ * 支持 address ([c812459](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/c812459276927d7225cfff0dcd4ce1b3267723ea))
20
+ * 新增banner ([8dba4d4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/8dba4d42665360e02b390c472c902075061157c7))
21
+
22
+ ### [0.5.12](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.11...v0.5.12) (2025-10-11)
23
+
24
+
25
+ ### ✨ Features | 新功能
26
+
27
+ * t同步constant ([9f4c637](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/9f4c6374935e04bc6de4c3f26c149b42c98237eb))
28
+ * 删除多余依赖 ([84abd86](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/84abd860f693cbacb74c6bc0ef27fe552784df1d))
29
+ * 图片圆角 ([a68898e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/a68898ec76b518fa16e4038936c0bea4a815ae7a))
30
+
5
31
  ### [0.5.11](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.7...v0.5.11) (2025-10-11)
6
32
 
7
33
 
@@ -123,6 +123,7 @@ const openType = computed(() => {
123
123
  const onActionClick = async () => {
124
124
  const { jumpUrl, jumpType: type } = props
125
125
  const jumpType = getJumpType(type)
126
+ if (props.jumpInterceptor?.(props)) return
126
127
  /**
127
128
  * 跳转类型 1: 网页 2: 小程序内页 10: 跳转小程序 11: 跳转半屏小程序 12: 小程序客服
128
129
  * 13: 退出登录 14: 小程序弹框 21: 新窗口跳到页面 22: 切换TAB页 23: 重启进入某页面
@@ -11,6 +11,8 @@ export type LcbActionViewProps = {
11
11
  autoJumpSecond?: number
12
12
  /** 弹窗位置 */
13
13
  position?: PopupType
14
+ // 跳转拦截方法 如果返回true则不进行跳转
15
+ jumpInterceptor?: (action: LcbActionViewProps) => boolean
14
16
  /** 弹窗文案 */
15
17
  content?: string
16
18
  /** 弹窗标题 */
@@ -1,23 +1,43 @@
1
1
  <template>
2
- <lcb-block v-bind="$props" custom-class="overflow-visible lcb-banner-block flex flex-col">
3
- <!-- <z-swiper v-bind="$props">
4
- <z-swiper-item v-for="item in items" :key="item.link">
5
- <lcb-action-view v-bind="item.link">
6
- <view
7
- class="absolute top-0 left-0 w-full h-full z-1 pointer-events-none"
8
- :style="{
9
- background: item.maskBgColor,
10
- }"
2
+ <lcb-block v-bind="$props">
3
+ <view class="lcb-carousel" @touchstart="starts" @touchend="ends">
4
+ <view
5
+ v-for="(item, i) in imagelist"
6
+ :key="i"
7
+ class="carousel-block"
8
+ @click="changeBlock(item)"
9
+ :style="{
10
+ left: item.left,
11
+ top: item.top,
12
+ zIndex: item.zIndex,
13
+ width: itemWidth + 'rpx',
14
+ height: itemHeight + 'rpx',
15
+ transition: item.transition + 's all',
16
+ transform: 'translate3d(-50%, -50%, 0) scale(' + item.scale + ')',
17
+ }"
18
+ >
19
+ <lcb-action-view
20
+ v-bind="item.item.link"
21
+ customClass="w-full h-full"
22
+ :jumpInterceptor="jumpInterceptorHandler(item)"
23
+ >
24
+ <wd-img
25
+ :src="item.item.url"
26
+ mode="aspectFill"
27
+ width="100%"
28
+ height="100%"
29
+ :radius="imageRadius"
11
30
  />
12
- <wd-img :src="item.url" height="100%" width="100%" />
13
31
  </lcb-action-view>
14
- </z-swiper-item>
15
- </z-swiper> -->
32
+ </view>
33
+ </view>
16
34
  </lcb-block>
17
35
  </template>
18
36
 
19
37
  <script setup lang="ts">
38
+ import { computed, onMounted, reactive, ref, watch } from 'vue'
20
39
  import { LcbSwiperProps } from './types'
40
+ import { ActionView } from 'action'
21
41
  defineOptions({
22
42
  name: 'LcbSwiper',
23
43
  options: {
@@ -27,6 +47,209 @@ defineOptions({
27
47
  },
28
48
  })
29
49
 
30
- withDefaults(defineProps<LcbSwiperProps>(), {})
50
+ const props = withDefaults(defineProps<LcbSwiperProps>(), {
51
+ mode: 'multiple',
52
+ itemWidth: 450,
53
+ itemHeight: 300,
54
+ })
55
+ type DataRecord = Record<string, any>
56
+
57
+ interface SlotStyle {
58
+ left: string
59
+ top: string
60
+ zIndex: number
61
+ scale: number
62
+ transition: number
63
+ }
64
+
65
+ interface ImageItem extends SlotStyle {
66
+ isIndex: number
67
+ slotIndex: number
68
+ item: Partial<
69
+ ActionView & {
70
+ maskBgColor?: string
71
+ }
72
+ >
73
+ }
74
+
75
+ const emit = defineEmits<{
76
+ (e: 'selection', item: DataRecord): void
77
+ }>()
78
+
79
+ const datalist = ref<DataRecord[]>([])
80
+ const imagelist = ref<ImageItem[]>([])
81
+ const ismove = ref(0)
82
+ const count = reactive({ sta: 0, end: 0 })
83
+ const slotStyles = ref<SlotStyle[]>([])
84
+
85
+ const visible = computed<number>(() => {
86
+ if (props.visibleCount && props.visibleCount > 0) return props.visibleCount
87
+ if (props.mode === 'single') return 3
88
+ if (props.mode === 'multiple') return 5
89
+ return 5
90
+ })
91
+
92
+ function buildSlots(n: number): SlotStyle[] {
93
+ const center = Math.floor(n / 2)
94
+ const spacing = 14 // percent per slot
95
+ const scaleStep = 0.15
96
+ return Array.from({ length: n }, (_, i) => {
97
+ const d = Math.abs(i - center)
98
+ return {
99
+ left: `calc(50% + ${(i - center) * spacing}% )`,
100
+ top: '50%',
101
+ zIndex: 100 - d,
102
+ scale: Math.max(1 - d * scaleStep, 0.6),
103
+ transition: 0.2,
104
+ }
105
+ })
106
+ }
107
+
108
+ function initData() {
109
+ datalist.value = Array.isArray(props.items) ? props.items.slice() : []
110
+ const desired = visible.value
111
+ const n = Math.min(desired, datalist.value.length)
112
+ slotStyles.value = buildSlots(n)
113
+ imagelist.value = slotStyles.value.map((s, i) => ({
114
+ ...s,
115
+ isIndex: i,
116
+ slotIndex: i,
117
+ item: datalist.value[i],
118
+ }))
119
+ count.sta = 0
120
+ count.end = Math.max(0, n - 1)
121
+ }
122
+
123
+ function refreshVisibleFields() {
124
+ imagelist.value.forEach((item) => {
125
+ item.item = datalist.value[item.isIndex]
126
+ })
127
+ }
128
+
129
+ function applySlotStyle(item: ImageItem, slot: SlotStyle) {
130
+ item.left = slot.left
131
+ item.top = slot.top
132
+ item.zIndex = slot.zIndex
133
+ item.scale = slot.scale
134
+ item.transition = slot.transition
135
+ }
136
+
137
+ function LeftSliding() {
138
+ const n = imagelist.value.length
139
+ if (n === 0) return
140
+ const slots = slotStyles.value
141
+ imagelist.value.forEach((item) => {
142
+ const to = item.slotIndex - 1 < 0 ? n - 1 : item.slotIndex - 1
143
+ item.slotIndex = to
144
+ // @ts-ignore
145
+ applySlotStyle(item, slots[to])
146
+ if (to === n - 1) {
147
+ count.end = count.end + 1 > datalist.value.length - 1 ? 0 : count.end + 1
148
+ item.isIndex = count.end
149
+ item.item = datalist.value[count.end]
150
+ }
151
+ if (to === 0) {
152
+ count.sta = item.isIndex
153
+ }
154
+ })
155
+ }
156
+
157
+ function RightSliding() {
158
+ const n = imagelist.value.length
159
+ if (n === 0) return
160
+ const slots = slotStyles.value
161
+ imagelist.value.forEach((item) => {
162
+ const to = item.slotIndex + 1 > n - 1 ? 0 : item.slotIndex + 1
163
+ item.slotIndex = to
164
+ applySlotStyle(item, slots[to])
165
+ if (to === 0) {
166
+ count.sta = count.sta - 1 < 0 ? datalist.value.length - 1 : count.sta - 1
167
+ item.isIndex = count.sta
168
+ item.item = datalist.value[count.sta]
169
+ }
170
+ if (to === n - 1) {
171
+ count.end = item.isIndex
172
+ }
173
+ })
174
+ }
175
+
176
+ function changeBlock(item: ImageItem) {
177
+ const n = imagelist.value.length
178
+ const center = Math.floor(n / 2)
179
+ const toor = item.slotIndex
180
+ if (toor < center) {
181
+ RightSliding()
182
+ if (toor < center - 1) {
183
+ setTimeout(() => RightSliding(), 100)
184
+ }
185
+ } else if (toor > center) {
186
+ LeftSliding()
187
+ if (toor > center + 1) {
188
+ setTimeout(() => LeftSliding(), 100)
189
+ }
190
+ } else {
191
+ const selected = datalist.value[item.isIndex]
192
+ if (selected) emit('selection', selected)
193
+ }
194
+ }
195
+
196
+ function starts(e: any) {
197
+ if (e && e.touches && e.touches[0]) {
198
+ ismove.value = e.touches[0].pageX
199
+ }
200
+ }
201
+
202
+ function ends(e: any) {
203
+ if (!e || !e.changedTouches || !e.changedTouches[0]) return
204
+ const pageX = e.changedTouches[0].pageX
205
+ const nums = ismove.value - pageX
206
+ if (nums > 50) {
207
+ LeftSliding()
208
+ } else if (nums < -50) {
209
+ RightSliding()
210
+ }
211
+ }
212
+
213
+ onMounted(() => {
214
+ initData()
215
+ })
216
+
217
+ // Re-init when count-related inputs change or array length changes
218
+ watch(
219
+ () => [props.visibleCount, props.mode, props.items?.length],
220
+ () => initData(),
221
+ )
222
+
223
+ // Update only fields when array identity changes without length change
224
+ watch(
225
+ () => props.items,
226
+ () => {
227
+ datalist.value = Array.isArray(props.items) ? props.items.slice() : []
228
+ refreshVisibleFields()
229
+ },
230
+ )
231
+ const jumpInterceptorHandler: any = (item: ImageItem) => () => {
232
+ if (item.scale === 1) {
233
+ return false
234
+ }
235
+ changeBlock(item)
236
+ return true
237
+ }
31
238
  </script>
32
- <style lang="scss" scoped></style>
239
+ <style lang="scss" scoped>
240
+ .lcb-carousel {
241
+ width: 100%;
242
+ height: 100%;
243
+ min-height: 200px;
244
+ position: relative;
245
+ overflow: hidden;
246
+ .carousel-block {
247
+ position: absolute;
248
+ overflow: hidden;
249
+ border-radius: 10upx;
250
+ overflow: hidden;
251
+ box-shadow: 0 0 5px #0000001a;
252
+ will-change: transform;
253
+ }
254
+ }
255
+ </style>
@@ -7,4 +7,9 @@ export interface LcbSwiperProps extends LcbBlockProps {
7
7
  maskBgColor?: string
8
8
  }
9
9
  >[]
10
+ itemWidth?: number
11
+ itemHeight?: number
12
+ mode?: string
13
+ visibleCount?: number
14
+ imageRadius?: number
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -20,8 +20,7 @@
20
20
  "dependencies": {
21
21
  "mp-html": "^2.5.0",
22
22
  "qs": "6.5.3",
23
- "uview-plus": "^3.3.9",
24
- "@zebra-ui/swiper": "^3.0.2"
23
+ "uview-plus": "^3.3.9"
25
24
  },
26
25
  "devDependencies": {
27
26
  "standard-version": "^9.5.0"
@@ -10,6 +10,7 @@ export type LcbActionViewProps = {
10
10
  autoJumpSecond?: number
11
11
  /** 弹窗位置 */
12
12
  position?: PopupType
13
+ jumpInterceptor?: (action: LcbActionViewProps) => boolean
13
14
  /** 弹窗文案 */
14
15
  content?: string
15
16
  /** 弹窗标题 */
@@ -75,6 +75,9 @@ declare const _default: import('vue').DefineComponent<
75
75
  renderMode?: 'view' | 'button'
76
76
  autoJumpSecond?: number
77
77
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
78
+ jumpInterceptor?: (
79
+ action: import('../lcb-action-view/types').LcbActionViewProps,
80
+ ) => boolean
78
81
  content?: string
79
82
  title?: string
80
83
  requestParam?: Record<string, any>
@@ -179,6 +182,9 @@ declare const _default: import('vue').DefineComponent<
179
182
  renderMode?: 'view' | 'button'
180
183
  autoJumpSecond?: number
181
184
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
185
+ jumpInterceptor?: (
186
+ action: import('../lcb-action-view/types').LcbActionViewProps,
187
+ ) => boolean
182
188
  content?: string
183
189
  title?: string
184
190
  requestParam?: Record<string, any>
@@ -262,6 +268,9 @@ declare const _default: import('vue').DefineComponent<
262
268
  renderMode?: 'view' | 'button'
263
269
  autoJumpSecond?: number
264
270
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
271
+ jumpInterceptor?: (
272
+ action: import('../lcb-action-view/types').LcbActionViewProps,
273
+ ) => boolean
265
274
  content?: string
266
275
  title?: string
267
276
  requestParam?: Record<string, any>
@@ -344,6 +353,9 @@ declare const _default: import('vue').DefineComponent<
344
353
  renderMode?: 'view' | 'button'
345
354
  autoJumpSecond?: number
346
355
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
356
+ jumpInterceptor?: (
357
+ action: import('../lcb-action-view/types').LcbActionViewProps,
358
+ ) => boolean
347
359
  content?: string
348
360
  title?: string
349
361
  requestParam?: Record<string, any>
@@ -426,6 +438,9 @@ declare const _default: import('vue').DefineComponent<
426
438
  renderMode?: 'view' | 'button'
427
439
  autoJumpSecond?: number
428
440
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
441
+ jumpInterceptor?: (
442
+ action: import('../lcb-action-view/types').LcbActionViewProps,
443
+ ) => boolean
429
444
  content?: string
430
445
  title?: string
431
446
  requestParam?: Record<string, any>
@@ -514,6 +529,9 @@ declare const _default: import('vue').DefineComponent<
514
529
  renderMode?: 'view' | 'button'
515
530
  autoJumpSecond?: number
516
531
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
532
+ jumpInterceptor?: (
533
+ action: import('../lcb-action-view/types').LcbActionViewProps,
534
+ ) => boolean
517
535
  content?: string
518
536
  title?: string
519
537
  requestParam?: Record<string, any>
@@ -596,6 +614,9 @@ declare const _default: import('vue').DefineComponent<
596
614
  renderMode?: 'view' | 'button'
597
615
  autoJumpSecond?: number
598
616
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
617
+ jumpInterceptor?: (
618
+ action: import('../lcb-action-view/types').LcbActionViewProps,
619
+ ) => boolean
599
620
  content?: string
600
621
  title?: string
601
622
  requestParam?: Record<string, any>
@@ -678,6 +699,9 @@ declare const _default: import('vue').DefineComponent<
678
699
  renderMode?: 'view' | 'button'
679
700
  autoJumpSecond?: number
680
701
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
702
+ jumpInterceptor?: (
703
+ action: import('../lcb-action-view/types').LcbActionViewProps,
704
+ ) => boolean
681
705
  content?: string
682
706
  title?: string
683
707
  requestParam?: Record<string, any>
@@ -764,6 +788,9 @@ declare const _default: import('vue').DefineComponent<
764
788
  renderMode?: 'view' | 'button'
765
789
  autoJumpSecond?: number
766
790
  position?: import('@tplc/wot/types/components/wd-popup/types').PopupType
791
+ jumpInterceptor?: (
792
+ action: import('../lcb-action-view/types').LcbActionViewProps,
793
+ ) => boolean
767
794
  content?: string
768
795
  title?: string
769
796
  requestParam?: Record<string, any>
@@ -1,19 +1,44 @@
1
1
  import { LcbSwiperProps } from './types'
2
+ type DataRecord = Record<string, any>
2
3
  declare const _default: import('vue').DefineComponent<
3
- __VLS_WithDefaults<__VLS_TypePropsToOption<LcbSwiperProps>, {}>,
4
+ __VLS_WithDefaults<
5
+ __VLS_TypePropsToOption<LcbSwiperProps>,
6
+ {
7
+ mode: string
8
+ itemWidth: number
9
+ itemHeight: number
10
+ }
11
+ >,
4
12
  {},
5
13
  unknown,
6
14
  {},
7
15
  {},
8
16
  import('vue').ComponentOptionsMixin,
9
17
  import('vue').ComponentOptionsMixin,
10
- {},
18
+ {
19
+ selection: (item: DataRecord) => void
20
+ },
11
21
  string,
12
22
  import('vue').PublicProps,
13
23
  Readonly<
14
- import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LcbSwiperProps>, {}>>
15
- >,
16
- {},
24
+ import('vue').ExtractPropTypes<
25
+ __VLS_WithDefaults<
26
+ __VLS_TypePropsToOption<LcbSwiperProps>,
27
+ {
28
+ mode: string
29
+ itemWidth: number
30
+ itemHeight: number
31
+ }
32
+ >
33
+ >
34
+ > & {
35
+ onSelection?: ((item: DataRecord) => any) | undefined
36
+ },
37
+ {
38
+ mode: string
39
+ itemWidth: number
40
+ itemHeight: number
41
+ },
17
42
  {}
18
43
  >
19
44
  export default _default
@@ -6,4 +6,9 @@ export interface LcbSwiperProps extends LcbBlockProps {
6
6
  maskBgColor?: string
7
7
  }
8
8
  >[]
9
+ itemWidth?: number
10
+ itemHeight?: number
11
+ mode?: string
12
+ visibleCount?: number
13
+ imageRadius?: number
9
14
  }
@@ -180,10 +180,10 @@ declare const _default: import('vue').DefineComponent<
180
180
  width: string | number
181
181
  height: string | number
182
182
  showScrollbar: boolean
183
- idKey: string
184
- addTime: number
185
183
  columnCount: string | number
186
184
  columnGap: string | number
185
+ idKey: string
186
+ addTime: number
187
187
  leftGap: string | number
188
188
  rightGap: string | number
189
189
  },