@tplc/business 0.4.59 → 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,20 @@
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
+
12
+ ### [0.4.60](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.59...v0.4.60) (2025-04-06)
13
+
14
+
15
+ ### ✨ Features | 新功能
16
+
17
+ * 调整数据 ([3778c3c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/3778c3caf8ff0193ebac4206945b52c75be8d7af))
18
+
5
19
  ### [0.4.59](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.58...v0.4.59) (2025-04-05)
6
20
 
7
21
 
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
@@ -140,6 +140,20 @@ const onActionClick = async () => {
140
140
  break
141
141
  /** 退出登录 */
142
142
  case 13:
143
+ uni.showModal({
144
+ title: '提示',
145
+ content: '确定退出登录吗?',
146
+ success: async (res) => {
147
+ if (res.confirm) {
148
+ await uni.$lcb.http.post('/user/user/loginout')
149
+ uni.$lcb.userStore?.().updateUser({
150
+ phone: '',
151
+ userName: '',
152
+ headImgUrl: '',
153
+ })
154
+ }
155
+ },
156
+ })
143
157
  break
144
158
  /** 小程序弹框 */
145
159
  case 14:
@@ -150,7 +164,6 @@ const onActionClick = async () => {
150
164
  if (url) {
151
165
  onPageScrollSelector(url)
152
166
  }
153
-
154
167
  break
155
168
  case 17:
156
169
  if (props.requestInfo)
@@ -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,7 +30,12 @@
30
30
  <view class="flex items-center justify-center text-[var(--content-color)] gap-16rpx">
31
31
  <lcb-city-select :location="userLocation" v-model="addressCity">
32
32
  <view class="flex items-center gap-16rpx">
33
- <view class="text-30rpx max-w-13 truncate">
33
+ <view
34
+ class="max-w-14 truncate"
35
+ :style="{
36
+ fontSize: (addressCity?.addressName || '').length > 4 ? '22rpx' : '30rpx',
37
+ }"
38
+ >
34
39
  {{ addressCity?.addressName || '全国' }}
35
40
  </view>
36
41
  <img
@@ -26,7 +26,7 @@
26
26
  ]"
27
27
  >
28
28
  <lcb-action-view
29
- v-for="(item, index) in items"
29
+ v-for="(item, index) in renderItems"
30
30
  :key="item.title"
31
31
  v-bind="item.link"
32
32
  @click="onItemClick(item)"
@@ -59,6 +59,7 @@
59
59
  :color="iconColor"
60
60
  />
61
61
  <wd-img
62
+ v-else
62
63
  :width="iconSize + 'rpx'"
63
64
  :height="iconSize + 'rpx'"
64
65
  :radius="iconRadius + 'rpx'"
@@ -89,10 +90,14 @@
89
90
  </template>
90
91
 
91
92
  <script lang="ts" setup>
93
+ import { computed, inject, Ref } from 'vue'
92
94
  import { ActionView } from '../../action'
93
95
  import { transformValueUnit } from '../../utils/transform'
94
96
  import { LcbImgNavProps } from './types'
97
+ import { PAGE_PROVIDE_KEY } from '../../constants'
95
98
  const emits = defineEmits(['click'])
99
+ const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
100
+ const userStore = uni.$lcb.userStore?.()
96
101
  const onItemClick = (item: ActionView) => {
97
102
  emits('click', item)
98
103
  }
@@ -105,7 +110,7 @@ defineOptions({
105
110
  },
106
111
  })
107
112
 
108
- withDefaults(defineProps<LcbImgNavProps>(), {
113
+ const props = withDefaults(defineProps<LcbImgNavProps>(), {
109
114
  textColor: '#212121',
110
115
  iconColor: '#212121',
111
116
  iconRadius: 0,
@@ -125,6 +130,21 @@ withDefaults(defineProps<LcbImgNavProps>(), {
125
130
  arrowSize: 44,
126
131
  arrowColor: '#212121',
127
132
  })
133
+
134
+ const renderItems = computed(() => {
135
+ return (
136
+ props.items?.filter((item) => {
137
+ if (item.dependKey) {
138
+ if (item.keyFromUser) {
139
+ return Boolean(userStore?.userInfo?.[item.dependKey])
140
+ } else {
141
+ return Boolean(pageInfo.value?.[item.dependKey])
142
+ }
143
+ }
144
+ return true
145
+ }) || []
146
+ )
147
+ })
128
148
  </script>
129
149
 
130
150
  <style lang="scss" scoped>
@@ -13,7 +13,12 @@ export interface LcbImgNavProps extends LcbBlockProps {
13
13
  /** 图标类型 0.系统 1.自定义 */
14
14
  iconType?: 0 | 1
15
15
  /** 数据内容 */
16
- items?: ActionView[]
16
+ items?: (ActionView & {
17
+ /** 依赖值 */
18
+ dependKey?: string
19
+ /** 依赖值类型 */
20
+ keyFromUser?: boolean
21
+ })[]
17
22
  /** 排布方式每行几个 */
18
23
  pictureDistribution?: 3 | 4 | 5
19
24
  /** 图标尺寸 0.小40px 2.大50px */
@@ -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"
@@ -33,7 +33,13 @@
33
33
  授权登录
34
34
  </view>
35
35
  <view v-else class="leading-none">
36
- <view class="text-32rpx font-#000 font-500 mb-20rpx">
36
+ <view
37
+ class="text-32rpx font-#000 font-500 mb-20rpx"
38
+ :style="{
39
+ fontSize: transformValueUnit(textSize),
40
+ color: textColor,
41
+ }"
42
+ >
37
43
  {{ userStore?.userInfo?.userName || '微信用户' }}
38
44
  </view>
39
45
  <view class="flex" @click="toEdit">
@@ -41,7 +47,7 @@
41
47
  class="flex flex-content-center flex-items-center mt-5px border-style-solid"
42
48
  :style="{
43
49
  color: textColor,
44
- borderWidth: editBorder ? transformValueUnit(1) : 0,
50
+ borderWidth: editBorder ? transformValueUnit(2) : 0,
45
51
  borderColor: textColor,
46
52
  padding: editBorder ? `2px ${editSize / 2.5}px 2px ${editSize / 2.5}px` : '',
47
53
  borderRadius: transformValueUnit(30),
@@ -188,9 +194,12 @@ const phoneHandler = () => {
188
194
  })
189
195
  }
190
196
  const onAvatar = (headImgUrl) => {
191
- userStore?.updateUser({
192
- headImgUrl,
193
- })
197
+ userStore?.updateUser(
198
+ {
199
+ headImgUrl,
200
+ },
201
+ true,
202
+ )
194
203
  }
195
204
  const toEdit = () => {
196
205
  uni.navigateTo({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.59",
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'
@@ -12,7 +12,12 @@ export interface LcbImgNavProps extends LcbBlockProps {
12
12
  /** 图标类型 0.系统 1.自定义 */
13
13
  iconType?: 0 | 1
14
14
  /** 数据内容 */
15
- items?: ActionView[]
15
+ items?: (ActionView & {
16
+ /** 依赖值 */
17
+ dependKey?: string
18
+ /** 依赖值类型 */
19
+ keyFromUser?: boolean
20
+ })[]
16
21
  /** 排布方式每行几个 */
17
22
  pictureDistribution?: 3 | 4 | 5
18
23
  /** 图标尺寸 0.小40px 2.大50px */