@tplc/business 0.4.112 → 0.4.113

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,23 @@
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.113](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.111...v0.4.113) (2025-05-14)
6
+
7
+
8
+ ### 🚀 Chore | 构建/工程依赖/工具
9
+
10
+ * **release:** 0.4.112 ([4cf93e5](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/4cf93e53809128aa4d13200eb590e030e47a47ef))
11
+
12
+
13
+ ### ✨ Features | 新功能
14
+
15
+ * history 根据productName唯一 ([27149ba](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/27149ba0de8dd19cb84be79703d9915222634a99))
16
+ * propmt ([7904ba7](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7904ba753b23dd38ca995c64a2a9c269ad9c95de))
17
+ * 动态参数抽离 ([0082963](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/008296339ba898c05f241c8e78f54ddb39214f8b))
18
+ * 同步button text ([54e3778](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/54e3778dd724cfa489ef911c6cb37383001f9075))
19
+ * 定位调整为gcj02 ([9bf188c](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/9bf188c1216959c75ea7583254bfc87684d5245a))
20
+ * 新增下载地址 ([0885ce4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/0885ce48b5fc836461c0df3191cb2abb1605262e))
21
+
5
22
  ### [0.4.112](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.102...v0.4.112) (2025-05-14)
6
23
 
7
24
 
@@ -16,7 +16,7 @@
16
16
  ...innerItemStyle,
17
17
  }"
18
18
  >
19
- <lcb-action-view v-bind="action" @avatar="onAvatar">
19
+ <lcb-action-view v-bind="actionProps" @avatar="onAvatar">
20
20
  <view class="!flex items-center justify-center" :style="`gap: ${iconGap}rpx`">
21
21
  <wd-icon
22
22
  v-if="icon"
@@ -47,7 +47,7 @@ import { computed, inject, Ref } from 'vue'
47
47
  import { LcbButtonProps } from './types'
48
48
  import { PAGE_PROVIDE_KEY } from '../../constants'
49
49
  import { getFlexStyle, transformValueUnit } from '../../utils/transform'
50
- import { get } from 'lodash-es'
50
+ import { getDynamicData } from '../../utils/utils'
51
51
  defineOptions({
52
52
  name: 'LcbButton',
53
53
  options: {
@@ -69,11 +69,10 @@ const userStore = uni.$lcb.userStore?.()
69
69
  const dynamicValue = computed(() => {
70
70
  let value = ''
71
71
  if (props.dynamicKey) {
72
- if (props.keyFromUser) {
73
- value = get(userStore?.userInfo, props.dynamicKey)
74
- } else {
75
- value = get(pageInfo.value, props.dynamicKey)
76
- }
72
+ value = getDynamicData(props.dynamicKey, {
73
+ store: props.keyFromUser ? userStore?.userInfo : pageInfo.value,
74
+ defaultText: props.textDefaultValue,
75
+ })
77
76
  }
78
77
  return value
79
78
  })
@@ -81,17 +80,20 @@ const innerValue = computed(() => {
81
80
  if (props.mode === 'image') {
82
81
  return dynamicValue.value || props.url
83
82
  }
84
- let value = props.text
85
- if (props.text && props.text.includes('${')) {
86
- value = props.text.replace(/\$\{([^}]+)\}/g, (_, p) => {
87
- if (props.keyFromUser) {
88
- return get(userStore?.userInfo, p) ?? props.textDefaultValue ?? ''
89
- } else {
90
- return get(pageInfo.value, p) ?? props.textDefaultValue ?? ''
91
- }
92
- })
83
+ return getDynamicData(props.text, {
84
+ store: props.keyFromUser ? userStore?.userInfo : pageInfo.value,
85
+ defaultText: props.textDefaultValue,
86
+ })
87
+ })
88
+
89
+ /** 处理跳转链接中的动态参数 */
90
+ const actionProps = computed(() => {
91
+ return {
92
+ ...props.action,
93
+ jumpUrl: getDynamicData(props.action?.jumpUrl, {
94
+ store: props.keyFromUser ? userStore?.userInfo : pageInfo.value,
95
+ }),
93
96
  }
94
- return value
95
97
  })
96
98
  const onAvatar = (headImgUrl) => {
97
99
  userStore?.updateUser(
@@ -67,10 +67,10 @@ async function link({ item }: { item: IPageBtn }) {
67
67
  inputError: '内容不能为空',
68
68
  inputValidate: (value) => Boolean(value),
69
69
  })
70
- .then(async () => {
70
+ .then(async ({ value }) => {
71
71
  await uni.$lcb.http.post(item.requestUrl, {
72
72
  ...item.requestParam,
73
- [item.popUpRequestInfo.inputKey]: formValue.value,
73
+ [item.popUpRequestInfo.inputKey]: value,
74
74
  })
75
75
  emits('refresh')
76
76
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.112",
3
+ "version": "0.4.113",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -23,3 +23,14 @@ export declare const calculateImageHeight: (
23
23
  ) => number
24
24
  export declare const customUpload: UploadMethod
25
25
  export declare const getSharePath: () => string
26
+ /** 获取动态数据 */
27
+ export declare const getDynamicData: (
28
+ text: string | undefined,
29
+ {
30
+ store,
31
+ defaultText,
32
+ }: {
33
+ store?: Record<string, any>
34
+ defaultText?: string
35
+ },
36
+ ) => string
package/utils/utils.ts CHANGED
@@ -2,6 +2,7 @@ import { isH5 } from '@tplc/wot/components/common/util'
2
2
  import { UploadMethod } from '@tplc/wot/types/components/wd-upload/types'
3
3
  import { uploadFile } from '../hooks/useUpload'
4
4
  import { parse, stringify } from 'qs'
5
+ import { get } from 'lodash-es'
5
6
  export function formatJson(str: string | object | undefined, defVal = {}) {
6
7
  if (!str) return defVal
7
8
  if (typeof str === 'object') return str
@@ -119,3 +120,23 @@ export const getSharePath = () => {
119
120
  distributorId: uni.$lcb.userStore?.()?.userInfo?.distributorId,
120
121
  })}`
121
122
  }
123
+
124
+ /** 获取动态数据 */
125
+ export const getDynamicData = (
126
+ text = '',
127
+ {
128
+ store,
129
+ defaultText,
130
+ }: {
131
+ store?: Record<string, any>
132
+ defaultText?: string
133
+ },
134
+ ) => {
135
+ let value = text
136
+ if (text && text.includes('${')) {
137
+ value = text.replace(/\$\{([^}]+)\}/g, (_, p) => {
138
+ return get(store, p) ?? defaultText ?? ''
139
+ })
140
+ }
141
+ return value
142
+ }