@tplc/business 0.0.48 → 0.0.50

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/action.d.ts +7 -2
  3. package/api/user.ts +6 -0
  4. package/components/lcb-action-view/types.ts +2 -2
  5. package/components/lcb-block/types.ts +1 -0
  6. package/components/lcb-button/lcb-button.vue +32 -0
  7. package/components/lcb-button/types.ts +8 -0
  8. package/components/lcb-city-select/components/lcb-city-letter/index.vue +1 -1
  9. package/components/lcb-city-select/components/lcb-city-list/index.vue +1 -1
  10. package/components/lcb-city-select/components/lcb-city-list/types.ts +1 -1
  11. package/components/lcb-dynamic-data/lcb-dynamic-data.vue +10 -3
  12. package/components/lcb-image/Image/index.vue +15 -25
  13. package/components/lcb-list/components/FilterList/index.vue +9 -4
  14. package/components/lcb-list/components/FilterList/mockData.ts +575 -0
  15. package/components/lcb-list/hooks/useSelect.ts +2 -0
  16. package/components/lcb-list/lcb-list.vue +32 -17
  17. package/components/lcb-list/types.ts +0 -13
  18. package/components/lcb-nav/lcb-nav.vue +1 -1
  19. package/components/lcb-notice/api/index.ts +21 -0
  20. package/components/lcb-notice/lcb-notice.vue +66 -50
  21. package/components/lcb-notice/types.ts +11 -26
  22. package/components/lcb-product/lcb-product.vue +37 -33
  23. package/components/lcb-product-item/components/ItemValue.vue +103 -22
  24. package/components/lcb-product-item/lcb-product-item.vue +249 -70
  25. package/components/lcb-product-item/types.ts +15 -14
  26. package/components/lcb-text/lcb-text.vue +20 -0
  27. package/components/lcb-text/types.ts +5 -0
  28. package/components/lcb-user-top/Nums/index.vue +19 -10
  29. package/components/lcb-user-top/lcb-user-top.vue +51 -43
  30. package/constants.ts +2 -0
  31. package/global.d.ts +2 -0
  32. package/hooks/useUpload.ts +3 -6
  33. package/index.ts +1 -1
  34. package/package.json +2 -2
  35. package/tsconfig.json +24 -0
  36. package/types/api/user.d.ts +6 -0
  37. package/types/components/lcb-action-view/types.d.ts +2 -2
  38. package/types/components/lcb-block/types.d.ts +1 -0
  39. package/types/components/{lcb-notice/Item/index.vue.d.ts → lcb-button/lcb-button.vue.d.ts} +4 -18
  40. package/types/components/lcb-button/types.d.ts +7 -0
  41. package/types/components/lcb-city-select/components/lcb-city-letter/index.vue.d.ts +1 -1
  42. package/types/components/lcb-city-select/components/lcb-city-list/types.d.ts +1 -1
  43. package/types/components/lcb-list/components/FilterList/mockData.d.ts +63 -0
  44. package/types/components/lcb-list/lcb-list.vue.d.ts +7 -3
  45. package/types/components/lcb-list/types.d.ts +0 -1
  46. package/types/components/lcb-notice/api/index.d.ts +19 -0
  47. package/types/components/lcb-notice/lcb-notice.vue.d.ts +25 -19
  48. package/types/components/lcb-notice/types.d.ts +11 -24
  49. package/types/components/lcb-product/lcb-product.vue.d.ts +2 -22
  50. package/types/components/lcb-product-item/components/ItemValue.vue.d.ts +26 -8
  51. package/types/components/lcb-product-item/lcb-product-item.vue.d.ts +63 -23
  52. package/types/components/lcb-product-item/types.d.ts +14 -13
  53. package/types/components/lcb-text/lcb-text.vue.d.ts +42 -0
  54. package/types/components/lcb-text/types.d.ts +4 -0
  55. package/types/constants.d.ts +2 -0
  56. package/types/hooks/useUpload.d.ts +1 -3
  57. package/types/utils/auth.d.ts +2 -0
  58. package/types/utils/utils.d.ts +2 -0
  59. package/utils/auth.ts +19 -0
  60. package/utils/utils.ts +6 -1
  61. package/components/lcb-notice/Item/index.vue +0 -112
  62. package/components/lcb-user-top/api/index.ts +0 -13
  63. package/types/components/lcb-user-top/api/index.d.ts +0 -10
@@ -24,16 +24,3 @@ export interface FilterItemProps {
24
24
  options?: Option[]
25
25
  test?: 1
26
26
  }
27
-
28
- export const defaultLcbListProps: LcbListProps = {
29
- pageFilterType: 'hotelTravelFilter',
30
- border: true,
31
- styleMode: 'default',
32
- listType: 'list',
33
- // @ts-ignore
34
- pageListProps: () => ({
35
- productProps: {
36
- // listType: 'list',
37
- },
38
- }),
39
- }
@@ -305,7 +305,7 @@ const toBack = () => {
305
305
  background: transparent;
306
306
 
307
307
  .navbar-header {
308
- color: rgb(0, 0, 0) !important;
308
+ color: rgb(0, 0, 0);
309
309
  background-repeat: no-repeat;
310
310
  background-size: contain;
311
311
  }
@@ -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
- <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"
2
+ <lcb-block v-bind="$props" custom-class="border-solid border-1" v-if="adverts.length">
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
  }
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue'
3
3
  import { LcbProductProps } from './types'
4
- import { lcbProductItemContentTypes } from '../lcb-product-item/types'
5
4
 
6
5
  const attrs = useAttrs()
7
6
  defineOptions({
@@ -20,17 +19,7 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
20
19
  itemHeight: 560,
21
20
  } as any)
22
21
  defineSlots<{
23
- image(): any
24
- title(): any
25
- subTitle(): any
26
- price(): any
27
- priceUnit(): any
28
- priceSuffix(): any
29
- originPrice(): any
30
- originPriceUnit(): any
31
- tags(): any
32
- location(): any
33
- distance(): any
22
+ item(props: { item: any }): any
34
23
  }>()
35
24
  </script>
36
25
 
@@ -43,13 +32,31 @@ defineSlots<{
43
32
  v-bind="{ ...item, ...attrs }"
44
33
  :imageStyle="{ width: `${imageWidthPercent}%` }"
45
34
  >
46
- <template
47
- v-for="slotName in lcbProductItemContentTypes"
48
- :key="slotName"
49
- #[slotName]="slotContext"
50
- >
51
- <slot :name="slotName" v-bind="slotContext" />
35
+ <!-- <template #itemTopSection>
36
+ <view class="min-w-10 min-h-10 bg-red-500/50"></view>
52
37
  </template>
38
+ <template #itemBottomSection>
39
+ <view class="min-w-10 min-h-10 bg-yellow-500/50"></view>
40
+ </template>
41
+ <template #itemLeftSection>
42
+ <view class="min-w-10 min-h-10 bg-blue-500/50"></view>
43
+ </template>
44
+ <template #itemRightSection>
45
+ <view class="min-w-10 min-h-10 bg-green-500/50"></view>
46
+ </template> -->
47
+
48
+ <!-- <template #imageSection>
49
+ <view class="min-w-5 min-h-5 bg-yellow-400 right-1 top-1 absolute z-10"></view>
50
+ </template>
51
+
52
+ <template #itemSection>
53
+ <view class="min-w-10 min-h-10 bg-blue-500/50 right-0 top-0 absolute z-10"></view>
54
+ </template>
55
+ <template #contentSection>
56
+ <view
57
+ class="min-w-15 min-h-15 bg-gray-500/20 right-10 top-10 absolute z-10 rounded-full"
58
+ ></view>
59
+ </template> -->
53
60
  </lcb-product-item>
54
61
  </slot>
55
62
  </view>
@@ -66,13 +73,18 @@ defineSlots<{
66
73
  className="!h-full"
67
74
  :imageStyle="{ height: `${imageHeightPercent}%` }"
68
75
  >
69
- <template
70
- v-for="slotName in lcbProductItemContentTypes"
71
- :key="slotName"
72
- #[slotName]="slotContext"
73
- >
74
- <slot :name="slotName" v-bind="slotContext" />
76
+ <!-- <template #itemTopSection>
77
+ <view class="min-w-10 min-h-10 bg-red-500/50"></view>
78
+ </template>
79
+ <template #itemBottomSection>
80
+ <view class="min-w-10 min-h-10 bg-yellow-500/50"></view>
75
81
  </template>
82
+ <template #itemLeftSection>
83
+ <view class="min-w-10 min-h-10 bg-blue-500/50"></view>
84
+ </template>
85
+ <template #itemRightSection>
86
+ <view class="min-w-10 min-h-10 bg-green-500/50"></view>
87
+ </template> -->
76
88
  </lcb-product-item>
77
89
  </slot>
78
90
  </view>
@@ -88,15 +100,7 @@ defineSlots<{
88
100
  class="!w-66vw flex-shrink-0"
89
101
  >
90
102
  <slot name="item" :item="item">
91
- <lcb-product-item v-bind="item" imageClass="!w-1/2">
92
- <template
93
- v-for="slotName in lcbProductItemContentTypes"
94
- :key="slotName"
95
- #[slotName]="slotContext"
96
- >
97
- <slot :name="slotName" v-bind="slotContext" />
98
- </template>
99
- </lcb-product-item>
103
+ <lcb-product-item v-bind="item" imageClass="!w-1/2"></lcb-product-item>
100
104
  </slot>
101
105
  </view>
102
106
  </view>
@@ -4,7 +4,7 @@ import { isArray } from '@tplc/wot/components/common/util'
4
4
 
5
5
  // const attrs = useAttrs()
6
6
 
7
- const itemProps = inject('lcb-product-item-props')
7
+ const itemProps: any = inject('lcb-product-item-props')
8
8
 
9
9
  const props = withDefaults(
10
10
  defineProps<{
@@ -14,19 +14,20 @@ const props = withDefaults(
14
14
  {},
15
15
  )
16
16
 
17
- // defineSlots<{
18
- // image(): any
19
- // title(): any
20
- // subTitle(): any
21
- // price(): any
22
- // priceUnit(): any
23
- // priceSuffix(): any
24
- // originPrice(): any
25
- // originPriceUnit(): any
26
- // tags(): any
27
- // location(): any
28
- // distance(): any
29
- // }>()
17
+ defineSlots<{
18
+ image(props: { value: any }): any
19
+ title(props: { value: any }): any
20
+ subTitle(props: { value: any }): any
21
+ price(props: { value: any }): any
22
+ priceUnit(props: { value: any }): any
23
+ priceSuffix(props: { value: any }): any
24
+ originPrice(props: { value: any }): any
25
+ originPriceUnit(props: { value: any }): any
26
+ originPriceSuffix(props: { value: any }): any
27
+ tags(props: { value: any }): any
28
+ location(props: { value: any }): any
29
+ distance(props: { value: any }): any
30
+ }>()
30
31
 
31
32
  const visible = computed(() => {
32
33
  return itemProps?.[`${props?.prop}Visible`] ?? true
@@ -43,17 +44,44 @@ const value = computed(() => {
43
44
  </script>
44
45
 
45
46
  <template>
46
- <template v-if="visible && !!value && (isArray(value) ? value?.length > 0 : true)">
47
+ <template
48
+ v-if="visible && (prop === 'image' || (!!value && (isArray(value) ? value?.length > 0 : true)))"
49
+ >
47
50
  <!-- 图片 -->
48
51
  <slot :value="value" v-if="prop === 'image'" name="image">
49
52
  <view :value="value" :class="className" :style="style">
50
53
  <image :src="value" class="w-full h-full" mode="aspectFill" />
54
+ <slot></slot>
51
55
  </view>
52
56
  </slot>
53
57
 
54
58
  <!-- 标题 -->
55
59
  <slot :value="value" v-if="prop === 'title'" name="title">
56
- <view :class="className" :style="style" :value="value" class="text-ellipsis line-clamp-1">
60
+ <view
61
+ :class="[
62
+ className,
63
+ 'text-ellipsis',
64
+ {
65
+ 'line-clamp-1': itemProps?.titleLineClamp === 1,
66
+ 'line-clamp-2': itemProps?.titleLineClamp === 2,
67
+ 'line-clamp-3': itemProps?.titleLineClamp === 3,
68
+ },
69
+ ]"
70
+ :style="style"
71
+ :value="value"
72
+ >
73
+ <view>{{ value }}</view>
74
+ </view>
75
+ </slot>
76
+
77
+ <!-- 副标题 -->
78
+ <slot :value="value" v-if="prop === 'subTitle'" name="subTitle">
79
+ <view
80
+ :class="className"
81
+ :style="style"
82
+ :value="value"
83
+ class="text-22rpx text-gray-500 text-ellipsis line-clamp-1"
84
+ >
57
85
  <view>{{ value }}</view>
58
86
  </view>
59
87
  </slot>
@@ -67,17 +95,35 @@ const value = computed(() => {
67
95
  class="text-gray-500 text-22rpx flex gap-3rpx items-center"
68
96
  >
69
97
  <wd-icon name="location" size="32rpx"></wd-icon>
70
- <view>{{ value }}</view>
98
+ <view class="text-ellipsis line-clamp-1">{{ value }}</view>
71
99
  </view>
72
100
  </slot>
73
101
 
74
- <!-- 标签 -->
75
- <slot :value="value" v-if="prop === 'tags'" name="tags">
102
+ <!-- 距离 -->
103
+ <slot :value="value" v-if="prop === 'distance'" name="distance">
76
104
  <view
77
105
  :class="className"
78
106
  :style="style"
79
107
  :value="value"
80
- class="flex gap-1 whitespace-nowrap overflow-auto"
108
+ class="text-gray-500 text-22rpx flex gap-3rpx items-center"
109
+ >
110
+ <wd-icon name="location" size="32rpx"></wd-icon>
111
+ <view class="text-ellipsis line-clamp-1">
112
+ 距您{{ value }}{{ itemProps?.distanceUnit ?? 'km' }}
113
+ </view>
114
+ </view>
115
+ </slot>
116
+
117
+ <!-- 标签 -->
118
+ <slot :value="value" v-if="prop === 'tags'" name="tags">
119
+ <view
120
+ :class="[
121
+ 'flex gap-1',
122
+ {
123
+ 'whitespace-nowrap overflow-auto': !itemProps?.tagOverflowWrap,
124
+ 'flex-wrap': itemProps?.tagOverflowWrap,
125
+ },
126
+ ]"
81
127
  >
82
128
  <wd-tag
83
129
  v-for="tag in value"
@@ -85,8 +131,12 @@ const value = computed(() => {
85
131
  class="!text-20rpx"
86
132
  :class="className"
87
133
  :style="style"
88
- plain
89
- type="primary"
134
+ :color="itemProps?.tagContentColor"
135
+ :bg-color="itemProps?.tagBgColor"
136
+ :plain="itemProps?.tagPlain ?? true"
137
+ :mark="itemProps?.tagMark ?? false"
138
+ :round="itemProps?.tagRound ?? false"
139
+ :type="itemProps?.tagType ?? 'primary'"
90
140
  >
91
141
  {{ tag }}
92
142
  </wd-tag>
@@ -123,5 +173,36 @@ const value = computed(() => {
123
173
  <view>{{ value }}</view>
124
174
  </view>
125
175
  </slot>
176
+
177
+ <!-- 原始价格单位 -->
178
+ <slot :value="value" v-if="prop === 'originPriceUnit'" name="originPriceUnit">
179
+ <view
180
+ :class="className"
181
+ :style="style"
182
+ :value="value"
183
+ class="text-gray-500 font-bold text-19rpx"
184
+ >
185
+ <view>{{ value }}</view>
186
+ </view>
187
+ </slot>
188
+
189
+ <!-- 原始价格 -->
190
+ <slot :value="value" v-if="prop === 'originPrice'" name="originPrice">
191
+ <view
192
+ :class="className"
193
+ :style="style"
194
+ :value="value"
195
+ class="text-gray-500 font-bold text-20rpx"
196
+ >
197
+ <view>{{ value }}</view>
198
+ </view>
199
+ </slot>
200
+
201
+ <!-- 原始价格后缀 -->
202
+ <slot :value="value" v-if="prop === 'originPriceSuffix'" name="originPriceSuffix">
203
+ <view :class="className" :style="style" :value="value" class="text-gray-500 text-20rpx">
204
+ <view>{{ value }}</view>
205
+ </view>
206
+ </slot>
126
207
  </template>
127
208
  </template>