index.html 3.01 KB
Newer Older
1 2 3 4 5
<!DOCTYPE html>
<html>

<head>
    <meta lang="zh-cn">
xd's avatar
xd committed
6
    <title>领取优惠券</title>
7 8 9
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
    <style>
xd's avatar
xd committed
10
        html,body{
11 12 13 14
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
xd's avatar
xd committed
15 16
            font-size: 16px;
            color: #ffffff;
17
        }
xd's avatar
xd committed
18 19 20 21 22 23
        .register_container{
            height: 100%;
            background-color: rgba(15, 106, 184, 0.99);
            margin: 0;
            padding: 2.5rem 2rem;
            box-sizing: border-box;
24 25
            text-align: center;
        }
xd's avatar
xd committed
26
        .register_titles .title{
27
            font-size: 3rem;
xd's avatar
xd committed
28
            line-height: 5rem;
29 30

        }
xd's avatar
xd committed
31 32 33 34 35
        .register_qrcode  #image{
            display: inline-block;
            width: 60%;
            height: auto;
            margin: 3rem 0;
36
        }
xd's avatar
xd committed
37
        .register_qrcode .qrcodeTip{
38 39
            font-size: 2rem;
        }
40 41 42
    </style>
</head>
<body>
xd's avatar
xd committed
43 44 45
<div class="register_container">
    <div class="register_titles">
        <div class="title">扫码领券</div>
46
    </div>
xd's avatar
xd committed
47 48 49
    <div class="register_qrcode">
        <img class="qrcode" id="image" src="" alt />
        <div class="qrcodeTip">长按识别二维码</div>
50 51 52 53 54
    </div>
</div>

<script>
    const cleanUrlAndPostQRInfo = () => {
xd's avatar
xd committed
55
        // 获取参数
xd's avatar
xd committed
56 57 58 59 60 61 62 63 64 65 66
        function GetQueryString(name) {
           var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
           var r = window.location.search.substr(1).match(reg)
           var context = ""
           if (r != null)
               context = r[2]
           reg = null
           r = null
           return context == null || context == "" || context == "undefined" ? "" : context;
        }
        const nowUrl= GetQueryString('Url')
67
        alert(`nowurl--->${nowUrl}`)
xd's avatar
xd committed
68
        let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${nowUrl}`
69 70 71 72 73 74 75 76 77 78 79 80 81

        $.ajax({
            type: "POST",
            url: pageUrl,
            // data: JSON.stringify({ path: "pages/signIn/signIn" }),
            data: {},
            success: function (res) {
                $('#image').attr('src', res.data)
            },
            error: function (data) {
                alert(`--->qrCode: ajax: err: err =${JSON.stringify(err)}`)
                alert('error' + JSON.stringify(data))
            }
xd's avatar
xd committed
82
        })
83 84 85 86 87 88
    }

    const __main = () => {
        cleanUrlAndPostQRInfo()
    }
    __main()
89 90 91 92 93 94 95 96 97 98 99 100 101
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }
    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady()
    } 
102
</script>
103 104
</body>

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
</html>