This commit is contained in:
vipg
2025-11-12 17:16:21 +08:00
parent 8fba06bca3
commit b6c475a387
3 changed files with 37 additions and 63 deletions

View File

@@ -1,22 +0,0 @@
# 依赖
node_modules/
.pnp/
.pnp.js
# 构建产物
dist/
# 日志
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# 编辑器配置
.idea/
.vscode/
*.swp
*.swo
# 操作系统文件
.DS_Store
Thumbs.db

View File

@@ -1,17 +0,0 @@
{
"name": "asset-assistant-system",
"version": "1.0.0",
"description": "资产辅助管理系统",
"main": "index.html",
"scripts": {
"dev": "serve",
"build": "echo '构建脚本待实现'",
"test": "echo '测试脚本待实现'"
},
"keywords": ["asset", "management", "system"],
"author": "",
"license": "MIT",
"devDependencies": {
"serve": "^14.2.3"
}
}

View File

@@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -22,6 +23,7 @@
height: 100vh; height: 100vh;
padding: 20px; padding: 20px;
} }
.login-card { .login-card {
width: 100%; width: 100%;
max-width: 400px; max-width: 400px;
@@ -30,28 +32,34 @@
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
padding: 30px; padding: 30px;
} }
.login-header { .login-header {
text-align: center; text-align: center;
margin-bottom: 30px; margin-bottom: 30px;
} }
.login-title { .login-title {
font-size: 24px; font-size: 24px;
color: var(--primary-color); color: var(--primary-color);
margin-bottom: 8px; margin-bottom: 8px;
} }
.login-desc { .login-desc {
color: var(--text-secondary); color: var(--text-secondary);
font-size: 14px; font-size: 14px;
} }
.form-group { .form-group {
margin-bottom: 20px; margin-bottom: 20px;
} }
.form-label { .form-label {
display: block; display: block;
margin-bottom: 8px; margin-bottom: 8px;
color: var(--text-primary); color: var(--text-primary);
font-weight: 500; font-weight: 500;
} }
.login-btn { .login-btn {
width: 100%; width: 100%;
padding: 12px; padding: 12px;
@@ -60,6 +68,7 @@
} }
</style> </style>
</head> </head>
<body class="dark-theme"> <body class="dark-theme">
<div class="login-container"> <div class="login-container">
<div class="login-card"> <div class="login-card">
@@ -82,31 +91,35 @@
</div> </div>
<script> <script>
// 登录表单提交事件 // 等待DOM完全加载后再执行
$('#login-form').on('submit', async (e) => { window.addEventListener('DOMContentLoaded', () => {
e.preventDefault(); // 登录表单提交事件
$('#login-form').on('submit', async (e) => {
const username = $('#username').val().trim(); e.preventDefault();
const password = $('#password').val().trim();
const username = $('#username').val().trim();
if (!username || !password) { const password = $('#password').val().trim();
Message.error('账号和密码不能为空');
return; if (!username || !password) {
} Message.error('账号和密码不能为空');
return;
try { }
Loading.show('正在登录...');
const result = await Auth.login(username, password); try {
Message.success(result.message); Loading.show('正在登录...');
setTimeout(() => { const result = await Auth.login(username, password);
window.location.href = 'index.html'; Message.success(result.message);
}, 1000); setTimeout(() => {
} catch (error) { window.location.href = 'index.html';
Message.error(error.message || '登录失败,请重试'); }, 1000);
} finally { } catch (error) {
Loading.hide(); Message.error(error.message || '登录失败,请重试');
} } finally {
Loading.hide();
}
});
}); });
</script> </script>
</body> </body>
</html> </html>