微信公众号前端模版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1" >
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
</head>
<body>
<h3 id="menu-location">地理位置接口</h3>
<span class="desc">使用微信内置地图查看位置接口</span>
<button class="btn btn_primary"
id="openLocation">openLocation</button>
<span class="desc">获取地理位置接口</span>
<button class="btn btn_primary"
id="getLocation">getLocation</button>
</body>
<script>
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
wx.config({
debug: false,
appId: wxconf.appid,
timestamp: wxconf.timestamp,
nonceStr: wxconf.noncestr,
signature: wxconf.signature,
jsApiList: [
'checkJsApi',
'openLocation',
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
wx.openLocation({
latitude: latlng.lat, // 纬度,浮点数,范围为90 ~ -90
longitude: latlng.lng, // 经度,浮点数,范围为180 ~ -180。
name: "正定飞机场朋信汽修", // 位置名
address: "新城铺商业街南头东行70米路南,朋信汽修", // 地址详情说明
scale: 18, // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl: "https://www.baidu.com"// 在查看位置界面底部显示的超链接,可点击跳转
});
});
wxready();
} else {
window.location.href = "https://api.map.baidu.com/marker?location=38.265227852835984,114.69348698387786&title=正定飞机场朋信汽修&content=新城铺商业街南头东行70米路南,朋信汽修&output=html";
}
</script>
</html>