feat: standalone login.html page + fix login button link
This commit is contained in:
parent
830cdd33e9
commit
44b8ceca3d
@ -60,7 +60,7 @@ body{font-family:system-ui;background:var(--bg);color:var(--text);min-height:100
|
||||
<div class="ctl">
|
||||
<button onclick="toggleTheme()" title="切换主题" id="btn-theme">🌓</button>
|
||||
<button id="btn-lang" title="切换语言">🌐 中文</button>
|
||||
<button id="btn-login" onclick="location.href='/rbac/user/login.ui'" title="用户登录">👤 登录</button>
|
||||
<button id="btn-login" onclick="location.href='/login.html'" title="用户登录">👤 登录</button>
|
||||
<span id="user-info" style="display:none;color:var(--text2);font-size:.85rem"></span>
|
||||
<button id="btn-logout" style="display:none" onclick="doLogout()">退出</button>
|
||||
</div>
|
||||
|
||||
40
wwwroot/login.html
Normal file
40
wwwroot/login.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head><meta charset="UTF-8"><title>PCCS Login</title>
|
||||
<style>
|
||||
body{font-family:system-ui;background:#f8fafc;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0}
|
||||
.card{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:32px;width:360px;box-shadow:0 4px 12px rgba(0,0,0,.1)}
|
||||
h2{margin:0 0 24px;text-align:center;color:#1e293b}
|
||||
.form-group{margin-bottom:16px}
|
||||
label{display:block;font-size:.85rem;color:#64748b;margin-bottom:4px}
|
||||
input{width:100%;padding:10px 12px;border:1px solid #e2e8f0;border-radius:8px;font-size:1rem;box-sizing:border-box}
|
||||
.btn{width:100%;padding:10px;background:#2563eb;color:#fff;border:none;border-radius:8px;font-size:1rem;cursor:pointer;font-weight:600}
|
||||
.btn:hover{opacity:.9}
|
||||
.msg{margin-top:12px;font-size:.85rem;text-align:center;color:#dc2626}
|
||||
a{color:#2563eb;text-decoration:none;font-size:.85rem;display:block;text-align:center;margin-top:12px}
|
||||
</style></head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h2>PCCS 登录</h2>
|
||||
<div class="form-group"><label>用户名</label><input type="text" id="user" placeholder="admin"></div>
|
||||
<div class="form-group"><label>密码</label><input type="password" id="pass" placeholder="admin123"></div>
|
||||
<button class="btn" onclick="login()">登录</button>
|
||||
<div class="msg" id="msg"></div>
|
||||
<a href="/">← 返回首页</a>
|
||||
</div>
|
||||
<script>
|
||||
async function login(){
|
||||
var u=document.getElementById('user').value;
|
||||
var p=document.getElementById('pass').value;
|
||||
if(!u||!p){document.getElementById('msg').textContent='请输入用户名和密码';return}
|
||||
var fd=new FormData();fd.append('username',u);fd.append('password',p);
|
||||
try{
|
||||
var r=await fetch('/pccs/api/login.dspy',{method:'POST',body:fd});
|
||||
var d=await r.json();
|
||||
if(d.status==='ok'){document.getElementById('msg').style.color='#16a34a';document.getElementById('msg').textContent='登录成功! '+d.user.username;setTimeout(function(){location.href='/'},1000)}
|
||||
else document.getElementById('msg').textContent=d.message||'登录失败'
|
||||
}catch(e){document.getElementById('msg').textContent='网络错误'}
|
||||
}
|
||||
document.getElementById('pass').addEventListener('keydown',function(e){if(e.key==='Enter')login()})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user