zoukankan      html  css  js  c++  java
  • 微信扫码功能

     1 //3.微信扫码功能
     2 
     3 <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>     
     4      <script type="text/javascript">
     5 $(function(){
     6     //$('#shippingId').tpselect({'url':'${apppath}','blankHead':false,'headStr':'--请选择--',autoload:true});
     7     /* $("#gotoSend").on('click',function(){
     8         $("#dialog1").show();
     9         $(".ok").click(function(){
    10             $("#sendInfo").submit();
    11         });
    12         $(".cancel").click(function(){
    13             $("#dialog1").hide();
    14         });
    15     var isRefresh = ${isRefresh};
    16     if(isRefresh){
    17         window.location.reload();
    18     }
    19     }); */
    20             //获取微信权限
    21             wx.config({      
    22                 debug: false,
    23                 appId: '${wxconfig.appID}',
    24                 timestamp: '${wxconfig.timestamp}',
    25                 nonceStr: '${wxconfig.nonce}',
    26                 signature: '${wxconfig.signature}',
    27                 jsApiList: [
    28                              'scanQRCode'
    29                          ] 
    30             });
    31         
    32             //微信扫一扫接口
    33             $("#sendInfo #weScan").click(function(){
    34                 
    35                 wx.scanQRCode({
    36                     needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
    37                     scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码,默认二者都有
    38                     success: function (res) {
    39                     var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
    40                     if(result!=null && result!=""){
    41                         $("#${popid} #sendcode").prop("value",sendCode);
    42                         }else{
    43                             alert("扫描无效,请重新输入!");
    44                             return false;
    45                         }
    46                     }
    47                     });
    48                 
    49                 
    50             });
    51 </script>
  • 相关阅读:
    神秘题目4
    神秘题目3
    神秘题目2
    AC自动机
    Fence Obstacle Course 题解
    Fractal Streets
    龟速乘
    快速幂
    Stall Reservation
    Sunscreen
  • 原文地址:https://www.cnblogs.com/guoziyi/p/5999462.html
Copyright © 2011-2022 走看看