@tplc/business 0.5.3 → 0.5.4
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,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.5.4](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.3...v0.5.4) (2025-10-10)
|
|
6
|
+
|
|
5
7
|
### [0.5.3](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v0.5.1...v0.5.3) (2025-10-10)
|
|
6
8
|
|
|
7
9
|
|
|
@@ -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, { currentAddressId } from '../../../hooks/useLocation'
|
|
23
24
|
|
|
24
25
|
defineOptions({
|
|
25
26
|
name: 'AddressCommunity',
|
|
@@ -34,29 +35,29 @@ withDefaults(defineProps<AddressCommunityProps>(), {
|
|
|
34
35
|
color: '#000',
|
|
35
36
|
width: 240,
|
|
36
37
|
})
|
|
37
|
-
const {
|
|
38
|
+
const { userLocation } = 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
|
+
currentAddressId.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
|
+
currentAddressId.value = firstItem.addressId
|
|
58
59
|
uni.$emit('lcb-city-select-change', firstItem)
|
|
59
|
-
}
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
{
|
|
@@ -68,15 +69,19 @@ watch(
|
|
|
68
69
|
<style lang="scss" scoped>
|
|
69
70
|
.drop-menu-container {
|
|
70
71
|
margin-right: 24rpx;
|
|
72
|
+
|
|
71
73
|
:deep(.wd-drop-menu__list) {
|
|
72
74
|
background-color: transparent;
|
|
73
75
|
}
|
|
76
|
+
|
|
74
77
|
:deep(.wd-drop-menu) {
|
|
75
78
|
font-size: 28rpx !important;
|
|
76
79
|
}
|
|
80
|
+
|
|
77
81
|
:deep(.wd-drop-menu__item) {
|
|
78
82
|
color: var(--address-content-color);
|
|
79
83
|
}
|
|
84
|
+
|
|
80
85
|
:deep(.wd-drop-item) {
|
|
81
86
|
.wd-popup {
|
|
82
87
|
width: var(--address-width);
|
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',
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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>
|