从后端模板迁过来的样式现在真正用上了,并修掉两处不一致:
- 登录页:.panel-switch + .pane-account / .pane-wechat + 右上角 .corner-toggle 三角形切换;
字段改成无 label 的 .field-plain + 悬浮 .tip;验证码用 .input-row 与按钮同行。
- 找回 / 重置密码页:同样换成 .field-plain 紧凑字段。
- 列表页(设备管理 / 扫码记录):AppLayout 支持 fill → 内容区加 .content-fill,
表格包进 .table-wrap → 卡片撑满剩余高度、表头吸顶、只有表格内部滚动、分页贴底。
- 卡片间距交给 .card + .card;测试页结果区改用全局 .json-box 与 .sub-title。
- ⚠️ 修 bug:「注册」标签下注册面板不显示 —— 登录与注册共用 .pane-account,
但 CSS 只写了 .is-login .pane-account / .is-register .pane-register(后者没有对应元素);
同时给 .is-register 补上 padding-top,避免折角三角形压住第一个输入框。
- 顺带去掉不再需要的内联 margin。
验证:vue-tsc + vite build 通过;浏览器实测三个面板都能切换(注册面板 5 个字段可见、
三角形不压输入框),两个列表页 content-fill 生效、整页不滚动、表格内部滚动且表头 sticky。
489 lines
8.8 KiB
CSS
489 lines
8.8 KiB
CSS
:root {
|
||
--brand: #2563eb;
|
||
--brand-dark: #1d4ed8;
|
||
--text: #1f2430;
|
||
--text-muted: #6b7280;
|
||
--border: #e5e7eb;
|
||
--bg: #f6f7fb;
|
||
--card: #ffffff;
|
||
--danger: #dc2626;
|
||
--ok: #16a34a;
|
||
--radius: 10px;
|
||
}
|
||
|
||
* {
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
html,
|
||
body,
|
||
#app {
|
||
height: 100%;
|
||
margin: 0;
|
||
}
|
||
|
||
body {
|
||
background: var(--bg);
|
||
color: var(--text);
|
||
font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
|
||
}
|
||
|
||
a {
|
||
color: var(--brand);
|
||
text-decoration: none;
|
||
}
|
||
|
||
button {
|
||
font: inherit;
|
||
}
|
||
|
||
.card {
|
||
background: var(--card);
|
||
border: 1px solid var(--border);
|
||
border-radius: var(--radius);
|
||
padding: 20px;
|
||
}
|
||
|
||
.field {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 6px;
|
||
margin-bottom: 14px;
|
||
}
|
||
|
||
.field > span {
|
||
color: var(--text-muted);
|
||
font-size: 13px;
|
||
}
|
||
|
||
input,
|
||
select {
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
padding: 9px 12px;
|
||
font: inherit;
|
||
outline: none;
|
||
background: #fff;
|
||
}
|
||
|
||
input:focus,
|
||
select:focus {
|
||
border-color: var(--brand);
|
||
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
|
||
}
|
||
|
||
.btn {
|
||
border: 0;
|
||
border-radius: 8px;
|
||
background: var(--brand);
|
||
color: #fff;
|
||
padding: 9px 16px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.btn:hover {
|
||
background: var(--brand-dark);
|
||
}
|
||
|
||
.btn:disabled {
|
||
opacity: 0.6;
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
.btn-ghost {
|
||
background: #fff;
|
||
color: var(--text);
|
||
border: 1px solid var(--border);
|
||
}
|
||
|
||
.btn-danger {
|
||
background: var(--danger);
|
||
}
|
||
|
||
.hint {
|
||
color: var(--text-muted);
|
||
font-size: 13px;
|
||
}
|
||
|
||
.alert {
|
||
border-radius: 8px;
|
||
padding: 10px 12px;
|
||
margin-bottom: 14px;
|
||
font-size: 13px;
|
||
}
|
||
|
||
.alert-error {
|
||
background: #fef2f2;
|
||
color: #b91c1c;
|
||
border: 1px solid #fecaca;
|
||
}
|
||
|
||
.alert-ok {
|
||
background: #f0fdf4;
|
||
color: #15803d;
|
||
border: 1px solid #bbf7d0;
|
||
}
|
||
|
||
/* 登录/找回密码这类「裸页」:居中卡片 */
|
||
/* ⚠️ 不要用 align-items:center:卡片比视口高时顶部会被裁掉且滚不上去 → 用 margin:auto 把卡片推居中 */
|
||
.bare-page {
|
||
min-height: 100%;
|
||
display: flex;
|
||
padding: 24px;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.bare-card {
|
||
width: 360px;
|
||
max-width: 100%;
|
||
margin: auto;
|
||
}
|
||
|
||
/* ---------------- 登录页的面板切换(账号密码 ↔ 微信扫码) ----------------
|
||
· 面板都放在同一个 .panel-switch 容器里,靠 is-login / is-register / is-wechat 决定显示哪个;
|
||
· 登录与扫码用 padding-top + min-height 定成同高 → 切换时卡片高度/位置不变;
|
||
· 右上角的三角形 .corner-toggle 挂在容器上,和输入框右边缘对齐(不是页面右上角)。 */
|
||
.panel-switch {
|
||
position: relative;
|
||
}
|
||
|
||
/* 登录(含注册)与扫码面板都要给右上角三角形留出 38px,登录/扫码再定成同高 */
|
||
.panel-switch.is-login,
|
||
.panel-switch.is-register,
|
||
.panel-switch.is-wechat {
|
||
padding-top: 38px;
|
||
}
|
||
|
||
.panel-switch.is-login,
|
||
.panel-switch.is-wechat {
|
||
min-height: 300px;
|
||
}
|
||
|
||
.pane {
|
||
display: none;
|
||
}
|
||
|
||
/* ⚠️ 登录与注册共用同一个 .pane-account(面板内再用 tab 切表单),所以 is-register 也要显示它;
|
||
如果只按「账号面板 / 注册面板」两套元素写选择器,点「注册」会一片空白(那个元素并不存在) */
|
||
.panel-switch.is-login .pane-account,
|
||
.panel-switch.is-register .pane-account,
|
||
.panel-switch.is-wechat .pane-wechat {
|
||
display: block;
|
||
}
|
||
|
||
/* 三角形只在自己那块折角区域内可点(clip-path 会把命中区一起裁掉) */
|
||
.corner-toggle {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
width: 38px;
|
||
height: 38px;
|
||
padding: 0;
|
||
border: 0;
|
||
cursor: pointer;
|
||
background: #eef2ff;
|
||
color: var(--brand);
|
||
clip-path: polygon(100% 0, 100% 100%, 0 0);
|
||
display: flex;
|
||
align-items: flex-start;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.corner-toggle:hover {
|
||
background: #e0e7ff;
|
||
}
|
||
|
||
.corner-toggle svg {
|
||
width: 18px;
|
||
height: 18px;
|
||
margin: 5px 5px 0 0;
|
||
fill: currentColor;
|
||
}
|
||
|
||
/* ---------------- 无 label 的紧凑字段(登录 / 注册 / 找回 / 重置) ----------------
|
||
字段名写进 placeholder;「必填 + 说明」用悬浮气泡 —— 绝对定位、hover 或聚焦才显示,
|
||
显示/移除都不参与布局,所以不会把卡片撑高。 */
|
||
.field-plain {
|
||
position: relative;
|
||
margin-bottom: 12px;
|
||
}
|
||
|
||
.field-plain input {
|
||
width: 100%;
|
||
}
|
||
|
||
.field-plain .tip {
|
||
position: absolute;
|
||
top: -17px;
|
||
right: 2px;
|
||
max-width: 100%;
|
||
padding: 2px 8px;
|
||
border-radius: 999px;
|
||
background: #fff;
|
||
border: 1px solid var(--border);
|
||
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
|
||
color: var(--text-muted);
|
||
font-size: 12px;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
opacity: 0;
|
||
visibility: hidden;
|
||
transition: opacity 0.12s ease;
|
||
pointer-events: none;
|
||
}
|
||
|
||
.field-plain:hover .tip,
|
||
.field-plain:focus-within .tip {
|
||
opacity: 1;
|
||
visibility: visible;
|
||
}
|
||
|
||
.field-plain .required {
|
||
color: var(--danger);
|
||
}
|
||
|
||
/* 输入框 + 右侧按钮(如「获取验证码」)同一行 */
|
||
.input-row {
|
||
display: flex;
|
||
gap: 8px;
|
||
}
|
||
|
||
.input-row input {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
/* ---------------- 业务页布局:左侧菜单 + 内容区 ---------------- */
|
||
.layout {
|
||
display: flex;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.sidebar {
|
||
width: 210px;
|
||
flex: 0 0 210px;
|
||
background: #0f172a;
|
||
color: #cbd5e1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.sidebar .brand {
|
||
padding: 18px 16px;
|
||
font-weight: 600;
|
||
color: #fff;
|
||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||
}
|
||
|
||
.sidebar nav {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
padding: 10px 8px;
|
||
}
|
||
|
||
.sidebar nav a {
|
||
display: block;
|
||
padding: 9px 12px;
|
||
border-radius: 8px;
|
||
color: #cbd5e1;
|
||
margin-bottom: 2px;
|
||
}
|
||
|
||
.sidebar nav a.router-link-active {
|
||
background: rgba(37, 99, 235, 0.9);
|
||
color: #fff;
|
||
}
|
||
|
||
.sidebar .me {
|
||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||
padding: 12px 16px;
|
||
font-size: 13px;
|
||
}
|
||
|
||
.main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.topbar {
|
||
height: 52px;
|
||
background: #fff;
|
||
border-bottom: 1px solid var(--border);
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 0 20px;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.content {
|
||
flex: 1;
|
||
min-height: 0;
|
||
overflow-y: auto;
|
||
padding: 20px;
|
||
}
|
||
|
||
table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
background: #fff;
|
||
}
|
||
|
||
th,
|
||
td {
|
||
text-align: left;
|
||
padding: 9px 12px;
|
||
border-bottom: 1px solid var(--border);
|
||
font-size: 13px;
|
||
}
|
||
|
||
th {
|
||
background: #f9fafb;
|
||
color: var(--text-muted);
|
||
font-weight: 500;
|
||
}
|
||
|
||
.muted {
|
||
color: var(--text-muted);
|
||
}
|
||
|
||
/* ---------------- 列表页公共样式(设备管理 / 扫码记录) ---------------- */
|
||
|
||
.toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 14px;
|
||
}
|
||
|
||
.toolbar-wrap {
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.table {
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.table th,
|
||
.table td {
|
||
vertical-align: middle;
|
||
}
|
||
|
||
.table code {
|
||
font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
|
||
background: #f3f4f6;
|
||
padding: 1px 5px;
|
||
border-radius: 5px;
|
||
}
|
||
|
||
/* 展开的明细行(孩子表)+ 孩子表本身 */
|
||
.row-detail > td {
|
||
background: #f9fafb;
|
||
padding: 0 12px 12px;
|
||
}
|
||
|
||
.table-sub {
|
||
border: 1px solid var(--border);
|
||
border-radius: 6px;
|
||
}
|
||
|
||
.pager {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
gap: 10px;
|
||
margin-top: 14px;
|
||
}
|
||
|
||
.btn-sm {
|
||
padding: 4px 10px;
|
||
font-size: 13px;
|
||
margin-right: 6px;
|
||
}
|
||
|
||
.badge {
|
||
display: inline-block;
|
||
padding: 1px 8px;
|
||
border-radius: 999px;
|
||
font-size: 12px;
|
||
border: 1px solid transparent;
|
||
}
|
||
|
||
.badge-ok {
|
||
color: #15803d;
|
||
background: #f0fdf4;
|
||
border-color: #bbf7d0;
|
||
}
|
||
|
||
.badge-off {
|
||
color: #b91c1c;
|
||
background: #fef2f2;
|
||
border-color: #fecaca;
|
||
}
|
||
|
||
/* ---------------- 列表页:占满高度,滚动只在表格内部(整页不滚动) ----------------
|
||
AppLayout 传 fill 时给内容区加 .content-fill:
|
||
卡片撑满剩余高度(只有一两条数据也撑满)→ 表头吸顶、分页固定在卡片底部。 */
|
||
.content-fill {
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.content-fill > .card {
|
||
display: flex;
|
||
flex-direction: column;
|
||
flex: 1 1 auto;
|
||
min-height: 0;
|
||
}
|
||
|
||
.content-fill .table-wrap {
|
||
flex: 1 1 auto;
|
||
min-height: 0;
|
||
overflow: auto;
|
||
}
|
||
|
||
.table-wrap > .table {
|
||
border: 0;
|
||
border-radius: 0;
|
||
}
|
||
|
||
/* border-collapse:collapse 下 sticky 会丢边框 → 用 box-shadow 补一条 */
|
||
.table-wrap > .table > thead th {
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 2;
|
||
background: #f9fafb;
|
||
box-shadow: inset 0 -1px 0 var(--border);
|
||
}
|
||
|
||
/* ---------------- 卡片间距与 JSON 输出 ---------------- */
|
||
.card + .card {
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.sub-title {
|
||
margin: 18px 0 4px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.json-box {
|
||
margin: 12px 0 0;
|
||
max-height: 320px;
|
||
overflow: auto;
|
||
padding: 12px;
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
background: #f9fafb;
|
||
color: var(--text);
|
||
font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
|
||
white-space: pre-wrap;
|
||
word-break: break-all;
|
||
}
|