@tplc/business 0.0.20 → 0.0.24

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 (50) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/action.d.ts +2 -1
  3. package/components/lcb-action-view/lcb-action-view.vue +5 -2
  4. package/components/lcb-action-view/types.ts +3 -2
  5. package/components/lcb-banner/lcb-banner.vue +1 -0
  6. package/components/lcb-banner-block/lcb-banner-block.vue +11 -11
  7. package/components/lcb-banner-block/types.ts +1 -1
  8. package/components/lcb-block/lcb-block.vue +1 -0
  9. package/components/lcb-grid/lcb-grid.vue +10 -8
  10. package/components/lcb-grid/types.ts +1 -1
  11. package/components/lcb-home-search/lcb-home-search.vue +18 -10
  12. package/components/lcb-home-search/types.ts +2 -1
  13. package/components/lcb-image/Image/index.vue +1 -0
  14. package/components/lcb-image/lcb-image.vue +12 -8
  15. package/components/lcb-image/types.ts +1 -1
  16. package/components/lcb-img-nav/lcb-img-nav.vue +23 -37
  17. package/components/lcb-img-nav/types.ts +4 -0
  18. package/components/lcb-nav/lcb-nav.vue +53 -15
  19. package/components/lcb-nav/types.ts +1 -2
  20. package/components/lcb-notice/Item/index.vue +112 -0
  21. package/components/lcb-notice/lcb-notice.vue +76 -0
  22. package/components/lcb-notice/types.ts +27 -0
  23. package/components/lcb-user-order/lcb-user-order.vue +31 -48
  24. package/components/lcb-user-order/types.ts +12 -0
  25. package/components/lcb-user-top/Nums/index.vue +20 -0
  26. package/components/lcb-user-top/lcb-user-top.vue +72 -81
  27. package/components/lcb-user-top/types.ts +18 -2
  28. package/components/lcb-video/lcb-video.vue +2 -2
  29. package/global.d.ts +1 -0
  30. package/package.json +2 -2
  31. package/types/components/lcb-action-view/types.d.ts +3 -2
  32. package/types/components/lcb-banner-block/types.d.ts +1 -1
  33. package/types/components/lcb-grid/types.d.ts +1 -1
  34. package/types/components/lcb-home-search/lcb-home-search.vue.d.ts +3 -0
  35. package/types/components/lcb-home-search/types.d.ts +2 -1
  36. package/types/components/lcb-image/lcb-image.vue.d.ts +0 -1
  37. package/types/components/lcb-image/types.d.ts +1 -1
  38. package/types/components/lcb-img-nav/types.d.ts +2 -0
  39. package/types/components/lcb-nav/Search/index.vue.d.ts +1 -1
  40. package/types/components/lcb-nav/lcb-nav.vue.d.ts +1 -1
  41. package/types/components/lcb-nav/types.d.ts +1 -2
  42. package/types/components/lcb-notice/Item/index.vue.d.ts +56 -0
  43. package/types/components/lcb-notice/lcb-notice.vue.d.ts +68 -0
  44. package/types/components/lcb-notice/types.d.ts +24 -0
  45. package/types/components/lcb-user-order/types.d.ts +7 -0
  46. package/types/components/lcb-user-top/Nums/index.vue.d.ts +28 -0
  47. package/types/components/lcb-user-top/lcb-user-top.vue.d.ts +0 -2
  48. package/types/components/lcb-user-top/types.d.ts +16 -2
  49. package/types/utils/transform.d.ts +1 -1
  50. package/utils/transform.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
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.24](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.23...v0.0.24) (2024-09-25)
6
+
7
+ ### [0.0.23](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.9...v0.0.23) (2024-09-25)
8
+
9
+ ### [0.0.22](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.21...v0.0.22) (2024-09-24)
10
+
11
+ ### [0.0.21](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.7...v0.0.21) (2024-09-24)
12
+
13
+
14
+ ### ✨ Features | 新功能
15
+
16
+ * banner grid 新增链接 ([06ea3f9](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/06ea3f9203a04867ee71b01239f046d242f4ee3a))
17
+ * banner 新增click ([e95fc15](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/e95fc15c6620ad5de70854a572eab5b3800cbf3c))
18
+ * home-search支持点击 ([726fe69](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/726fe6974f0f5c83a92ddcf4c5f4d471e9bcfe28))
19
+ * navImg 跳转 ([27e9d65](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/27e9d659770441e72e996a565820a98fdc8c48d0))
20
+ * update version ([6aeee95](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6aeee95a18ab4a1091253c6b2a8bec76e3a63886))
21
+ * 图片间隙 ([ce3501b](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/ce3501be567230d88e09abc5166941edc5c45ec0))
22
+ * 支持nav action ([1ad0c00](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1ad0c001b8ecaa35041131ee3c3359f6b715c962))
23
+ * 调整customClass ([74e83ce](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/74e83ce404fb3ccc73e0fb6c7065511e417d7470))
24
+ * 调整swiper布局 ([faa2e24](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/faa2e244ed4e2929b91249b41256d6ab9055082a))
25
+ * 跳转jumpType ([1a89c12](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/1a89c12457388ed7875b4ce990c959e8e997407e))
26
+
5
27
  ### [0.0.20](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.19...v0.0.20) (2024-09-22)
6
28
 
7
29
  ### 0.0.19 (2024-09-22)
package/action.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import { LcbActionViewProps } from './components/lcb-action-view/types'
1
2
  export interface ActionView {
2
3
  title: string
3
4
  icon?: string
4
- link: string
5
+ link: LcbActionViewProps
5
6
  url?: string
6
7
  mode: number
7
8
  hotSpot?: {
@@ -4,6 +4,7 @@
4
4
  class="lcb-action-btn"
5
5
  :open-type="openType"
6
6
  @getphonenumber="getPhoneNumber"
7
+ :class="customClass"
7
8
  >
8
9
  <slot />
9
10
  </button>
@@ -22,10 +23,10 @@ defineOptions({
22
23
  })
23
24
  const props = defineProps<LcbActionViewProps>()
24
25
  const openType = computed(() => {
25
- return { 88: 'getPhoneNumber', 12: 'contact' }[props.jumpType]
26
+ return { 88: 'getPhoneNumber', 12: 'contact' }[props.jumpType || '']
26
27
  })
27
28
  const onActionClick = () => {
28
- const { jumpAppid, jumpPageUrl: url, jumpType, phoneNumber } = props
29
+ const { jumpAppid, jumpUrl: url, jumpType, phoneNumber } = props
29
30
  /**
30
31
  * 跳转类型 1: 网页 2: 小程序内页 10: 跳转小程序 11: 跳转半屏小程序 12: 小程序客服
31
32
  * 13: 退出登录 14: 小程序弹框 21: 新窗口跳到页面 22: 切换TAB页 23: 重启进入某页面
@@ -138,6 +139,8 @@ const getPhoneNumber = (e) => {
138
139
  color: inherit;
139
140
  font-size: inherit;
140
141
  display: inline-block;
142
+ line-height: normal;
143
+ border-radius: inherit;
141
144
  &::after {
142
145
  border: none;
143
146
  }
@@ -4,10 +4,11 @@ export interface LcbActionViewProps {
4
4
  * 13: 退出登录 14: 小程序弹框 21: 新窗口跳到页面 22: 切换TAB页 23: 重启进入某页面
5
5
  * 24: 回到上一层 25: 关闭当前页面 26: 关闭当前窗口 30: 拨打电话 88: 授权手机号
6
6
  */
7
- jumpType: 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 88
7
+ jumpType?: 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 88
8
8
  /** 跳转路径 */
9
- jumpPageUrl?: string
9
+ jumpUrl?: string
10
10
  /** 小程序appid */
11
11
  jumpAppid?: string
12
12
  phoneNumber?: string
13
+ customClass?: string
13
14
  }
@@ -3,6 +3,7 @@
3
3
  <lcb-block v-bind="$props">
4
4
  <wd-swiper
5
5
  value-key="url"
6
+ action
6
7
  v-bind="{
7
8
  list: items,
8
9
  loop,
@@ -12,17 +12,17 @@
12
12
  <wd-icon class-prefix="iconfont" name="a-xingzhuang97" size="24rpx" color="#666666" />
13
13
  </view>
14
14
  <scroll-view scroll-x class="w-full whitespace-nowrap pb-24rpx">
15
- <img
16
- v-for="(item, index) in items"
17
- :key="index"
18
- :src="item.url"
19
- class="inline-block"
20
- :style="{
21
- height: transformValueUnit(height),
22
- width: transformValueUnit(imgWidth),
23
- marginRight: transformValueUnit(itemPadding),
24
- }"
25
- />
15
+ <lcb-action-view v-for="(item, index) in items" :key="index" v-bind="item.link">
16
+ <img
17
+ :src="item.url"
18
+ class="block"
19
+ :style="{
20
+ height: transformValueUnit(height),
21
+ width: transformValueUnit(imgWidth),
22
+ marginRight: transformValueUnit(itemPadding),
23
+ }"
24
+ />
25
+ </lcb-action-view>
26
26
  </scroll-view>
27
27
  </view>
28
28
  <view v-if="styleGroup === 2">
@@ -1,7 +1,7 @@
1
1
  import { LcbBlockProps } from '../lcb-block/types'
2
2
  import { ActionView } from 'action'
3
3
  export interface LcbBannerListProps extends LcbBlockProps {
4
- items?: Partial<ActionView>[]
4
+ items?: ActionView[]
5
5
  /** 风格 1.顶部title 2.底部title */
6
6
  styleGroup?: 1 | 2
7
7
  /** 轮播图高度 默认192 */
@@ -17,6 +17,7 @@
17
17
  shadowColor && shadowSize ? `0px 0px ${blurSize}px ${shadowSize}px ${shadowColor}` : '',
18
18
  }"
19
19
  class="box-border overflow-hidden relative"
20
+ :class="customClass"
20
21
  >
21
22
  <slot />
22
23
  </view>
@@ -6,14 +6,16 @@
6
6
  'grid-template-columns': `repeat(${cols}, minmax(0, 1fr))`,
7
7
  }"
8
8
  >
9
- <wd-img
10
- v-for="(item, index) in items"
11
- :key="index"
12
- :src="item.url"
13
- :height="transformValueUnit(height)"
14
- :radius="transformValueUnit(radius)"
15
- mode="aspectFill"
16
- />
9
+ <lcb-action-view v-for="(item, index) in items" :key="index" v-bind="item.link">
10
+ <wd-img
11
+ :src="item.url"
12
+ :height="transformValueUnit(height)"
13
+ :radius="transformValueUnit(radius)"
14
+ mode="aspectFill"
15
+ width="100%"
16
+ custom-class="!block"
17
+ />
18
+ </lcb-action-view>
17
19
  </view>
18
20
  </lcb-block>
19
21
  </template>
@@ -1,7 +1,7 @@
1
1
  import { LcbBlockProps } from '../lcb-block/types'
2
2
  import { ActionView } from 'action'
3
3
  export interface LcbGridProps extends LcbBlockProps {
4
- items?: Partial<ActionView>[]
4
+ items?: ActionView[]
5
5
  height?: number
6
6
  cols?: number
7
7
  gap?: number
@@ -37,35 +37,42 @@
37
37
  </view>
38
38
  <view class="w-full h-1px bg-#F1F1F1 mt-26rpx mb-44rpx"></view>
39
39
  <view class="flex items-center">
40
- <view class="title">612日</view>
40
+ <view class="title">{{ dayRange[0].format('MMDD日') }}</view>
41
41
  <view class="hint ml-1">今天入住</view>
42
- <view class="title mx-2">——</view>
43
- <view class="title">613日</view>
42
+ <view class="title mx-1">——</view>
43
+ <view class="title">{{ dayRange[1].format('MMDD日') }}</view>
44
44
  <view class="hint ml-1 flex-1">明天离店</view>
45
- <view class="tag">共1晚</view>
45
+ <view class="tag">共{{ nightCount }}晚</view>
46
46
  </view>
47
- <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>
48
50
  <view
49
51
  class="px-50rpx flex justify-between items-center mb-42rpx text-#000 text-28rpx"
50
52
  v-if="items?.length"
51
53
  >
52
- <view
54
+ <lcb-action-view
53
55
  v-for="item in items"
54
56
  :key="item.title"
55
- class="flex justify-center items-center gap-16rpx"
57
+ v-bind="item.link"
58
+ customClass="!flex justify-center items-center gap-16rpx"
56
59
  >
57
60
  <img :src="item.url" class="w-36rpx h-36rpx" />
58
61
  {{ item.title }}
59
- </view>
62
+ </lcb-action-view>
60
63
  </view>
61
64
  </view>
62
65
  </lcb-block>
63
66
  </template>
64
67
 
65
68
  <script setup lang="ts">
66
- import { ref } from 'vue'
69
+ import { computed, ref } from 'vue'
67
70
  import { LcbHomeSearch } from './types'
68
-
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
+ })
69
76
  defineOptions({
70
77
  name: 'LcbHomeSearch',
71
78
  options: {
@@ -80,6 +87,7 @@ withDefaults(defineProps<LcbHomeSearch>(), {
80
87
  backgroundColor: '#fff',
81
88
  radius: 16,
82
89
  placeholder: '位置|酒店|关键词',
90
+ btnText: '搜索酒店',
83
91
  })
84
92
  const tabs = ['全部', '酒店', '民宿']
85
93
  const current = ref(0)
@@ -3,5 +3,6 @@ import { LcbBlockProps } from '../lcb-block/types'
3
3
 
4
4
  export interface LcbHomeSearch extends LcbBlockProps {
5
5
  placeholder?: string
6
- items?: Partial<ActionView>[]
6
+ items?: ActionView[]
7
+ btnText?: string
7
8
  }
@@ -78,6 +78,7 @@ function getRealSize(size: number = 0) {
78
78
  if (mode !== 3 && props.marginHorizontal) realWidth -= props.marginHorizontal * 2
79
79
  const imgSpan = props.imageMargin
80
80
  if (mode === 2 && imgSpan) realWidth -= (lens - 1) / 2
81
+ // console.log('size', size, 'realWidth', realWidth, 'props.marginHorizontal', props.marginHorizontal)
81
82
  return (realWidth / 375) * size
82
83
  }
83
84
  </script>
@@ -3,13 +3,15 @@
3
3
  <view v-if="!items?.length" class="flex justify-center items-center bg-light color-gray overflow-hidden" :style="{
4
4
  height: transformValueUnit(400),
5
5
  borderRadius: transformValueUnit(imageRadius),
6
+ marginTop: transformValueUnit(-(floatUp || 0)),
6
7
  }"><wd-icon name="image" size="50px"></wd-icon></view>
7
8
 
8
9
  <view v-if="styleGroup != 3" :class="styleGroup == 2 ? 'flex' : ''" :style="{
9
10
  marginLeft: transformValueUnit(marginHorizontal),
10
11
  marginRight: transformValueUnit(marginHorizontal),
11
- marginTop: transformValueUnit(marginTop),
12
- marginBottom: transformValueUnit(marginBottom),
12
+ marginTop: transformValueUnit(-(floatUp || 0)),
13
+ // marginTop: transformValueUnit(marginTop),
14
+ // marginBottom: transformValueUnit(marginBottom),
13
15
  }">
14
16
  <!-- <view v-for="(item, index) in items" :key="index" :class="styleGroup == 2 ? 'flex-1 relative' : 'relative'" :style="{
15
17
  marginTop: transformValueUnit(styleGroup == 1 && index > 0 ? imageMargin : 0),
@@ -33,8 +35,9 @@
33
35
  <scroll-view v-if="styleGroup == 3" scroll-x class="w-full whitespace-nowrap" :style="{
34
36
  marginLeft: transformValueUnit(marginHorizontal),
35
37
  marginRight: transformValueUnit(marginHorizontal),
36
- marginTop: transformValueUnit(marginTop),
37
- marginBottom: transformValueUnit(marginBottom),
38
+ marginTop: transformValueUnit(-(floatUp || 0)),
39
+ // marginTop: transformValueUnit(marginTop),
40
+ // marginBottom: transformValueUnit(marginBottom),
38
41
  }">
39
42
  <view class="flex shrink-0">
40
43
  <Image v-bind="imageProps" />
@@ -73,15 +76,16 @@ const imageProps = computed(() => {
73
76
  imageSize: props.imageSize,
74
77
  imageMargin: props.imageMargin,
75
78
  imageRadius: props.imageRadius,
79
+ marginHorizontal: props.marginHorizontal,
76
80
  enablePreview: props.enablePreview,
77
81
  styleGroup: props.styleGroup,
78
82
  }
79
83
  })
80
84
 
81
- const iconItems = computed(() => {
82
- console.log('props.items', props.items)
83
- return props.items;
84
- })
85
+ // const iconItems = computed(() => {
86
+ // console.log('props.items', props.items)
87
+ // return props.items;
88
+ // })
85
89
 
86
90
  </script>
87
91
 
@@ -10,6 +10,6 @@ export interface LcbImageProps {
10
10
  marginHorizontal?: number
11
11
  imageMargin?: number
12
12
  imageSize?: number
13
- marginTop?: number
13
+ floatUp?: number
14
14
  marginBottom?: number
15
15
  }
@@ -1,43 +1,26 @@
1
1
  <template>
2
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
- <view
10
- v-for="item in items"
11
- :key="item.title"
12
- class="flex flex-col justify-center items-center"
13
- >
14
- <view
15
- class="overflow-hidden"
16
- :style="{
17
- marginBottom: iconTextMargin + 'rpx',
18
- }"
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
- />
3
+ <lcb-title v-if="showTitle" :title="title" :marginHorizontal="0" />
4
+ <view :style="{
5
+ gridTemplateColumns: `repeat(${pictureDistribution}, minmax(0, 1fr))`,
6
+ }" :class="[styleGroup === 2 ? 'mutil' : 'single']">
7
+ <lcb-action-view v-for="item in items" :key="item.title" v-bind="item.link"
8
+ custom-class="!flex flex-col justify-center items-center">
9
+ <view class="overflow-hidden" :style="{
10
+ marginBottom: iconTextMargin + 'rpx',
11
+ }">
12
+ <!-- <div v-if="iconType === 0" class="flex justify-center items-center"> -->
13
+ <wd-icon v-if="iconType === 0" class-prefix="iconfont" :name="item.icon!" :size="iconSize + 'rpx'"
14
+ :color="iconColor" />
15
+ <!-- </div> -->
16
+ <img v-else class="block" :style="{
17
+ borderRadius: iconRadius + 'rpx',
18
+ height: iconSize + 'rpx',
19
+ width: iconSize + 'rpx',
20
+ }" :src="item.url" />
38
21
  </view>
39
22
  <view class="title">{{ item.title }}</view>
40
- </view>
23
+ </lcb-action-view>
41
24
  </view>
42
25
  </lcb-block>
43
26
  </template>
@@ -73,14 +56,17 @@ withDefaults(defineProps<LcbImgNavProps>(), {
73
56
  width: 100%;
74
57
  overflow-x: auto;
75
58
  white-space: nowrap;
76
- > view {
59
+
60
+ >view {
77
61
  display: inline-flex;
78
62
  }
79
63
  }
64
+
80
65
  .mutil {
81
66
  display: grid;
82
67
  row-gap: 36rpx;
83
68
  }
69
+
84
70
  .title {
85
71
  width: 68px;
86
72
  overflow: hidden;
@@ -22,4 +22,8 @@ export interface LcbImgNavProps extends LcbBlockProps {
22
22
  iconRadius?: number
23
23
  /** 文字与图标距离 */
24
24
  iconTextMargin?: number
25
+
26
+ //是否显示标题
27
+ showTitle?: boolean
28
+ title?: string
25
29
  }
@@ -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">
@@ -87,8 +92,8 @@ import { ICapsule, NavProps } from './types'
87
92
  import Title from './Title/index.vue'
88
93
  import Search from './Search/index.vue'
89
94
  import { onPageScroll } from '@dcloudio/uni-app'
90
-
91
- const { statusBarHeight } = uni.getSystemInfoSync()
95
+ import { Locale } from '@tplc/wot'
96
+ import enUS from '@tplc/wot/locale/lang/en-US'
92
97
  defineOptions({
93
98
  name: 'LcbNav',
94
99
  options: {
@@ -97,6 +102,15 @@ defineOptions({
97
102
  styleIsolation: 'shared',
98
103
  },
99
104
  })
105
+ const { statusBarHeight } = uni.getSystemInfoSync()
106
+ const iconMap = {
107
+ back: 'dingdanliebiao',
108
+ search: 'a-xingzhuang23kaobei',
109
+ scanCode: 'a-xingzhuang106',
110
+ translate: 'a-xingzhuang22',
111
+ setting: 'shezhi',
112
+ home: 'tingshi',
113
+ }
100
114
  const scrollTop = ref(0)
101
115
  const props = withDefaults(defineProps<NavProps>(), {
102
116
  styleGroup: 1,
@@ -147,26 +161,50 @@ const capsuleList = computed(() => {
147
161
  if (props.back) {
148
162
  list.push({
149
163
  icon: 'chevron-left',
150
- action: 'link',
164
+ action: 'back',
151
165
  })
152
166
  }
153
167
 
154
168
  return [...list, ...(props.capsules || [])] as ICapsule[]
155
169
  })
156
- const onCapsule = ({ action = 'link', link }: ICapsule) => {
170
+ const onCapsule = ({ action }: ICapsule) => {
157
171
  switch (action) {
158
- case 'link':
159
- if (link) {
160
- uni.navigateTo({
161
- url: link,
162
- })
163
- } else {
164
- toBack()
165
- }
172
+ case 'back':
173
+ toBack()
174
+ break
175
+ case 'search':
176
+ uni.navigateTo({
177
+ url: '/pages/search/index',
178
+ })
166
179
  break
180
+ case 'scanCode':
181
+ uni.scanCode({
182
+ success: (res) => {
183
+ console.log(res)
184
+ },
185
+ })
186
+ break
187
+ case 'translate':
188
+ uni.showActionSheet({
189
+ itemList: ['中文', '英文'],
190
+ success: (res) => {
191
+ if (res.tapIndex === 0) {
192
+ Locale.use('zh-CN')
193
+ } else {
194
+ Locale.use('en-US', enUS)
195
+ }
196
+ },
197
+ })
198
+ break
199
+ case 'setting':
200
+ uni.navigateTo({
201
+ url: '/pages/setting/index',
202
+ })
203
+ break
204
+
167
205
  case 'home':
168
206
  uni.switchTab({
169
- url: '/pages/home/index',
207
+ url: '/pages/index/index',
170
208
  })
171
209
  break
172
210
  }
@@ -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 {
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <view class="flex items-center">
3
+ <div
4
+ v-if="iconType === 1"
5
+ class="overflow-hidden bg-no-repeat bg-contain mr-12rpx"
6
+ :style="{
7
+ height: transformValueUnit(40),
8
+ width: transformValueUnit(40),
9
+ // color: textColor,
10
+ backgroundImage: `url('${item?.icon}')`,
11
+ }"
12
+ />
13
+ <view v-if="iconType === 0" class="mr-12rpx">
14
+ <wd-icon
15
+ class-prefix="iconfont"
16
+ v-bind="{
17
+ name: item?.icon || '',
18
+ size: transformValueUnit(40),
19
+ // color: textColor,
20
+ }"
21
+ />
22
+ </view>
23
+ <view class="flex-1 noticeBar relative overflow-hidden">
24
+ <view
25
+ :class="`text-28rpx absolute left-0 top-0 noticeItem flex overflow-hidden${lens == 1 ? ' infinite' : ''}${showAni ? ' animation' : ''}`"
26
+ :style="{
27
+ animationDuration: getTime(item?.noticeContent),
28
+ }"
29
+ >
30
+ {{ item?.noticeContent }}
31
+ <lcb-action-view v-bind="item?.link" customClass="absolute top-0 left-0 right-0 bottom-0" />
32
+ </view>
33
+ </view>
34
+ </view>
35
+ </template>
36
+
37
+ <script setup lang="ts">
38
+ import { NoticeBarItemProps } from '../types'
39
+ import { computed } from 'vue'
40
+ import { transformValueUnit } from '../../../utils/transform'
41
+ defineOptions({
42
+ name: 'NoticeBarItem',
43
+ options: {
44
+ addGlobalClass: true,
45
+ virtualHost: true,
46
+ styleIsolation: 'shared',
47
+ },
48
+ })
49
+ const props = withDefaults(defineProps<NoticeBarItemProps>(), {
50
+ textSpeed: 1,
51
+ })
52
+ // const { proxy } = getCurrentInstance() as any
53
+ const showAni = computed(() => {
54
+ // const query = uni.createSelectorQuery().in(proxy)
55
+ // query.select('.noticeBar').boundingClientRect()
56
+ // query.exec((res) => {
57
+ // console.log(res)
58
+ // })
59
+ const len = props.item?.noticeContent?.length || 0
60
+ // console.log('showAni', props.idx, len)
61
+ return props.current === props.idx && len > 25
62
+ })
63
+
64
+ function getTime(text: string | undefined) {
65
+ const len = text?.length || 0
66
+ // console.log('item---', props.textSpeed)
67
+ return `${((50 - len) / 10) * props.textSpeed + 3}s`
68
+ }
69
+ </script>
70
+ <style lang="scss" scoped>
71
+ .noticeBar {
72
+ height: 72rpx;
73
+ }
74
+
75
+ .noticeItem {
76
+ height: 72rpx;
77
+ line-height: 72rpx;
78
+ transform: translateZ(0.5px);
79
+ line-clamp: 1;
80
+ white-space: nowrap;
81
+ text-overflow: ellipsis;
82
+ word-break: break-all;
83
+ animation-delay: 0.5s;
84
+ animation-direction: normal;
85
+ animation-duration: 3s;
86
+ animation-fill-mode: forwards;
87
+ animation-play-state: running;
88
+ animation-range-end: normal;
89
+ animation-range-start: normal;
90
+ animation-timeline: auto;
91
+ animation-timing-function: linear;
92
+ }
93
+
94
+ .infinite {
95
+ animation-iteration-count: infinite;
96
+ }
97
+
98
+ .animation {
99
+ animation-name: change;
100
+ // animation-duration: 5s;
101
+ }
102
+
103
+ @keyframes change {
104
+ 0% {
105
+ transform: translate(0%);
106
+ }
107
+
108
+ 100% {
109
+ transform: translate(-60%);
110
+ }
111
+ }
112
+ </style>