#
Junjie
3 天以前 030a1abd26f8588c121ec47d53473e64a1e4f343
#
1个文件已修改
137 ■■■■ 已修改文件
src/main/webapp/views/login.html 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/login.html
@@ -81,35 +81,17 @@
            border-radius: 4px;
            height: 52px;
        }
        #code-box {
            position: relative;
            height: 42px;
        }
        #code-label {
            z-index: 999;
        }
        #code {
            position: absolute;
            left: 0;
            top: 0;
            display: inline-block;
            width: 60%;
        }
        #codeImg {
            border: 1px solid rgba(0,0,0,0.1);
            position: absolute;
            right: 5%;
            top: 0;
            width: 30%;
            height: 90%;
        }
    </style>
</head>
<body class="login-bg animsition">
<div id="login-wrapper" class="animate__animated animate__bounceInDown">
    <header>
        <h2>RCS调度系统V2.0</h2>
        <h2 id="login-title" style="cursor: pointer; user-select: none;">WCS系统V3.0</h2>
        <div id="system-btns" style="display: none; margin-bottom: 20px;">
            <button class="layui-btn layui-btn-normal layui-btn-sm" id="btn-server-info">获取系统配置</button>
            <button class="layui-btn layui-btn-normal layui-btn-sm" id="btn-activate">一键激活</button>
        </div>
    </header>
    <div class="layui-form layadmin-user-login-body">
        <div class="layui-form-item">
@@ -179,6 +161,115 @@
            layer = layui.layer,
            $ = layui.jquery;
        // 连续点击三次标题显示隐藏功能
        var titleClickCount = 0;
        var titleClickTimer = null;
        $('#login-title').click(function() {
            titleClickCount++;
            if (titleClickTimer) {
                clearTimeout(titleClickTimer);
            }
            if (titleClickCount >= 3) {
                $('#system-btns').show();
                titleClickCount = 0;
            } else {
                titleClickTimer = setTimeout(function() {
                    titleClickCount = 0;
                }, 500);
            }
        });
        // 获取系统配置
        $('#btn-server-info').click(function() {
            $.ajax({
                url: baseUrl + "/license/getServerInfos",
                headers: {'token': localStorage.getItem('token')},
                method: 'GET',
                success: function (res) {
                    var pretty = '';
                    try {
                        pretty = JSON.stringify(res, null, 2);
                    } catch (e) {
                        pretty = res;
                    }
                    var html = ''
                        + '<div style="padding:15px 20px 5px 20px;">'
                        +   '<div style="font-weight:600;margin-bottom:8px;">系统配置信息</div>'
                        +   '<pre id="server-info-pre" style="background:#f7f7f7;border:1px solid #e6e6e6;border-radius:6px;padding:12px;white-space:pre-wrap;word-wrap:break-word;max-height:360px;overflow:auto;">'
                        +       pretty
                        +   '</pre>'
                        +   '<div class="layui-btn-container" style="text-align:right;margin-top:6px;">'
                        +       '<button class="layui-btn layui-btn-primary" id="copy-server-info">复制</button>'
                        +   '</div>'
                        + '</div>';
                    layer.open({
                        type: 1,
                        title: '获取系统配置',
                        area: ['640px','480px'],
                        shadeClose: true,
                        content: html,
                        success: function (layero, index) {
                            layero.find('#copy-server-info').on('click', function () {
                                var text = layero.find('#server-info-pre').text();
                                if (navigator.clipboard && navigator.clipboard.writeText) {
                                    navigator.clipboard.writeText(text).then(function () {
                                        layer.msg('已复制到剪贴板');
                                    }).catch(function () {
                                        fallbackCopy(text);
                                    });
                                } else {
                                    fallbackCopy(text);
                                }
                            });
                        }
                    });
                },
                error: function () {
                    layer.msg('获取系统配置信息失败');
                }
            });
            return false;
        });
        function fallbackCopy(text) {
            try {
                var textarea = document.createElement('textarea');
                textarea.value = text;
                textarea.style.position = 'fixed';
                textarea.style.opacity = '0';
                document.body.appendChild(textarea);
                textarea.select();
                document.execCommand('copy');
                document.body.removeChild(textarea);
                layer.msg('已复制到剪贴板');
            } catch (err) {
                layer.msg('复制失败');
            }
        }
        // 一键激活
        $('#btn-activate').click(function() {
            layer.confirm('确定执行一键激活吗', function(index){
                layer.close(index);
                $.ajax({
                    url: baseUrl + "/license/activate",
                    headers: {'token': localStorage.getItem('token')},
                    method: 'POST',
                    success: function (res) {
                        if (res.code === 200){
                            layer.msg('激活成功');
                        } else {
                            layer.msg(res.msg)
                        }
                    },
                    error: function () {
                        layer.msg('激活失败');
                    }
                });
            });
            return false;
        });
        form.on('submit(login)', function (data) {
            var mobile = $("#mobile").val();
            if (mobile === "") {