@tplc/business 0.4.60 → 0.4.61

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,13 @@
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.4.61](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.60...v0.4.61) (2025-04-06)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 调整 ([6fff186](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6fff186f6a6630b7389337c269c291aa6982be72))
11
+
5
12
  ### [0.4.60](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.59...v0.4.60) (2025-04-06)
6
13
 
7
14
 
package/action.d.ts CHANGED
@@ -34,7 +34,7 @@ export interface LcbGlobal {
34
34
  }
35
35
  userStore?: () => {
36
36
  userInfo: Record<string, any>
37
- updateUser: (data: Record<string, any>) => void
37
+ updateUser: (data: Record<string, any>, isLogin?: boolean) => void
38
38
  getUser: () => void
39
39
  }
40
40
  getIsTabbar: () => boolean
@@ -4,6 +4,7 @@
4
4
  :style="{
5
5
  ...innerStyle,
6
6
  }"
7
+ v-if="dynamicKey && hideWhenDynamicKeyNotExist ? dynamicValue : true"
7
8
  >
8
9
  <lcb-block
9
10
  v-bind="$props"
@@ -15,15 +16,24 @@
15
16
  }"
16
17
  >
17
18
  <lcb-action-view v-bind="action" @avatar="onAvatar">
18
- <template v-if="mode === 'image'">
19
- <wd-img
20
- :src="innerValue || props.url"
21
- :width="imageWidth"
22
- :height="imageHeight"
23
- mode="aspectFit"
19
+ <view class="!flex items-center justify-center" :style="`gap: ${iconGap}rpx`">
20
+ <wd-icon
21
+ v-if="icon"
22
+ :name="icon"
23
+ class-prefix="lcb"
24
+ :size="transformValueUnit(iconSize)"
25
+ :color="iconColor"
24
26
  />
25
- </template>
26
- <template v-else>{{ innerValue || props.text }}</template>
27
+ <template v-if="mode === 'image'">
28
+ <wd-img
29
+ :src="innerValue || props.url"
30
+ :width="imageWidth"
31
+ :height="imageHeight"
32
+ mode="aspectFit"
33
+ />
34
+ </template>
35
+ <template v-else>{{ innerValue || props.text }}</template>
36
+ </view>
27
37
  </lcb-action-view>
28
38
  </lcb-block>
29
39
  </view>
@@ -33,7 +43,7 @@
33
43
  import { computed, inject, Ref } from 'vue'
34
44
  import { LcbButtonProps } from './types'
35
45
  import { PAGE_PROVIDE_KEY } from '../../constants'
36
- import { getFlexStyle } from '../../utils/transform'
46
+ import { getFlexStyle, transformValueUnit } from '../../utils/transform'
37
47
  defineOptions({
38
48
  name: 'LcbButton',
39
49
  options: {
@@ -45,10 +55,14 @@ defineOptions({
45
55
  const props = withDefaults(defineProps<LcbButtonProps>(), {
46
56
  color: '#ffffff',
47
57
  backgroundColor: 'var(--wot-color-theme)',
58
+ hideWhenDynamicKeyNotExist: false,
59
+ iconGap: 4,
60
+ iconSize: 24,
48
61
  })
49
62
  const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
50
63
  const userStore = uni.$lcb.userStore?.()
51
- const innerValue = computed(() => {
64
+
65
+ const dynamicValue = computed(() => {
52
66
  let value = ''
53
67
  if (props.dynamicKey) {
54
68
  if (props.keyFromUser) {
@@ -57,6 +71,10 @@ const innerValue = computed(() => {
57
71
  value = pageInfo.value?.[props.dynamicKey]
58
72
  }
59
73
  }
74
+ return value
75
+ })
76
+ const innerValue = computed(() => {
77
+ let value = ''
60
78
  if (props.text.includes('${')) {
61
79
  value = props.text.replace(/\$\{([^}]+)\}/g, (_, p1) => {
62
80
  if (props.keyFromUser) {
@@ -69,9 +87,12 @@ const innerValue = computed(() => {
69
87
  return value
70
88
  })
71
89
  const onAvatar = (headImgUrl) => {
72
- userStore?.updateUser({
73
- headImgUrl,
74
- })
90
+ userStore?.updateUser(
91
+ {
92
+ headImgUrl,
93
+ },
94
+ true,
95
+ )
75
96
  }
76
97
  const innerStyle = computed(() => {
77
98
  return getFlexStyle(props.align)
@@ -12,6 +12,12 @@ export interface LcbButtonProps extends LcbBlockProps {
12
12
  keyFromUser?: boolean
13
13
  fillWidth?: boolean
14
14
  fillHeight?: boolean
15
+ icon?: string
16
+ iconSize?: number
17
+ iconColor?: string
18
+ iconGap?: number
19
+ // 动态值不存在就不显示
20
+ hideWhenDynamicKeyNotExist?: boolean
15
21
  itemAlign?:
16
22
  | 'top-left'
17
23
  | 'top-center'
@@ -30,11 +30,14 @@
30
30
  }"
31
31
  />
32
32
 
33
- <wd-img
33
+ <img
34
34
  v-if="item.iconType === 1"
35
- :height="transformValueUnit(iconSize)"
36
- :width="transformValueUnit(iconSize)"
37
35
  :src="item.iconUpload"
36
+ mode="aspectFit"
37
+ :style="{
38
+ height: transformValueUnit(iconSize),
39
+ width: transformValueUnit(iconSize),
40
+ }"
38
41
  />
39
42
  </wd-badge>
40
43
  </view>
@@ -14,7 +14,7 @@
14
14
  height: transformValueUnit(photoSize),
15
15
  round: photoRound,
16
16
  src:
17
- userStore?.userInfo?.headImgUrl ||
17
+ (userStore?.userInfo?.loginFlag && userStore?.userInfo?.headImgUrl) ||
18
18
  'https://lycs.eluying.com/material/icon/1/20240925185540/userPhoto.jpg',
19
19
  }"
20
20
  custom-class="mr-40rpx bg-#eee"
@@ -194,9 +194,12 @@ const phoneHandler = () => {
194
194
  })
195
195
  }
196
196
  const onAvatar = (headImgUrl) => {
197
- userStore?.updateUser({
198
- headImgUrl,
199
- })
197
+ userStore?.updateUser(
198
+ {
199
+ headImgUrl,
200
+ },
201
+ true,
202
+ )
200
203
  }
201
204
  const toEdit = () => {
202
205
  uni.navigateTo({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.60",
3
+ "version": "0.4.61",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -5,6 +5,9 @@ declare const _default: import('vue').DefineComponent<
5
5
  {
6
6
  color: string
7
7
  backgroundColor: string
8
+ hideWhenDynamicKeyNotExist: boolean
9
+ iconGap: number
10
+ iconSize: number
8
11
  }
9
12
  >,
10
13
  {},
@@ -23,6 +26,9 @@ declare const _default: import('vue').DefineComponent<
23
26
  {
24
27
  color: string
25
28
  backgroundColor: string
29
+ hideWhenDynamicKeyNotExist: boolean
30
+ iconGap: number
31
+ iconSize: number
26
32
  }
27
33
  >
28
34
  >
@@ -30,6 +36,9 @@ declare const _default: import('vue').DefineComponent<
30
36
  {
31
37
  backgroundColor: string
32
38
  color: string
39
+ iconSize: number
40
+ iconGap: number
41
+ hideWhenDynamicKeyNotExist: boolean
33
42
  },
34
43
  {}
35
44
  >
@@ -11,6 +11,11 @@ export interface LcbButtonProps extends LcbBlockProps {
11
11
  keyFromUser?: boolean
12
12
  fillWidth?: boolean
13
13
  fillHeight?: boolean
14
+ icon?: string
15
+ iconSize?: number
16
+ iconColor?: string
17
+ iconGap?: number
18
+ hideWhenDynamicKeyNotExist?: boolean
14
19
  itemAlign?:
15
20
  | 'top-left'
16
21
  | 'top-center'