引入qq地图
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
<link rel ="shortcut icon" type="image/x-icon" href="./lsh.jpg">
<!-- <script src="https://www.h5anli.com/demo/hammerjs/js/hammer.min.js"></script> -->
<title>应用中心</title>
<script src="/lshextension/set.js"></script>
<script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=xxxxx"></script>
</head>
Http.sys.sign({url: location.href.split('#')[0]}).then((res) => {
if (res.obj && res.code === "success") {
const Vo = res.obj
wx.config({
debug: false,
appId: Vo.appId,
timestamp: Vo.timestamp,
nonceStr: Vo.noncestr,
signature: Vo.sign,
jsApiList: ['getLocation'],
});
wx.ready(function () {
wx.getLocation({
type: 'gcj02',
success: function (res) {
console.info(res, 124)
var latLng = new qq.maps.LatLng(res.latitude, res.longitude)
getAddr.getAddress(latLng)
},
cancel: function (res) {
that.$toast('用户拒绝授权获取地理位置')
}
})
})
wx.error(function (res) {
console.log('微信js-sdk 配置失败000' + res.errMsg)
})
var getAddr = new qq.maps.Geocoder({
complete: function (res) {
var allAddress = res.detail.addressComponents
if(allAddress.province == allAddress.city){
that.addressData = allAddress.province+ allAddress.district
} else {
that.addressData = allAddress.province + allAddress.city + allAddress.district
}
let params = {
channel: 'ELECTRONIC_CONTRACT_PAYMENT',
mobile: that.mobilePhone,
name: that.userName,
selectAgree: num,
answerTime: that.formatDate(new Date()),
geographicalLocation: that.addressData
};
Http.privacy.externalPlatformCallback(params).then(res => {
if (res.code == 'success') {
that.show = false;
}
});
}
})
}
});