@tplc/business 0.1.13 → 0.1.14

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,34 +2,14 @@
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.1.13](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.6...v0.1.13) (2024-10-28)
5
+ ### [0.1.14](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.21...v0.1.14) (2024-10-29)
6
6
 
7
7
 
8
8
  ### 🚀 Chore | 构建/工程依赖/工具
9
9
 
10
- * **release:** 0.1.10 ([732f746](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/732f746ecc268186d3357b882c40e4ee0a227250))
11
- * **release:** 0.1.11 ([0ff8ceb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0ff8ceb8c63810597998d2660a87ccc8007f7196))
12
- * **release:** 0.1.12 ([cb45e26](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/cb45e26560dbc7de5691950e480b3f070d3dafa5))
13
- * **release:** 0.1.7 ([69fbf39](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/69fbf39f9e9f1c7b2daf25aa81d7e508a530fa2b))
14
- * **release:** 0.1.8 ([0cd2b98](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0cd2b98488ea39de407df1badedf2554f94190f1))
15
- * **release:** 0.1.9 ([b1dd896](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/b1dd896c4acc76bfc370b39c7d0a24eb729182eb))
16
-
17
-
18
- ### 🐛 Bug Fixes | Bug 修复
19
-
20
- * 修改图片尺寸 ([1d4dd25](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1d4dd25e5065401562cd75560507bc23953967e8))
10
+ * **release:** 0.1.13 ([d2ff093](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d2ff0931511bb59dcde85de2cbdefa21f338a1f2))
21
11
 
22
-
23
- ### ✨ Features | 新功能
24
-
25
- * lcb-list 相关 slot 适应小程序调整 ([aff0850](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/aff085079e4918761191a7a00f7c48a5fb2c599d))
26
- * nav 颜色调整 ([1f7bba0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1f7bba00c2386a85a5bfe3b3973ad160c87efd78))
27
- * version update ([3e0904a](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3e0904a72675d2c262ec4efd388c08a1f4a5375a))
28
- * 上传图片 ([5ae5dcb](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/5ae5dcbb018ce5c9bbc53290eb0e3e082985d887))
29
- * 优化 lcb-product-item 插槽与属性 ([29d00e4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/29d00e49adf8c47ea223f92b400eac74385f8ee0))
30
- * 新增dynamic-data ([d43b20f](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d43b20f5f334ae6ac5b46294b5caf7903bc4a820))
31
- * 类型调整 ([206b930](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/206b93056631e72531cd39617a3c6e7ad5529723))
32
- * 调整usertop ui ([13daab3](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/13daab39ecd02d313cf9c9c61fa8ab79ba10198f))
12
+ ### [0.1.13](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.21...v0.1.13) (2024-10-29)
33
13
 
34
14
  ### [0.1.12](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.6...v0.1.12) (2024-10-28)
35
15
 
@@ -16,6 +16,8 @@ const useSelect = (
16
16
  } else {
17
17
  model.value = [...(model.value || []), item.value as string]
18
18
  }
19
+ } else if (model.value === item.value) {
20
+ model.value = undefined
19
21
  } else {
20
22
  model.value = item.value
21
23
  }
@@ -0,0 +1,21 @@
1
+ export interface AdvertItem {
2
+ adContent: string
3
+ advertId: string
4
+ closeTime: number
5
+ closeType: string
6
+ createDate: string
7
+ jumpType: number
8
+ lastModifyDate: string
9
+ pageType: string
10
+ type: number
11
+ title?: string
12
+ weightSort: string
13
+ }
14
+ /** 获取公告 */
15
+ export const getAdvertList = (data: {
16
+ pageType: string
17
+ /** 1: 文字 2: 图片 */
18
+ type: 1 | 2
19
+ }) => {
20
+ return uni.$lcb.http.post<AdvertItem[]>('/advert/list', data)
21
+ }
@@ -1,32 +1,49 @@
1
1
  <template>
2
2
  <lcb-block v-bind="$props" custom-class="border-solid border-1">
3
- <swiper
4
- class="swiper"
5
- circular
6
- :autoplay="true"
7
- :disableTouch="true"
8
- :interval="interval"
9
- :vertical="direction == 'up'"
10
- @change="onSwiperChange"
3
+ <wd-notice-bar
4
+ :text="textArray"
5
+ backgroundColor="transparent"
6
+ :color="color"
7
+ :direction="direction"
8
+ :speed="speed"
9
+ @click="handleClick"
10
+ custom-class="!p-0 !rounded-none"
11
11
  >
12
- <swiper-item v-for="(item, idx) in items" :key="item.id">
13
- <Item
14
- :idx="idx"
15
- :current="current"
16
- :lens="items?.length"
17
- :iconType="iconType"
18
- :item="item"
19
- :textSpeed="textSpeed"
20
- :textColor="textColor"
21
- />
22
- </swiper-item>
23
- </swiper>
12
+ <template #prefix v-if="iconType !== -1 && icon">
13
+ <view class="mr-12rpx">
14
+ <image
15
+ :src="icon"
16
+ class="h-auto"
17
+ mode="widthFix"
18
+ v-if="iconType === 1"
19
+ :style="{
20
+ width: transformValueUnit(iconSize),
21
+ }"
22
+ />
23
+ <wd-icon :name="icon" :size="transformValueUnit(iconSize)" class-prefix="lcb" v-else />
24
+ </view>
25
+ </template>
26
+ <template #suffix v-if="rightArrow">
27
+ <wd-icon name="arrow-right" size="32rpx" />
28
+ </template>
29
+ </wd-notice-bar>
24
30
  </lcb-block>
31
+ <wd-popup v-model="popup.show" position="bottom" custom-class="!bg-transparent" closable>
32
+ <view class="text-#333 px-3 pb-3 box-border bg-#fff rounded-t-20rpx">
33
+ <view class="py-3 text-center font-500 text-4">{{ popup.item.title || '公告' }}</view>
34
+ <view class="min-h-30vh max-h-50vh overflow-y-auto text-28rpx">
35
+ {{ popup.item.adContent }}
36
+ </view>
37
+ </view>
38
+ </wd-popup>
25
39
  </template>
26
40
 
27
41
  <script setup lang="ts">
28
42
  import { LcbNoticeBarProps } from './types'
29
- import Item from './Item/index.vue'
43
+ import { inject, watch, ref, computed } from 'vue'
44
+ import { AdvertItem, getAdvertList } from './api'
45
+ import { PAGE_TYPE_PROVIDE_KEY } from '../../constants'
46
+ import { transformValueUnit } from '../../utils/transform'
30
47
 
31
48
  defineOptions({
32
49
  name: 'LcbNotice',
@@ -36,37 +53,36 @@ defineOptions({
36
53
  styleIsolation: 'shared',
37
54
  },
38
55
  })
39
-
56
+ const adverts = ref<AdvertItem[]>([])
40
57
  const props = withDefaults(defineProps<LcbNoticeBarProps>(), {
41
- textSpeed: 1,
58
+ speed: 50,
42
59
  borderColor: 'transparent',
60
+ direction: 'vertical',
61
+ backgroundColor: '#fff',
62
+ paddingVertical: 16,
63
+ rightArrow: true,
64
+ color: '#333',
65
+ iconSize: 40,
43
66
  })
44
- console.log(props, 'props')
45
-
46
- function getTime(text: string | undefined) {
47
- const len = text?.length || 0
48
- // console.log('props.textSpeed', len, props.textSpeed)
49
- return len > 25 ? ((50 - len) / 10) * props.textSpeed * 1000 + 3000 : 3000
50
- }
51
- // const params = ref<number>(0)
52
- // const model = defineModel<number>()
53
- const current = defineModel({ type: Number, default: 0 })
54
- const interval = defineModel('interval', { type: Number, default: 3000 })
55
- function onSwiperChange(item: any) {
56
- // console.log('current.value', current.value)
57
- current.value = item?.detail?.current
58
- interval.value = getTime(props.items?.[current.value]?.noticeContent)
59
- // console.log('onSwiperChange item', item)
60
- // console.log('interval.value', interval.value)
67
+ const popup = ref({
68
+ show: false,
69
+ item: {} as AdvertItem,
70
+ })
71
+ const pageType = inject(PAGE_TYPE_PROVIDE_KEY, props.pageType) as string
72
+ const getData = async () => {
73
+ const { data } = await getAdvertList({
74
+ type: 1,
75
+ pageType,
76
+ })
77
+ adverts.value = data
61
78
  }
79
+ watch(() => pageType, getData, { immediate: true })
62
80
 
63
- // function onSetInterval(val: number) {
64
- // interval.value = val;
65
- // }
66
- </script>
67
-
68
- <style lang="scss" scoped>
69
- .swiper {
70
- height: 72rpx;
81
+ const textArray = computed(() => adverts.value.map((item) => item.adContent))
82
+ const handleClick = (data: { text: string; index: number }) => {
83
+ popup.value = {
84
+ show: true,
85
+ item: adverts.value[data.index],
86
+ }
71
87
  }
72
- </style>
88
+ </script>
@@ -1,30 +1,15 @@
1
- import { LcbActionViewProps } from '../../components/lcb-action-view/types'
2
- interface NoticeItem {
3
- id?: number
4
- noticeContent?: string
5
- icon?: string
6
- link?: LcbActionViewProps
7
- }
1
+ import { NoticeBarScrollDirection } from '@tplc/wot/types/components/wd-notice-bar/types'
2
+ import { LcbBlockProps } from '../lcb-block/types'
8
3
 
9
- export interface LcbNoticeBarProps {
10
- // Define the component's prop types here
11
- items?: Partial<NoticeItem>[]
4
+ export interface LcbNoticeBarProps extends LcbBlockProps {
12
5
  vertical?: boolean
13
- iconType?: number
14
- direction?: string
15
- textSpeed?: number
16
- textColor?: string
17
- borderColor?: string
18
- }
19
-
20
- export interface NoticeBarItemProps {
21
- idx?: number
22
- current?: number
23
- text?: string
24
- lens?: number
25
- iconType?: number
26
- item?: NoticeItem
27
- textSpeed?: number
6
+ /** -1 无 0 图标 1 自定义 */
7
+ iconType?: -1 | 0 | 1
8
+ direction?: NoticeBarScrollDirection
9
+ speed?: number
28
10
  textColor?: string
29
- // setInterval?: Function
11
+ pageType?: string
12
+ rightArrow?: boolean
13
+ icon?: string
14
+ iconSize?: number
30
15
  }
package/constants.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export const FORM_KEY = 'form'
2
2
  /** 页面信息 */
3
3
  export const PAGE_PROVIDE_KEY = 'page_provide'
4
+ /** 页面类型 */
5
+ export const PAGE_TYPE_PROVIDE_KEY = 'page_type_provide'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
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.20"
14
+ "@tplc/wot": "0.1.21"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=18",
@@ -0,0 +1,19 @@
1
+ export interface AdvertItem {
2
+ adContent: string
3
+ advertId: string
4
+ closeTime: number
5
+ closeType: string
6
+ createDate: string
7
+ jumpType: number
8
+ lastModifyDate: string
9
+ pageType: string
10
+ type: number
11
+ title?: string
12
+ weightSort: string
13
+ }
14
+ /** 获取公告 */
15
+ export declare const getAdvertList: (data: {
16
+ pageType: string
17
+ /** 1: 文字 2: 图片 */
18
+ type: 1 | 2
19
+ }) => Promise<import('../../../action').IResData<AdvertItem[]>>
@@ -1,16 +1,16 @@
1
1
  import { LcbNoticeBarProps } from './types'
2
- declare let __VLS_typeProps: LcbNoticeBarProps
3
- declare const interval: import('vue').ModelRef<number, string>
4
- type __VLS_PublicProps = {
5
- modelValue?: any
6
- interval?: NonNullable<(typeof interval)['value']>
7
- } & typeof __VLS_typeProps
8
2
  declare const _default: import('vue').DefineComponent<
9
3
  __VLS_WithDefaults<
10
- __VLS_TypePropsToOption<__VLS_PublicProps>,
4
+ __VLS_TypePropsToOption<LcbNoticeBarProps>,
11
5
  {
12
- textSpeed: number
6
+ speed: number
13
7
  borderColor: string
8
+ direction: string
9
+ backgroundColor: string
10
+ paddingVertical: number
11
+ rightArrow: boolean
12
+ color: string
13
+ iconSize: number
14
14
  }
15
15
  >,
16
16
  {},
@@ -19,29 +19,35 @@ declare const _default: import('vue').DefineComponent<
19
19
  {},
20
20
  import('vue').ComponentOptionsMixin,
21
21
  import('vue').ComponentOptionsMixin,
22
- {
23
- 'update:modelValue': (modelValue: any) => void
24
- 'update:interval': (interval: number) => void
25
- },
22
+ {},
26
23
  string,
27
24
  import('vue').PublicProps,
28
25
  Readonly<
29
26
  import('vue').ExtractPropTypes<
30
27
  __VLS_WithDefaults<
31
- __VLS_TypePropsToOption<__VLS_PublicProps>,
28
+ __VLS_TypePropsToOption<LcbNoticeBarProps>,
32
29
  {
33
- textSpeed: number
30
+ speed: number
34
31
  borderColor: string
32
+ direction: string
33
+ backgroundColor: string
34
+ paddingVertical: number
35
+ rightArrow: boolean
36
+ color: string
37
+ iconSize: number
35
38
  }
36
39
  >
37
40
  >
38
- > & {
39
- 'onUpdate:modelValue'?: ((modelValue: any) => any) | undefined
40
- 'onUpdate:interval'?: ((interval: number) => any) | undefined
41
- },
41
+ >,
42
42
  {
43
+ paddingVertical: number
44
+ backgroundColor: string
45
+ color: string
43
46
  borderColor: string
44
- textSpeed: number
47
+ direction: import('@tplc/wot/types/components/wd-notice-bar/types').NoticeBarScrollDirection
48
+ iconSize: number
49
+ speed: number
50
+ rightArrow: boolean
45
51
  },
46
52
  {}
47
53
  >
@@ -1,27 +1,14 @@
1
- import { LcbActionViewProps } from '../../components/lcb-action-view/types'
2
- interface NoticeItem {
3
- id?: number
4
- noticeContent?: string
5
- icon?: string
6
- link?: LcbActionViewProps
7
- }
8
- export interface LcbNoticeBarProps {
9
- items?: Partial<NoticeItem>[]
1
+ import { NoticeBarScrollDirection } from '@tplc/wot/types/components/wd-notice-bar/types'
2
+ import { LcbBlockProps } from '../lcb-block/types'
3
+ export interface LcbNoticeBarProps extends LcbBlockProps {
10
4
  vertical?: boolean
11
- iconType?: number
12
- direction?: string
13
- textSpeed?: number
14
- textColor?: string
15
- borderColor?: string
16
- }
17
- export interface NoticeBarItemProps {
18
- idx?: number
19
- current?: number
20
- text?: string
21
- lens?: number
22
- iconType?: number
23
- item?: NoticeItem
24
- textSpeed?: number
5
+ /** -1 无 0 图标 1 自定义 */
6
+ iconType?: -1 | 0 | 1
7
+ direction?: NoticeBarScrollDirection
8
+ speed?: number
25
9
  textColor?: string
10
+ pageType?: string
11
+ rightArrow?: boolean
12
+ icon?: string
13
+ iconSize?: number
26
14
  }
27
- export {}
@@ -1,3 +1,5 @@
1
1
  export declare const FORM_KEY = 'form'
2
2
  /** 页面信息 */
3
3
  export declare const PAGE_PROVIDE_KEY = 'page_provide'
4
+ /** 页面类型 */
5
+ export declare const PAGE_TYPE_PROVIDE_KEY = 'page_type_provide'
@@ -1,112 +0,0 @@
1
- <template>
2
- <view class="flex items-center">
3
- <div
4
- v-if="iconType === 1"
5
- class="overflow-hidden bg-no-repeat bg-contain mr-12rpx"
6
- :style="{
7
- height: transformValueUnit(40),
8
- width: transformValueUnit(40),
9
- backgroundImage: `url('${item?.icon}')`,
10
- }"
11
- />
12
- <view v-if="iconType === 0" class="mr-12rpx">
13
- <wd-icon
14
- class-prefix="lcb"
15
- v-bind="{
16
- name: item?.icon || '',
17
- size: transformValueUnit(40),
18
- }"
19
- />
20
- </view>
21
- <view class="flex-1 noticeBar relative overflow-hidden">
22
- <view
23
- :class="`text-24rpx absolute left-0 top-0 noticeItem flex overflow-hidden${lens == 1 ? ' infinite' : ''}${showAni ? ' animation' : ''}`"
24
- :style="{
25
- animationDuration: getTime(item?.noticeContent),
26
- color: textColor,
27
- }"
28
- >
29
- {{ item?.noticeContent }}
30
- <lcb-action-view v-bind="item?.link" customClass="absolute top-0 left-0 right-0 bottom-0" />
31
- </view>
32
- </view>
33
- <wd-icon name="arrow-right" size="32rpx" :color="textColor" />
34
- </view>
35
- </template>
36
-
37
- <script setup lang="ts">
38
- import { NoticeBarItemProps } from '../types'
39
- import { computed } from 'vue'
40
- import { transformValueUnit } from '../../../utils/transform'
41
- defineOptions({
42
- name: 'NoticeBarItem',
43
- options: {
44
- addGlobalClass: true,
45
- virtualHost: true,
46
- styleIsolation: 'shared',
47
- },
48
- })
49
- const props = withDefaults(defineProps<NoticeBarItemProps>(), {
50
- textSpeed: 1,
51
- })
52
- // const { proxy } = getCurrentInstance() as any
53
- const showAni = computed(() => {
54
- // const query = uni.createSelectorQuery().in(proxy)
55
- // query.select('.noticeBar').boundingClientRect()
56
- // query.exec((res) => {
57
- // console.log(res)
58
- // })
59
- const len = props.item?.noticeContent?.length || 0
60
- // console.log('showAni', props.idx, len)
61
- return props.current === props.idx && len > 25
62
- })
63
-
64
- function getTime(text: string | undefined) {
65
- const len = text?.length || 0
66
- // console.log('item---', props.textSpeed)
67
- return `${((50 - len) / 10) * props.textSpeed + 3}s`
68
- }
69
- </script>
70
- <style lang="scss" scoped>
71
- .noticeBar {
72
- height: 72rpx;
73
- }
74
-
75
- .noticeItem {
76
- height: 72rpx;
77
- line-height: 72rpx;
78
- transform: translateZ(0.5px);
79
- line-clamp: 1;
80
- white-space: nowrap;
81
- text-overflow: ellipsis;
82
- word-break: break-all;
83
- animation-delay: 0.5s;
84
- animation-direction: normal;
85
- animation-duration: 3s;
86
- animation-fill-mode: forwards;
87
- animation-play-state: running;
88
- animation-range-end: normal;
89
- animation-range-start: normal;
90
- animation-timeline: auto;
91
- animation-timing-function: linear;
92
- }
93
-
94
- .infinite {
95
- animation-iteration-count: infinite;
96
- }
97
-
98
- .animation {
99
- animation-name: change;
100
- // animation-duration: 5s;
101
- }
102
-
103
- @keyframes change {
104
- 0% {
105
- transform: translate(0%);
106
- }
107
-
108
- 100% {
109
- transform: translate(-60%);
110
- }
111
- }
112
- </style>
@@ -1,56 +0,0 @@
1
- import { NoticeBarItemProps } from '../types'
2
- declare const _default: import('vue').DefineComponent<
3
- __VLS_WithDefaults<
4
- __VLS_TypePropsToOption<NoticeBarItemProps>,
5
- {
6
- textSpeed: number
7
- }
8
- >,
9
- {},
10
- unknown,
11
- {},
12
- {},
13
- import('vue').ComponentOptionsMixin,
14
- import('vue').ComponentOptionsMixin,
15
- {},
16
- string,
17
- import('vue').PublicProps,
18
- Readonly<
19
- import('vue').ExtractPropTypes<
20
- __VLS_WithDefaults<
21
- __VLS_TypePropsToOption<NoticeBarItemProps>,
22
- {
23
- textSpeed: number
24
- }
25
- >
26
- >
27
- >,
28
- {
29
- textSpeed: number
30
- },
31
- {}
32
- >
33
- export default _default
34
- type __VLS_WithDefaults<P, D> = {
35
- [K in keyof Pick<P, keyof P>]: K extends keyof D
36
- ? __VLS_Prettify<
37
- P[K] & {
38
- default: D[K]
39
- }
40
- >
41
- : P[K]
42
- }
43
- type __VLS_Prettify<T> = {
44
- [K in keyof T]: T[K]
45
- } & {}
46
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T
47
- type __VLS_TypePropsToOption<T> = {
48
- [K in keyof T]-?: {} extends Pick<T, K>
49
- ? {
50
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>
51
- }
52
- : {
53
- type: import('vue').PropType<T[K]>
54
- required: true
55
- }
56
- }