@tplc/business 0.0.18 → 0.0.20

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 (48) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/action.d.ts +8 -0
  3. package/components/lcb-action-view/lcb-action-view.vue +145 -0
  4. package/components/lcb-action-view/types.ts +13 -0
  5. package/components/lcb-banner/lcb-banner.vue +1 -6
  6. package/components/lcb-banner/types.ts +2 -4
  7. package/components/lcb-banner-block/lcb-banner-block.vue +6 -16
  8. package/components/lcb-block/lcb-block.vue +10 -23
  9. package/components/lcb-block/types.ts +23 -9
  10. package/components/lcb-grid/lcb-grid.vue +2 -8
  11. package/components/lcb-home-search/lcb-home-search.vue +44 -24
  12. package/components/lcb-home-search/types.ts +2 -2
  13. package/components/lcb-image/Image/index.vue +96 -0
  14. package/components/lcb-image/lcb-image.vue +88 -0
  15. package/components/lcb-image/types.ts +15 -0
  16. package/components/lcb-img-nav/lcb-img-nav.vue +37 -39
  17. package/components/lcb-img-nav/types.ts +2 -9
  18. package/components/lcb-title/lcb-title.vue +2 -3
  19. package/components/lcb-user-order/lcb-user-order.vue +59 -54
  20. package/components/lcb-user-order/types.ts +2 -2
  21. package/components/lcb-user-top/lcb-user-top.vue +96 -48
  22. package/components/lcb-user-top/types.ts +1 -0
  23. package/components/lcb-video/lcb-video.vue +33 -0
  24. package/components/lcb-video/types.ts +11 -0
  25. package/global.d.ts +3 -0
  26. package/package.json +1 -1
  27. package/types/components/lcb-action-view/lcb-action-view.vue.d.ts +41 -0
  28. package/types/components/lcb-action-view/types.d.ts +13 -0
  29. package/types/components/lcb-banner/lcb-banner.vue.d.ts +1 -2
  30. package/types/components/lcb-banner/types.d.ts +2 -3
  31. package/types/components/lcb-banner-block/lcb-banner-block.vue.d.ts +7 -3
  32. package/types/components/lcb-block/lcb-block.vue.d.ts +18 -25
  33. package/types/components/lcb-block/types.d.ts +21 -9
  34. package/types/components/lcb-grid/lcb-grid.vue.d.ts +4 -1
  35. package/types/components/lcb-home-search/lcb-home-search.vue.d.ts +9 -0
  36. package/types/components/lcb-home-search/types.d.ts +2 -2
  37. package/types/components/lcb-image/Image/index.vue.d.ts +56 -0
  38. package/types/components/lcb-image/lcb-image.vue.d.ts +71 -0
  39. package/types/components/lcb-image/types.d.ts +13 -0
  40. package/types/components/lcb-img-nav/lcb-img-nav.vue.d.ts +6 -12
  41. package/types/components/lcb-img-nav/types.d.ts +2 -9
  42. package/types/components/lcb-nav/lcb-nav.vue.d.ts +1 -1
  43. package/types/components/lcb-title/lcb-title.vue.d.ts +6 -0
  44. package/types/components/lcb-user-order/lcb-user-order.vue.d.ts +1 -1
  45. package/types/components/lcb-user-top/lcb-user-top.vue.d.ts +3 -0
  46. package/types/components/lcb-user-top/types.d.ts +1 -0
  47. package/types/components/lcb-video/lcb-video.vue.d.ts +56 -0
  48. package/types/components/lcb-video/types.d.ts +10 -0
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <view
3
+ v-for="(item, index) in items"
4
+ :key="index"
5
+ :class="styleGroup == 2 ? 'flex-1' : ''"
6
+ :style="{
7
+ marginLeft: transformValueUnit(styleGroup != 1 && index > 0 ? imageMargin : 0),
8
+ marginTop: transformValueUnit(styleGroup == 1 && index > 0 ? imageMargin : 0),
9
+ // marginLeft: transformValueUnit(styleGroup == 2 && index > 0 ? imageMargin : 0),
10
+ width: styleGroup == 3 ? transformValueUnit(imageSize) : 'auto',
11
+ }"
12
+ >
13
+ <view class="relative overflow-hidden">
14
+ <wd-img
15
+ v-if="!!item.url"
16
+ :width="`${styleGroup == 3 ? transformValueUnit(imageSize) : '100%'}`"
17
+ @click="item.mode == 1 && onClickItem(item)"
18
+ :src="item.url"
19
+ :enable-preview="enablePreview"
20
+ mode="widthFix"
21
+ :class="`${styleGroup == 3 ? 'overflow-hidden' : 'overflow-hidden block'}`"
22
+ :style="{
23
+ borderRadius: transformValueUnit(imageRadius),
24
+ display: 'block',
25
+ }"
26
+ />
27
+
28
+ <view
29
+ v-if="!item.url"
30
+ class="flex justify-center items-center bg-light color-gray overflow-hidden"
31
+ :style="{
32
+ height: transformValueUnit(styleGroup == 3 ? 300 : 400),
33
+ borderRadius: transformValueUnit(imageRadius),
34
+ }"
35
+ >
36
+ <wd-icon name="image" size="50px"></wd-icon>
37
+ </view>
38
+
39
+ <view
40
+ v-for="(each, edx) in item.hotSpot"
41
+ :key="edx"
42
+ class="link absolute"
43
+ :style="{
44
+ width: transformValueUnit(getRealSize(each.width)),
45
+ height: transformValueUnit(getRealSize(each.height)),
46
+ left: transformValueUnit(getRealSize(each.x)),
47
+ top: transformValueUnit(getRealSize(each.y)),
48
+ }"
49
+ >
50
+ <lcb-action-view v-bind="each.urlObj" />
51
+ </view>
52
+ </view>
53
+ </view>
54
+ </template>
55
+
56
+ <script setup lang="ts">
57
+ import { LcbImageProps } from '../types'
58
+ import { transformValueUnit } from '../../../utils/transform'
59
+
60
+ // defineProps<LcbImageProps>() @click="onClickItem(each.urlObj)"
61
+
62
+ function onClickItem(item: any) {
63
+ if (item?.link) {
64
+ uni.navigateTo({
65
+ url: item.link,
66
+ })
67
+ }
68
+ }
69
+
70
+ const props = withDefaults(defineProps<LcbImageProps>(), {
71
+ imageMargin: 0,
72
+ })
73
+
74
+ function getRealSize(size: number = 0) {
75
+ const mode = props.styleGroup
76
+ const lens = props.items?.length || 1
77
+ let realWidth = (mode === 1 ? 750 : mode === 2 ? 750 / lens : props.imageSize) || 0
78
+ if (mode !== 3 && props.marginHorizontal) realWidth -= props.marginHorizontal * 2
79
+ const imgSpan = props.imageMargin
80
+ if (mode === 2 && imgSpan) realWidth -= (lens - 1) / 2
81
+ return (realWidth / 375) * size
82
+ }
83
+ </script>
84
+ <style lang="scss" scoped>
85
+ .link {
86
+ .lcb-action-btn {
87
+ position: absolute;
88
+ width: 100%;
89
+ height: 100%;
90
+ top: 0;
91
+ bottom: 0;
92
+ left: 0;
93
+ right: 0;
94
+ }
95
+ }
96
+ </style>
@@ -0,0 +1,88 @@
1
+ <template>
2
+
3
+ <view v-if="!items?.length" class="flex justify-center items-center bg-light color-gray overflow-hidden" :style="{
4
+ height: transformValueUnit(400),
5
+ borderRadius: transformValueUnit(imageRadius),
6
+ }"><wd-icon name="image" size="50px"></wd-icon></view>
7
+
8
+ <view v-if="styleGroup != 3" :class="styleGroup == 2 ? 'flex' : ''" :style="{
9
+ marginLeft: transformValueUnit(marginHorizontal),
10
+ marginRight: transformValueUnit(marginHorizontal),
11
+ marginTop: transformValueUnit(marginTop),
12
+ marginBottom: transformValueUnit(marginBottom),
13
+ }">
14
+ <!-- <view v-for="(item, index) in items" :key="index" :class="styleGroup == 2 ? 'flex-1 relative' : 'relative'" :style="{
15
+ marginTop: transformValueUnit(styleGroup == 1 && index > 0 ? imageMargin : 0),
16
+ marginLeft: transformValueUnit(styleGroup == 2 && index > 0 ? imageMargin : 0),
17
+ }">
18
+ <wd-img v-if="!!item.url" v-bind="{
19
+ src: item.url,
20
+ class: 'overflow-hidden block',
21
+ }" @click="onClickItem(item)" width="100%" :enable-preview="enablePreview" mode="widthFix" :style="{
22
+ borderRadius: transformValueUnit(imageRadius),
23
+ display: 'block',
24
+ }" />
25
+ <view v-if="!item.url" class="flex justify-center items-center bg-light color-gray overflow-hidden" :style="{
26
+ height: transformValueUnit(400),
27
+ borderRadius: transformValueUnit(imageRadius),
28
+ }"><wd-icon name="image" size="50px"></wd-icon></view>
29
+ </view> -->
30
+ <Image v-bind="imageProps" />
31
+ </view>
32
+
33
+ <scroll-view v-if="styleGroup == 3" scroll-x class="w-full whitespace-nowrap" :style="{
34
+ marginLeft: transformValueUnit(marginHorizontal),
35
+ marginRight: transformValueUnit(marginHorizontal),
36
+ marginTop: transformValueUnit(marginTop),
37
+ marginBottom: transformValueUnit(marginBottom),
38
+ }">
39
+ <view class="flex shrink-0">
40
+ <Image v-bind="imageProps" />
41
+ </view>
42
+ </scroll-view>
43
+
44
+ <!-- <view class="pl-20px pr-20px break-all">{{ JSON.stringify(iconItems) }}</view> -->
45
+
46
+ </template>
47
+
48
+ <script setup lang="ts">
49
+ import { computed } from 'vue';
50
+ import { transformValueUnit } from '../../utils/transform'
51
+ import Image from './Image/index.vue'
52
+ import { LcbImageProps } from './types'
53
+ defineOptions({
54
+ name: 'LcbImage',
55
+ options: {
56
+ addGlobalClass: true,
57
+ virtualHost: true,
58
+ styleIsolation: 'shared',
59
+ },
60
+ })
61
+ const props = withDefaults(defineProps<LcbImageProps>(), {
62
+ styleGroup: 1,
63
+ imageMargin: 0,
64
+ imageSize: 300,
65
+ marginTop: 0,
66
+ marginBottom: 0,
67
+ marginHorizontal: 0,
68
+ })
69
+
70
+ const imageProps = computed(() => {
71
+ return {
72
+ items: props.items,
73
+ imageSize: props.imageSize,
74
+ imageMargin: props.imageMargin,
75
+ imageRadius: props.imageRadius,
76
+ enablePreview: props.enablePreview,
77
+ styleGroup: props.styleGroup,
78
+ }
79
+ })
80
+
81
+ const iconItems = computed(() => {
82
+ console.log('props.items', props.items)
83
+ return props.items;
84
+ })
85
+
86
+ </script>
87
+
88
+ <style lang="scss" scoped></style>
@@ -0,0 +1,15 @@
1
+ import { ActionView } from 'action'
2
+ export interface LcbImageProps {
3
+ // Define the component's prop types here
4
+ items?: Partial<ActionView>[]
5
+ styleGroup?: number //1 纵向 2 横向 3 横向滚动
6
+
7
+ imageRadius?: number
8
+ itemPadding?: number
9
+ enablePreview?: boolean
10
+ marginHorizontal?: number
11
+ imageMargin?: number
12
+ imageSize?: number
13
+ marginTop?: number
14
+ marginBottom?: number
15
+ }
@@ -1,45 +1,45 @@
1
1
  <template>
2
- <view
3
- class="box-border"
4
- :style="{
5
- backgroundColor: bgColor,
6
- color: textColor,
7
- gridTemplateColumns: `repeat(${pictureDistribution}, minmax(0, 1fr))`,
8
- padding: `${topMargin}rpx ${leftRightMargin}rpx ${bottomMargin}rpx`,
9
- backgroundImage: bgImg ? `url(${bgImg})` : '',
10
- backgroundSize: '100% 100%',
11
- }"
12
- :class="[styleGroup === 2 ? 'mutil' : 'single']"
13
- >
14
- <view v-for="item in items" :key="item.title" class="flex flex-col justify-center items-center">
2
+ <lcb-block v-bind="$props">
3
+ <view
4
+ :style="{
5
+ gridTemplateColumns: `repeat(${pictureDistribution}, minmax(0, 1fr))`,
6
+ }"
7
+ :class="[styleGroup === 2 ? 'mutil' : 'single']"
8
+ >
15
9
  <view
16
- class="overflow-hidden"
17
- :style="{
18
- marginBottom: iconTextMargin + 'rpx',
19
- }"
10
+ v-for="item in items"
11
+ :key="item.title"
12
+ class="flex flex-col justify-center items-center"
20
13
  >
21
- <div v-if="iconType === 0" class="flex justify-center items-center">
22
- <wd-icon
23
- class-prefix="iconfont"
24
- :name="item.icon!"
25
- :size="iconSize + 'rpx'"
26
- :color="iconColor"
27
- />
28
- </div>
29
- <img
30
- v-else
31
- class="block"
14
+ <view
15
+ class="overflow-hidden"
32
16
  :style="{
33
- borderRadius: iconRadius + 'rpx',
34
- height: iconSize + 'rpx',
35
- width: iconSize + 'rpx',
17
+ marginBottom: iconTextMargin + 'rpx',
36
18
  }"
37
- :src="item.url"
38
- />
19
+ >
20
+ <div v-if="iconType === 0" class="flex justify-center items-center">
21
+ <wd-icon
22
+ class-prefix="iconfont"
23
+ :name="item.icon!"
24
+ :size="iconSize + 'rpx'"
25
+ :color="iconColor"
26
+ />
27
+ </div>
28
+ <img
29
+ v-else
30
+ class="block"
31
+ :style="{
32
+ borderRadius: iconRadius + 'rpx',
33
+ height: iconSize + 'rpx',
34
+ width: iconSize + 'rpx',
35
+ }"
36
+ :src="item.url"
37
+ />
38
+ </view>
39
+ <view class="title">{{ item.title }}</view>
39
40
  </view>
40
- <view class="title">{{ item.title }}</view>
41
41
  </view>
42
- </view>
42
+ </lcb-block>
43
43
  </template>
44
44
 
45
45
  <script lang="ts" setup>
@@ -55,14 +55,12 @@ defineOptions({
55
55
  })
56
56
 
57
57
  withDefaults(defineProps<LcbImgNavProps>(), {
58
- bgColor: '#ffffff',
59
58
  textColor: '#212121',
60
59
  iconColor: '#212121',
61
60
  iconRadius: 0,
62
- topMargin: 36,
63
- bottomMargin: 36,
61
+ paddingVertical: 36,
64
62
  iconSize: 80,
65
- leftRightMargin: 0,
63
+ paddingHorizontal: 0,
66
64
  iconTextMargin: 4,
67
65
  pictureDistribution: 4,
68
66
  })
@@ -1,12 +1,11 @@
1
1
  import { ActionView } from 'action'
2
+ import { LcbBlockProps } from '../lcb-block/types'
2
3
 
3
- export interface LcbImgNavProps {
4
+ export interface LcbImgNavProps extends LcbBlockProps {
4
5
  /** 模式 1.单行 2.多行 */
5
6
  styleGroup?: 1 | 2
6
7
  /** 文字颜色 #212121 */
7
8
  textColor?: string
8
- /** 背景颜色 #ffffff */
9
- bgColor?: string
10
9
  /** 背景图片 */
11
10
  bgImg?: string
12
11
  /** 图标颜色 #212121 */
@@ -15,14 +14,8 @@ export interface LcbImgNavProps {
15
14
  iconType?: 0 | 1
16
15
  /** 数据内容 */
17
16
  items?: ActionView[]
18
- /** 上边距 */
19
- topMargin?: 0 | 24 | 36
20
- /** 下边距 */
21
- bottomMargin?: 0 | 24 | 36
22
17
  /** 排布方式每行几个 */
23
18
  pictureDistribution?: 3 | 4 | 5
24
- /** 左右间距 */
25
- leftRightMargin?: number
26
19
  /** 图标尺寸 0.小40px 2.大50px */
27
20
  iconSize?: number
28
21
  /** 图标圆角 默认 0 */
@@ -2,10 +2,7 @@
2
2
  <lcb-block
3
3
  v-bind="{
4
4
  ...$props,
5
- title: undefined,
6
5
  }"
7
- :marginLeft="24"
8
- :marginRight="24"
9
6
  >
10
7
  <text
11
8
  :style="{
@@ -28,9 +25,11 @@ defineOptions({
28
25
  },
29
26
  })
30
27
  withDefaults(defineProps<LcbTitleProps>(), {
28
+ marginHorizontal: 24,
31
29
  fontWeight: 600,
32
30
  fontSize: 14,
33
31
  color: '#333',
32
+ title: '标题',
34
33
  })
35
34
  </script>
36
35
  <style lang="scss" scoped></style>
@@ -1,50 +1,59 @@
1
1
  <template>
2
- <lcb-block class="flex flex-justify-between" v-bind="{
3
- marginTop,
4
- marginBottom,
5
- marginLeft: marginHorizontal,
6
- marginRight: marginHorizontal,
7
- paddingTop: paddingVertical,
8
- paddingBottom: paddingVertical,
9
- paddingLeft: paddingHorizontal,
10
- paddingRight: paddingHorizontal,
11
- backgroundColor,
12
- radius,
13
- boxShadow: shadowColor && shadowSize ? `0px 0px ${blurSize}px ${shadowSize}px ${shadowColor}` : '',
14
- // boxShadow: '0px 4px 8px 0px rgba(236,236,236,0.5)'
15
- }">
16
- <view class="flex flex-col flex-justify-center items-center" @click="onClick(item)" v-for="item in iconList"
17
- :key="item.id">
18
- <view class="position-relative" :style="{
19
- height: transformValueUnit(iconSize),
20
- width: transformValueUnit(iconSize),
21
- }">
22
- <view v-if="item.iconType === 0">
23
- <wd-icon class-prefix="iconfont" v-bind="{
24
- name: item.iconName || '',
25
- size: transformValueUnit(iconSize),
26
- color: iconColor,
27
- }" />
28
- </view>
29
- <view v-if="item.iconType === 1" class="bg-no-repeat bg-contain" :style="{
2
+ <lcb-block v-bind="$props" class="flex flex-justify-between">
3
+ <view
4
+ class="flex flex-col flex-justify-center items-center"
5
+ @click="onClick(item)"
6
+ v-for="item in iconList"
7
+ :key="item.id"
8
+ >
9
+ <view
10
+ class="position-relative"
11
+ :style="{
30
12
  height: transformValueUnit(iconSize),
31
13
  width: transformValueUnit(iconSize),
32
- color: iconColor,
33
- backgroundImage: `url('${item.iconUpload}')`,
34
- }" />
35
- <view v-if="item.id < 5" class="pos-absolute bg-#f23d3d pos-top-0 pos-right-0 w-8px h-8px rounded-4px" />
14
+ }"
15
+ >
16
+ <view v-if="item.iconType === 0">
17
+ <wd-icon
18
+ class-prefix="iconfont"
19
+ v-bind="{
20
+ name: item.iconName || '',
21
+ size: transformValueUnit(iconSize),
22
+ color: iconColor,
23
+ }"
24
+ />
25
+ </view>
26
+ <view
27
+ v-if="item.iconType === 1"
28
+ class="bg-no-repeat bg-contain"
29
+ :style="{
30
+ height: transformValueUnit(iconSize),
31
+ width: transformValueUnit(iconSize),
32
+ color: iconColor,
33
+ backgroundImage: `url('${item.iconUpload}')`,
34
+ }"
35
+ />
36
+ <view
37
+ v-if="item.id < 5"
38
+ class="pos-absolute bg-#f23d3d pos-top-0 pos-right-0 w-8px h-8px rounded-4px"
39
+ />
40
+ </view>
41
+ <view
42
+ class="flex flex-justify-between text-center"
43
+ :style="{
44
+ color: textColor,
45
+ fontSize: transformValueUnit(textSize),
46
+ marginTop: transformValueUnit((textSize || 0) / 3),
47
+ }"
48
+ >
49
+ {{ item.iconTitle }}
36
50
  </view>
37
- <view class="flex flex-justify-between text-center" :style="{
38
- color: textColor,
39
- fontSize: transformValueUnit(textSize),
40
- marginTop: transformValueUnit((textSize || 0) / 3),
41
- }">{{ item.iconTitle }}</view>
42
51
  </view>
43
52
  </lcb-block>
44
53
  </template>
45
54
 
46
55
  <script setup lang="ts">
47
- import { computed } from 'vue';
56
+ import { computed } from 'vue'
48
57
  import { LcbUserOrderProps, IIconList } from './types'
49
58
  import { transformValueUnit } from '../../utils/transform'
50
59
  defineOptions({
@@ -55,36 +64,32 @@ defineOptions({
55
64
  styleIsolation: 'shared',
56
65
  },
57
66
  })
58
- const onClick = (item: any) => {
59
-
60
- }
67
+ const onClick = (item: any) => {}
61
68
  const props = withDefaults(defineProps<LcbUserOrderProps>(), {
62
69
  paddingVertical: 0,
63
70
  paddingHorizontal: 0,
64
71
  blurSize: 5,
65
72
  })
66
- const statusNumbers = ['0', '1', '2', '3', '5', ''];
73
+ const statusNumbers = ['0', '1', '2', '3', '5', '']
67
74
  const iconList = computed(() => {
68
75
  const list: IIconList[] = []
69
76
  for (let i = 0; i < statusNumbers.length; i++) {
70
- const item = statusNumbers[i];
71
- const isShow = props['iconShow' + item];
77
+ const item = statusNumbers[i]
78
+ const isShow = props['iconShow' + item]
72
79
  console.log('isShow', isShow)
73
80
  if (isShow !== false) {
74
81
  list.push({
75
- 'id': i,
76
- 'iconType': props['iconType' + item],
77
- 'iconTitle': props['iconTitle' + item],
78
- 'iconName': props['iconName' + item],
79
- 'iconUpload': props['iconUpload' + item],
80
- });
82
+ id: i,
83
+ iconType: props['iconType' + item],
84
+ iconTitle: props['iconTitle' + item],
85
+ iconName: props['iconName' + item],
86
+ iconUpload: props['iconUpload' + item],
87
+ })
81
88
  }
82
89
  }
83
- console.log('list', list)
90
+ console.log('list', list, props)
84
91
  return list as IIconList[]
85
92
  })
86
93
  </script>
87
94
 
88
- <style lang="scss" scoped>
89
-
90
- </style>
95
+ <style lang="scss" scoped></style>
@@ -1,7 +1,7 @@
1
1
  export interface IIconList {
2
- id: number,
2
+ id: number
3
3
  iconType: number
4
- iconTitle?: string,
4
+ iconTitle?: string
5
5
  iconName?: string
6
6
  iconUpload?: string
7
7
  }