1 Commits

Author SHA1 Message Date
7a11c229a4 更新 .vscode/mcp.json 2025-11-18 17:29:35 +00:00
5 changed files with 1 additions and 147 deletions

3
.vscode/mcp.json vendored
View File

@@ -1,5 +1,4 @@
{
"mcp": {
"inputs": [
{
"type": "promptString",
@@ -27,5 +26,5 @@
}
}
}
}
}

View File

@@ -1,40 +0,0 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Demo - 主页</title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<main class="container">
<header>
<h1>Demo 应用</h1>
</header>
<section id="content">
<p id="greeting">正在检查登录状态……</p>
<div id="actions"></div>
</section>
</main>
<script>
// 简单客户端令牌检查
const token = localStorage.getItem('demo_auth_token');
const greeting = document.getElementById('greeting');
const actions = document.getElementById('actions');
if (token) {
greeting.textContent = '欢迎,已登录用户!';
const logoutBtn = document.createElement('button');
logoutBtn.textContent = '退出登录';
logoutBtn.onclick = () => {
localStorage.removeItem('demo_auth_token');
location.reload();
};
actions.appendChild(logoutBtn);
} else {
greeting.innerHTML = '你还未登录。前往 <a href="/login.html">登录页面</a>。';
}
</script>
</body>
</html>

View File

@@ -1,34 +0,0 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>登录 - Demo</title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<main class="container">
<form id="loginForm" class="card">
<h2>用户登录</h2>
<div class="form-group">
<label for="username">用户名</label>
<input id="username" name="username" type="text" placeholder="请输入用户名" required>
</div>
<div class="form-group">
<label for="password">密码</label>
<input id="password" name="password" type="password" placeholder="请输入密码" required>
</div>
<div class="form-group row">
<label><input id="remember" type="checkbox"> 记住我</label>
</div>
<div class="form-group">
<div id="error" class="error" aria-live="polite"></div>
</div>
<div class="form-group">
<button type="submit">登录</button>
</div>
</form>
</main>
<script src="/static/js/login.js"></script>
</body>
</html>

View File

@@ -1,20 +0,0 @@
:root{
--bg:#f4f7fb;
--card:#ffffff;
--accent:#1976d2;
--muted:#666;
}
*{box-sizing:border-box}
body{font-family:Inter,system-ui,Arial,Helvetica,sans-serif;background:var(--bg);margin:0;color:#222}
.container{max-width:520px;padding:20px;margin:48px auto}
.card{background:var(--card);padding:20px;border-radius:8px;box-shadow:0 6px 18px rgba(20,30,50,0.08)}
h1,h2{margin:0 0 12px}
.form-group{margin:12px 0}
label{display:block;margin-bottom:6px;color:var(--muted);font-size:14px}
input[type=text],input[type=password]{width:100%;padding:10px 12px;border:1px solid #d9e2ef;border-radius:6px;font-size:15px}
button{background:var(--accent);color:#fff;border:none;padding:10px 14px;border-radius:6px;font-size:15px;cursor:pointer}
.error{color:#b00020;font-size:14px;min-height:18px}
@media (max-width:520px){
.container{margin:20px;padding:12px}
}

View File

@@ -1,51 +0,0 @@
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('loginForm');
const username = document.getElementById('username');
const password = document.getElementById('password');
const remember = document.getElementById('remember');
const error = document.getElementById('error');
function showError(msg){
error.textContent = msg;
}
function validate() {
if (!username.value || username.value.trim().length < 3) {
showError('用户名至少 3 个字符');
return false;
}
if (!password.value || password.value.length < 6) {
showError('密码至少 6 个字符');
return false;
}
return true;
}
form.addEventListener('submit', (e) => {
e.preventDefault();
showError('');
if (!validate()) return;
// 本地模拟认证:示例用户名/密码对
const validUsers = { 'alice':'password123', 'bob':'secret123', 'beppeb':'demoPass' };
const inputUser = username.value.trim();
const inputPass = password.value;
if (validUsers[inputUser] && validUsers[inputUser] === inputPass) {
// 登录成功:写入本地 token示例并跳转首页
const token = 'demo-token-' + Math.random().toString(36).slice(2);
if (remember.checked) {
localStorage.setItem('demo_auth_token', token);
} else {
sessionStorage.setItem('demo_auth_token', token);
// keep a copy in localStorage to let index.html detect login; it's demo-only
localStorage.setItem('demo_auth_token', token);
}
// 简短提示后跳转
showError('登录成功,正在跳转……');
setTimeout(() => { window.location.href = '/'; }, 700);
} else {
showError('用户名或密码不正确(此示例使用本地模拟账号)。');
}
});
});