@tplc/business 0.4.71 → 0.4.72
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,13 @@
|
|
|
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.72](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.71...v0.4.72) (2025-04-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 调整缓存策略 ([45900e3](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/45900e3c2619ed2c5dadcfa49da3a98aa73d79f6))
|
|
11
|
+
|
|
5
12
|
### [0.4.71](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.70...v0.4.71) (2025-04-12)
|
|
6
13
|
|
|
7
14
|
### [0.4.70](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.81...v0.4.70) (2025-04-12)
|
|
@@ -123,12 +123,21 @@ import useLocation from '../../hooks/useLocation'
|
|
|
123
123
|
import { useTranslate } from '@tplc/wot'
|
|
124
124
|
import { ChildHotAddress } from '../lcb-city-select/api'
|
|
125
125
|
import { stringify } from 'qs'
|
|
126
|
-
import { getHistoryCity } from '../../utils/history'
|
|
126
|
+
import { getHistoryCity, setHistoryCity } from '../../utils/history'
|
|
127
127
|
import { FORM_KEY } from '../../constants'
|
|
128
128
|
const dayRange = ref([dayjs().valueOf(), dayjs().add(1, 'day').valueOf()])
|
|
129
129
|
const { translate } = useTranslate()
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
const addressCity = ref<ChildHotAddress | undefined>(getHistoryCity())
|
|
132
|
+
const { getLocation, userLocation, locationIng } = useLocation((location) => {
|
|
133
|
+
addressCity.value = {
|
|
134
|
+
addressName: location.showName || location.cityName,
|
|
135
|
+
areaId: location.areaId,
|
|
136
|
+
cityId: location.cityId,
|
|
137
|
+
provinceId: location.provinceId,
|
|
138
|
+
}
|
|
139
|
+
setHistoryCity(addressCity.value)
|
|
140
|
+
})
|
|
132
141
|
getLocation()
|
|
133
142
|
const nightCount = computed(() => {
|
|
134
143
|
return dayjs(dayRange.value[1]).diff(dayRange.value[0], 'day')
|
package/hooks/useLocation.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ref } from 'vue'
|
|
|
3
3
|
import { getUserLocation, UserLocation } from './useLocation.api'
|
|
4
4
|
export const currentLocation = ref<UserLocation>()
|
|
5
5
|
export const currentUserLatLon = ref<UniApp.GetLocationSuccess>()
|
|
6
|
-
const useLocation = () => {
|
|
6
|
+
const useLocation = (onLocation?: (location: UserLocation) => void) => {
|
|
7
7
|
const { translate } = useTranslate()
|
|
8
8
|
// 正在获取经纬度
|
|
9
9
|
const locationIng = ref(false)
|
|
@@ -63,6 +63,7 @@ const useLocation = () => {
|
|
|
63
63
|
})
|
|
64
64
|
.then((res) => {
|
|
65
65
|
currentLocation.value = res.data
|
|
66
|
+
if (force) onLocation?.(res.data)
|
|
66
67
|
})
|
|
67
68
|
.finally(() => {
|
|
68
69
|
locationIng.value = false
|
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
3
|
export declare const currentUserLatLon: import('vue').Ref<UniApp.GetLocationSuccess | undefined>
|
|
4
|
-
declare const useLocation: () => {
|
|
4
|
+
declare const useLocation: (onLocation?: (location: UserLocation) => void) => {
|
|
5
5
|
getLocation: (force?: boolean) => Promise<void>
|
|
6
6
|
locationIng: import('vue').Ref<boolean>
|
|
7
7
|
userLocation: import('vue').Ref<UserLocation | undefined>
|