wlzboy
2025-08-07 54979feba74bd3c7dea2630e1ba96401b25f60d8
index.asp
@@ -11,197 +11,10 @@
l   = Request("l")   '注册用户/登录
' 如果没有传递任何参数,显示登录码输入页面
If n="" And s="" And u="" And l="" Then
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录码输入</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        .container {
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            text-align: center;
            max-width: 400px;
            width: 100%;
        }
        .title {
            font-size: 24px;
            color: #333;
            margin-bottom: 30px;
        }
        .input-group {
            margin-bottom: 20px;
        }
        .input-group label {
            display: block;
            text-align: left;
            margin-bottom: 8px;
            color: #555;
            font-weight: bold;
        }
        .input-group input {
            width: 100%;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            box-sizing: border-box;
        }
        .input-group input:focus {
            outline: none;
            border-color: #007bff;
        }
        .btn {
            background-color: #007bff;
            color: white;
            padding: 12px 30px;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            margin: 5px;
            transition: background-color 0.3s;
        }
        .btn:hover {
            background-color: #0056b3;
        }
        .btn:disabled {
            background-color: #ccc;
            cursor: not-allowed;
        }
        .tip {
            color: #666;
            font-size: 14px;
            margin-top: 20px;
            line-height: 1.5;
        }
        .error {
            color: #dc3545;
            font-size: 14px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="title">广东民航医疗快线 支付登录</div>
        <form id="loginForm">
            <div class="input-group">
                <label for="loginCode">登录码:</label>
                <input type="text" id="loginCode" name="loginCode" maxlength="6" placeholder="请输入6位登录码" autocomplete="off">
            </div>
            <div class="input-group">
                <button type="button" id="payBtn" class="btn" disabled>去支付</button>
            </div>
            <div class="tip">请输入支付短信中发送的登录码</div>
            <div id="errorMsg" class="error" style="display: none;"></div>
        </form>
    </div>
    <script>
        const loginCodeInput = document.getElementById('loginCode');
        const payBtn = document.getElementById('payBtn');
        const errorMsg = document.getElementById('errorMsg');
        let autoRedirectTimer = null;
        function validateLoginCode(code) {
            return /^[A-Za-z0-9]{6}$/.test(code);
        }
        function redirectToLogin(code) {
            const currentUrl = window.location.href.split('?')[0];
            window.location.href = currentUrl + '?n=' + encodeURIComponent(code);
        }
        function updateButtonState() {
            const code = loginCodeInput.value.trim();
            const isValid = validateLoginCode(code);
            payBtn.disabled = !isValid;
            if (isValid) {
                errorMsg.style.display = 'none';
                // 清除之前的定时器
                if (autoRedirectTimer) {
                    clearTimeout(autoRedirectTimer);
                }
                // 设置自动跳转定时器(2秒后自动跳转)
                autoRedirectTimer = setTimeout(() => {
                    redirectToLogin(code);
                }, 2000);
            } else {
                if (autoRedirectTimer) {
                    clearTimeout(autoRedirectTimer);
                    autoRedirectTimer = null;
                }
            }
        }
        function showError(message) {
            errorMsg.textContent = message;
            errorMsg.style.display = 'block';
        }
        function hideError() {
            errorMsg.style.display = 'none';
        }
        // 输入框事件监听
        loginCodeInput.addEventListener('input', function() {
            const code = this.value.trim();
            // 只允许输入数字和字母
            this.value = code.replace(/[^A-Za-z0-9]/g, '');
            updateButtonState();
            hideError();
        });
        // 支付按钮点击事件
        payBtn.addEventListener('click', function() {
            const code = loginCodeInput.value.trim();
            if (validateLoginCode(code)) {
                redirectToLogin(code);
            } else {
                showError('请输入正确的6位登录码');
            }
        });
        // 回车键提交
        loginCodeInput.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                const code = this.value.trim();
                if (validateLoginCode(code)) {
                    redirectToLogin(code);
                } else {
                    showError('请输入正确的6位登录码');
                }
            }
        });
        // 页面加载时聚焦到输入框
        window.addEventListener('load', function() {
            loginCodeInput.focus();
        });
    </script>
</body>
</html>
<%
Response.End
If n="" And s="" And u="" And l="" Then %>
   <!--#include virtual="/inc/login_input.asp"-->
   <%
   Response.End
End If
Response.Cookies("n")=n