| | |
| | | <block v-for="(item,index) in deviceList" :key="index"> |
| | | <view class="item"> |
| | | <view class="item-img"> |
| | | <image src="../../static/logo.png" alt=''></image> |
| | | <image v-if="item.url" :src="baseUrl + '/upload' + item.url" alt='' mode="aspectFit"></image> |
| | | <image v-else src="../../static/images/station/facilityImg.svg" alt='' mode="aspectFit"></image> |
| | | </view> |
| | | <view class="item-info"> |
| | | <view class="info-name">{{item.facilityName}}</view> |
| | | <view class="info-addr" @click="openMap(item.lat,item.lon)"> |
| | | <text class="addr-text">地址:{{item.address}}</text> |
| | | <view> |
| | | <image src="../../static/images/index/icon22.png" alt=''></image> |
| | | <image src="../../static/images/index/icon22.svg" alt=''></image> |
| | | <text>{{item.distance}}km</text> |
| | | </view> |
| | | </view> |
| | |
| | | <script setup> |
| | | import { onMounted, ref } from 'vue' |
| | | import { searchFacilityApi } from '../../api/index.js' |
| | | import { BASE_URL } from '../../config/baseUrl.js' |
| | | |
| | | const baseUrl = ref(BASE_URL) |
| | | const deviceList = ref([]) |
| | | const userLocation = ref() |
| | | //获取设备信息 |
| | |
| | | distance:preDistance.km, |
| | | lat:item.latitude, |
| | | lon:item.longitude, |
| | | url:item.facilityUrl |
| | | }) |
| | | }) |
| | | console.log('deviceList.value',deviceList.value) |
| | |
| | | } |
| | | //打开地图导航 |
| | | function openMap(lat,lon){ |
| | | console.log('lat:',parseFloat(lat),'lon:',parseFloat(lon)) |
| | | uni.openLocation({ |
| | | latitude: parseFloat(lat), |
| | | longitude: parseFloat(lon), |