|
@@ -114,22 +114,31 @@ export default {
|
|
|
message: '正在获取您附近的机构...',
|
|
|
duration: 0,
|
|
|
})
|
|
|
- // 获取定位信息 百度坐标转高德坐标
|
|
|
- try {
|
|
|
- const location = await loactionSelf()
|
|
|
- const result = await this.$http.api.assistant({
|
|
|
- key: '1bcc97330f6cf517e8dd9d5278957e67',
|
|
|
- locations: `${location.point.lng},${location.point.lat}`,
|
|
|
- coordsys: 'baidu',
|
|
|
- output: 'JSON',
|
|
|
- })
|
|
|
- const res = await result.json()
|
|
|
- this.listQuery.lngAndLat = res.locations
|
|
|
- } catch (error) {
|
|
|
- this.$toast.clear()
|
|
|
- this.$toast('获取定位信息失败,请确保您开启的定位权限并保存网络畅通')
|
|
|
- this.isRequest = false
|
|
|
+
|
|
|
+ const locations = localStorage.getItem('zp-locations')
|
|
|
+
|
|
|
+ if (!locations) {
|
|
|
+ // 获取定位信息 百度坐标转高德坐标
|
|
|
+ try {
|
|
|
+ const location = await loactionSelf()
|
|
|
+ const result = await this.$http.api.assistant({
|
|
|
+ key: '1bcc97330f6cf517e8dd9d5278957e67',
|
|
|
+ locations: `${location.point.lng},${location.point.lat}`,
|
|
|
+ coordsys: 'baidu',
|
|
|
+ output: 'JSON',
|
|
|
+ })
|
|
|
+ const res = await result.json()
|
|
|
+ this.listQuery.lngAndLat = res.locations
|
|
|
+ localStorage.setItem('zp-locations', res.locations)
|
|
|
+ } catch (error) {
|
|
|
+ this.$toast.clear()
|
|
|
+ this.$toast('获取定位信息失败,请确保您开启的定位权限并保存网络畅通')
|
|
|
+ this.isRequest = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.listQuery.lngAndLat = locations
|
|
|
}
|
|
|
+
|
|
|
this.listQuery.authUserId = this.authUserId
|
|
|
// 获取机构列表
|
|
|
this.fetchList()
|
|
@@ -142,12 +151,13 @@ export default {
|
|
|
this.total = res.data.total
|
|
|
this.list = [...this.list, ...res.data.list]
|
|
|
this.finished = !res.data.hasNextPage
|
|
|
+ this.isLoadingMore = false
|
|
|
+ this.listQuery.pageNum += 1
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
} finally {
|
|
|
this.$toast.clear()
|
|
|
this.isRequest = false
|
|
|
- this.isLoadingMore = false
|
|
|
}
|
|
|
}, 400),
|
|
|
|
|
@@ -198,7 +208,6 @@ export default {
|
|
|
// 加载更多
|
|
|
onLoadMore() {
|
|
|
if (this.isRequest) return
|
|
|
- this.listQuery.pageNum += 1
|
|
|
this.fetchList()
|
|
|
},
|
|
|
},
|