@tplc/business 0.5.3 → 0.5.5
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,10 @@
|
|
|
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.5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.4...v0.5.5) (2025-10-10)
|
|
6
|
+
|
|
7
|
+
### [0.5.4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.3...v0.5.4) (2025-10-10)
|
|
8
|
+
|
|
5
9
|
### [0.5.3](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.1...v0.5.3) (2025-10-10)
|
|
6
10
|
|
|
7
11
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<view
|
|
3
3
|
class="drop-menu-container"
|
|
4
4
|
:style="`background-color: ${backgroundColor}; --address-content-color: ${color};--address-width: ${width}rpx;width: ${width}rpx;`"
|
|
5
|
+
v-if="options.length > 0"
|
|
5
6
|
>
|
|
6
7
|
<wd-drop-menu>
|
|
7
8
|
<wd-drop-menu-item
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
<script setup lang="ts">
|
|
20
21
|
import { ref, watch } from 'vue'
|
|
21
22
|
import { AddressCommunityProps } from '../types'
|
|
22
|
-
import useLocation
|
|
23
|
+
import useLocation from '../../../hooks/useLocation'
|
|
23
24
|
|
|
24
25
|
defineOptions({
|
|
25
26
|
name: 'AddressCommunity',
|
|
@@ -34,49 +35,60 @@ withDefaults(defineProps<AddressCommunityProps>(), {
|
|
|
34
35
|
color: '#000',
|
|
35
36
|
width: 240,
|
|
36
37
|
})
|
|
37
|
-
const {
|
|
38
|
+
const { userLocation, userAddressId } = useLocation()
|
|
38
39
|
const value = defineModel<string>('')
|
|
39
40
|
const title = ref<string>('地址社区')
|
|
40
41
|
const options = ref<{ addressName: string; addressId: string }[]>([])
|
|
41
42
|
|
|
42
43
|
const handleChange = (e: any) => {
|
|
43
44
|
title.value = e.selectedItem.label
|
|
44
|
-
|
|
45
|
+
userAddressId.value = e.selectedItem.addressId
|
|
45
46
|
uni.$emit('lcb-city-select-change', e.selectedItem)
|
|
46
47
|
}
|
|
47
|
-
getLocation()
|
|
48
48
|
watch(
|
|
49
49
|
() => userLocation.value,
|
|
50
|
-
(val) => {
|
|
50
|
+
async (val) => {
|
|
51
51
|
if (val) {
|
|
52
|
-
uni.$lcb.http.post<any[]>('/addressCommunity/list')
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const { data } = await uni.$lcb.http.post<any[]>('/addressCommunity/list')
|
|
53
|
+
options.value = data
|
|
54
|
+
if (data.length > 0) {
|
|
55
|
+
const firstItem = data[0]
|
|
55
56
|
title.value = firstItem.label
|
|
56
57
|
value.value = firstItem.addressId
|
|
57
|
-
|
|
58
|
+
userAddressId.value = firstItem.addressId
|
|
58
59
|
uni.$emit('lcb-city-select-change', firstItem)
|
|
59
|
-
}
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
{
|
|
63
64
|
immediate: true,
|
|
64
65
|
},
|
|
65
66
|
)
|
|
67
|
+
|
|
68
|
+
watch(
|
|
69
|
+
() => userAddressId.value,
|
|
70
|
+
(val) => {
|
|
71
|
+
console.log('userAddressId', val)
|
|
72
|
+
},
|
|
73
|
+
)
|
|
66
74
|
</script>
|
|
67
75
|
|
|
68
76
|
<style lang="scss" scoped>
|
|
69
77
|
.drop-menu-container {
|
|
70
78
|
margin-right: 24rpx;
|
|
79
|
+
|
|
71
80
|
:deep(.wd-drop-menu__list) {
|
|
72
81
|
background-color: transparent;
|
|
73
82
|
}
|
|
83
|
+
|
|
74
84
|
:deep(.wd-drop-menu) {
|
|
75
85
|
font-size: 28rpx !important;
|
|
76
86
|
}
|
|
87
|
+
|
|
77
88
|
:deep(.wd-drop-menu__item) {
|
|
78
89
|
color: var(--address-content-color);
|
|
79
90
|
}
|
|
91
|
+
|
|
80
92
|
:deep(.wd-drop-item) {
|
|
81
93
|
.wd-popup {
|
|
82
94
|
width: var(--address-width);
|
|
@@ -197,7 +197,7 @@ const props = withDefaults(defineProps<NavProps>(), {
|
|
|
197
197
|
fontWeight: 500,
|
|
198
198
|
textColor: '#000000',
|
|
199
199
|
keyFromUser: false,
|
|
200
|
-
showAddressCommunity:
|
|
200
|
+
showAddressCommunity: false,
|
|
201
201
|
})
|
|
202
202
|
const navbarBgColor = computed(() => {
|
|
203
203
|
return props.backgroundType === 'color' ? props.backColor : ''
|
package/hooks/useLocation.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { useTranslate } from '@tplc/wot'
|
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { getUserLocation, UserLocation } from './useLocation.api'
|
|
4
4
|
export const currentLocation = ref<UserLocation>()
|
|
5
|
+
export const currentAddressId = ref<string>('')
|
|
5
6
|
export const currentUserLatLon = ref<UniApp.GetLocationSuccess>()
|
|
6
7
|
const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
7
8
|
const { translate } = useTranslate()
|
|
@@ -52,6 +53,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
52
53
|
if (!force && currentLocation.value) return
|
|
53
54
|
if ((await checkLocationPermission()) !== false) {
|
|
54
55
|
locationIng.value = true
|
|
56
|
+
|
|
55
57
|
await new Promise<void>((resolve) => {
|
|
56
58
|
uni.getLocation({
|
|
57
59
|
type: 'gcj02',
|
|
@@ -94,7 +96,13 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
94
96
|
navigateToSettings(forceSetting)
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
getLocation,
|
|
101
|
+
locationIng,
|
|
102
|
+
userLocation: currentLocation,
|
|
103
|
+
userLatLon: currentUserLatLon,
|
|
104
|
+
userAddressId: currentAddressId,
|
|
105
|
+
}
|
|
98
106
|
}
|
|
99
107
|
|
|
100
108
|
export default useLocation
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { UserLocation } from './useLocation.api'
|
|
2
2
|
export declare const currentLocation: import('vue').Ref<UserLocation | undefined>
|
|
3
|
+
export declare const currentAddressId: import('vue').Ref<string>
|
|
3
4
|
export declare const currentUserLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
|
|
4
5
|
declare const useLocation: (onLocation?: (location: UserLocation) => void) => {
|
|
5
6
|
getLocation: (force?: boolean, forceSetting?: boolean) => Promise<void>
|
|
6
7
|
locationIng: import('vue').Ref<boolean>
|
|
7
8
|
userLocation: import('vue').Ref<UserLocation | undefined>
|
|
8
9
|
userLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
|
|
10
|
+
userAddressId: import('vue').Ref<string>
|
|
9
11
|
}
|
|
10
12
|
export default useLocation
|