Files
SimpleNav/assets/css/admin.css
T
laoyang 717a8877bb 后台排序改造:按板块标签页 + 拖拽排序 + 顺序完全固定
- 后台网站列表按板块分标签页,每个板块单独调顺序;用 URL hash
  (#sgroup-<gid>) 定位,上移/下移提交后回跳到原来的板块
- 支持鼠标拖拽排序(原生 HTML5 拖拽,零库依赖):拖动时实时重排预览,
  松手后整组落库(Ajax 动作 site_reorder,带 CSRF 校验与板块归属校验,
  防止跨板块搬条目)
- 稀疏排序:新增链接的顺序号 = 同板块 MAX + SORT_STEP(1000),天然排最后;
  拖拽落库、历史数据迁移时整组归一化为 index * SORT_STEP
- 修复真根因:旧机制靠「交换两条 sort_order」上移/下移,一旦历史数据里
  出现重复值,交换即无效、位置退化为按 id 排序 —— 这正是「排了顺序又被
  打乱」的来源。新增一次性归一化迁移,用 settings.mig_sort_sparse 作哨兵,
  避免每次请求重复覆盖用户设置
- 新增/修改链接不再用 MAX+1(MAX+1 会落进已有间隙、插到用户排好的中间)
- 改变所属板块时,该条目自动排到新板块的最后
- 后台页面 + 拖拽手柄做了配套样式,触屏设备降级为上下移按钮
2026-09-29 09:21:51 +08:00

197 lines
9.4 KiB
CSS

/* 简航 SimpleNav —— 后台样式 */
:root {
--wrap: 1140px;
--gutter: 16px;
--pad-x: max(var(--gutter), calc((100% - var(--wrap)) / 2));
}
body.admin { background: #eef0f3; color: #333; font-size: 14px; }
.topbar {
display: flex; align-items: center; gap: 16px; padding: 0 var(--pad-x); height: 56px;
background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 50;
}
.topbar .brand { font-size: 17px; font-weight: 700; }
.topbar .brand a { color: #2F6BF7; }
.topbar .brand span { color: #999; font-weight: 400; font-size: 13px; margin-left: 6px; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { padding: 8px 14px; border-radius: 8px; color: #555; }
.topnav a:hover { background: #f2f4f7; }
.topnav a.active { background: #2F6BF7; color: #fff; }
.topright { display: flex; align-items: center; gap: 10px; color: #666; }
.wrap { padding: 0 var(--pad-x); margin: 20px 0 60px; }
.card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; margin: 0; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid-form label { display: flex; flex-direction: column; font-size: 13px; color: #555; gap: 5px; }
.grid-form label.chk { flex-direction: row; align-items: center; gap: 6px; }
.grid-form .span2 { grid-column: 1 / -1; }
.grid-form .row { display: flex; gap: 8px; }
.grid-form .row input { flex: 1; }
.grid-form input[type=text], .grid-form input[type=password], .grid-form select {
height: 38px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: 8px; font-size: 14px; width: 100%;
}
.grid-form input:focus, .grid-form select:focus { outline: none; border-color: #2F6BF7; }
.form-actions { display: flex; align-items: center; gap: 10px; }
.hint { color: #999; font-size: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn.primary { background: #2F6BF7; color: #fff; }
.btn.primary:hover { background: #2456cc; }
.btn.ghost { background: #f2f4f7; color: #444; }
.btn.ghost:hover { background: #e6e9ee; }
.btn.block { width: 100%; justify-content: center; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert.ok { background: #e8f6ee; color: #1a7f45; }
.alert.err { background: #fdecec; color: #c0392b; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 窄屏下表格自己横向滚动,绝不撑破页面 */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl th, .tbl td { padding: 9px 8px; text-align: left; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.tbl th { color: #888; font-weight: 500; }
.tbl tr:hover td { background: #fafbfc; }
.tbl .muted { color: #999; }
.tbl .ell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.mini { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #f4f5f7; }
.mini.letter { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
.inline { display: inline; }
.ico-btn {
display: inline-flex; align-items: center; justify-content: center;
border: none; background: #f2f4f7; width: 28px; height: 28px; border-radius: 6px;
cursor: pointer; color: #555; margin: 0 1px; padding: 0; transition: background .15s, color .15s;
}
.ico-btn:hover { background: #e6e9ee; }
.ico-btn:disabled { opacity: .5; cursor: default; }
.ico-btn.danger { color: #c0392b; }
.ico-btn.danger:hover { background: #fdecec; }
.ok-dot { color: #1a7f45; font-size: 12px; }
/* 显示 / 隐藏 切换按钮:绿=显示中,灰=已隐藏 */
.ico-btn.toggle { color: #9aa3af; }
.ico-btn.toggle:hover { background: #e6e9ee; color: #555; }
.ico-btn.toggle.on { color: #1a7f45; background: #e8f6ee; }
.ico-btn.toggle.on:hover { background: #d6efe1; }
.ico-btn.toggle svg { display: block; }
/* 状态胶囊 */
.state {
display: inline-block; min-width: 52px; padding: 2px 8px; border-radius: 10px;
font-size: 12px; line-height: 18px; text-align: center; vertical-align: middle;
}
.state.on { background: #e8f6ee; color: #1a7f45; }
.state.off { background: #f1f3f5; color: #98a2b3; }
/* 「自定义图标」标记 */
.badge {
display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px;
background: #eef3ff; color: #2F6BF7; font-size: 11px; line-height: 16px; vertical-align: middle;
}
/* 图数字段 */
.icon-field {
display: flex; gap: 16px; align-items: flex-start; padding: 12px;
border: 1px dashed #d9dde3; border-radius: 10px; background: #fafbfc;
}
.icon-field-preview { flex: 0 0 72px; }
.icon-preview {
display: flex; align-items: center; justify-content: center; width: 72px; height: 72px;
border-radius: 14px; background: #fff; border: 1px solid #e6e9ee; overflow: hidden;
}
.icon-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.icon-preview .ph { color: #bbb; font-size: 12px; }
/* 站点整体图标:比格子里的图标大一号,看得清 */
.icon-preview.big { width: 96px; height: 96px; border-radius: 20px; }
.icon-field-preview.big { flex: 0 0 96px; }
.pill {
display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px;
font-weight: 400; background: #eef2f7; color: #667085; vertical-align: 1px;
}
.pill[data-site-icon="custom"] { background: #e8f1fe; color: #2456cc; }
.icon-field-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.icon-field-title { font-size: 13px; color: #555; font-weight: 600; }
.icon-field-body input[type=text] {
height: 38px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: 8px; font-size: 14px; width: 100%;
}
.icon-field-body input[type=text]:focus { outline: none; border-color: #2F6BF7; }
.icon-row2 { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.icon-row2 .chk { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: #555; }
.icon-row2 input[type=file] {
font-size: 13px; color: #666; background: #fff; border: 1px solid #d9dde3;
border-radius: 8px; padding: 6px 8px; max-width: 300px;
}
.icon-field .hint { line-height: 1.75; margin: 0; }
.icon-field .hint b { color: #2F6BF7; }
/* 已隐藏的行稍作弱化 */
.tbl tr.row-off td:first-child, .tbl tr.row-off td:nth-child(2) { color: #98a2b3; }
/* ===== 网站列表:板块标签页 + 拖拽排序 ===== */
/* 板块标签条(后台自己的配色,不复用前台的 .tabs —— 前台的底色是半透明,
放在后台白卡上会显得发灰) */
.sites-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sites-tabs .tab {
display: inline-flex; align-items: center; gap: 6px;
border: 1px solid #dfe3e8; background: #f7f9fb; color: #4a5568; cursor: pointer;
padding: 7px 14px; border-radius: 999px; font-size: 13px; transition: all .15s;
}
.sites-tabs .tab:hover { background: #eef2f7; }
.sites-tabs .tab.active { background: #2F6BF7; border-color: #2F6BF7; color: #fff; }
.sites-tabs .tab .tab-count {
display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px;
background: rgba(0,0,0,.08); font-size: 11px; line-height: 16px; text-align: center;
}
.sites-tabs .tab.active .tab-count { background: rgba(255,255,255,.28); }
/* 面板:一次只显示一个板块 */
.sites-panel { display: none; }
.sites-panel.active { display: block; }
/* 拖拽手柄列 */
.tbl-sortable .th-drag, .tbl-sortable .td-drag { width: 30px; padding-right: 0; }
.drag-handle {
display: inline-flex; align-items: center; justify-content: center;
width: 22px; height: 26px; border-radius: 5px; color: #b6bec9; cursor: grab;
vertical-align: middle; user-select: none;
}
.drag-handle:hover { background: #eef2f7; color: #6b7684; }
tr[draggable="true"] { cursor: default; }
/* 正在被拖动的那一行 */
.tbl tr.dragging { opacity: .45; background: #eef3ff !important; }
.tbl tr.dragging td { background: #eef3ff !important; }
/* 拖拽/保存状态提示(每个板块一条) */
.sort-status { min-height: 18px; margin: 8px 0 0; }
.sort-status:empty { display: none; }
/* 触屏等不支持 HTML5 拖拽的环境:手柄给个提示色,微调按钮仍可用 */
@media (hover: none) {
.drag-handle { color: #c8cfd8; }
.sort-status { display: none; }
}
/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; background: #fff; border-radius: 14px; padding: 30px 26px; box-shadow: 0 10px 30px rgba(0,0,0,.08); text-align: center; }
.login-card h1 { font-size: 20px; margin: 8px 0 2px; }
.login-card .sub { color: #999; font-size: 13px; margin: 0 0 18px; }
.login-card input { width: 100%; height: 42px; margin-bottom: 12px; padding: 0 12px; border: 1px solid #d9dde3; border-radius: 8px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: #2F6BF7; }
.login-card .btn { height: 42px; }
.login-logo { width: 56px; height: 56px; }
@media (max-width: 720px) {
.grid-form { grid-template-columns: 1fr; }
.topbar { flex-wrap: wrap; height: auto; padding: 10px var(--pad-x); }
.tbl { min-width: 620px; }
.tbl .ell { max-width: 120px; }
.icon-field { flex-direction: column; }
.icon-field-preview { flex: 0 0 auto; }
.icon-row2 input[type=file] { max-width: 100%; }
}