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

      

  • 相关阅读:
    C# Dapper 2.0源码
    C#实现隐藏手机号、邮箱、姓名等敏感信息扩展方法
    C# 自定义弹窗提醒
    用sqlyog 连 mysql 8 时,报错:plugin caching_sha2_password could not be loaded
    汇总最全的C#.NET(数据库/.net/其它)面试题及参考答案
    安装sql2008r2后,数据库引擎为空是为什么?
    SQL Server 2008找不到SQL Server配置管理器的问题
    PrintDialog.ShowDialog不能显示打印对话框
    PrintDialog控件
    PrintPreviewControl控件
  • 原文地址:https://www.cnblogs.com/txw1958/p/11188962.html
Copyright © 2020-2023  润新知