|
|
@ -28,6 +28,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import ZhToPinYin from '@/js_sdk/tui-zh-pinyin/tui-zh-pinyin.js'; |
|
|
|
import ZhToPinYin from '@/js_sdk/tui-zh-pinyin/tui-zh-pinyin.js'; |
|
|
|
|
|
|
|
import jweixin from '@/common/jweixin.js' |
|
|
|
var QQMapWX = require('@/js_sdk/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'); |
|
|
|
var QQMapWX = require('@/js_sdk/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js'); |
|
|
|
var qqmapsdk; |
|
|
|
var qqmapsdk; |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
// #ifdef MP-WEIXIN |
|
|
@ -51,6 +52,11 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad: function(options) { |
|
|
|
onLoad: function(options) { |
|
|
|
const that = this; |
|
|
|
const that = this; |
|
|
|
|
|
|
|
var city = this.$queue.getData("city") |
|
|
|
|
|
|
|
console.log(this.$queue.getData("city")) |
|
|
|
|
|
|
|
if (city != '') { |
|
|
|
|
|
|
|
this.city = city |
|
|
|
|
|
|
|
} |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
// 实例化API核心类 |
|
|
|
// 实例化API核心类 |
|
|
|
qqmapsdk = new QQMapWX({ |
|
|
|
qqmapsdk = new QQMapWX({ |
|
|
@ -73,12 +79,29 @@ |
|
|
|
this.$queue.setData('localCampus', item.name); |
|
|
|
this.$queue.setData('localCampus', item.name); |
|
|
|
} |
|
|
|
} |
|
|
|
//#endif |
|
|
|
//#endif |
|
|
|
|
|
|
|
//#ifdef H5 |
|
|
|
var city = this.$queue.getData("city") |
|
|
|
let lat = this.$queue.getData("latH") |
|
|
|
console.log(this.$queue.getData("city")) |
|
|
|
let lng = this.$queue.getData("lngH") |
|
|
|
if (city != '') { |
|
|
|
console.log(lat,'latlatlatlat') |
|
|
|
this.city = city |
|
|
|
if(lat){ |
|
|
|
|
|
|
|
let str = `output=jsonp&location=${lat},${lng}&key=LH3BZ-NYN62-2SIUW-CGKY5-K5MXT-FWFOI` |
|
|
|
|
|
|
|
this.$jsonp('https://apis.map.qq.com/ws/geocoder/v1/?'+str).then(res=>{ |
|
|
|
|
|
|
|
if(res.status == 0){ |
|
|
|
|
|
|
|
console.log(res,'resresresresres') |
|
|
|
|
|
|
|
this.latitude = res.result.location.lat; |
|
|
|
|
|
|
|
this.longitude = res.result.location.lng; |
|
|
|
|
|
|
|
this.weizhi.names = res.result.formatted_addresses.recommend; |
|
|
|
|
|
|
|
this.weizhi.dizhi = res.result.address |
|
|
|
|
|
|
|
this.city = res.result.address_component.city |
|
|
|
|
|
|
|
this.$queue.setData('latitude', this.latitude); |
|
|
|
|
|
|
|
this.$queue.setData('longitude', this.longitude); |
|
|
|
|
|
|
|
this.$queue.setData('city', res.result.address_component.city); |
|
|
|
|
|
|
|
this.$queue.setData('localCampus', res.result.formatted_addresses.recommend); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//#endif |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
gocity() { |
|
|
|
gocity() { |
|
|
@ -95,11 +118,14 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
saveAddress() { |
|
|
|
saveAddress() { |
|
|
|
console.log("this.city____:" + this.city) |
|
|
|
console.log("this.city____:" + this.city) |
|
|
|
|
|
|
|
console.log("this.this.weizhi.names:" + this.weizhi.names) |
|
|
|
this.$queue.setData('latitude', this.latitude); |
|
|
|
this.$queue.setData('latitude', this.latitude); |
|
|
|
this.$queue.setData('longitude', this.longitude); |
|
|
|
this.$queue.setData('longitude', this.longitude); |
|
|
|
this.$queue.setData('city', this.city); |
|
|
|
this.$queue.setData('city', this.city); |
|
|
|
this.$queue.setData('localCampus', this.weizhi.names); |
|
|
|
// this.$queue.setData('localCampus', this.weizhi.names); |
|
|
|
uni.navigateBack(); |
|
|
|
uni.switchTab({ |
|
|
|
|
|
|
|
url: '/pages/index/index' |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
initLocation(latitude, longitude) { |
|
|
|
initLocation(latitude, longitude) { |
|
|
|
var that = this; |
|
|
|
var that = this; |
|
|
@ -127,6 +153,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
dingwei() { |
|
|
|
dingwei() { |
|
|
|
const that = this; |
|
|
|
const that = this; |
|
|
|
|
|
|
|
//#ifdef MP-WEIXIN |
|
|
|
uni.chooseLocation({ |
|
|
|
uni.chooseLocation({ |
|
|
|
success: function(res) { |
|
|
|
success: function(res) { |
|
|
|
console.log(res) |
|
|
|
console.log(res) |
|
|
@ -145,6 +172,12 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
//#endif |
|
|
|
|
|
|
|
//#ifdef H5 |
|
|
|
|
|
|
|
var pageUrl = window.location.href; |
|
|
|
|
|
|
|
var url1 = `https://apis.map.qq.com/tools/locpicker?search=1&type=0&backurl=${pageUrl}&key=LH3BZ-NYN62-2SIUW-CGKY5-K5MXT-FWFOI&referer=myapp` |
|
|
|
|
|
|
|
location.href= url1; |
|
|
|
|
|
|
|
//#endif |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|