<html lang="en">

<head>

    <meta charset="UTF-8">
    <script src="/js/jquery.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <title>微信扫一扫</title>

</head>

<body>

<script type="application/javascript">
    const purl = location.href;
    const data = {"url": purl};
    $.ajax({
        url: "https://wxservice.fu-qing.com/jsSign",
        data: JSON.stringify(data),
        type: "POST",
        contentType: 'application/json',
        dataType: "json",
        success: function (result) {
            wx.config({
                debug: false,
                appId: result.data.appId,
                timestamp: result.data.timestamp, // 必填，生成签名的时间戳
                nonceStr: result.data.nonceStr,// 必填，生成签名的随机串
                signature: result.data.signature,// 必填，签名
                jsApiList: ['scanQRCode']
            });
        },
        error: function () {
            alert("请求失败");
        }
    });

    wx.ready(function () {
        wx.scanQRCode({
            needResult: 0,
            scanType: ["qrCode"],
            success: function (res) {

            },
            error: function (res) {
                if (res.errMsg.indexOf('function_not_exist') > 0) {
                    alert('当前版本低，请进行升级！');
                }
            }
        });
    });

</script>
</body>

</html>
