微信企业号JS SDK

<?php
define('CorpID', "wx82e2c31215d9a5a7");
define('CorpSecret', ""); //设置->功能设置->权限管理->系统管理组->深圳管理(新建的管理组)->Secret
define('AgentID', "24"); //应用ID require_once('wxqiye.class.php');
$weixin = new class_wxqiye();
$signPackage = $weixin->GetSignPackage(); ?> <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<title>微信企业JSSDK</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="http://demo.open.weixin.qq.com/jssdk/css/style.css">
</head>
<body ontouchstart="">
</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script> wx.config({
debug: false,
appId: '<?php echo $signPackage["appId"];?>',
timestamp: <?php echo $signPackage["timestamp"];?>,
nonceStr: '<?php echo $signPackage["nonceStr"];?>',
signature: '<?php echo $signPackage["signature"];?>',
// url:'<?php echo $signPackage["url"];?>',
jsApiList: [
// 所有要调用的 API 都要加到这个列表中
'checkJsApi',
'openLocation',
'getLocation',
]
});
</script> <script>
wx.ready(function () { //自动执行的
wx.checkJsApi({
jsApiList: [
'getLocation',
],
success: function (res) {
alert(JSON.stringify(res));
}
}); wx.hideOptionMenu(); //如果不支持则不会执行
wx.getLocation({
success: function (res) {
alert(JSON.stringify(res));
// alert('经度' + res.longitude);
// alert('纬度' + res.latitude);
// window.location.href = "location.php?longitude=" + res.longitude + "&latitude=" + res.latitude;
},
cancel: function (res) {
alert('用户拒绝授权获取地理位置');
}
}); }); wx.error(function (res) {
alert(res.errMsg);
});
</script>
</html>

  

05-11 21:57