Sfoglia il codice sorgente

fix(web): 修复移动端对话框遮罩并调整工单页面字号层级

sy 2 giorni fa
parent
commit
7122d02308

+ 5 - 5
web-scaffold/src/pages/mobile/MobileWorkOrderPages.tsx

@@ -1,6 +1,6 @@
-import { useLayoutEffect, useRef, type ReactNode } from "react";
+import { useLayoutEffect, useRef } from "react";
 import { Link, Navigate, useLocation, useNavigate, useParams, useSearchParams } from "react-router";
-import { ArrowLeft, CalendarDays, ChevronRight, ClipboardCheck, Clock3, Monitor, Smartphone } from "lucide-react";
+import { ArrowLeft, CalendarDays, ChevronRight, ClipboardCheck, Clock3, Smartphone } from "lucide-react";
 import { Button } from "../../components/ui/button";
 import { TicketStatusTag, TicketTypeTag } from "../../components/work-order/TicketBadges";
 import { classifyTicketError, useTicketDetail, useTicketList } from "../../lib/ticket";
@@ -23,10 +23,10 @@ const pageSize = 100;
 // 浏览器后退与页面返回按钮共用原列表的位置,只在本次浏览中保留。
 let lastListPosition: { key: string; y: number } | undefined;
 
-function MobileHeader({ title, backLabel, onBack, children }: { title: string; backLabel?: string; onBack?: () => void; children?: ReactNode }) {
+function MobileHeader({ title, backLabel, onBack }: { title: string; backLabel?: string; onBack?: () => void }) {
   return <header className="field-top">
     {onBack && <Button variant="ghost" size="icon" aria-label={backLabel} onClick={onBack}><ArrowLeft size={20} /></Button>}
-    <h1>{title}</h1>{children}
+    <h1>{title}</h1>
   </header>;
 }
 
@@ -60,7 +60,7 @@ function MobileMineInner() {
     window.scrollTo(0, 0);
   }
   return <main className="field-page">
-    <MobileHeader title="待办工单"><Link className="field-desktop" to="/work-orders/mine"><Monitor size={16} />桌面版</Link></MobileHeader>
+    <MobileHeader title="待办工单" />
     <div className="field-content">
       <section className="field-brief" aria-label="待办概况">
         <div><p>分派给我的工单</p><strong>{total ?? "—"}<small>单</small></strong></div>

+ 41 - 29
web-scaffold/src/styles/mobile-work-orders.css

@@ -1,5 +1,15 @@
 /* 现场工单 H5:同一阅读宽度,操作区随视觉视口收放。 */
 .field-page {
+  --type-meta: .8125rem;
+  --type-support: .875rem;
+  --type-body: 1rem;
+  --type-section: 1.0625rem;
+  --field-title: clamp(1.25rem, calc(1rem + 1.05vw), 1.5rem);
+  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", var(--font-sans);
+  font-size: var(--type-body);
+  line-height: 1.55;
+  -webkit-text-size-adjust: 100%;
+  text-size-adjust: 100%;
   --field-gap: clamp(14px, 4vw, 24px);
   width: min(100%, 640px);
   min-height: 100svh;
@@ -14,12 +24,11 @@
   gap: 10px; justify-content: flex-start; padding: calc(4px + env(safe-area-inset-top)) var(--field-gap) 4px;
   min-height: 54px; border-bottom: 1px solid var(--border); background: var(--card);
 }
-.field-page h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.025em; }
+.field-page h1 { margin: 0; font-size: var(--field-title); line-height: 1.3; font-weight: 600; }
 .field-top > button, .field-page .work-order-drawer--page > header > button { width: 44px; height: 44px; margin-left: -9px; }
-.field-desktop, .field-phone, .field-primary {
+.field-phone, .field-primary {
   display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; text-decoration: none;
 }
-.field-desktop { margin-inline-start: auto; color: var(--text-secondary); font-size: 14px; }
 .field-content { display: grid; gap: 14px; padding: 16px var(--field-gap) calc(24px + env(safe-area-inset-bottom)); }
 .field-content > *, .field-group li, .field-panel dd { min-width: 0; }
 .field-brief {
@@ -28,48 +37,48 @@
   background-image: linear-gradient(110deg, #125653 45%, transparent), linear-gradient(90deg, #ffffff0e 1px, transparent 1px), linear-gradient(#ffffff0e 1px, transparent 1px);
   background-size: auto, 22px 22px, 22px 22px;
 }
-.field-brief p { margin: 0 0 4px; font-size: 14px; color: #def3ee; }
-.field-brief strong { display: flex; align-items: baseline; gap: 7px; font-size: 36px; font-weight: 550; line-height: 1.12; font-variant-numeric: tabular-nums; }
-.field-brief small { font-size: 14px; font-weight: 400; color: #def3ee; }
-.field-brief time, .field-serial { font: 13px/1.5 var(--font-mono); }
+.field-brief p { margin: 0 0 4px; font-size: var(--type-support); color: #def3ee; }
+.field-brief strong { display: flex; align-items: baseline; gap: 7px; font-size: clamp(1.875rem, calc(1.5rem + 2vw), 2.25rem); font-weight: 600; line-height: 1.12; font-variant-numeric: tabular-nums; }
+.field-brief small { font-size: var(--type-support); font-weight: 400; color: #def3ee; }
+.field-brief time, .field-serial { font: var(--type-meta)/1.5 var(--font-mono); }
 .field-brief time { display: flex; align-items: center; gap: 7px; color: #e5f4ef; }
-.field-group h2 { display: flex; align-items: center; gap: 8px; margin: 4px 2px 8px; font-size: 15px; font-weight: 600; }
+.field-group h2 { display: flex; align-items: center; gap: 8px; margin: 4px 2px 8px; font-size: var(--type-support); font-weight: 600; }
 .field-group h2::before { content: ""; width: 3px; height: 14px; border-radius: 3px; background: var(--primary); }
 .field-group[data-tone="urgent"] h2::before { background: var(--warning); }
 .field-group[data-tone="waiting"] h2::before { background: var(--muted-foreground); }
-.field-group h2 small { color: var(--muted-foreground); font-size: 13px; font-weight: 500; }
+.field-group h2 small { color: var(--muted-foreground); font-size: var(--type-meta); font-weight: 500; }
 .field-group ul, .field-empty {
   margin: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card);
 }
 .field-group ul { list-style: none; padding: 0 15px; }
 .field-group li + li { border-top: 1px solid var(--border-subtle); }
-.field-group li a { display: grid; gap: 5px; padding-block: 15px; color: inherit; text-decoration: none; }
+.field-group li a { display: grid; gap: 6px; padding-block: 16px; color: inherit; text-decoration: none; }
 .field-group li a:active { background: var(--primary-soft); }
 .field-row-meta, .field-row-title, .field-row-foot, .field-row-foot span, .field-date { display: flex; align-items: center; gap: 7px; }
 .field-row-meta { justify-content: space-between; flex-wrap: wrap; }
 .field-row-title { justify-content: space-between; }
-.field-row-title strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 17px; font-weight: 600; line-height: 1.5; }
+.field-row-title strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: var(--type-section); font-weight: 600; line-height: 1.5; }
 .field-row-title svg, .field-page svg { flex-shrink: 0; }
 .field-row-title svg { color: var(--muted-foreground); }
-.field-meta, .field-row-foot, .field-state { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
-.field-row-foot { justify-content: space-between; flex-wrap: wrap; margin-top: 3px; font-size: 13px; }
-.field-row-foot span:last-child { color: var(--primary); }
+.field-meta, .field-state { margin: 0; color: var(--text-secondary); font-size: var(--type-support); line-height: 1.5; }
+.field-row-foot { color: var(--muted-foreground); justify-content: space-between; flex-wrap: wrap; margin-top: 4px; font-size: var(--type-meta); }
+.field-row-foot span:last-child { color: var(--primary-soft-foreground); font-weight: 500; }
 .field-state, .field-empty { padding: 32px 16px; text-align: center; }
 .field-empty svg { margin: auto; color: var(--primary); }
-.field-empty h2 { margin: 12px 0 4px; font-size: 18px; }
-.field-empty p { color: var(--text-secondary); font-size: 14px; }
+.field-empty h2 { margin: 12px 0 4px; font-size: 1.125rem; }
+.field-empty p { color: var(--text-secondary); font-size: var(--type-support); }
 .field-pager { display: flex; align-items: center; justify-content: space-between; }
 .field-pager button { min-height: 44px; }
 .field-serial { color: var(--text-secondary); user-select: all; }
-.field-date { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
+.field-date { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: var(--type-support); }
 .field-date time { margin-inline-start: auto; font-variant-numeric: tabular-nums; color: var(--primary); }
-.field-panel h2 { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 600; }
+.field-panel h2 { display: flex; align-items: center; gap: 7px; font-size: var(--type-body); font-weight: 600; }
 .field-panel h2 svg, .field-phone { color: var(--primary); }
 .field-panel dl { margin: 10px 0 0; }
 .field-panel dl > div { display: grid; grid-template-columns: 5em minmax(0,1fr); gap: 8px; padding-block: 10px; }
 .field-panel dl > div + div { border-top: 1px solid var(--border-subtle); }
-.field-panel dt { padding-top: 2px; color: var(--text-secondary); font-size: 14px; }
-.field-panel dd { margin: 0; font-size: 16px; line-height: 1.5; }
+.field-panel dt { padding-top: 2px; color: var(--field-label); font-size: var(--type-support); }
+.field-panel dd { margin: 0; font-size: var(--type-body); line-height: 1.5; }
 .field-panel dl > div:last-child { padding-bottom: 0; }
 .field-phone, .field-contact { display: flex; width: fit-content; }
 .field-record > .ops-record-page {
@@ -78,8 +87,8 @@
 .field-record .work-order-head { gap: 8px; padding: 16px 16px 0; background: linear-gradient(140deg,var(--primary-soft),var(--card) 65%); }
 .field-record .work-order-head-top { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px; }
 .field-record .work-order-head-main, .field-record .work-order-head-copy { display: contents; }
-.field-record .work-order-head-no { grid-area: 1 / 1; }
-.field-record .work-order-head-title { grid-area: 2 / 1 / 3 / -1; font-size: 21px; line-height: 1.35; }
+.field-record .work-order-head-no { grid-area: 1 / 1; font-size: var(--type-meta); }
+.field-record .work-order-head-title { grid-area: 2 / 1 / 3 / -1; font-size: var(--field-title); line-height: 1.35; }
 .field-record .work-order-head-tags { grid-area: 3 / 1 / 4 / -1; }
 .field-record .work-order-head-icon { display: none; }
 .field-record .work-order-head-actions { grid-area: 1 / 2; width: auto; }
@@ -89,7 +98,7 @@
 .field-record .field-date { margin-top: 5px; padding-top: 10px; }
 .field-ticket-meta { border-top: 1px solid var(--border-subtle); }
 .field-ticket-meta summary, .field-ticket-gaps summary {
-  display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer; font-size: 14px;
+  display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer; font-size: var(--type-support);
 }
 .field-record summary::-webkit-details-marker { display: none; }
 .field-ticket-meta summary svg, .field-ticket-gaps summary svg { margin-inline-start: auto; }
@@ -104,7 +113,7 @@
 .field-ticket-gaps .work-order-gaps { padding-top: 0; border: 0; }
 .field-record .work-order-layout { grid-template-columns: minmax(0, 1fr); }
 .field-record .work-order-record-tabs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 2px; padding: 4px; }
-.field-record .work-order-record-tabs button { justify-content: center; gap: 3px; min-height: 44px; padding: 0 2px; line-height: 1.35; font-size: 13px; }
+.field-record .work-order-record-tabs button { justify-content: center; gap: 3px; min-height: 44px; padding: 0 2px; line-height: 1.35; font-size: var(--type-meta); }
 .field-record .record-tab-count { min-width: 0; padding-inline: 3px; }
 @media (max-width: 374px) {
   .field-record .work-order-record-tabs { grid-template-columns: repeat(3,minmax(0,1fr)); }
@@ -119,7 +128,7 @@
   position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 12px;
   padding: 10px var(--field-gap) calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--border);
 }
-.field-primary { flex: 1; border-radius: 8px; color: var(--primary-foreground); background: var(--primary); font-size: 16px; font-weight: 550; }
+.field-primary { flex: 1; border-radius: 8px; color: var(--primary-foreground); background: var(--primary); font-size: var(--type-body); font-weight: 600; }
 .field-page :is(button, a, input, textarea, select, summary) { scroll-margin-block: 80px 100px; }
 .field-page :is(a,button,summary):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
 .field-page .work-order-drawer--page {
@@ -127,16 +136,19 @@
   margin: 0; border: 0; box-shadow: none; overflow: visible; background: var(--background);
 }
 .field-page .field-form-context { margin: 16px var(--field-gap) 0; padding: 14px 16px; border-radius: 10px; background: var(--primary-soft); }
-.field-form-context strong { display: block; margin-top: 3px; font-size: 18px; font-weight: 600; color: var(--primary-soft-foreground); }
+.field-form-context strong { display: block; margin-top: 3px; font-size: 1.125rem; font-weight: 600; color: var(--primary-soft-foreground); }
 .field-page .work-order-drawer--page .work-order-editor { padding: 0; }
 .field-page .work-order-editor > .work-order-form-grid { margin: 14px var(--field-gap); gap: 12px; }
 .field-page .work-order-editor :is(.wo-backfill-panel,.work-order-ext-editor,.work-order-repeater,.work-order-gap-anchor,.work-order-action-guide) { min-width: 0; margin: 0; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
 .field-page .work-order-editor .work-order-action-guide { padding: 0; }
-.field-page .work-order-action-guide summary { min-height: 44px; font-size: 14px; }
+.field-page .work-order-action-guide summary { min-height: 44px; font-size: var(--type-support); }
 .field-page :is(.wo-backfill-result,.wo-backfill-execution,.work-order-ext-grid,.work-order-ext-paired,.wo-path-card) { grid-template-columns: minmax(0,1fr); }
 .field-page .work-order-ext-grid > *, .field-page .work-order-ext-paired > * { grid-column: 1 / -1; min-width: 0; }
-.field-page .work-order-editor label { font-size: 14px; }
-.field-page .work-order-editor :is(input:not([type="checkbox"]):not([type="file"]),select,textarea) { min-height: 44px; min-width: 0; max-width: 100%; font-size: 16px; }
+.field-page .ops-dialog > header h2 { font-size: 1.125rem; line-height: 1.4; font-weight: 600; }
+.field-page .wo-backfill-panel > h3 { font-size: var(--type-section); line-height: 1.4; font-weight: 600; }
+.field-page .work-order-editor label { font-size: var(--type-support); }
+.field-page ::placeholder { color: var(--muted-foreground); opacity: 1; }
+.field-page :is(.work-order-editor, .ops-dialog) :is(input:not([type="checkbox"]):not([type="file"]),select,textarea) { min-height: 44px; min-width: 0; max-width: 100%; font-size: max(16px, var(--type-body)); }
 .field-page .work-order-editor :is(button:not(.field-hint),.work-order-checklist label,.wo-path-card-toggle) { min-height: 44px; }
 .field-page .work-order-editor .field-hint { min-height: 28px; min-width: 28px; }
 .field-page .work-order-editor :is(.wo-evidence-list button,.wo-field-with-scan button) { min-width: 44px; }

+ 4 - 2
web-scaffold/src/styles/tokens.css

@@ -86,7 +86,6 @@
   --notice-foreground: #ffffff;
   --notice-hover: #38525c;
   --notice-border: #4b6570;
-  --overlay: rgb(18 35 44 / 38%);
   /* 投影走「几乎看不见」的一档:卡片靠 1px 边框分层,⛔ 再加厚投影。 */
   --shadow-color: rgb(16 24 40 / 4%);
   --shadow-card: 0 1px 2px var(--shadow-color);
@@ -147,7 +146,6 @@
   --notice-foreground: #192a34;
   --notice-hover: #c1d6e1;
   --notice-border: #afc8d5;
-  --overlay: rgb(4 12 18 / 68%);
   --shadow-color: rgb(0 0 0 / 20%);
   --shadow-floating-control: 0 3px 12px rgb(0 0 0 / 34%);
   --shadow-panel: 0 18px 60px rgb(0 0 0 / 28%);
@@ -157,3 +155,7 @@
   --scrollbar-thumb-hover: rgb(145 183 180 / 29%);
   --scrollbar-track: transparent;
 }
+
+/* 旧版 WebKit 的原生对话框遮罩无法继承根节点变量,直接给伪元素同一主题色。 */
+:root, dialog::backdrop { --overlay: rgba(18, 35, 44, .38); }
+.dark, .dark dialog::backdrop { --overlay: rgba(4, 12, 18, .68); }