Add user authentication and role management

This commit is contained in:
巫凤萍
2026-08-07 11:06:20 +08:00
parent 1f910c975d
commit c926a6a874
25 changed files with 2370 additions and 132 deletions

View File

@@ -79,6 +79,135 @@ body {
text-decoration: none;
}
.login-page {
display: grid;
min-height: 100vh;
grid-template-columns: minmax(0, 1.25fr) minmax(380px, 0.75fr);
gap: 28px;
align-items: stretch;
padding: 42px;
background: #eef2ee;
}
.login-brand,
.login-card {
border-radius: 28px;
}
.login-brand {
display: flex;
min-height: 620px;
flex-direction: column;
justify-content: center;
padding: clamp(42px, 7vw, 96px);
color: white;
background: linear-gradient(135deg, #102d25, #1f6f55);
box-shadow: var(--shadow);
}
.login-logo {
display: grid;
width: 54px;
height: 54px;
place-items: center;
border-radius: 16px;
color: #15553f;
background: #a9e4cc;
font-size: 23px;
font-weight: 800;
}
.login-brand p {
margin: 28px 0 6px;
color: #67d4aa;
font-size: 12px;
font-weight: 800;
letter-spacing: 0.16em;
}
.login-brand h1 {
margin: 0;
font-size: clamp(42px, 6vw, 82px);
font-weight: 520;
letter-spacing: -0.06em;
}
.login-brand span {
margin-top: 20px;
color: rgb(255 255 255 / 0.64);
font-size: 15px;
}
.login-card {
display: flex;
width: 100%;
max-width: 520px;
flex-direction: column;
align-self: center;
justify-self: center;
padding: clamp(32px, 5vw, 58px);
border: 1px solid #dfe6e1;
background: white;
box-shadow: var(--shadow);
}
.login-card h2 {
margin: 6px 0 4px;
font-size: 32px;
letter-spacing: -0.04em;
}
.login-tip {
margin-bottom: 30px;
color: var(--muted);
font-size: 12px;
}
.login-card label,
.user-create-form label {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 16px;
}
.login-card label > span,
.user-create-form label > span {
color: #61706b;
font-size: 11px;
font-weight: 650;
}
.login-card input,
.user-create-form input,
.user-create-form select {
height: 48px;
padding: 0 14px;
border: 1px solid #dbe3de;
border-radius: 11px;
outline: none;
background: #fbfcfb;
}
.login-card input:focus,
.user-create-form input:focus,
.user-create-form select:focus {
border-color: #5fb28f;
box-shadow: 0 0 0 3px rgb(50 153 112 / 0.1);
}
.login-card .primary-button {
width: 100%;
height: 50px;
margin-top: 8px;
}
.login-error {
margin: -2px 0 10px;
color: #c45e3a;
font-size: 11px;
}
body {
margin: 0;
background: var(--canvas);
@@ -293,6 +422,17 @@ a {
margin-top: 12px;
padding: 10px 8px 0;
border-top: 1px solid rgb(255 255 255 / 0.06);
border-right: 0;
border-bottom: 0;
border-left: 0;
width: 100%;
color: inherit;
background: transparent;
text-align: left;
}
.sidebar-user:hover {
background: rgb(255 255 255 / 0.035);
}
.chevron {
@@ -2735,6 +2875,89 @@ label small {
font-size: 9px;
}
.user-management-layout {
display: grid;
grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
gap: 18px;
}
.user-create-panel,
.user-list-panel {
align-self: start;
}
.user-create-form {
display: flex;
flex-direction: column;
margin-top: 24px;
}
.user-create-form .primary-button {
width: 100%;
height: 45px;
margin-top: 3px;
}
.user-management-message {
margin: 14px 0 0;
padding: 10px 12px;
border-radius: 9px;
color: #27634f;
background: #edf7f2;
font-size: 10px;
}
.user-table {
margin-top: 18px;
border: 1px solid var(--line);
border-radius: 12px;
overflow: hidden;
}
.user-table-head,
.user-table-row {
display: grid;
grid-template-columns: minmax(130px, 1.4fr) minmax(90px, 0.8fr) minmax(90px, 0.8fr) 82px;
gap: 12px;
align-items: center;
padding: 12px 14px;
}
.user-table-head {
color: #899490;
background: #f5f7f5;
font-size: 9px;
}
.user-table-row {
border-top: 1px solid var(--line);
font-size: 10px;
}
.user-table-row > span:not(.role-pill) {
color: #84908c;
}
.role-pill {
width: fit-content;
padding: 5px 8px;
border-radius: 999px;
color: #53625d;
background: #edf1ee;
font-size: 8px;
font-weight: 650;
}
.role-pill.super_admin {
color: #7d5a14;
background: #fff4d9;
}
.role-pill.admin {
color: #22614b;
background: #e5f5ed;
}
.toast {
position: fixed;
right: 24px;
@@ -2881,6 +3104,19 @@ label small {
}
@media (max-width: 900px) {
.login-page {
grid-template-columns: 1fr;
padding: 20px;
}
.login-brand {
min-height: 260px;
}
.user-management-layout {
grid-template-columns: 1fr;
}
.sidebar {
transform: translateX(-100%);
transition: transform 180ms ease;
@@ -2957,6 +3193,32 @@ label small {
}
@media (max-width: 680px) {
.login-page {
padding: 12px;
}
.login-brand {
min-height: 210px;
padding: 30px;
}
.login-brand h1 {
font-size: 40px;
}
.login-card {
padding: 28px 22px;
}
.user-table {
overflow-x: auto;
}
.user-table-head,
.user-table-row {
min-width: 560px;
}
.topbar {
height: 62px;
}