@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 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
 
@@ -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 {
@@ -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('${backgroundImage}'), ${innerBackgroundColor || 'transparent'}`,
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 pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
54
- const userStore = uni.$lcb.userStore?.()
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 : pageInfo.value,
75
+ currentOptions.keyFrom === 'user' ? userStore?.userInfo : innerDynamicData.value,
71
76
  currentOptions.dynamicKey,
72
77
  )
73
78
  if (data) {
@@ -59,6 +59,7 @@ export interface LcbBlockProps {
59
59
 
60
60
  // 动态样式集合
61
61
  dynamicStyleOptions?: Record<string, DynamicOptions>
62
+ dynamicBgImage?: string
62
63
  }
63
64
  export interface LcbBlockInnerProps extends LcbBlockProps {
64
65
  [key: string]: any
@@ -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 pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
83
- const wrapperItemData = inject(WRAPPER_ITEM_KEY, undefined) as unknown as Ref<Record<string, any>>
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 : innerStore.value
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(innerStore.value, props.dynamicActionKey)
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 pageInfo = inject(PAGE_PROVIDE_KEY) as Ref<Record<string, any>>
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 daynamicData = await dynamicRequest(
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 (daynamicData) {
59
- data = daynamicData
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.5.78",
3
+ "version": "0.5.79",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -55,6 +55,7 @@ export interface LcbBlockProps {
55
55
  | 'bottom-center'
56
56
  | 'bottom-right'
57
57
  dynamicStyleOptions?: Record<string, DynamicOptions>
58
+ dynamicBgImage?: string
58
59
  }
59
60
  export interface LcbBlockInnerProps extends LcbBlockProps {
60
61
  [key: string]: any
@@ -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