@tplc/business 0.5.5 → 0.5.7
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.7](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.6...v0.5.7) (2025-10-10)
|
|
6
|
+
|
|
7
|
+
### [0.5.6](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.5...v0.5.6) (2025-10-10)
|
|
8
|
+
|
|
5
9
|
### [0.5.5](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.4...v0.5.5) (2025-10-10)
|
|
6
10
|
|
|
7
11
|
### [0.5.4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.3...v0.5.4) (2025-10-10)
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { ref, watch } from 'vue'
|
|
22
22
|
import { AddressCommunityProps } from '../types'
|
|
23
23
|
import useLocation from '../../../hooks/useLocation'
|
|
24
|
-
|
|
24
|
+
import { AddressCommunity } from '../../../utils/addressCommunity'
|
|
25
25
|
defineOptions({
|
|
26
26
|
name: 'AddressCommunity',
|
|
27
27
|
options: {
|
|
@@ -35,15 +35,14 @@ withDefaults(defineProps<AddressCommunityProps>(), {
|
|
|
35
35
|
color: '#000',
|
|
36
36
|
width: 240,
|
|
37
37
|
})
|
|
38
|
-
const { userLocation
|
|
38
|
+
const { userLocation } = useLocation()
|
|
39
39
|
const value = defineModel<string>('')
|
|
40
40
|
const title = ref<string>('地址社区')
|
|
41
41
|
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
|
+
AddressCommunity.setAddressId(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
|
+
AddressCommunity.setAddressId(firstItem.addressId)
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
60
|
},
|
|
@@ -64,13 +62,6 @@ watch(
|
|
|
64
62
|
immediate: true,
|
|
65
63
|
},
|
|
66
64
|
)
|
|
67
|
-
|
|
68
|
-
watch(
|
|
69
|
-
() => userAddressId.value,
|
|
70
|
-
(val) => {
|
|
71
|
-
console.log('userAddressId', val)
|
|
72
|
-
},
|
|
73
|
-
)
|
|
74
65
|
</script>
|
|
75
66
|
|
|
76
67
|
<style lang="scss" scoped>
|
package/hooks/useLocation.ts
CHANGED
|
@@ -2,7 +2,6 @@ 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>('')
|
|
6
5
|
export const currentUserLatLon = ref<UniApp.GetLocationSuccess>()
|
|
7
6
|
const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
8
7
|
const { translate } = useTranslate()
|
|
@@ -65,10 +64,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
65
64
|
userLatitude: res.latitude.toString(),
|
|
66
65
|
})
|
|
67
66
|
.then((res) => {
|
|
68
|
-
currentLocation.value =
|
|
69
|
-
...currentLocation.value,
|
|
70
|
-
...res.data,
|
|
71
|
-
}
|
|
67
|
+
currentLocation.value = res.data
|
|
72
68
|
if (force) onLocation?.(res.data)
|
|
73
69
|
})
|
|
74
70
|
.finally(() => {
|
|
@@ -80,10 +76,7 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
80
76
|
console.log('获取位置信息失败:', res)
|
|
81
77
|
getUserLocation()
|
|
82
78
|
.then((res) => {
|
|
83
|
-
currentLocation.value =
|
|
84
|
-
...currentLocation.value,
|
|
85
|
-
...res.data,
|
|
86
|
-
}
|
|
79
|
+
currentLocation.value = res.data
|
|
87
80
|
})
|
|
88
81
|
.finally(() => {
|
|
89
82
|
locationIng.value = false
|
|
@@ -101,7 +94,6 @@ const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
|
101
94
|
locationIng,
|
|
102
95
|
userLocation: currentLocation,
|
|
103
96
|
userLatLon: currentUserLatLon,
|
|
104
|
-
userAddressId: currentAddressId,
|
|
105
97
|
}
|
|
106
98
|
}
|
|
107
99
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
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>
|
|
5
4
|
declare const useLocation: (onLocation?: (location: UserLocation) => void) => {
|
|
6
5
|
getLocation: (force?: boolean, forceSetting?: boolean) => Promise<void>
|
|
7
6
|
locationIng: import('vue').Ref<boolean>
|
|
8
7
|
userLocation: import('vue').Ref<UserLocation | undefined>
|
|
9
8
|
userLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
|
|
10
|
-
userAddressId: import('vue').Ref<string>
|
|
11
9
|
}
|
|
12
10
|
export default useLocation
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-01-25 23:06:48
|
|
4
|
+
* @LastEditTime: 2024-03-30 11:30:55
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/locale/index.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import { ref } from 'vue'
|
|
11
|
+
|
|
12
|
+
const addressCommunity = ref<string>('')
|
|
13
|
+
|
|
14
|
+
export const AddressCommunity = {
|
|
15
|
+
setAddressId(newLang: string) {
|
|
16
|
+
addressCommunity.value = newLang
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
getAddressId() {
|
|
20
|
+
return addressCommunity.value
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useCurrentAddressCommunity = () => addressCommunity
|
|
25
|
+
|
|
26
|
+
export default AddressCommunity
|