@tplc/business 0.5.77 → 0.5.79
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 +25 -0
- package/components/lcb-area/lcb-area.vue +4 -5
- package/components/lcb-block/lcb-block.vue +13 -8
- package/components/lcb-block/types.ts +1 -0
- package/components/lcb-button/lcb-button.vue +6 -9
- package/components/lcb-button/types.ts +1 -0
- package/components/lcb-wrapper-list/lcb-wrapper-list.vue +11 -8
- package/hooks/useDynamicData.ts +18 -0
- package/package.json +1 -1
- package/types/components/lcb-block/types.d.ts +1 -0
- package/types/components/lcb-button/types.d.ts +1 -0
- package/types/components/lcb-list/lcb-list.vue.d.ts +1 -0
- package/types/hooks/useDynamicData.d.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
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.5.79](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.78...v0.5.79) (2025-12-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 支持页面 ([ed64824](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/ed648247161824f029876925944668d16e68bca6))
|
|
11
|
+
|
|
12
|
+
### [0.5.78](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.76...v0.5.78) (2025-12-05)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🚀 Chore | 构建/工程依赖/工具
|
|
16
|
+
|
|
17
|
+
* **release:** 0.5.77 ([3ab3f4e](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/3ab3f4ec0c8a1355818b4f8ee4ba24ca981d068d))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
21
|
+
|
|
22
|
+
* dynamicStyleOptions 支持旧数据 ([2317541](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/23175418f5306e754ae29d58779d7d51fc507a31))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### ✨ Features | 新功能
|
|
26
|
+
|
|
27
|
+
* wrapper 支持嵌套 ([1bed138](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/1bed138292c76209e91588b49474903d9a89b9da))
|
|
28
|
+
* 支持属性上下文修改 ([e4a9f58](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/e4a9f583dd701f15cad9f656566e17fdaa6886fe))
|
|
29
|
+
|
|
5
30
|
### [0.5.77](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.74...v0.5.77) (2025-12-05)
|
|
6
31
|
|
|
7
32
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:style="{
|
|
6
6
|
display: display,
|
|
7
7
|
gap: transformValueUnit(gap),
|
|
8
|
-
overflowX: scrollX ? 'auto' : '
|
|
8
|
+
overflowX: scrollX ? 'auto' : 'hidden',
|
|
9
9
|
...innerStyle,
|
|
10
10
|
}"
|
|
11
11
|
class="h-full"
|
|
@@ -59,7 +59,6 @@ const innerStyle = computed(() => {
|
|
|
59
59
|
alignItems: 'stretch',
|
|
60
60
|
}
|
|
61
61
|
})
|
|
62
|
-
|
|
63
62
|
const getStyle = (index: number) => {
|
|
64
63
|
const flex = props.areaFlexs?.[index]?.flex ?? 1
|
|
65
64
|
return {
|
|
@@ -75,11 +74,11 @@ const getStyle = (index: number) => {
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
const getData = async () => {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
77
|
+
const dynamicData = await dynamicRequest(props.dataSource, pageInfo.value, userStore?.userInfo)
|
|
78
|
+
if (dynamicData) {
|
|
80
79
|
pageInfo.value = {
|
|
81
80
|
...pageInfo.value,
|
|
82
|
-
...
|
|
81
|
+
...dynamicData,
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
padding: `${transformValueUnit(paddingTop || paddingVertical || 0)} ${transformValueUnit(paddingRight || paddingHorizontal || 0)} ${transformValueUnit(paddingBottom || paddingVertical || 0)} ${transformValueUnit(paddingLeft || paddingHorizontal || 0)}`,
|
|
6
6
|
borderRadius: `${transformValueUnit(topRadius || radius)} ${transformValueUnit(topRadius || radius)} ${transformValueUnit(bottomRadius || radius)} ${transformValueUnit(bottomRadius || radius)}`,
|
|
7
7
|
color,
|
|
8
|
-
background: `${backgroundPosition} / ${backgroundSize} ${backgroundRepeat} url('${
|
|
8
|
+
background: `${backgroundPosition} / ${backgroundSize} ${backgroundRepeat} url('${dynamicBgImage}'), ${innerBackgroundColor || 'transparent'}`,
|
|
9
9
|
fontSize: transformValueUnit(fontSize),
|
|
10
10
|
fontWeight,
|
|
11
11
|
borderColor,
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script setup lang="ts">
|
|
31
|
-
import { LcbBlockInnerProps } from './types'
|
|
32
|
-
import { transformValueUnit, getFlexStyle } from '../../utils/transform'
|
|
33
|
-
import { computed, inject, Ref } from 'vue'
|
|
34
|
-
import { PAGE_PROVIDE_KEY } from '../../constants'
|
|
35
31
|
import { get } from 'lodash-es'
|
|
32
|
+
import { computed } from 'vue'
|
|
33
|
+
import useDynamicData from '../../hooks/useDynamicData'
|
|
34
|
+
import { getFlexStyle, transformValueUnit } from '../../utils/transform'
|
|
35
|
+
import { LcbBlockInnerProps } from './types'
|
|
36
36
|
defineOptions({
|
|
37
37
|
name: 'LcbBlock',
|
|
38
38
|
options: {
|
|
@@ -50,8 +50,13 @@ const props = withDefaults(defineProps<LcbBlockInnerProps>(), {
|
|
|
50
50
|
fontSize: 24,
|
|
51
51
|
position: 'relative',
|
|
52
52
|
})
|
|
53
|
-
const
|
|
54
|
-
const
|
|
53
|
+
const { userStore, innerDynamicData } = useDynamicData()
|
|
54
|
+
const dynamicBgImage = computed(() => {
|
|
55
|
+
return (
|
|
56
|
+
(props.dynamicBgImage && get(innerDynamicData.value, props.dynamicBgImage)) ||
|
|
57
|
+
props.backgroundImage
|
|
58
|
+
)
|
|
59
|
+
})
|
|
55
60
|
// 透明度+颜色
|
|
56
61
|
const innerBackgroundColor = computed(() => {
|
|
57
62
|
if (!props.backgroundColor) return ''
|
|
@@ -67,7 +72,7 @@ const getInnerStyle = computed(() => {
|
|
|
67
72
|
const currentOptions = props.dynamicStyleOptions[key]
|
|
68
73
|
if (key) {
|
|
69
74
|
const data = get(
|
|
70
|
-
currentOptions.keyFrom === 'user' ? userStore?.userInfo :
|
|
75
|
+
currentOptions.keyFrom === 'user' ? userStore?.userInfo : innerDynamicData.value,
|
|
71
76
|
currentOptions.dynamicKey,
|
|
72
77
|
)
|
|
73
78
|
if (data) {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
v-if="innerValue"
|
|
47
47
|
/>
|
|
48
48
|
</template>
|
|
49
|
-
<text v-else style="line-height: 1.54">
|
|
49
|
+
<text v-else style="line-height: 1.54" :class="{ truncate: textTruncate }">
|
|
50
50
|
{{ innerValue }}
|
|
51
51
|
</text>
|
|
52
52
|
</view>
|
|
@@ -62,6 +62,7 @@ import { PAGE_PROVIDE_KEY, WRAPPER_ITEM_KEY } from '../../constants'
|
|
|
62
62
|
import { getFlexStyle, transformValueUnit } from '../../utils/transform'
|
|
63
63
|
import { getDynamicData } from '../../utils/utils'
|
|
64
64
|
import { get } from 'lodash-es'
|
|
65
|
+
import useDynamicData from '../../hooks/useDynamicData'
|
|
65
66
|
defineOptions({
|
|
66
67
|
name: 'LcbButton',
|
|
67
68
|
options: {
|
|
@@ -79,14 +80,10 @@ const props = withDefaults(defineProps<LcbButtonProps>(), {
|
|
|
79
80
|
iconSize: 24,
|
|
80
81
|
qrCodeSize: 100,
|
|
81
82
|
})
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
const userStore = uni.$lcb.userStore?.()
|
|
85
|
-
const innerStore = computed(() => {
|
|
86
|
-
return wrapperItemData ? wrapperItemData.value : pageInfo.value
|
|
87
|
-
})
|
|
83
|
+
const { userStore, innerDynamicData } = useDynamicData()
|
|
84
|
+
|
|
88
85
|
const store = computed(() => {
|
|
89
|
-
return props.keyFromUser ? userStore?.userInfo :
|
|
86
|
+
return props.keyFromUser ? userStore?.userInfo : innerDynamicData.value
|
|
90
87
|
})
|
|
91
88
|
|
|
92
89
|
const dynamicValue = computed(() => {
|
|
@@ -118,7 +115,7 @@ const innerValue = computed(() => {
|
|
|
118
115
|
/** 处理跳转链接中的动态参数 */
|
|
119
116
|
const actionProps = computed(() => {
|
|
120
117
|
if (props.dynamicActionKey) {
|
|
121
|
-
return get(
|
|
118
|
+
return get(innerDynamicData.value, props.dynamicActionKey)
|
|
122
119
|
}
|
|
123
120
|
return {
|
|
124
121
|
...props.action,
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
|
-
import { computed, inject, Ref, ref, watchEffect } from 'vue'
|
|
18
|
-
import { LcbWrapperListProps } from './types'
|
|
19
|
-
import { PAGE_PROVIDE_KEY } from '@tplc/business/constants'
|
|
20
17
|
import { transformValueUnit } from '@tplc/business/utils/transform'
|
|
18
|
+
import { computed, ref, watchEffect } from 'vue'
|
|
19
|
+
import useDynamicData from '../../hooks/useDynamicData'
|
|
21
20
|
import { dynamicRequest } from '../../utils/request'
|
|
21
|
+
import { LcbWrapperListProps } from './types'
|
|
22
22
|
defineOptions({
|
|
23
23
|
name: 'LcbWrapperList',
|
|
24
24
|
options: {
|
|
@@ -31,8 +31,7 @@ const props = withDefaults(defineProps<LcbWrapperListProps>(), {
|
|
|
31
31
|
display: 'flex',
|
|
32
32
|
flexDirection: 'column',
|
|
33
33
|
})
|
|
34
|
-
const
|
|
35
|
-
const userStore = uni.$lcb.userStore?.()
|
|
34
|
+
const { userStore, innerDynamicData } = useDynamicData()
|
|
36
35
|
const renderList = ref<unknown[]>([{ walletAmount: 1 }])
|
|
37
36
|
|
|
38
37
|
const transformStringArrayToObjectArray = (data: unknown[]): unknown[] => {
|
|
@@ -46,9 +45,13 @@ const transformStringArrayToObjectArray = (data: unknown[]): unknown[] => {
|
|
|
46
45
|
|
|
47
46
|
watchEffect(async () => {
|
|
48
47
|
let data: unknown[] = []
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const dynamicData = await dynamicRequest(
|
|
49
|
+
props.dataSource,
|
|
50
|
+
innerDynamicData.value,
|
|
51
|
+
userStore?.userInfo,
|
|
52
|
+
)
|
|
53
|
+
if (dynamicData) {
|
|
54
|
+
data = dynamicData
|
|
52
55
|
}
|
|
53
56
|
// 转换字符串数组为对象数组的辅助函数
|
|
54
57
|
renderList.value = Array.isArray(data) ? transformStringArrayToObjectArray(data) : []
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PAGE_PROVIDE_KEY, WRAPPER_ITEM_KEY } from '../constants'
|
|
2
|
+
import { computed, inject, Ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const useDynamicData = (formUser = false) => {
|
|
5
|
+
const pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
|
|
6
|
+
const wrapperItemData = inject(WRAPPER_ITEM_KEY, {}) as unknown as Ref<Record<string, any>>
|
|
7
|
+
const userStore = uni.$lcb.userStore?.()
|
|
8
|
+
const innerDynamicData = computed(() => {
|
|
9
|
+
return formUser ? userStore?.userInfo : wrapperItemData.value
|
|
10
|
+
})
|
|
11
|
+
return {
|
|
12
|
+
pageInfo,
|
|
13
|
+
wrapperItemData,
|
|
14
|
+
userStore,
|
|
15
|
+
innerDynamicData,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default useDynamicData
|
package/package.json
CHANGED
|
@@ -66,6 +66,7 @@ declare const __VLS_component: import('vue').DefineComponent<
|
|
|
66
66
|
| 'bottom-center'
|
|
67
67
|
| 'bottom-right'
|
|
68
68
|
dynamicStyleOptions: Record<string, import('../../action').DynamicOptions>
|
|
69
|
+
dynamicBgImage: string
|
|
69
70
|
gap: number
|
|
70
71
|
imageWidth: number
|
|
71
72
|
borderRadius: number
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from 'vue'
|
|
2
|
+
declare const useDynamicData: (formUser?: boolean) => {
|
|
3
|
+
pageInfo: Ref<Record<string, any>>
|
|
4
|
+
wrapperItemData: Ref<Record<string, any>>
|
|
5
|
+
userStore:
|
|
6
|
+
| {
|
|
7
|
+
userInfo: Record<string, any>
|
|
8
|
+
updateUser: (data: Record<string, any>, isLogin?: boolean) => void
|
|
9
|
+
getUser: () => void
|
|
10
|
+
}
|
|
11
|
+
| undefined
|
|
12
|
+
innerDynamicData: import('vue').ComputedRef<Record<string, any> | undefined>
|
|
13
|
+
}
|
|
14
|
+
export default useDynamicData
|