@tplc/business 0.4.80 → 0.4.82

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,15 @@
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.82](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.81...v0.4.82) (2025-04-29)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 支持scope ([22fc204](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/22fc2049e6c5af088ff333ce4152959404b914bb))
11
+
12
+ ### [0.4.81](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.80...v0.4.81) (2025-04-29)
13
+
5
14
  ### [0.4.80](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.78...v0.4.80) (2025-04-29)
6
15
 
7
16
 
@@ -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
@@ -40,7 +40,7 @@
40
40
  </template>
41
41
 
42
42
  <script setup lang="ts">
43
- import { getCurrentPage } from '../../../utils/utils'
43
+ import { getCurrentPage, getSharePath } from '../../../utils/utils'
44
44
  import { getShareConfigList } from './api'
45
45
  import { ref, inject, watch } from 'vue'
46
46
  import lcbPoster from '../../lcb-poster/lcb-poster.vue'
@@ -147,13 +147,14 @@ const onShare = () => {
147
147
  if (!data.value) return
148
148
  uni.showShareImageMenu({
149
149
  path: data.value[current.value].path,
150
+ entrancePath: getSharePath(),
150
151
  success: () => {
151
152
  uni.showToast({
152
153
  title: '分享成功',
153
154
  icon: 'success',
154
155
  })
155
156
  },
156
- })
157
+ } as any)
157
158
  }
158
159
  </script>
159
160
  <style scoped lang="scss"></style>
@@ -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
  }
@@ -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
  }
@@ -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.80",
3
+ "version": "0.4.82",
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
  }
@@ -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
@@ -22,3 +22,4 @@ export declare const calculateImageHeight: (
22
22
  gap?: number,
23
23
  ) => number
24
24
  export declare const customUpload: UploadMethod
25
+ export declare const getSharePath: () => string
package/utils/utils.ts CHANGED
@@ -97,3 +97,16 @@ export const customUpload: UploadMethod = (file, formData, options) => {
97
97
  },
98
98
  })
99
99
  }
100
+
101
+ export const getSharePath = () => {
102
+ const inviteUserId = uni.$lcb.userStore?.()?.userInfo?.userId
103
+ const inviteTime = new Date().getTime()
104
+ return `/pages/start/index?${stringify({
105
+ path: getCurrentPage().fullPath,
106
+ ...getCurrentPage().options,
107
+ inviteTime,
108
+ inviteUserId,
109
+ shareDistributorId: uni.$lcb.userStore?.()?.userInfo?.shareDistributorId,
110
+ distributorId: uni.$lcb.userStore?.()?.userInfo?.distributorId,
111
+ })}`
112
+ }