diff --git a/.gitignore b/.gitignore index 88a952c..b77a2e7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ node_modules .env .idea +.history logs/ \ No newline at end of file diff --git a/app/config/api-config.ts b/app/config/api-config.ts index 8ffd4cd..22249af 100644 --- a/app/config/api-config.ts +++ b/app/config/api-config.ts @@ -35,7 +35,7 @@ const configs: Record = { // postgrest baseUrl: 'http://10.79.97.16:8000', // minio - documentUrl: 'http://10.76.244.156:9001/docauditai/', + documentUrl: 'http://10.76.244.156:9000/docauditai/', // 文件上传 uploadUrl: 'http://10.79.97.16:8000/admin/documents/upload', }, diff --git a/app/routes/login.tsx b/app/routes/login.tsx index 0d9921e..482a63c 100644 --- a/app/routes/login.tsx +++ b/app/routes/login.tsx @@ -29,8 +29,31 @@ export async function action({ request }: ActionFunctionArgs) { return Response.json({ error: "用户名和密码不能为空" }); } + if(userRole === 'common') { + // console.log("username-----", username); + // console.log("password-----", password); + const validUsers = [ + { username: 'gdycuser', password: 'gdyc06111' }, + { username: 'gdycuser2', password: 'gdyc06112' }, + { username: 'gdycuser3', password: 'gdyc06113' } + ]; + const validUser = validUsers.find(user => user.username === username && user.password === password); + if (!validUser) { + return Response.json({ error: "普通用户用户名或密码错误" }); + } + } + + // console.log("login success", userRole); + + // 管理员登录 if (userRole === 'developer') { - if (username !== 'admin' || password !== 'admin') { + const validAdminUsers = [ + { username: 'admin', password: 'admin0611' }, + // { username: 'admin2', password: 'admin06112' }, + // { username: 'admin3', password: 'admin06113' } + ]; + const validAdminUser = validAdminUsers.find(user => user.username === username && user.password === password); + if (!validAdminUser) { return Response.json({ error: "管理员用户名或密码错误" }); } } @@ -73,6 +96,7 @@ export default function Login() { const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [userRole, setUserRole] = useState("common"); + const [showPassword, setShowPassword] = useState(false); const actionData = useActionData(); return ( @@ -111,15 +135,25 @@ export default function Login() {
- setPassword(e.target.value)} - className="form-input" - placeholder="请输入密码" - /> +
+ setPassword(e.target.value)} + className="form-input password-input" + placeholder="请输入密码" + /> + +
@@ -133,7 +167,7 @@ export default function Login() { required > - + {/* */}
diff --git a/app/styles/pages/login.css b/app/styles/pages/login.css index a912bc1..4433aa1 100644 --- a/app/styles/pages/login.css +++ b/app/styles/pages/login.css @@ -112,6 +112,40 @@ box-shadow: 0 0 0 2px rgba(44, 173, 125, 0.2); } +/* 密码输入框容器样式 */ +.password-input-container { + position: relative; + display: flex; + align-items: center; +} + +.password-input { + padding-right: 3rem; /* 为眼睛图标留出空间 */ +} + +.password-toggle-btn { + position: absolute; + right: 0.75rem; + top: 50%; + transform: translateY(-50%); + background: none; + border: none; + cursor: pointer; + padding: 0.25rem; + color: #666; + font-size: 1.25rem; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + transition: color 0.2s, background-color 0.2s; +} + +.password-toggle-btn:hover { + color: #2cad7d; +} + + .login-button { margin-top: 1rem; padding: 0.75rem 1.5rem;