@tplc/business 0.5.4 → 0.5.6
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.6](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.5...v0.5.6) (2025-10-10)
|
|
6
|
+
|
|
7
|
+
### [0.5.5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.4...v0.5.5) (2025-10-10)
|
|
8
|
+
|
|
5
9
|
### [0.5.4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.3...v0.5.4) (2025-10-10)
|
|
6
10
|
|
|
7
11
|
### [0.5.3](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.1...v0.5.3) (2025-10-10)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
21
|
import { ref, watch } from 'vue'
|
|
22
22
|
import { AddressCommunityProps } from '../types'
|
|
23
|
-
import useLocation, {
|
|
23
|
+
import useLocation, { useCurrentAddressId } from '../../../hooks/useLocation'
|
|
24
24
|
|
|
25
25
|
defineOptions({
|
|
26
26
|
name: 'AddressCommunity',
|
|
@@ -42,8 +42,7 @@ const options = ref<{ addressName: string; addressId: string }[]>([])
|
|
|
42
42
|
|
|
43
43
|
const handleChange = (e: any) => {
|
|
44
44
|
title.value = e.selectedItem.label
|
|
45
|
-
|
|
46
|
-
uni.$emit('lcb-city-select-change', e.selectedItem)
|
|
45
|
+
useCurrentAddressId().value = e.selectedItem.addressId
|
|
47
46
|
}
|
|
48
47
|
watch(
|
|
49
48
|
() => userLocation.value,
|
|
@@ -55,8 +54,7 @@ watch(
|
|
|
55
54
|
const firstItem = data[0]
|
|
56
55
|
title.value = firstItem.label
|
|
57
56
|
value.value = firstItem.addressId
|
|
58
|
-
|
|
59
|
-
uni.$emit('lcb-city-select-change', firstItem)
|
|
57
|
+
useCurrentAddressId().value = firstItem.addressId
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
},
|
|
@@ -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,8 +2,9 @@ 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
|
-
|
|
5
|
+
const currentAddressId = ref<string>('')
|
|
6
6
|
export const currentUserLatLon = ref<UniApp.GetLocationSuccess>()
|
|
7
|
+
export const useCurrentAddressId = () => currentAddressId
|
|
7
8
|
const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
8
9
|
const { translate } = useTranslate()
|
|
9
10
|
// 正在获取经纬度
|
|
@@ -65,10 +66,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
65
66
|
userLatitude: res.latitude.toString(),
|
|
66
67
|
})
|
|
67
68
|
.then((res) => {
|
|
68
|
-
currentLocation.value =
|
|
69
|
-
...currentLocation.value,
|
|
70
|
-
...res.data,
|
|
71
|
-
}
|
|
69
|
+
currentLocation.value = res.data
|
|
72
70
|
if (force) onLocation?.(res.data)
|
|
73
71
|
})
|
|
74
72
|
.finally(() => {
|
|
@@ -80,10 +78,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
80
78
|
console.log('获取位置信息失败:', res)
|
|
81
79
|
getUserLocation()
|
|
82
80
|
.then((res) => {
|
|
83
|
-
currentLocation.value =
|
|
84
|
-
...currentLocation.value,
|
|
85
|
-
...res.data,
|
|
86
|
-
}
|
|
81
|
+
currentLocation.value = res.data
|
|
87
82
|
})
|
|
88
83
|
.finally(() => {
|
|
89
84
|
locationIng.value = false
|
|
@@ -96,7 +91,12 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
96
91
|
navigateToSettings(forceSetting)
|
|
97
92
|
}
|
|
98
93
|
}
|
|
99
|
-
return {
|
|
94
|
+
return {
|
|
95
|
+
getLocation,
|
|
96
|
+
locationIng,
|
|
97
|
+
userLocation: currentLocation,
|
|
98
|
+
userLatLon: currentUserLatLon,
|
|
99
|
+
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export default useLocation
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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>
|
|
4
3
|
export declare const currentUserLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
|
|
4
|
+
export declare const useCurrentAddressId: () => import('vue').Ref<string>
|
|
5
5
|
declare const useLocation: (onLocation?: (location: UserLocation) => void) => {
|
|
6
6
|
getLocation: (force?: boolean, forceSetting?: boolean) => Promise<void>
|
|
7
7
|
locationIng: import('vue').Ref<boolean>
|