<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>微信授权</title>
    <script src="/static/js/public/reset.js"></script>
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.0/weui.min.css">
    <style>
        html, body {
            height: 100%
        }

        .container {
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
    </style>
</head>
<body>
    <div class="container">
        <img style="width:10rem;margin-bottom:3rem" src="/static/images/public/wechat.png" />
        <div class="weui-btn weui-btn_primary" onclick="wxlogin(this);">一键微信登录</div>
    </div>
    <script src="/static/js/jquery-2.1.0.min.js"></script>
    <script src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.min.js"></script>
    <script>
        function wxlogin(e) {
            var url = decodeURIComponent(getquerystring('url'));
            if (url) {
                var loading = weui.loading('加载中')
                window.location.href = url;
            }
            else{
                weui.alert('数据丢失，请重新扫码！');
            }
        }

        function getquerystring(name) {
            var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
            if (result == null || result.length < 1) {
                return "";
            }
            return result[1];
        };

    </script>
</body>
</html>