@tplc/business 0.0.18 → 0.0.22

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 +148 -0
  2. package/action.d.ts +10 -1
  3. package/components/lcb-action-view/lcb-action-view.vue +148 -0
  4. package/components/lcb-action-view/types.ts +14 -0
  5. package/components/lcb-banner/lcb-banner.vue +2 -6
  6. package/components/lcb-banner/types.ts +2 -4
  7. package/components/lcb-banner-block/lcb-banner-block.vue +17 -27
  8. package/components/lcb-banner-block/types.ts +1 -1
  9. package/components/lcb-block/lcb-block.vue +11 -23
  10. package/components/lcb-block/types.ts +23 -9
  11. package/components/lcb-grid/lcb-grid.vue +12 -16
  12. package/components/lcb-grid/types.ts +1 -1
  13. package/components/lcb-home-search/lcb-home-search.vue +62 -34
  14. package/components/lcb-home-search/types.ts +4 -3
  15. package/components/lcb-image/Image/index.vue +96 -0
  16. package/components/lcb-image/lcb-image.vue +91 -0
  17. package/components/lcb-image/types.ts +15 -0
  18. package/components/lcb-img-nav/lcb-img-nav.vue +37 -37
  19. package/components/lcb-img-nav/types.ts +2 -9
  20. package/components/lcb-nav/lcb-nav.vue +42 -14
  21. package/components/lcb-nav/types.ts +1 -2
  22. package/components/lcb-notice-bar/Item/index.vue +85 -0
  23. package/components/lcb-notice-bar/lcb-notice-bar.vue +63 -0
  24. package/components/lcb-notice-bar/types.ts +19 -0
  25. package/components/lcb-title/lcb-title.vue +2 -3
  26. package/components/lcb-user-order/lcb-user-order.vue +20 -32
  27. package/components/lcb-user-order/types.ts +3 -2
  28. package/components/lcb-user-top/lcb-user-top.vue +96 -48
  29. package/components/lcb-user-top/types.ts +1 -0
  30. package/components/lcb-video/lcb-video.vue +33 -0
  31. package/components/lcb-video/types.ts +11 -0
  32. package/global.d.ts +4 -0
  33. package/package.json +2 -2
  34. package/types/components/lcb-action-view/lcb-action-view.vue.d.ts +41 -0
  35. package/types/components/lcb-action-view/types.d.ts +14 -0
  36. package/types/components/lcb-banner/lcb-banner.vue.d.ts +1 -2
  37. package/types/components/lcb-banner/types.d.ts +2 -3
  38. package/types/components/lcb-banner-block/lcb-banner-block.vue.d.ts +7 -3
  39. package/types/components/lcb-banner-block/types.d.ts +1 -1
  40. package/types/components/lcb-block/lcb-block.vue.d.ts +18 -25
  41. package/types/components/lcb-block/types.d.ts +21 -9
  42. package/types/components/lcb-grid/lcb-grid.vue.d.ts +4 -1
  43. package/types/components/lcb-grid/types.d.ts +1 -1
  44. package/types/components/lcb-home-search/lcb-home-search.vue.d.ts +12 -0
  45. package/types/components/lcb-home-search/types.d.ts +4 -3
  46. package/types/components/lcb-image/Image/index.vue.d.ts +56 -0
  47. package/types/components/lcb-image/lcb-image.vue.d.ts +70 -0
  48. package/types/components/lcb-image/types.d.ts +13 -0
  49. package/types/components/lcb-img-nav/lcb-img-nav.vue.d.ts +6 -12
  50. package/types/components/lcb-img-nav/types.d.ts +2 -9
  51. package/types/components/lcb-nav/Search/index.vue.d.ts +1 -1
  52. package/types/components/lcb-nav/lcb-nav.vue.d.ts +2 -2
  53. package/types/components/lcb-nav/types.d.ts +1 -2
  54. package/types/components/lcb-notice-bar/Item/index.vue.d.ts +28 -0
  55. package/types/components/lcb-notice-bar/lcb-notice-bar.vue.d.ts +56 -0
  56. package/types/components/lcb-notice-bar/types.d.ts +15 -0
  57. package/types/components/lcb-title/lcb-title.vue.d.ts +6 -0
  58. package/types/components/lcb-user-order/lcb-user-order.vue.d.ts +1 -1
  59. package/types/components/lcb-user-order/types.d.ts +1 -0
  60. package/types/components/lcb-user-top/lcb-user-top.vue.d.ts +3 -0
  61. package/types/components/lcb-user-top/types.d.ts +1 -0
  62. package/types/components/lcb-video/lcb-video.vue.d.ts +56 -0
  63. package/types/components/lcb-video/types.d.ts +10 -0
@@ -1,12 +1,6 @@
1
1
  <template>
2
- <lcb-block
3
- :marginLeft="24"
4
- :marginRight="24"
5
- :radius="16"
6
- backgroundColor="#fff"
7
- :marginTop="-(marginTop || 0)"
8
- >
9
- <view class="flex w-full bg-#F5F6F9">
2
+ <lcb-block v-bind="$props">
3
+ <view class="flex w-full search-view overflow-hidden">
10
4
  <view
11
5
  v-for="(item, index) in tabs"
12
6
  :key="item"
@@ -14,6 +8,8 @@
14
8
  @click="current = index"
15
9
  :class="{
16
10
  active: current === index,
11
+ 'active-left': index === current - 1,
12
+ 'active-right': index === current + 1,
17
13
  }"
18
14
  >
19
15
  {{ item }}
@@ -22,48 +18,61 @@
22
18
  <view class="box-border px-3 leading-none">
23
19
  <view class="flex items-center justify-center mt-3 text-#333 gap-16rpx">
24
20
  <view class="text-30rpx font-bold">义乌</view>
25
- <wd-icon name="chevron-down-circle" size="30rpx"></wd-icon>
21
+ <img
22
+ class="w-30rpx h-30rpx"
23
+ mode="aspectFit"
24
+ src="https://ddll-lycs.oss-cn-hangzhou.aliyuncs.com/default/1/20240914164446/%E5%BD%A2%E7%8A%B6%2092%402x.png"
25
+ />
26
26
  <view class="h-42rpx w-1px bg-#F1F1F1"></view>
27
27
  <view class="text-#999 text-28rpx">{{ placeholder }}</view>
28
28
  <view class="flex-1"></view>
29
29
  <view class="justify-center flex flex-col items-center">
30
- <view>
31
- <wd-icon name="play-circle-stroke" size="30rpx"></wd-icon>
32
- </view>
30
+ <img
31
+ class="w-30rpx h-30rpx"
32
+ mode="aspectFit"
33
+ src="https://ddll-lycs.oss-cn-hangzhou.aliyuncs.com/default/1/20240914164707/%E5%BD%A2%E7%8A%B6%2095%402x.png"
34
+ />
33
35
  <view class="text-26rpx text-#333 mt-12rpx">当前位置</view>
34
36
  </view>
35
37
  </view>
36
38
  <view class="w-full h-1px bg-#F1F1F1 mt-26rpx mb-44rpx"></view>
37
39
  <view class="flex items-center">
38
- <view class="title">612日</view>
40
+ <view class="title">{{ dayRange[0].format('MMDD日') }}</view>
39
41
  <view class="hint ml-1">今天入住</view>
40
- <view class="title mx-2">——</view>
41
- <view class="title">613日</view>
42
+ <view class="title mx-1">——</view>
43
+ <view class="title">{{ dayRange[1].format('MMDD日') }}</view>
42
44
  <view class="hint ml-1 flex-1">明天离店</view>
43
- <view class="tag">共1晚</view>
45
+ <view class="tag">共{{ nightCount }}晚</view>
44
46
  </view>
45
- <wd-button type="primary" customClass="!w-full my-42rpx" size="large">搜索酒店</wd-button>
47
+ <wd-button type="primary" customClass="!w-full my-42rpx" size="large">
48
+ {{ btnText }}
49
+ </wd-button>
46
50
  <view
47
51
  class="px-50rpx flex justify-between items-center mb-42rpx text-#000 text-28rpx"
48
52
  v-if="items?.length"
49
53
  >
50
- <view
54
+ <lcb-action-view
51
55
  v-for="item in items"
52
56
  :key="item.title"
53
- class="flex justify-center items-center gap-16rpx"
57
+ v-bind="item.link"
58
+ customClass="!flex justify-center items-center gap-16rpx"
54
59
  >
55
60
  <img :src="item.url" class="w-36rpx h-36rpx" />
56
61
  {{ item.title }}
57
- </view>
62
+ </lcb-action-view>
58
63
  </view>
59
64
  </view>
60
65
  </lcb-block>
61
66
  </template>
62
67
 
63
68
  <script setup lang="ts">
64
- import { ref } from 'vue'
69
+ import { computed, ref } from 'vue'
65
70
  import { LcbHomeSearch } from './types'
66
-
71
+ import dayjs from 'dayjs'
72
+ const dayRange = ref([dayjs(), dayjs().add(1, 'day')])
73
+ const nightCount = computed(() => {
74
+ return dayRange.value[1].diff(dayRange.value[0], 'day')
75
+ })
67
76
  defineOptions({
68
77
  name: 'LcbHomeSearch',
69
78
  options: {
@@ -73,23 +82,42 @@ defineOptions({
73
82
  },
74
83
  })
75
84
 
76
- withDefaults(defineProps<LcbHomeSearch>(), { placeholder: '位置|酒店|关键词' })
85
+ withDefaults(defineProps<LcbHomeSearch>(), {
86
+ marginHorizontal: 24,
87
+ backgroundColor: '#fff',
88
+ radius: 16,
89
+ placeholder: '位置|酒店|关键词',
90
+ btnText: '搜索酒店',
91
+ })
77
92
  const tabs = ['全部', '酒店', '民宿']
78
93
  const current = ref(0)
79
94
  </script>
80
95
  <style lang="scss" scoped>
81
- .search-tab {
82
- flex: 1;
83
- text-align: center;
84
- font-size: 30rpx;
85
- padding: 24rpx 0;
86
- color: #999;
87
- }
88
- .active {
89
- background-color: #fff;
90
- color: #000;
91
- font-weight: bold;
96
+ .search-view {
97
+ border-radius: 16rpx;
98
+ .search-tab {
99
+ flex: 1;
100
+ text-align: center;
101
+ font-size: 30rpx;
102
+ padding: 24rpx 0;
103
+ color: #999;
104
+ background-color: #f5f6f9;
105
+ }
106
+ .active {
107
+ background-color: #fff;
108
+ color: #000;
109
+ font-weight: bold;
110
+ border-top-left-radius: 16rpx;
111
+ border-top-right-radius: 16rpx;
112
+ &-left {
113
+ border-bottom-right-radius: 16rpx;
114
+ }
115
+ &-right {
116
+ border-bottom-left-radius: 16rpx;
117
+ }
118
+ }
92
119
  }
120
+
93
121
  .title {
94
122
  font-weight: bold;
95
123
  font-size: 32rpx;
@@ -1,7 +1,8 @@
1
1
  import { ActionView } from 'action'
2
+ import { LcbBlockProps } from '../lcb-block/types'
2
3
 
3
- export interface LcbHomeSearch {
4
- marginTop?: number
4
+ export interface LcbHomeSearch extends LcbBlockProps {
5
5
  placeholder?: string
6
- items?: Partial<ActionView>[]
6
+ items?: ActionView[]
7
+ btnText?: string
7
8
  }
@@ -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,91 @@
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
+ marginTop: transformValueUnit(-(floatUp || 0)),
7
+ }"><wd-icon name="image" size="50px"></wd-icon></view>
8
+
9
+ <view v-if="styleGroup != 3" :class="styleGroup == 2 ? 'flex' : ''" :style="{
10
+ marginLeft: transformValueUnit(marginHorizontal),
11
+ marginRight: transformValueUnit(marginHorizontal),
12
+ marginTop: transformValueUnit(-(floatUp || 0)),
13
+ // marginTop: transformValueUnit(marginTop),
14
+ // marginBottom: transformValueUnit(marginBottom),
15
+ }">
16
+ <!-- <view v-for="(item, index) in items" :key="index" :class="styleGroup == 2 ? 'flex-1 relative' : 'relative'" :style="{
17
+ marginTop: transformValueUnit(styleGroup == 1 && index > 0 ? imageMargin : 0),
18
+ marginLeft: transformValueUnit(styleGroup == 2 && index > 0 ? imageMargin : 0),
19
+ }">
20
+ <wd-img v-if="!!item.url" v-bind="{
21
+ src: item.url,
22
+ class: 'overflow-hidden block',
23
+ }" @click="onClickItem(item)" width="100%" :enable-preview="enablePreview" mode="widthFix" :style="{
24
+ borderRadius: transformValueUnit(imageRadius),
25
+ display: 'block',
26
+ }" />
27
+ <view v-if="!item.url" class="flex justify-center items-center bg-light color-gray overflow-hidden" :style="{
28
+ height: transformValueUnit(400),
29
+ borderRadius: transformValueUnit(imageRadius),
30
+ }"><wd-icon name="image" size="50px"></wd-icon></view>
31
+ </view> -->
32
+ <Image v-bind="imageProps" />
33
+ </view>
34
+
35
+ <scroll-view v-if="styleGroup == 3" scroll-x class="w-full whitespace-nowrap" :style="{
36
+ marginLeft: transformValueUnit(marginHorizontal),
37
+ marginRight: transformValueUnit(marginHorizontal),
38
+ marginTop: transformValueUnit(-(floatUp || 0)),
39
+ // marginTop: transformValueUnit(marginTop),
40
+ // marginBottom: transformValueUnit(marginBottom),
41
+ }">
42
+ <view class="flex shrink-0">
43
+ <Image v-bind="imageProps" />
44
+ </view>
45
+ </scroll-view>
46
+
47
+ <!-- <view class="pl-20px pr-20px break-all">{{ JSON.stringify(iconItems) }}</view> -->
48
+
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { computed } from 'vue';
53
+ import { transformValueUnit } from '../../utils/transform'
54
+ import Image from './Image/index.vue'
55
+ import { LcbImageProps } from './types'
56
+ defineOptions({
57
+ name: 'LcbImage',
58
+ options: {
59
+ addGlobalClass: true,
60
+ virtualHost: true,
61
+ styleIsolation: 'shared',
62
+ },
63
+ })
64
+ const props = withDefaults(defineProps<LcbImageProps>(), {
65
+ styleGroup: 1,
66
+ imageMargin: 0,
67
+ imageSize: 300,
68
+ marginTop: 0,
69
+ marginBottom: 0,
70
+ marginHorizontal: 0,
71
+ })
72
+
73
+ const imageProps = computed(() => {
74
+ return {
75
+ items: props.items,
76
+ imageSize: props.imageSize,
77
+ imageMargin: props.imageMargin,
78
+ imageRadius: props.imageRadius,
79
+ enablePreview: props.enablePreview,
80
+ styleGroup: props.styleGroup,
81
+ }
82
+ })
83
+
84
+ // const iconItems = computed(() => {
85
+ // console.log('props.items', props.items)
86
+ // return props.items;
87
+ // })
88
+
89
+ </script>
90
+
91
+ <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
+ floatUp?: number
14
+ marginBottom?: number
15
+ }
@@ -1,45 +1,47 @@
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">
15
- <view
16
- class="overflow-hidden"
17
- :style="{
18
- marginBottom: iconTextMargin + 'rpx',
19
- }"
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
+ >
9
+ <lcb-action-view
10
+ v-for="item in items"
11
+ :key="item.title"
12
+ v-bind="item.link"
13
+ custom-class="!flex flex-col justify-center items-center"
20
14
  >
21
- <div v-if="iconType === 0" class="flex justify-center items-center">
15
+ <view
16
+ class="overflow-hidden"
17
+ :style="{
18
+ marginBottom: iconTextMargin + 'rpx',
19
+ }"
20
+ >
21
+ <!-- <div v-if="iconType === 0" class="flex justify-center items-center"> -->
22
22
  <wd-icon
23
+ v-if="iconType === 0"
23
24
  class-prefix="iconfont"
24
25
  :name="item.icon!"
25
26
  :size="iconSize + 'rpx'"
26
27
  :color="iconColor"
27
28
  />
28
- </div>
29
- <img
30
- v-else
31
- class="block"
32
- :style="{
33
- borderRadius: iconRadius + 'rpx',
34
- height: iconSize + 'rpx',
35
- width: iconSize + 'rpx',
36
- }"
37
- :src="item.url"
38
- />
39
- </view>
40
- <view class="title">{{ item.title }}</view>
29
+ <!-- </div> -->
30
+ <img
31
+ v-else
32
+ class="block"
33
+ :style="{
34
+ borderRadius: iconRadius + 'rpx',
35
+ height: iconSize + 'rpx',
36
+ width: iconSize + 'rpx',
37
+ }"
38
+ :src="item.url"
39
+ />
40
+ </view>
41
+ <view class="title">{{ item.title }}</view>
42
+ </lcb-action-view>
41
43
  </view>
42
- </view>
44
+ </lcb-block>
43
45
  </template>
44
46
 
45
47
  <script lang="ts" setup>
@@ -55,14 +57,12 @@ defineOptions({
55
57
  })
56
58
 
57
59
  withDefaults(defineProps<LcbImgNavProps>(), {
58
- bgColor: '#ffffff',
59
60
  textColor: '#212121',
60
61
  iconColor: '#212121',
61
62
  iconRadius: 0,
62
- topMargin: 36,
63
- bottomMargin: 36,
63
+ paddingVertical: 36,
64
64
  iconSize: 80,
65
- leftRightMargin: 0,
65
+ paddingHorizontal: 0,
66
66
  iconTextMargin: 4,
67
67
  pictureDistribution: 4,
68
68
  })
@@ -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 */
@@ -38,10 +38,15 @@
38
38
  class="h-full flex items-center"
39
39
  @click="onCapsule(item)"
40
40
  v-for="item in capsuleList"
41
- :key="item.icon"
41
+ :key="item.action"
42
42
  :class="[capsuleList.length === 1 ? 'px-2' : 'px-2.5']"
43
43
  >
44
- <wd-icon class-prefix="iconfont" :name="item.icon" size="36rpx" :color="contentColor" />
44
+ <wd-icon
45
+ class-prefix="iconfont"
46
+ :name="iconMap[item.action]"
47
+ size="36rpx"
48
+ :color="contentColor"
49
+ />
45
50
  </view>
46
51
  </view>
47
52
  <template v-else-if="back">
@@ -88,7 +93,6 @@ import Title from './Title/index.vue'
88
93
  import Search from './Search/index.vue'
89
94
  import { onPageScroll } from '@dcloudio/uni-app'
90
95
 
91
- const { statusBarHeight } = uni.getSystemInfoSync()
92
96
  defineOptions({
93
97
  name: 'LcbNav',
94
98
  options: {
@@ -97,6 +101,15 @@ defineOptions({
97
101
  styleIsolation: 'shared',
98
102
  },
99
103
  })
104
+ const { statusBarHeight } = uni.getSystemInfoSync()
105
+ const iconMap = {
106
+ back: 'dingdanliebiao',
107
+ search: 'a-xingzhuang23kaobei',
108
+ scanCode: 'a-xingzhuang106',
109
+ translate: 'a-xingzhuang22',
110
+ setting: 'shezhi',
111
+ home: 'tingshi',
112
+ }
100
113
  const scrollTop = ref(0)
101
114
  const props = withDefaults(defineProps<NavProps>(), {
102
115
  styleGroup: 1,
@@ -147,26 +160,41 @@ const capsuleList = computed(() => {
147
160
  if (props.back) {
148
161
  list.push({
149
162
  icon: 'chevron-left',
150
- action: 'link',
163
+ action: 'back',
151
164
  })
152
165
  }
153
166
 
154
167
  return [...list, ...(props.capsules || [])] as ICapsule[]
155
168
  })
156
- const onCapsule = ({ action = 'link', link }: ICapsule) => {
169
+ const onCapsule = ({ action }: ICapsule) => {
157
170
  switch (action) {
158
- case 'link':
159
- if (link) {
160
- uni.navigateTo({
161
- url: link,
162
- })
163
- } else {
164
- toBack()
165
- }
171
+ case 'back':
172
+ toBack()
173
+ break
174
+ case 'search':
175
+ uni.navigateTo({
176
+ url: '/pages/search/index',
177
+ })
166
178
  break
179
+ case 'scanCode':
180
+ uni.scanCode({
181
+ success: (res) => {
182
+ console.log(res)
183
+ },
184
+ })
185
+ break
186
+ case 'translate':
187
+ toBack()
188
+ break
189
+ case 'setting':
190
+ uni.navigateTo({
191
+ url: '/pages/setting/index',
192
+ })
193
+ break
194
+
167
195
  case 'home':
168
196
  uni.switchTab({
169
- url: '/pages/home/index',
197
+ url: '/pages/index/index',
170
198
  })
171
199
  break
172
200
  }
@@ -1,7 +1,6 @@
1
1
  export interface ICapsule {
2
2
  icon: string
3
- action?: 'translate' | 'scanCode' | 'link' | 'home'
4
- link?: string
3
+ action: 'translate' | 'scanCode' | 'search' | 'home' | 'setting' | 'back'
5
4
  }
6
5
 
7
6
  export interface NavTitleProps {