@tplc/business 0.4.79 → 0.4.81

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,22 @@
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.81](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.80...v0.4.81) (2025-04-29)
6
+
7
+ ### [0.4.80](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.78...v0.4.80) (2025-04-29)
8
+
9
+
10
+ ### 🚀 Chore | 构建/工程依赖/工具
11
+
12
+ * **release:** 0.4.79 ([97bdcf2](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/97bdcf25173249dd1240fcc9b824b8ad5896ad44))
13
+
14
+
15
+ ### ✨ Features | 新功能
16
+
17
+ * PAGE_DYNAMIC_DATA ([815d9de](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/815d9ded9a4b6b55893104198a2e569d39036ea8))
18
+ * 图片展示规则 ([af06680](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/af066808b6276ccd55e19c6baa711c1a3e815941))
19
+ * 新增cityArea判断 ([587bdb4](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/587bdb41d2f7e1dd8fc0f804d1a2fe58120e2708))
20
+
5
21
  ### [0.4.79](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.77...v0.4.79) (2025-04-28)
6
22
 
7
23
 
@@ -38,10 +38,10 @@
38
38
  </template>
39
39
 
40
40
  <script setup lang="ts">
41
- import { LcbFilterGridProps } from './types'
41
+ import { inject, ref } from 'vue'
42
+ import useSyncForm from '../../hooks/useSyncForm'
42
43
  import { transformValueUnit } from '../../utils/transform'
43
- import { inject, Ref, ref } from 'vue'
44
- import { FORM_KEY } from '../../constants'
44
+ import { LcbFilterGridProps } from './types'
45
45
  defineOptions({
46
46
  name: 'LcbFilterGrid',
47
47
  options: {
@@ -51,7 +51,6 @@ defineOptions({
51
51
  },
52
52
  })
53
53
  const themeColor = inject('theme-color', '#3875FF')
54
- const form = inject<Ref<Record<string, any>>>(FORM_KEY)
55
54
  const props = withDefaults(defineProps<LcbFilterGridProps>(), {
56
55
  marginHorizontal: 24,
57
56
  height: 100,
@@ -61,6 +60,7 @@ const props = withDefaults(defineProps<LcbFilterGridProps>(), {
61
60
  imgRadius: 8,
62
61
  fontSize: 28,
63
62
  })
63
+ const { syncForm } = useSyncForm(props.dynamicScope)
64
64
  const current = ref(-1)
65
65
  const handleClick = (index: number) => {
66
66
  const isCurrent = index === current.value
@@ -69,15 +69,11 @@ const handleClick = (index: number) => {
69
69
  const params = JSON.parse(props.items?.[index]?.name)
70
70
  if (isCurrent) {
71
71
  Object.keys(params).forEach((key) => {
72
- form!.value[key] = undefined
72
+ syncForm({ [key]: undefined })
73
73
  })
74
74
  return
75
75
  }
76
-
77
- form!.value = {
78
- ...form!.value,
79
- ...params,
80
- }
76
+ syncForm(params)
81
77
  } catch (error) {
82
78
  console.error(error)
83
79
  }
@@ -14,4 +14,5 @@ export interface LcbFilterGridProps extends LcbBlockProps {
14
14
  textPH?: number
15
15
  textPV?: number
16
16
  borderColor?: string
17
+ dynamicScope?: string
17
18
  }
@@ -17,12 +17,12 @@
17
17
  </template>
18
18
 
19
19
  <script setup lang="ts">
20
- import { inject, Ref, ref, watch, watchEffect, onMounted, onUnmounted } from 'vue'
20
+ import { onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'
21
21
  import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
22
- import { FORM_KEY } from '../../../../constants'
22
+ import useAutoHeight from '../../../../hooks/useAutoHeight'
23
+ import useSyncForm from '../../../../hooks/useSyncForm'
23
24
  import { getCurrentPage } from '../../../../utils/utils'
24
25
  import { LcbFilterListProps } from './type'
25
- import useAutoHeight from '../../../../hooks/useAutoHeight'
26
26
 
27
27
  defineOptions({
28
28
  name: 'FilterList',
@@ -37,7 +37,7 @@ const props = defineProps<LcbFilterListProps>()
37
37
  const dataList = ref<unknown[]>([])
38
38
  const paging = ref()
39
39
  const { height } = useAutoHeight()
40
- const form = inject<Ref<Record<string, any>>>(FORM_KEY)
40
+ const { form } = useSyncForm(props.dynamicScope)
41
41
  const refreshed = ref(false)
42
42
  useZPaging(paging)
43
43
  const modelValue = defineModel<unknown[]>({
@@ -7,4 +7,5 @@ export interface PageListProps {
7
7
  }
8
8
  export interface LcbFilterListProps extends PageListProps, LcbListInfo {
9
9
  autoHeight?: boolean
10
+ dynamicScope?: string
10
11
  }
@@ -30,6 +30,7 @@
30
30
  v-bind="{ ...info.listInfo, listType, ...props }"
31
31
  :autoHeight="!isSticky"
32
32
  v-model="items"
33
+ :dynamicScope="dynamicScope"
33
34
  @refresh="productRef?.clear?.()"
34
35
  v-if="mode === 'list'"
35
36
  >
@@ -17,6 +17,7 @@ export interface LcbListProps extends LcbBlockProps {
17
17
  layoutType?: 'vertical' | 'horizontal'
18
18
  imageRadius?: number
19
19
  itemWidth?: number // 列表项宽度
20
+ dynamicScope?: string
20
21
  }
21
22
  export interface Option {
22
23
  label: string
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { inject, Ref, ref, useAttrs, watch, watchEffect } from 'vue'
2
+ import { isH5 } from '@tplc/wot/components/common/util'
3
3
  import UWaterfall from 'uview-plus/components/u-waterfall/u-waterfall.vue'
4
- import UnconditionedLayout from '../lcb-list/components/UnconditionedLayout/index.vue'
5
- import { LcbProductProps } from './types'
4
+ import { ref, useAttrs, watch, watchEffect } from 'vue'
5
+ import useSyncForm from '../../hooks/useSyncForm'
6
6
  import { transformValueUnit } from '../../utils/transform'
7
7
  import { calculateImageHeight } from '../../utils/utils'
8
- import { isH5 } from '@tplc/wot/components/common/util'
9
- import { FORM_KEY } from '../../constants'
8
+ import UnconditionedLayout from '../lcb-list/components/UnconditionedLayout/index.vue'
9
+ import { LcbProductProps } from './types'
10
10
 
11
11
  const uWaterfallRef = ref()
12
12
  defineOptions({
@@ -29,8 +29,8 @@ const props = withDefaults(defineProps<LcbProductProps>(), {
29
29
  paddingVertical: 24,
30
30
  sourceMode: 1,
31
31
  })
32
+ const { form } = useSyncForm(props.dynamicScope)
32
33
  const renderList = ref<Record<string, any>[]>([])
33
- const form = inject<Ref<Record<string, any>>>(FORM_KEY)
34
34
  const screenWidth = isH5 ? window.innerWidth : uni.getWindowInfo().screenWidth
35
35
  watchEffect(() => {
36
36
  if (!props.filterList) return
@@ -67,7 +67,7 @@ const getData = async () => {
67
67
  const { data } = await uni.$lcb.http.post(props.requestUrl, {
68
68
  listType: props.listType,
69
69
  ...requestParams,
70
- ...form!.value,
70
+ ...form.value,
71
71
  })
72
72
  renderList.value = data as Record<string, any>[]
73
73
  } else {
@@ -76,7 +76,7 @@ const getData = async () => {
76
76
  }
77
77
  }
78
78
  watch(
79
- () => form!.value,
79
+ () => form.value,
80
80
  () => {
81
81
  if (props.listType === 'waterfall') {
82
82
  renderList.value = []
@@ -37,4 +37,5 @@ export interface LcbProductProps extends LcbBlockProps {
37
37
  backgroundColor?: string
38
38
  }
39
39
  }
40
+ dynamicScope?: string
40
41
  }
@@ -154,14 +154,16 @@ const coverImgWidth = computed(() => {
154
154
  itemProps.areaOnImg &&
155
155
  !itemProps.imgBottomIcon
156
156
  "
157
- class="absolute bottom-0 left-0 z-1 p-2 line-clamp-1 w-full box-border text-white text-3.5"
157
+ class="flex absolute bottom-0 left-0 z-1 gap-1 p-2 w-full box-border text-white text-3.5 items-center"
158
158
  :style="{
159
159
  color: itemProps.areaColor,
160
160
  fontSize: `${itemProps.areaFontSize}rpx`,
161
161
  }"
162
162
  >
163
163
  <wd-icon name="location"></wd-icon>
164
- {{ itemAttrs.cityArea }}
164
+ <view class="line-clamp-1">
165
+ {{ itemAttrs.cityArea }}
166
+ </view>
165
167
  </view>
166
168
  <slot></slot>
167
169
  </view>
@@ -16,8 +16,8 @@
16
16
  </template>
17
17
 
18
18
  <script setup lang="ts">
19
- import { FORM_KEY } from '../../../../constants'
20
- import { inject, ref, Ref, watch } from 'vue'
19
+ import { ref, watch } from 'vue'
20
+ import useSyncForm from '../../../../hooks/useSyncForm'
21
21
  import { LcbTabsProps } from '../../types'
22
22
  defineOptions({
23
23
  name: 'LcbTabsItem',
@@ -27,7 +27,7 @@ defineOptions({
27
27
  styleIsolation: 'shared',
28
28
  },
29
29
  })
30
- const form = inject<Ref<Record<string, any>>>(FORM_KEY)
30
+
31
31
  const tabs = ref()
32
32
  const props = withDefaults(defineProps<LcbTabsProps>(), {
33
33
  lineWidth: 19,
@@ -35,13 +35,10 @@ const props = withDefaults(defineProps<LcbTabsProps>(), {
35
35
  slidable: 'auto',
36
36
  slidableNum: 6,
37
37
  })
38
+ const { syncForm } = useSyncForm(props.dynamicScope)
38
39
  const handleChange = (e: { name: string }) => {
39
40
  try {
40
- const params = JSON.parse(e.name)
41
- form!.value = {
42
- ...form!.value,
43
- ...params,
44
- }
41
+ syncForm(JSON.parse(e.name))
45
42
  } catch (error) {
46
43
  console.error(error)
47
44
  }
@@ -29,13 +29,12 @@
29
29
  </template>
30
30
 
31
31
  <script setup lang="ts">
32
- import { FORM_KEY } from '../../../../constants'
33
- import { LcbTabsProps } from '../../types'
34
- import { inject, ref, Ref } from 'vue'
32
+ import { ref } from 'vue'
33
+ import useSyncForm from '../../../../hooks/useSyncForm'
35
34
  import { transformValueUnit } from '../../../../utils/transform'
36
-
37
- withDefaults(defineProps<LcbTabsProps>(), {})
38
- const form = inject<Ref<Record<string, any>>>(FORM_KEY)
35
+ import { LcbTabsProps } from '../../types'
36
+ const props = withDefaults(defineProps<LcbTabsProps>(), {})
37
+ const { syncForm } = useSyncForm(props.dynamicScope)
39
38
  const current = ref()
40
39
  defineOptions({
41
40
  name: 'LcbTagsItem',
@@ -48,11 +47,7 @@ defineOptions({
48
47
  const handleTagClick = (name: string, index: number) => {
49
48
  current.value = index
50
49
  try {
51
- const params = JSON.parse(name)
52
- form!.value = {
53
- ...form!.value,
54
- ...params,
55
- }
50
+ syncForm(JSON.parse(name))
56
51
  } catch (error) {
57
52
  console.error(error)
58
53
  }
@@ -15,4 +15,5 @@ export interface LcbTabsProps extends LcbBlockProps {
15
15
  mode?: 'tabs' | 'block'
16
16
  tagsMode?: 'scroll' | 'tiled'
17
17
  gap?: number
18
+ dynamicScope?: string
18
19
  }
package/constants.ts CHANGED
@@ -9,3 +9,5 @@ export const PAGE_ANCHOR_PROVIDE_KEY = 'page_anchor_provide'
9
9
  export const USER_BASIC_INFO = 'user_basic_info'
10
10
  /** 列表页表单选择项 */
11
11
  export const LIST_FORM_CHOOSER_VALUES = 'list_form_chooser_values'
12
+ /** 页面动态数据 */
13
+ export const PAGE_DYNAMIC_DATA = 'page_dynamic_data'
@@ -0,0 +1,39 @@
1
+ import { FORM_KEY, PAGE_DYNAMIC_DATA } from '../constants'
2
+ import { computed, inject, Ref } from 'vue'
3
+
4
+ const useSyncForm = (dynamicScope?: string) => {
5
+ /** 上下文全局 */
6
+ const globalForm = inject(FORM_KEY) as Ref<Record<string, any>>
7
+ /** 上下文局部form */
8
+ const pageDynamicData = inject(PAGE_DYNAMIC_DATA) as Ref<Record<string, any>>
9
+ const syncForm = (params: Record<string, any>) => {
10
+ if (dynamicScope) {
11
+ pageDynamicData.value[dynamicScope] = {
12
+ ...pageDynamicData.value[dynamicScope],
13
+ ...params,
14
+ }
15
+ } else {
16
+ globalForm.value = {
17
+ ...globalForm.value,
18
+ ...params,
19
+ }
20
+ }
21
+ }
22
+
23
+ const form = computed(() => {
24
+ if (dynamicScope) {
25
+ return {
26
+ ...globalForm?.value,
27
+ ...pageDynamicData.value[dynamicScope],
28
+ }
29
+ }
30
+ return globalForm?.value
31
+ })
32
+
33
+ return {
34
+ syncForm,
35
+ form,
36
+ }
37
+ }
38
+
39
+ export default useSyncForm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.4.79",
3
+ "version": "0.4.81",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -13,4 +13,5 @@ export interface LcbFilterGridProps extends LcbBlockProps {
13
13
  textPH?: number
14
14
  textPV?: number
15
15
  borderColor?: string
16
+ dynamicScope?: string
16
17
  }
@@ -7,4 +7,5 @@ export interface PageListProps {
7
7
  }
8
8
  export interface LcbFilterListProps extends PageListProps, LcbListInfo {
9
9
  autoHeight?: boolean
10
+ dynamicScope?: string
10
11
  }
@@ -62,6 +62,7 @@ declare const __VLS_component: import('vue').DefineComponent<
62
62
  imageWidth: number
63
63
  borderRadius: number
64
64
  imageHeight: number
65
+ dynamicScope: string
65
66
  border: boolean
66
67
  listType: 'list' | 'horizontal' | 'grid' | 'waterfall'
67
68
  pageFilterType: string
@@ -16,6 +16,7 @@ export interface LcbListProps extends LcbBlockProps {
16
16
  layoutType?: 'vertical' | 'horizontal'
17
17
  imageRadius?: number
18
18
  itemWidth?: number
19
+ dynamicScope?: string
19
20
  }
20
21
  export interface Option {
21
22
  label: string
@@ -34,4 +34,5 @@ export interface LcbProductProps extends LcbBlockProps {
34
34
  backgroundColor?: string
35
35
  }
36
36
  }
37
+ dynamicScope?: string
37
38
  }
@@ -14,4 +14,5 @@ export interface LcbTabsProps extends LcbBlockProps {
14
14
  mode?: 'tabs' | 'block'
15
15
  tagsMode?: 'scroll' | 'tiled'
16
16
  gap?: number
17
+ dynamicScope?: string
17
18
  }
@@ -9,3 +9,5 @@ export declare const PAGE_ANCHOR_PROVIDE_KEY = 'page_anchor_provide'
9
9
  export declare const USER_BASIC_INFO = 'user_basic_info'
10
10
  /** 列表页表单选择项 */
11
11
  export declare const LIST_FORM_CHOOSER_VALUES = 'list_form_chooser_values'
12
+ /** 页面动态数据 */
13
+ export declare const PAGE_DYNAMIC_DATA = 'page_dynamic_data'
@@ -0,0 +1,5 @@
1
+ declare const useSyncForm: (dynamicScope?: string) => {
2
+ syncForm: (params: Record<string, any>) => void
3
+ form: import('vue').ComputedRef<any>
4
+ }
5
+ export default useSyncForm