Browse Source

腾讯/百度/高德地图

master
kuaileWu 1 year ago
parent
commit
f4927240af
  1. 12
      pages.json
  2. 43
      pages/index/index.vue
  3. 65
      pages/map/map.vue

12
pages.json

@ -1,5 +1,11 @@
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": ""
}
},
{
"path" : "pages/map/map",
"style" :
@ -8,12 +14,6 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": ""
}
},
{
"path" : "pages/book_detail/book_detail",
"style" :

43
pages/index/index.vue

@ -34,15 +34,15 @@
<view class="left">
<view class="title flex">
<text class="over2">{{item.hospital_name}}</text>
<img :src="cssUrl+'index_comback.svg'" alt="">
<img :src="cssUrl+'index_comback.svg'" v-if="item.hospital_location" @click="toLocation(item)">
</view>
<view class="date over2" v-if="item.visit_day_text">
出诊{{item.visit_day_text}}
</view>
</view>
<view class="right">
<view class="flex right-wrapper" style="justify-content:flex-end;">
<view class="">
<view class="flex right-wrapper" style="justify-content:flex-end;" v-if="item.hospital_location">
<view class="" @click="toLocation(item)">
<img :src="cssUrl+'index_nav.svg'" alt="">
<view>导航</view>
</view>
@ -120,6 +120,29 @@
this.getDoctorInfo()
},
methods: {
toLocation(hospital){
var that = this
uni.showActionSheet({
itemList: ['腾讯地图', '百度地图', '高德地图'],
success: function (res) {
var lngLat = hospital.hospital_location.toString().split(',')
var lng = lngLat[0].toString()
, lat = lngLat[1].toString()
var baiduLngLat = that.qqMapTransBMap(lng, lat)
var mapList = [
'http://apis.map.qq.com/uri/v1/marker?marker=coord:'+ lat+','+lng+';addr:'+hospital.hospital_name,
'http://api.map.baidu.com/marker?location='+baiduLngLat.lat+','+baiduLngLat.lng+'&title='+hospital.hospital_name+'&content=即将前往目的地&output=html&src=webapp.baidu.openAPIdemo',
'https://m.amap.com/share/index/lnglat='+hospital.hospital_location+'&name='+hospital.hospital_name+'&src=uriapi&innersrc=uriapi',
]
console.log(mapList[res.tapIndex])
// return;
location.href = mapList[res.tapIndex]
},
fail: function (res) {
}
});
},
login() {
this.$http.req('client/user/login', {code:this.code}, 'POST').then(data=>{
if(data == -1) return
@ -173,6 +196,19 @@
uni.navigateTo({
url:"/pages/book_detail/book_detail"
})
},
qqMapTransBMap(lng, lat) {
let x_pi = 3.14159265358979324 * 3000.0 / 180.0;
let x = lng;
let y = lat;
let z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
let theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
let lngs = z * Math.cos(theta) + 0.0065;
let lats = z * Math.sin(theta) + 0.006;
return {
lng: lngs,
lat: lats
}
}
}
}
@ -274,6 +310,7 @@
width: 100%;
margin-bottom: 36rpx;
.top{
min-height: 102rpx;
.left{
flex-grow: 1;
.title{

65
pages/map/map.vue

@ -1,30 +1,33 @@
<template>
<view>
<!-- <view>
<a href="http://uri.amap.com/navigation?from=114.02597366,22.54605355&to=114.029243,22.609562&mode=car&src=nyx_super;">高德地图</a>
</view>
<view>
<a href="http://uri.amap.com/navigation?from=114.02597366,22.54605355&to=114.029243,22.609562&mode=car&src=nyx_super;">高德地图</a>
</view>
<view>
<a href="https://uri.amap.com/marker?position=114.02597366,22.54605355&name=深圳南山">高德地图OK</a>
</view>
<view>
<a href="http://api.map.baidu.com/marker?location=114.02597366,22.54605355&title=深圳南山&content=介绍深圳南山bbb&output=html">百度地图不太ok</a>
</view>
<view>
<a href='http://apis.map.qq.com/uri/v1/marker?marker=coord:31.2353,121.48108;addr:上海市人民广场'>腾讯地图</a>
</view>
<view>
<a href='http://apis.map.qq.com/uri/v1/marker?marker=coord:22.54605355,114.02597366;addr:深圳南山'>腾讯地图2</a>
</view>
<view>
<a href='https://apis.map.qq.com/uri/v1/marker?marker=coord:39.892326,116.342763;title:超好吃冰激凌;addr:手帕口桥北铁路道口&referer=myapp'>腾讯地图3</a>
</view>
<a href="https://uri.amap.com/marker?position=114.02597366,22.54605355&name=深圳南山">高德地图OK</a>
<a href="http://uri.amap.com/marker?position=34.5145141,25.6414014&name=test&src=mypage&coordinate=gaode&callnative=00">高德地图OK</a>
</view>
<view>
<a href="http://api.map.baidu.com/marker?location=31.2503561772,121.3322653843&title=沃尔玛门店&content=即将前往目的地&output=html&src=webapp.baidu.openAPIdemo">百度地图</a>
</view>
<view>
<a href='http://apis.map.qq.com/uri/v1/marker?marker=coord:31.2353,121.48108;addr:上海市人民广场'>腾讯地图</a>
</view>
<view>
<a href='http://apis.map.qq.com/uri/v1/marker?marker=coord:22.54605355,114.02597366;addr:深圳南山'>腾讯地图2</a>
</view>
<view>
<a href='https://apis.map.qq.com/uri/v1/marker?marker=coord:39.892326,116.342763;title:超好吃冰激凌;addr:手帕口桥北铁路道口&referer=myapp'>腾讯地图3</a>
</view>
<view class="btna" @click="mapbtn">确定</view>
<!-- <view class="page-body">
<view class="page-section page-section-gap">
<map style="width: 100%; height: 100vh;" :latitude="latitude" :longitude="longitude" :markers="covers" :show-compass="true"></map>
</view>
</view> -->
<view class="btna" @click="mapbtn">确定</view> -->
<!-- https://blog.csdn.net/jinsedeme0881/article/details/135838478 -->
<!-- https://www.cnblogs.com/wangRong-smile/p/12027366.html -->
<!-- http://apis.map.qq.com/uri/v1/marker?marker=coord:23.54605355,104.02597366;addr: -->
<!-- http://apis.map.qq.com/uri/v1/marker?marker=coord:22.54605355,114.02597366;addr: -->
<!-- http://uri.amap.com/marker?position=39.938794,116.427134&name=test&src=mypage&coordinate=gaode&callnative=00 -->
</view>
</template>
@ -32,29 +35,13 @@
export default {
data() {
return {
id:0, // 使 marker id
title: 'map',
latitude: 39.909,
longitude: 116.39742,
covers: [{
latitude: 39.909,
longitude: 116.39742,
iconPath: '/static/images/frontend/add.svg'
}, {
latitude: 39.90,
longitude: 116.39,
iconPath: '/static/images/frontend/add.svg'
}]
}
},
methods: {
mapbtn() {
location.href="https://m.amap.com/picker/?keywords=写字楼,小区,学校&zoom=15&center=116.470098,39.992838&radius=1000&total=20&key=(您的Key)"
}
}
}
</script>
<style>
</style>

Loading…
Cancel
Save