This commit is contained in:
sjeam 2025-09-03 17:47:41 +08:00
commit 75b027411b
6 changed files with 139 additions and 98 deletions

View File

@ -126,6 +126,7 @@ export default defineManifestConfig({
minified: true, minified: true,
}, },
usingComponents: true, usingComponents: true,
requiredPrivateInfos: ['getLocation'],
permission: { permission: {
'scope.userLocation': { 'scope.userLocation': {
desc: '需要获取位置以展示医院信息', desc: '需要获取位置以展示医院信息',

View File

@ -100,6 +100,7 @@
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"pinia": "2.0.36", "pinia": "2.0.36",
"pinia-plugin-persistedstate": "3.2.1", "pinia-plugin-persistedstate": "3.2.1",
"qqmap-wx-jssdk": "^1.0.0",
"qs": "6.5.3", "qs": "6.5.3",
"uview-ui": "2.0.38", "uview-ui": "2.0.38",
"vue": "^3.4.21", "vue": "^3.4.21",

8
pnpm-lock.yaml generated
View File

@ -88,6 +88,9 @@ importers:
pinia-plugin-persistedstate: pinia-plugin-persistedstate:
specifier: 3.2.1 specifier: 3.2.1
version: 3.2.1(pinia@2.0.36(typescript@5.7.2)(vue@3.5.15(typescript@5.7.2))) version: 3.2.1(pinia@2.0.36(typescript@5.7.2)(vue@3.5.15(typescript@5.7.2)))
qqmap-wx-jssdk:
specifier: ^1.0.0
version: 1.0.0
qs: qs:
specifier: 6.5.3 specifier: 6.5.3
version: 6.5.3 version: 6.5.3
@ -5409,6 +5412,9 @@ packages:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'} engines: {node: '>=6'}
qqmap-wx-jssdk@1.0.0:
resolution: {integrity: sha512-wuaNetsA9/OKEQGgK1CNPsX6pppWpY10cQwQu1OHJplGMyMIMzK2bliMkNXjtry99qXYCsvDAWPqw2DI+/foJg==}
qrcode-reader@1.0.4: qrcode-reader@1.0.4:
resolution: {integrity: sha512-rRjALGNh9zVqvweg1j5OKIQKNsw3bLC+7qwlnead5K/9cb1cEIAGkwikt/09U0K+2IDWGD9CC6SP7tHAjUeqvQ==} resolution: {integrity: sha512-rRjALGNh9zVqvweg1j5OKIQKNsw3bLC+7qwlnead5K/9cb1cEIAGkwikt/09U0K+2IDWGD9CC6SP7tHAjUeqvQ==}
@ -13176,6 +13182,8 @@ snapshots:
punycode@2.3.1: {} punycode@2.3.1: {}
qqmap-wx-jssdk@1.0.0: {}
qrcode-reader@1.0.4: {} qrcode-reader@1.0.4: {}
qrcode-terminal@0.12.0: {} qrcode-terminal@0.12.0: {}

View File

@ -90,6 +90,9 @@
"minified": true "minified": true
}, },
"usingComponents": true, "usingComponents": true,
"requiredPrivateInfos": [
"getLocation"
],
"permission": { "permission": {
"scope.userLocation": { "scope.userLocation": {
"desc": "需要获取位置以展示医院信息" "desc": "需要获取位置以展示医院信息"

View File

@ -1,32 +1,17 @@
<template>
<view>
<map
id="hospitalMap"
style="width: 100%; height: 80vh"
:latitude="center.lat"
:longitude="center.lng"
:markers="markers"
@markertap="handleMarkerTap"
></map>
<scroll-view class="poi-list">
<view v-for="(item, index) in hospitals" :key="index" @click="focusMarker(item)">
<text class="hospital-name">{{ item.name }}</text>
<text class="hospital-distance">{{ item.distance }}</text>
</view>
</scroll-view>
</view>
</template>
<script> <script>
import QQMapWX from 'qqmap-wx-jssdk'
export default { export default {
data() { data() {
return { return {
center: { lat: 39.90469, lng: 116.40717 }, // center: { latitude: 28.871396, longitude: 105.442046 },
markers: [], markers: [],
hospitals: [], searchResult: [],
keyword: '',
} }
}, },
mounted() { onLoad(options) {
this.keyword = options.keyword
this.initMap() this.initMap()
}, },
methods: { methods: {
@ -34,57 +19,88 @@ export default {
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: (res) => { success: (res) => {
this.center = { lat: res.latitude, lng: res.longitude } this.center = { latitude: res.latitude, longitude: res.longitude }
this.searchHospitals() this.searchLocation()
},
fail: (fail) => {
console.log(fail)
}, },
}) })
}, },
searchHospitals() { searchLocation() {
// qqmapsdkH5使uni.requireNativePluginApp const that = this
const qqmapsdk = new qq.maps.SearchService({ const qqmapsdk = new QQMapWX({
complete: (result) => { key: 'D2XBZ-LOMKI-D4MGT-5Q6LH-WV5A2-KPBBW',
this.hospitals = result.detail.pois.map((poi) => ({ })
id: poi.id, qqmapsdk.search({
name: poi.title, keyword: that.keyword, //
address: poi.address, location: that.center, //
distance: poi._distance, page_size: 20,
lat: poi.latLng.lat, success(res) {
lng: poi.latLng.lng, console.log('search res', res)
})) for (let i = 0; i < res.data.length; i++) {
this.updateMarkers() that.markers.push({
id: i,
poi_id: res.data[i].id,
title: res.data[i].title,
latitude: res.data[i].location.lat,
longitude: res.data[i].location.lng,
label: {
content: res.data[i].title,
fontSize: 12,
anchorX: -40,
anchorY: 5,
},
width: 20,
height: 30,
})
}
},
fail(res) {
console.log(res)
}, },
}) })
qqmapsdk.searchNearby('医院', new qq.maps.LatLng(this.center.lat, this.center.lng), 2000)
},
updateMarkers() {
this.markers = this.hospitals.map((h) => ({
id: h.id,
latitude: h.lat,
longitude: h.lng,
iconPath: '/static/hospital-marker.png',
width: 24,
height: 24,
callout: { content: h.name },
}))
}, },
handleMarkerTap(e) { handleMarkerTap(e) {
const hospital = this.hospitals.find((h) => h.id === e.markerId) const current = this.markers.find((h) => h.id === e.detail.markerId)
uni.showActionSheet({ uni.showActionSheet({
itemList: ['导航到' + hospital.name, '查看详情'], itemList: [`导航到${current.title}`, '查看详情'],
success: (res) => { success: (res) => {
if (res.tapIndex === 0) { if (res.tapIndex === 0) {
this.openNavigation(hospital) this.openNavigation(current)
} }
}, },
}) })
}, },
focusMarker(item) { focusMarker(item) {
this.center = { lat: item.lat, lng: item.lng } this.center = { latitude: item.lat, longitude: item.lng }
}, },
}, },
} }
</script> </script>
<template>
<view>
<map
id="map"
:scale="16"
style="width: 100%; height: 100vh"
:latitude="center.latitude"
:longitude="center.longitude"
:markers="markers"
@markertap="handleMarkerTap"
/>
<!-- <scroll-view class="poi-list">
<view v-for="(item, index) in hospitals" :key="index" @click="focusMarker(item)">
<text class="hospital-name">
{{ item.name }}
</text>
<text class="hospital-distance">{{ item.distance }}</text>
</view>
</scroll-view> -->
</view>
</template>
<style> <style>
.poi-list { .poi-list {
height: 20vh; height: 20vh;

View File

@ -8,21 +8,47 @@
} }
</route> </route>
<script lang="ts" setup>
// import RequestComp from './components/request.vue'
// import UploadComp from './components/upload.vue'
//
const { safeAreaInsets } = uni.getSystemInfoSync()
// vue .ts
// const testOxlint = (name: string) => {
// console.log('oxlint')
// }
// testOxlint('oxlint')
// console.log('about')
function more(item) {
uni.navigateTo({
// url: `/pages/web_view/index?target=${item.url}&title=${item.name}`,
url: `/pages/service/find?keyword=${item.name}`,
})
// uni.openLocation({
// latitude: Number(2),
// longitude: Number(2),
// })
}
</script>
<template> <template>
<view class=""> <view class="">
<view class="background_home"> <view class="background_home">
<view class="relative h-50"> <view class="relative h-50">
<wd-img <wd-img
radius="0px 0px 20rpx 20rpx " radius="0px 0px 20rpx 20rpx "
:width="'100%'" width="100%"
:height="'100%'" height="100%"
src="https://meizi-chao-pub.8531.cn/1813416312440430594_720px.jpg" src="https://meizi-chao-pub.8531.cn/1813416312440430594_720px.jpg"
/> />
<view <view
class="absolute bottom-4 left-0 right-0 text-left text-white bg-black bg-opacity-20 ps-4" class="absolute bottom-4 left-0 right-0 bg-black bg-opacity-20 ps-4 text-left text-white"
> >
<text class="font-size-8 text-shadow">数字乡村</text> <text class="font-size-8 text-shadow">数字乡村</text>
<text class="block font-size-4 pt-2 text-shadow">同城一小时新鲜送到家</text> <text class="block pt-2 font-size-4 text-shadow">同城一小时新鲜送到家</text>
</view> </view>
</view> </view>
<view class="p-2"> <view class="p-2">
@ -32,8 +58,8 @@
<template #title> <template #title>
<view class="title"> <view class="title">
<view> <view>
<text class="text-xl text-sm font-size-4">看看附近</text> <text class="text-sm text-xl font-size-4">看看附近</text>
<text class="ps-2 text-xl text-sm font-size-3 color-gray-500"> <text class="ps-2 text-sm text-xl font-size-3 color-gray-500">
好物上新季特产抢先购 好物上新季特产抢先购
</text> </text>
</view> </view>
@ -46,62 +72,70 @@
</view> </view>
<wd-grid :gutter="2" :column="4"> <wd-grid :gutter="2" :column="4">
<view <view
@click="more(item)"
v-for="item in [ v-for="item in [
{ {
name: '找停车', name: '找停车',
keyword: '停车场',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/fj_1.png', icon: '/static/icons/fj_1.png',
color: 'green', color: 'green',
}, },
{ {
name: '农事服务', name: '农事服务',
keyword: '停车场',
url: '/pages/store/home/index?id=13', url: '/pages/store/home/index?id=13',
icon: '/static/icons/fj_2.png', icon: '/static/icons/fj_2.png',
color: 'blue', color: 'blue',
}, },
{ {
name: '店铺街', name: '店铺街',
keyword: '停车场',
url: '/pages/store/shopStreet/index', url: '/pages/store/shopStreet/index',
icon: '/static/icons/fj_3.png', icon: '/static/icons/fj_3.png',
color: 'orange', color: 'orange',
}, },
{ {
name: '特产产品', name: '特产产品',
keyword: '停车场',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/fj_4.png', icon: '/static/icons/fj_4.png',
color: 'green', color: 'green',
}, },
{ {
name: '特色美食', name: '特色美食',
keyword: '停车场',
url: '/pages/store/home/index?id=13', url: '/pages/store/home/index?id=13',
icon: '/static/icons/fj_5.png', icon: '/static/icons/fj_5.png',
color: 'blue', color: 'blue',
}, },
{ {
name: '当季产品', name: '当季产品',
keyword: '停车场',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/fj_6.png', icon: '/static/icons/fj_6.png',
color: 'orange', color: 'orange',
}, },
{ {
name: '美丽乡村', name: '美丽乡村',
keyword: '停车场',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/fj_7.png', icon: '/static/icons/fj_7.png',
color: 'red', color: 'red',
}, },
{ {
name: '景区景色', name: '景区景色',
keyword: '景区',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/fj_8.png', icon: '/static/icons/fj_8.png',
color: 'red', color: 'red',
}, },
]" ]"
@click="more(item)"
> >
<wd-grid-item use-slot> <wd-grid-item use-slot>
<view class="p-2"> <view class="p-2">
<wd-img radius="20rpx" :width="'100rpx'" :height="'100rpx'" :src="item.icon" /> <wd-img radius="20rpx" width="100rpx" height="100rpx" :src="item.icon" />
<view class="ps-2 pt-2 pb-2 text-center text-gray-500 font-size-3"> <view class="pb-2 ps-2 pt-2 text-center font-size-3 text-gray-500">
{{ item.name }} {{ item.name }}
</view> </view>
</view> </view>
@ -118,8 +152,8 @@
<template #title> <template #title>
<view class="title"> <view class="title">
<view> <view>
<text class="text-xl text-sm font-size-4">游玩必备</text> <text class="text-sm text-xl font-size-4">游玩必备</text>
<text class="ps-2 text-xl text-sm font-size-3 color-gray-500"> <text class="ps-2 text-sm text-xl font-size-3 color-gray-500">
好物上新季特产抢先购 好物上新季特产抢先购
</text> </text>
</view> </view>
@ -132,32 +166,35 @@
</view> </view>
<wd-grid :gutter="2" :column="4"> <wd-grid :gutter="2" :column="4">
<view <view
@click="more"
v-for="item in [ v-for="item in [
{ {
name: '酒店住宿', name: '酒店住宿',
keyword: '酒店',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/ly_1.png', icon: '/static/icons/ly_1.png',
color: 'green', color: 'green',
}, },
{ {
name: '风景景区', name: '风景景区',
keyword: '景区',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/ly_2.png', icon: '/static/icons/ly_2.png',
color: 'blue', color: 'blue',
}, },
{ {
name: '天气预报', name: '天气预报',
keyword: '景区',
url: '/pages/activity/lease/index', url: '/pages/activity/lease/index',
icon: '/static/icons/ly_3.png', icon: '/static/icons/ly_3.png',
color: 'orange', color: 'orange',
}, },
]" ]"
@click="more"
> >
<wd-grid-item use-slot> <wd-grid-item use-slot>
<view class="p-2"> <view class="p-2">
<wd-img radius="20rpx" :width="'100rpx'" :height="'100rpx'" :src="item.icon" /> <wd-img radius="20rpx" width="100rpx" height="100rpx" :src="item.icon" />
<view class="ps-2 pt-2 pb-2 text-center text-gray-500 font-size-3"> <view class="pb-2 ps-2 pt-2 text-center font-size-3 text-gray-500">
{{ item.name }} {{ item.name }}
</view> </view>
</view> </view>
@ -173,8 +210,8 @@
<template #title> <template #title>
<view class="title"> <view class="title">
<view> <view>
<text class="text-xl text-sm font-size-4">本地必备</text> <text class="text-sm text-xl font-size-4">本地必备</text>
<text class="ps-2 text-xl text-sm font-size-3 color-gray-500"> <text class="ps-2 text-sm text-xl font-size-3 color-gray-500">
<!-- 好物上新季特产抢先购 --> <!-- 好物上新季特产抢先购 -->
</text> </text>
</view> </view>
@ -187,7 +224,6 @@
</view> </view>
<wd-grid :gutter="2" :column="4"> <wd-grid :gutter="2" :column="4">
<view <view
@click="more"
v-for="item in [ v-for="item in [
{ {
name: '一条龙服务', name: '一条龙服务',
@ -214,11 +250,12 @@
color: 'red', color: 'red',
}, },
]" ]"
@click="more"
> >
<wd-grid-item use-slot> <wd-grid-item use-slot>
<view class="p-2"> <view class="p-2">
<wd-img radius="20rpx" :width="'100rpx'" :height="'100rpx'" :src="item.icon" /> <wd-img radius="20rpx" width="100rpx" height="100rpx" :src="item.icon" />
<view class="ps-2 pt-2 pb-2 text-center text-gray-500 font-size-3"> <view class="pb-2 ps-2 pt-2 text-center font-size-3 text-gray-500">
{{ item.name }} {{ item.name }}
</view> </view>
</view> </view>
@ -227,7 +264,7 @@
</wd-grid> </wd-grid>
</wd-card> </wd-card>
</view> </view>
<view class="p-2"></view> <view class="p-2" />
<!-- <RequestComp /> <!-- <RequestComp />
<UploadComp /> --> <UploadComp /> -->
@ -243,28 +280,3 @@
text-align: center; text-align: center;
} }
</style> </style>
<script lang="ts" setup>
// import RequestComp from './components/request.vue'
// import UploadComp from './components/upload.vue'
//
const { safeAreaInsets } = uni.getSystemInfoSync()
// vue .ts
// const testOxlint = (name: string) => {
// console.log('oxlint')
// }
// testOxlint('oxlint')
// console.log('about')
function more(item) {
uni.navigateTo({
// url: `/pages/web_view/index?target=${item.url}&title=${item.name}`,
url: `/pages/service/find`,
})
// uni.openLocation({
// latitude: Number(2),
// longitude: Number(2),
// })
}
</script>