@tplc/business 0.0.37 → 0.0.38

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,21 @@
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.0.38](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.17...v0.0.38) (2024-10-22)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * husky changed ([96139b0](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/96139b0e4f3fb469a62fd433f9446cfdf6a65016))
11
+
12
+
13
+ ### ✨ Features | 新功能
14
+
15
+ * city 支持mode ([9686a0e](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9686a0e1f19c4b05d936e1b674933b4744c1b3ba))
16
+ * gap支持safe-top ([d21834c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/d21834cb8b67da98667fc6216624dfa1962790e5))
17
+ * 优化 lcb-list 过滤器吸顶逻辑;增加 unocss 插件触发文件 ([ff8d6ef](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ff8d6ef0c7703823f1a7833482d3b17bb272ae82))
18
+ * 调整 lcb-product-item 样式与逻辑 ([22810b7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/22810b709783b44920a778d9c038e028dcce06ad))
19
+
5
20
  ### [0.0.37](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.36...v0.0.37) (2024-10-21)
6
21
 
7
22
  ### [0.0.36](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.35...v0.0.36) (2024-10-21)
@@ -43,3 +43,19 @@ export const getProvinceCityArea = async () => {
43
43
  }
44
44
  })
45
45
  }
46
+
47
+ export const getProvinceCity = async () => {
48
+ const { data } = await uni.$lcb.http.post<ProvinceCityArea[]>('/provinces/provinceCityArea')
49
+ return data.map(({ provinceId, provinceName, cityList }) => {
50
+ return {
51
+ label: provinceName,
52
+ value: provinceId,
53
+ children: cityList.map(({ cityId, cityName }) => {
54
+ return {
55
+ label: cityName,
56
+ value: cityId,
57
+ }
58
+ }),
59
+ }
60
+ })
61
+ }
@@ -13,7 +13,7 @@
13
13
  <script setup lang="ts">
14
14
  import { onMounted, ref, watch } from 'vue'
15
15
  import { LcbAreaPickerProps } from './types'
16
- import { AreaOptions, getProvinceCityArea } from './api'
16
+ import { AreaOptions, getProvinceCity, getProvinceCityArea } from './api'
17
17
  import { ColPickerColumnChangeOption } from '@tplc/wot/types/components/wd-col-picker/types'
18
18
  defineOptions({
19
19
  name: 'LcbAreaPicker',
@@ -23,7 +23,7 @@ defineOptions({
23
23
  styleIsolation: 'shared',
24
24
  },
25
25
  })
26
- withDefaults(defineProps<LcbAreaPickerProps>(), {})
26
+ const props = withDefaults(defineProps<LcbAreaPickerProps>(), { mode: 'area' })
27
27
  const emits = defineEmits<{
28
28
  (event: 'confirm', payload: AreaOptions[]): void
29
29
  }>()
@@ -40,7 +40,7 @@ const columnChange = ({ selectedItem, resolve, finish }: ColPickerColumnChangeOp
40
40
  }
41
41
  }
42
42
  onMounted(async () => {
43
- const data = await getProvinceCityArea()
43
+ const data = props.mode === 'area' ? await getProvinceCityArea() : await getProvinceCity()
44
44
  area.value = [data]
45
45
  })
46
46
  const stopWatch = watch(
@@ -57,9 +57,15 @@ const stopWatch = watch(
57
57
  return acc
58
58
  }, [] as string[])
59
59
  const cityItem = areas[0].find((item) => item.value === value[0])
60
- const areaItem = cityItem?.children?.find((item) => item.value === value[1])
61
- if (cityItem?.children && areaItem?.children)
62
- area.value = [areas[0], cityItem.children, areaItem.children]
60
+ if (cityItem?.children) {
61
+ if (props.mode === 'area') {
62
+ const areaItem = cityItem?.children?.find((item) => item.value === value[1])
63
+ if (areaItem?.children) area.value = [areas[0], cityItem.children, areaItem.children]
64
+ } else {
65
+ area.value = [areas[0], cityItem.children]
66
+ }
67
+ }
68
+
63
69
  stopWatch()
64
70
  }
65
71
  },
@@ -1,3 +1,3 @@
1
1
  export interface LcbAreaPickerProps {
2
- // Define the component's prop types here
2
+ mode: 'city' | 'area'
3
3
  }
@@ -7,14 +7,15 @@
7
7
  @query="queryList"
8
8
  use-page-scroll
9
9
  >
10
- <lcb-product v-bind="{ ...productProps }" :items="dataList" />
10
+ <lcb-product v-bind="{ ...productProps }" :items="normalizeDataList" />
11
11
  </z-paging>
12
12
  </template>
13
13
 
14
14
  <script setup lang="ts">
15
- import { ref, watch } from 'vue'
15
+ import { computed, ref, watch } from 'vue'
16
16
  import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
17
17
  import { LcbFilterListProps } from './type'
18
+ import { formatJson } from '../../../../utils/utils'
18
19
 
19
20
  defineOptions({
20
21
  name: 'FilterList',
@@ -28,6 +29,24 @@ const props = defineProps<LcbFilterListProps>()
28
29
  const dataList = ref<unknown[]>([])
29
30
  const paging = ref()
30
31
  useZPaging(paging)
32
+
33
+ const normalizeDataList = computed(() => {
34
+ const list = dataList.value?.map?.((item: any) => {
35
+ const imgArr = formatJson(item.coverImg, [])
36
+ const tags = formatJson(item.tags, [])
37
+ return {
38
+ ...item,
39
+ image: imgArr?.[1] ?? imgArr?.[0],
40
+ title: item?.productName,
41
+ tags,
42
+ price: item?.price,
43
+ }
44
+ })
45
+ console.log('list', list)
46
+
47
+ return list
48
+ })
49
+
31
50
  watch(
32
51
  () => props.url,
33
52
  async (val) => {
@@ -67,6 +86,13 @@ const queryList = async (page: number, limit: number) => {
67
86
  paging.value.complete(false)
68
87
  }
69
88
  }
89
+
90
+ watch(
91
+ () => dataList.value,
92
+ () => {
93
+ console.log('dataList', dataList.value)
94
+ },
95
+ )
70
96
  </script>
71
97
  <style lang="scss" scoped>
72
98
  .action-view {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <view v-if="info">
3
- <wd-sticky @sticky="sticky = $event">
3
+ <wd-sticky @sticky="sticky = $event" :offset-top="0.0001">
4
4
  <view
5
5
  :class="{
6
6
  'lcb-filter__border-top': showPlain ? false : border,
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <lcb-block v-bind="$props">
3
3
  <template v-if="styleGroup !== 2">
4
- <view v-for="(item, index) in items" :key="index">
5
- <!-- <view>{{ JSON.stringify(item) }}</view> -->
6
- <lcb-product-item :styleProps="styleProps" :idx="index" v-bind="item" />
4
+ <view class="flex flex-col gap-2 p-2">
5
+ <view v-for="(item, index) in items" :key="`${item?.productId}:${index}`">
6
+ <!-- <view>{{ JSON.stringify(item) }}</view> -->
7
+ <lcb-product-item v-bind="item" />
8
+ </view>
7
9
  </view>
8
10
  </template>
9
11
  <scroll-view v-if="styleGroup == 2" scroll-x class="w-full whitespace-nowrap">
@@ -1,50 +1,9 @@
1
- <template>
2
- <view
3
- :style="{
4
- paddingTop: `${transformValueUnit(15)}`,
5
- paddingBottom: `${transformValueUnit(15)}`,
6
- paddingLeft: styleProps?.styleGroup != 1 && idx > 0 ? transformValueUnit(15) : 0,
7
- width: styleProps?.styleGroup != 1 ? transformValueUnit(picWidth) : 'auto',
8
- // paddingHorizontal: styleProps?.styleGroup == 1 ? null : 15,
9
- }"
10
- >
11
- <view :class="`${styleProps?.styleGroup == 1 ? 'flex' : ''}`">
12
- <wd-img
13
- :src="realImg"
14
- :width="transformValueUnit(picWidth)"
15
- :height="transformValueUnit(picHeight)"
16
- />
17
- <view
18
- v-if="styleProps?.productStyle != 'image'"
19
- :class="`${styleProps?.styleGroup == 1 ? 'flex-1 pl-20rpx' : 'pt-20rpx'} pb-20rpx${styleProps?.productTitle == 1 ? ' ellipsis ' : ''}`"
20
- >
21
- <view
22
- :class="`${styleProps?.productTitle == 1 ? 'ellipsis' : styleProps?.productTitle == 2 ? 'mulEllipsis' : 'wordBreak'} text-32rpx color-#333`"
23
- >
24
- {{ productName }}
25
- </view>
26
- <lcb-tags v-if="!!styleProps?.showTags" :mode="2" :tagRadius="3" :items="tags" />
27
- <view>{{ subTitle }}</view>
28
- <view class="flex items-center mt-15rpx">
29
- <view v-if="!!styleProps?.showPrice" class="text-30rpx color-red">¥</view>
30
- <view v-if="!!styleProps?.showPrice" class="text-32rpx color-red">{{ price }}</view>
31
- <view
32
- v-if="!!styleProps?.showScribePrice"
33
- class="line-through text-22rpx color-#999 ml-10rpx pt-5rpx"
34
- >
35
- ¥{{ scribePrice }}
36
- </view>
37
- </view>
38
- </view>
39
- </view>
40
- </view>
41
- </template>
42
-
43
1
  <script setup lang="ts">
44
- import { computed } from 'vue'
2
+ import { computed, useAttrs } from 'vue'
45
3
  import { transformValueUnit } from '../../utils/transform'
46
4
  import { LcbProductItemProps } from './types'
47
5
  import { formatJson } from '../../utils/utils'
6
+
48
7
  defineOptions({
49
8
  name: 'LcbProductItem',
50
9
  options: {
@@ -55,43 +14,48 @@ defineOptions({
55
14
  })
56
15
 
57
16
  const props = withDefaults(defineProps<LcbProductItemProps>(), {
58
- idx: 0,
59
- picWidth: 300,
60
- picHeight: 200,
17
+ layoutType: 1,
18
+ priceUnit: '¥',
19
+ originPriceUnit: '¥',
20
+ lowestPriceUnit: '¥',
61
21
  })
62
- const realImg = computed(() => {
63
- console.log('props', props.styleProps)
64
- const imgArr = formatJson(props.coverImg, [])
65
- return imgArr[1] || imgArr[0]
66
- })
67
- </script>
22
+ const attrs = useAttrs()
68
23
 
69
- <style lang="scss" scoped>
70
- .ellipsis {
71
- overflow: hidden;
72
- white-space: nowrap;
73
- text-overflow: ellipsis;
74
- }
24
+ // console.log('attrs', attrs)
25
+ </script>
75
26
 
76
- .noEllip {
77
- white-space: normal;
78
- text-overflow: clip;
79
- }
27
+ <template>
28
+ <view v-if="layoutType === 1" class="flex gap-2 px-2 py-3 bg-white">
29
+ <view class="w-1/3 h-220rpx bg-coolgray/90 rounded-sm overflow-hidden">
30
+ <image :src="image" class="w-full h-full" mode="aspectFill" />
31
+ </view>
32
+ <view class="flex flex-col flex-1 justify-between text-26rpx overflow-hidden">
33
+ <view class="flex flex-col gap-2 overflow-hidden">
34
+ <view>{{ title ?? attrs?.productName }}</view>
35
+ <view v-if="tags?.length > 0" class="flex gap-1 whitespace-nowrap overflow-auto">
36
+ <wd-tag v-for="tag in tags" :key="tag" class="!text-20rpx" plain type="primary">
37
+ {{ tag }}
38
+ </wd-tag>
39
+ </view>
40
+ </view>
41
+ <view class="flex gap-2">
42
+ <view class="flex gap-[3rpx] items-end">
43
+ <view class="text-red font-bold">{{ priceUnit }}</view>
44
+ <view class="text-red font-bold">{{ price }}</view>
45
+ <view v-if="!!attrs?.behindUnit" class="text-22rpx">{{ attrs?.behindUnit }}</view>
46
+ </view>
47
+ </view>
48
+ </view>
49
+ </view>
80
50
 
81
- .wordBreak {
82
- word-wrap: break-word;
83
- word-break: break-all;
84
- white-space: normal;
85
- }
51
+ <!-- <view v-if="layoutType === 2" class="flex flex-col gap-2 p-2 bg-white">
52
+ <view class="overflow-hidden">
53
+ <image :src="image" class="w-full" mode="widthFix" />
54
+ </view>
55
+ <view class="flex flex-col flex-1 text-26rpx">
56
+ <view>{{ title ?? attrs?.productName }}</view>
57
+ </view>
58
+ </view> -->
59
+ </template>
86
60
 
87
- .mulEllipsis {
88
- /*! autoprefixer: off */
89
- white-space: normal;
90
- display: -webkit-box;
91
- -webkit-box-orient: vertical;
92
- text-overflow: ellipsis;
93
- overflow: hidden;
94
- word-break: break-all;
95
- -webkit-line-clamp: 2;
96
- }
97
- </style>
61
+ <style lang="scss" scoped></style>
@@ -0,0 +1,22 @@
1
+ # 产品展示组件
2
+
3
+ 属性说明
4
+
5
+
6
+ layoutType
7
+ image
8
+ title
9
+ subTitle
10
+ price
11
+ priceUnit
12
+ originPrice
13
+ originPriceUnit
14
+ lowestPrice
15
+ lowestPriceUnit
16
+ tags
17
+ location
18
+ distance
19
+
20
+ 尝试使用 grid 进行布局
21
+
22
+
@@ -1,14 +1,16 @@
1
1
  export interface LcbProductItemProps {
2
2
  // Define the component's prop types here
3
- coverImg?: string
4
- picWidth?: number
5
- picHeight?: number
6
- productName?: string
7
- tags?: string | Record<string, any>
8
- subTitle?: string
9
- price?: string | number
10
- priceColor?: string
11
- scribePrice?: string | number
12
- styleProps?: Record<string, any>
13
- idx?: number
3
+ layoutType?: 1 | 2 // 1 横向、2 纵向
4
+ image?: any
5
+ title?: any
6
+ subTitle?: any
7
+ price?: any
8
+ priceUnit?: any
9
+ originPrice?: any
10
+ originPriceUnit?: any
11
+ lowestPrice?: any
12
+ lowestPriceUnit?: any
13
+ tags?: any
14
+ location?: any
15
+ distance?: any
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
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.16"
14
+ "@tplc/wot": "0.1.17"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=18",
@@ -35,4 +35,14 @@ export declare const getProvinceCityArea: () => Promise<
35
35
  }[]
36
36
  }[]
37
37
  >
38
+ export declare const getProvinceCity: () => Promise<
39
+ {
40
+ label: string
41
+ value: string
42
+ children: {
43
+ label: string
44
+ value: string
45
+ }[]
46
+ }[]
47
+ >
38
48
  export {}
@@ -8,7 +8,12 @@ declare function __VLS_template(): {
8
8
  default?(_: { text: string[] | undefined }): any
9
9
  }
10
10
  declare const __VLS_component: import('vue').DefineComponent<
11
- __VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_PublicProps>, {}>,
11
+ __VLS_WithDefaults<
12
+ __VLS_TypePropsToOption<__VLS_PublicProps>,
13
+ {
14
+ mode: string
15
+ }
16
+ >,
12
17
  {},
13
18
  unknown,
14
19
  {},
@@ -23,13 +28,20 @@ declare const __VLS_component: import('vue').DefineComponent<
23
28
  import('vue').PublicProps,
24
29
  Readonly<
25
30
  import('vue').ExtractPropTypes<
26
- __VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_PublicProps>, {}>
31
+ __VLS_WithDefaults<
32
+ __VLS_TypePropsToOption<__VLS_PublicProps>,
33
+ {
34
+ mode: string
35
+ }
36
+ >
27
37
  >
28
38
  > & {
29
39
  onConfirm?: ((payload: AreaOptions[]) => any) | undefined
30
40
  'onUpdate:modelValue'?: ((modelValue: string[]) => any) | undefined
31
41
  },
32
- {},
42
+ {
43
+ mode: 'city' | 'area'
44
+ },
33
45
  {}
34
46
  >
35
47
  declare const _default: __VLS_WithTemplateSlots<
@@ -1 +1,3 @@
1
- export interface LcbAreaPickerProps {}
1
+ export interface LcbAreaPickerProps {
2
+ mode: 'city' | 'area'
3
+ }
@@ -3,9 +3,10 @@ declare const _default: import('vue').DefineComponent<
3
3
  __VLS_WithDefaults<
4
4
  __VLS_TypePropsToOption<LcbProductItemProps>,
5
5
  {
6
- idx: number
7
- picWidth: number
8
- picHeight: number
6
+ layoutType: number
7
+ priceUnit: string
8
+ originPriceUnit: string
9
+ lowestPriceUnit: string
9
10
  }
10
11
  >,
11
12
  {},
@@ -22,17 +23,19 @@ declare const _default: import('vue').DefineComponent<
22
23
  __VLS_WithDefaults<
23
24
  __VLS_TypePropsToOption<LcbProductItemProps>,
24
25
  {
25
- idx: number
26
- picWidth: number
27
- picHeight: number
26
+ layoutType: number
27
+ priceUnit: string
28
+ originPriceUnit: string
29
+ lowestPriceUnit: string
28
30
  }
29
31
  >
30
32
  >
31
33
  >,
32
34
  {
33
- idx: number
34
- picWidth: number
35
- picHeight: number
35
+ layoutType: 1 | 2
36
+ priceUnit: any
37
+ originPriceUnit: any
38
+ lowestPriceUnit: any
36
39
  },
37
40
  {}
38
41
  >
@@ -1,13 +1,15 @@
1
1
  export interface LcbProductItemProps {
2
- coverImg?: string
3
- picWidth?: number
4
- picHeight?: number
5
- productName?: string
6
- tags?: string | Record<string, any>
7
- subTitle?: string
8
- price?: string | number
9
- priceColor?: string
10
- scribePrice?: string | number
11
- styleProps?: Record<string, any>
12
- idx?: number
2
+ layoutType?: 1 | 2
3
+ image?: any
4
+ title?: any
5
+ subTitle?: any
6
+ price?: any
7
+ priceUnit?: any
8
+ originPrice?: any
9
+ originPriceUnit?: any
10
+ lowestPrice?: any
11
+ lowestPriceUnit?: any
12
+ tags?: any
13
+ location?: any
14
+ distance?: any
13
15
  }