@tplc/business 0.4.80 → 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 +2 -0
- package/components/lcb-filter-grid/lcb-filter-grid.vue +6 -10
- package/components/lcb-filter-grid/types.ts +1 -0
- package/components/lcb-list/components/FilterList/index.vue +4 -4
- package/components/lcb-list/components/FilterList/type.ts +1 -0
- package/components/lcb-list/lcb-list.vue +1 -0
- package/components/lcb-list/types.ts +1 -0
- package/components/lcb-product/lcb-product.vue +8 -8
- package/components/lcb-product/types.ts +1 -0
- package/components/lcb-tabs/components/Tabs/index.vue +5 -8
- package/components/lcb-tabs/components/Tags/index.vue +6 -11
- package/components/lcb-tabs/types.ts +1 -0
- package/hooks/useSyncForm.ts +39 -0
- package/package.json +1 -1
- package/types/components/lcb-filter-grid/types.d.ts +1 -0
- package/types/components/lcb-list/components/FilterList/type.d.ts +1 -0
- package/types/components/lcb-list/lcb-list.vue.d.ts +1 -0
- package/types/components/lcb-list/types.d.ts +1 -0
- package/types/components/lcb-product/types.d.ts +1 -0
- package/types/components/lcb-tabs/types.d.ts +1 -0
- package/types/hooks/useSyncForm.d.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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
|
+
|
|
5
7
|
### [0.4.80](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.78...v0.4.80) (2025-04-29)
|
|
6
8
|
|
|
7
9
|
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
40
|
<script setup lang="ts">
|
|
41
|
-
import {
|
|
41
|
+
import { inject, ref } from 'vue'
|
|
42
|
+
import useSyncForm from '../../hooks/useSyncForm'
|
|
42
43
|
import { transformValueUnit } from '../../utils/transform'
|
|
43
|
-
import {
|
|
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
|
-
|
|
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
|
}
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
|
-
import {
|
|
20
|
+
import { onMounted, onUnmounted, ref, watch, watchEffect } from 'vue'
|
|
21
21
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging'
|
|
22
|
-
import
|
|
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 =
|
|
40
|
+
const { form } = useSyncForm(props.dynamicScope)
|
|
41
41
|
const refreshed = ref(false)
|
|
42
42
|
useZPaging(paging)
|
|
43
43
|
const modelValue = defineModel<unknown[]>({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { isH5 } from '@tplc/wot/components/common/util'
|
|
3
3
|
import UWaterfall from 'uview-plus/components/u-waterfall/u-waterfall.vue'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
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
|
|
9
|
-
import {
|
|
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
|
|
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
|
|
79
|
+
() => form.value,
|
|
80
80
|
() => {
|
|
81
81
|
if (props.listType === 'waterfall') {
|
|
82
82
|
renderList.value = []
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
33
|
-
import
|
|
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
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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