jssdk.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>JSSDK 功能测试</title>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  8. <link rel="stylesheet" href="__ROOT__/static/theme/css/mobile.css">
  9. </head>
  10. <body>
  11. <header style="padding:35px 0">
  12. <h1 style="text-align:center;font-size:34px;color:#3cc51f;font-weight:400;">JSSDK 功能测试</h1>
  13. </header>
  14. <div style="padding:15px;text-align:center">
  15. <button type="button" style="padding:5px" id='show-alert'>调起摄像头扫码</button>
  16. </div>
  17. <script src="//res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  18. <script>
  19. wx.error(function (err) {
  20. alert(err.errMsg || '配置出错');
  21. });
  22. wx.config(JSON.parse('{$options|json_encode|raw}'));
  23. wx.ready(function () {
  24. alert('- 初始化成功 -');
  25. document.getElementById('show-alert').onclick = function () {
  26. wx.scanQRCode({
  27. needResult: 1,
  28. scanType: ["qrCode", "barCode"],
  29. success: function (res) {
  30. alert(res.resultStr);
  31. }
  32. });
  33. }
  34. });
  35. </script>
  36. </body>
  37. </html>