|
@@ -1,31 +1,58 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
+ <view class="icon-title-navBar-box">
|
|
|
+ <view @click="goUpPage" class="nav-bar-icon"></view>
|
|
|
+ <text class="nav-bar-title">选择地址</text>
|
|
|
+ </view>
|
|
|
+ <!-- 查询职业 -->
|
|
|
+ <view class="phone-search-box">
|
|
|
+ <input class="search-input" placeholder="请输入地址" v-model="data.keyword" />
|
|
|
+ <view class="search-icon" @click="handleClick">
|
|
|
+ <uni-icons type="search" size="24" color="#fff"></uni-icons>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<map style="width: 100%; height: 300px;" :latitude="data.latitude" :longitude="data.longitude"
|
|
|
:markers="data.covers" :show-location="true"> </map>
|
|
|
- <input type="text" v-model="data.keyword" placeholder="请输入地址" style="padding: 10px 0">
|
|
|
-
|
|
|
- <view>{{result && result.data.data}}</view>
|
|
|
-
|
|
|
- <button @click="handleClick">查询</button>
|
|
|
+ <view v-if="result" v-for="(item,index) in result.data.data" key="index">
|
|
|
+ <view @click="xuanzeAdress(item)">
|
|
|
+ <view :class="index==0?'xxxactive':''" >{{item.title}}</view>
|
|
|
+ <view>{{item.address}}</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import {
|
|
|
- reactive,ref
|
|
|
+ reactive,
|
|
|
+ ref
|
|
|
} from "vue"
|
|
|
import myIcon from "@/static/images/common/markIcon.png"
|
|
|
+
|
|
|
import {
|
|
|
- onLoad, onHide, onShow
|
|
|
+ onLoad,
|
|
|
+ onHide,
|
|
|
+ onShow
|
|
|
} from "@dcloudio/uni-app"
|
|
|
- import {useCustomMap} from "@/components/customMap/useMap.js"
|
|
|
- const { getPositionSearchByKeyword } = useCustomMap();
|
|
|
-
|
|
|
+ import {
|
|
|
+ useCustomMap
|
|
|
+ } from "@/components/customMap/useMap.js"
|
|
|
+
|
|
|
+ const emits = defineEmits(['close', 'xuanzeAdress'])
|
|
|
+ const {
|
|
|
+ getPositionSearchByKeyword
|
|
|
+ } = useCustomMap();
|
|
|
+
|
|
|
const result = ref(null);
|
|
|
-
|
|
|
+
|
|
|
function handleClick() {
|
|
|
if (data.keyword) {
|
|
|
- getPositionSearchByKeyword(data.keyword, `nearby(${data.latitude},${data.longitude},1000)`, onSuccess, onError, {page:1, size:3,})
|
|
|
+ getPositionSearchByKeyword(data.keyword, `nearby(${data.latitude},${data.longitude},1000)`, onSuccess,
|
|
|
+ onError, {
|
|
|
+ page: 1,
|
|
|
+ size: 3,
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -33,10 +60,22 @@
|
|
|
console.log('数据', data);
|
|
|
result.value = data
|
|
|
}
|
|
|
+
|
|
|
function onError(err) {
|
|
|
console.log('错误', err)
|
|
|
}
|
|
|
|
|
|
+ function goUpPage(err) {
|
|
|
+ console.log('错误', err)
|
|
|
+ emits('close');
|
|
|
+
|
|
|
+ }
|
|
|
+ function xuanzeAdress(item) {
|
|
|
+ console.log('item');
|
|
|
+ emits('xuanzeAdress',item.address);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
const data = reactive({
|
|
|
keyword: '', // 关键字
|
|
|
id: 0, // 使用 marker点击事件 需要填写id
|