diff --git a/pages.json b/pages.json index 1a04a11..f078ce8 100644 --- a/pages.json +++ b/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" : diff --git a/pages/index/index.vue b/pages/index/index.vue index 01d42b6..f2f9d84 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -34,15 +34,15 @@ {{item.hospital_name}} - + 出诊:{{item.visit_day_text}} - - + + 导航 @@ -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{ diff --git a/pages/map/map.vue b/pages/map/map.vue index fbe2b52..677f9a6 100644 --- a/pages/map/map.vue +++ b/pages/map/map.vue @@ -1,30 +1,33 @@ @@ -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¢er=116.470098,39.992838&radius=1000&total=20&key=(您的Key)" } } } -