• 微信企业号JS SDK


    微信企业号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>
    

      

  • 相关阅读:
    #在蓝懿学习iOS的日子#Day10
    #在蓝懿学习iOS的日子#Day9
    #在蓝懿学习iOS的日子#第三个练习日
    #在蓝懿学习iOS的日子#Day8
    WCF基础:绑定(二)
    WCF基础:绑定(三)
    WCF基础:绑定(一)
    MVC框架中的值提供机制(三)
    MVC框架中的值提供机制(二)
    MVC框架中的值提供机制(一)
  • 原文地址:https://www.cnblogs.com/txw1958/p/11188962.html
Copyright © 2020-2023  润新知