@tplc/business 0.5.78 → 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 +7 -0
- package/components/lcb-area/lcb-area.vue +0 -1
- package/components/lcb-block/lcb-block.vue +13 -8
- package/components/lcb-block/types.ts +1 -0
- package/components/lcb-button/lcb-button.vue +5 -8
- package/components/lcb-wrapper-list/lcb-wrapper-list.vue +8 -14
- 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-list/lcb-list.vue.d.ts +1 -0
- package/types/hooks/useDynamicData.d.ts +14 -0
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.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
|
+
|
|
5
12
|
### [0.5.78](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.76...v0.5.78) (2025-12-05)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -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) {
|
|
@@ -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, WRAPPER_ITEM_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,9 +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?.()
|
|
36
|
-
const wrapperItemData = inject(WRAPPER_ITEM_KEY, undefined) as unknown as Ref<Record<string, any>>
|
|
34
|
+
const { userStore, innerDynamicData } = useDynamicData()
|
|
37
35
|
const renderList = ref<unknown[]>([{ walletAmount: 1 }])
|
|
38
36
|
|
|
39
37
|
const transformStringArrayToObjectArray = (data: unknown[]): unknown[] => {
|
|
@@ -47,17 +45,13 @@ const transformStringArrayToObjectArray = (data: unknown[]): unknown[] => {
|
|
|
47
45
|
|
|
48
46
|
watchEffect(async () => {
|
|
49
47
|
let data: unknown[] = []
|
|
50
|
-
const
|
|
48
|
+
const dynamicData = await dynamicRequest(
|
|
51
49
|
props.dataSource,
|
|
52
|
-
|
|
53
|
-
...pageInfo.value,
|
|
54
|
-
...(wrapperItemData?.value || {}),
|
|
55
|
-
},
|
|
50
|
+
innerDynamicData.value,
|
|
56
51
|
userStore?.userInfo,
|
|
57
52
|
)
|
|
58
|
-
if (
|
|
59
|
-
data =
|
|
60
|
-
console.log('daynamicData', data, props.dataSource)
|
|
53
|
+
if (dynamicData) {
|
|
54
|
+
data = dynamicData
|
|
61
55
|
}
|
|
62
56
|
// 转换字符串数组为对象数组的辅助函数
|
|
63
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
|