• JQ通过后台传来的数据生成二维码方法


    <!DOCTYPE html>
    <html>
    
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title></title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
            <meta name="description" content="">
            <meta name="keywords" content="">
            <link rel="stylesheet" type="text/css" href="css/reset.css" />
            <link rel="stylesheet" type="text/css" href="css/style.css" />
            <script src="https://cdn.bootcss.com/jquery/2.1.2/jquery.min.js"></script>
            <script src="https://img.huiyiguanjia.com/CDNFile/layer/layer-v3.1.1/layer/layer.js"></script>
            <script src="https://img.huiyiguanjia.com/cdnfile/public/publicfunction.js"></script>
            <script type="text/javascript" src="//static.runoob.com/assets/qrcode/qrcode.min.js"></script>
        </head>
        <script type="text/javascript">
            mid = "4827262698575522532";
            TokenId = getCookie_Key('Auth_TokenID_9_' + mid, "tokenId");
            console.log(TokenId)
            if (!TokenId) {
                location.href = "login.html"
            }
            //通过将字符串转成数组拿到各项数据
            name = TokenId.split(",")[0];
            company = TokenId.split(",")[1];
            console.log(company)
        </script>
        <body>
            <div class="main">
                <section class="indexBox">
                    <div class="logo"><img src="img/logo.png"></div>
                    <div class="codeBox" style="color: #fff;">
                        <!-- 二维码容器 -->
                        <div id="qrcode" style="100px; height:100px; margin-top:15px;"></div>
                        <!-- 二维码生成数字的容器 -->
                        <p class="codeNumber"></p>
                    </div>
                    <div class="bottomImg"><img src="img/shouyeBottomImg.png"></div>
                </section>
            </div>
        </body>
    </html>
    <script type="text/javascript">
        //生成二维码的方法
        var qrcode = new QRCode(document.getElementById("qrcode"), {
             100,
            height: 100
        });
    
        function makeCode(qr) {
            var elText = document.getElementById("text");
            qrcode.makeCode(qr);
        }
        //请求数据后将请求的数据才能放到makeCode()方法中,所以要放到下边ajax里边  二维码生成库:https://www.runoob.com/try/try.php?filename=tryhtml5_QRCode
        // makeCode("55555");
        //请求数据
        $.ajax({
            type: "post",
            url: "http://testcustom.api.huiyiguanjia.com/api/meetinguser/GetMeetingUserInfonByTemp",
            dataType: "json",
            async: false,
            data: {
                mid: "4827262698575522532",
                name: name,
                company: company,
            },
            beforeSend: function() {},
            error: function() {
                layer.closeAll('loading');
                layer.msg("服务器错误", {
                    icon: 7
                });
            },
            complete: function() {
    
            },
            success: function(data) {
                console.log(data);
                if (data.Code == 1) {
                    //将得到的二维码数字赋值给要生成二维码的方法,makeCode();
                    makeCode(data.Data[0].CheckCode);
                    $(".codeNumber").html(data.Data[0].CheckCode); //将获取到的二维码数值放到页面的容器中
                } else {
                    layer.msg('网络错误,请稍后重试', {
                        icon: 2
                    });
                }
            }
        });
    </script>
  • 相关阅读:
    git 还原某个文件~~~
    uniqid()
    array_filter 过滤一维中空数组,数组的序列不变
    加密 解密
    gitlab基本维护和使用
    vim 单文件中查找方法
    php数组定义
    $('.goods_tag_ids_all')[0].checked = true;//~~~~~ 单条改变checkbox 属性样式
    由买冰箱想到的
    2014年年终总结
  • 原文地址:https://www.cnblogs.com/fkcqwq/p/11158551.html
Copyright © 2020-2023  润新知