@tplc/business 0.1.12 → 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,6 +2,15 @@
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.14](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.21...v0.1.14) (2024-10-29)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.1.13 ([d2ff093](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d2ff0931511bb59dcde85de2cbdefa21f338a1f2))
11
+
12
+ ### [0.1.13](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.21...v0.1.13) (2024-10-29)
13
+
5
14
  ### [0.1.12](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.6...v0.1.12) (2024-10-28)
6
15
 
7
16
 
@@ -17,7 +17,8 @@
17
17
  :src="item.url"
18
18
  :enable-preview="enablePreview"
19
19
  mode="widthFix"
20
- :class="`${styleGroup == 3 ? 'overflow-hidden' : 'overflow-hidden block'}`"
20
+ height="auto"
21
+ :custom-class="`${styleGroup == 3 ? 'overflow-hidden' : 'overflow-hidden block'}`"
21
22
  :style="{
22
23
  borderRadius: transformValueUnit(imageRadius),
23
24
  display: 'block',
@@ -37,13 +37,16 @@ const normalizeDataList = computed(() => {
37
37
  const imgArr = formatJson(item.coverImg, [])
38
38
  const tags = formatJson(item.tags, [])
39
39
  return {
40
- ...item,
41
40
  image: imgArr?.[1] || imgArr?.[0],
42
41
  title: item?.productName,
43
- tags,
42
+ // subTitle: item?.poiName,
43
+ location: item?.address,
44
44
  price: item?.price,
45
- location: item?.cityAreaName,
46
45
  priceSuffix: item?.behindUnit,
46
+ // originPrice: item?.price,
47
+ // originPriceSuffix: item?.behindUnit,
48
+ ...item,
49
+ tags,
47
50
  }
48
51
  })
49
52
  // console.log('list', list)
@@ -77,6 +80,7 @@ watch(
77
80
  )
78
81
  const queryList = async (page: number, limit: number) => {
79
82
  try {
83
+ // const { data } = mockData
80
84
  const { data } = await uni.$lcb.http.post(props.url, {
81
85
  ...props.baseParam,
82
86
  ...props.filter,
@@ -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
  }
@@ -90,7 +90,7 @@
90
90
 
91
91
  <script setup lang="ts">
92
92
  import { computed, inject, Ref, ref, watch, useAttrs } from 'vue'
93
- import { LcbListProps, defaultLcbListProps } from './types'
93
+ import { LcbListProps } from './types'
94
94
  import { FilterComponent, getFilterDetail, LcbFilterResult } from './api'
95
95
  import FilterSelect from './components/FilterSelect/index.vue'
96
96
  import TreeSelect from './components/TreeSelect/index.vue'
@@ -113,7 +113,18 @@ defineOptions({
113
113
  })
114
114
  const form = inject<Ref<Record<string, any>>>(FORM_KEY)
115
115
  const dropMenu = ref()
116
- const props = withDefaults(defineProps<LcbListProps>(), defaultLcbListProps as any)
116
+ const props = withDefaults(defineProps<LcbListProps>(), {
117
+ pageFilterType: 'hotelTravelFilter',
118
+ border: true,
119
+ styleMode: 'default',
120
+ listType: 'list',
121
+ // @ts-ignore
122
+ pageListProps: () => ({
123
+ productProps: {
124
+ // listType: 'list',
125
+ },
126
+ }),
127
+ } as LcbListProps as any)
117
128
  const info = ref<LcbFilterResult>()
118
129
  const filter = ref<Record<string, any>>({})
119
130
  const titleObj = ref<Record<string, any>>({})
@@ -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
- }
@@ -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
  }
@@ -31,7 +31,33 @@ defineSlots<{
31
31
  <lcb-product-item
32
32
  v-bind="{ ...item, ...attrs }"
33
33
  :imageStyle="{ width: `${imageWidthPercent}%` }"
34
- ></lcb-product-item>
34
+ >
35
+ <!-- <template #itemTopSection>
36
+ <view class="min-w-10 min-h-10 bg-red-500/50"></view>
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> -->
60
+ </lcb-product-item>
35
61
  </slot>
36
62
  </view>
37
63
  </view>
@@ -46,7 +72,20 @@ defineSlots<{
46
72
  layoutType="vertical"
47
73
  className="!h-full"
48
74
  :imageStyle="{ height: `${imageHeightPercent}%` }"
49
- ></lcb-product-item>
75
+ >
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>
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> -->
88
+ </lcb-product-item>
50
89
  </slot>
51
90
  </view>
52
91
  </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<{
@@ -23,6 +23,7 @@ defineSlots<{
23
23
  priceSuffix(props: { value: any }): any
24
24
  originPrice(props: { value: any }): any
25
25
  originPriceUnit(props: { value: any }): any
26
+ originPriceSuffix(props: { value: any }): any
26
27
  tags(props: { value: any }): any
27
28
  location(props: { value: any }): any
28
29
  distance(props: { value: any }): any
@@ -50,12 +51,37 @@ const value = computed(() => {
50
51
  <slot :value="value" v-if="prop === 'image'" name="image">
51
52
  <view :value="value" :class="className" :style="style">
52
53
  <image :src="value" class="w-full h-full" mode="aspectFill" />
54
+ <slot></slot>
53
55
  </view>
54
56
  </slot>
55
57
 
56
58
  <!-- 标题 -->
57
59
  <slot :value="value" v-if="prop === 'title'" name="title">
58
- <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
+ >
59
85
  <view>{{ value }}</view>
60
86
  </view>
61
87
  </slot>
@@ -69,21 +95,48 @@ const value = computed(() => {
69
95
  class="text-gray-500 text-22rpx flex gap-3rpx items-center"
70
96
  >
71
97
  <wd-icon name="location" size="32rpx"></wd-icon>
72
- <view>{{ value }}</view>
98
+ <view class="text-ellipsis line-clamp-1">{{ value }}</view>
99
+ </view>
100
+ </slot>
101
+
102
+ <!-- 距离 -->
103
+ <slot :value="value" v-if="prop === 'distance'" name="distance">
104
+ <view
105
+ :class="className"
106
+ :style="style"
107
+ :value="value"
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>
73
114
  </view>
74
115
  </slot>
75
116
 
76
117
  <!-- 标签 -->
77
118
  <slot :value="value" v-if="prop === 'tags'" name="tags">
78
- <view class="flex gap-1 whitespace-nowrap overflow-auto">
119
+ <view
120
+ :class="[
121
+ 'flex gap-1',
122
+ {
123
+ 'whitespace-nowrap overflow-auto': !itemProps?.tagOverflowWrap,
124
+ 'flex-wrap': itemProps?.tagOverflowWrap,
125
+ },
126
+ ]"
127
+ >
79
128
  <wd-tag
80
129
  v-for="tag in value"
81
130
  :key="tag"
82
131
  class="!text-20rpx"
83
132
  :class="className"
84
133
  :style="style"
85
- plain
86
- 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'"
87
140
  >
88
141
  {{ tag }}
89
142
  </wd-tag>
@@ -120,5 +173,36 @@ const value = computed(() => {
120
173
  <view>{{ value }}</view>
121
174
  </view>
122
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>
123
207
  </template>
124
208
  </template>