From a5d5c39411d6f204a3e145639ebae5769818944a Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Thu, 15 Oct 2026 12:36:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=89=8B=E6=9C=BA):=20=E6=94=B6=E8=B5=B7?= =?UTF-8?q?=E9=94=AE=E7=9B=98=E5=90=8E=E3=80=8C=E6=8F=90=E4=BA=A4=E3=80=8D?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=B8=8D=E5=9B=9E=E6=9D=A5=EF=BC=9B=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E9=A2=86=E5=A5=96=E5=8F=B0=E7=AC=AC=E4=B8=80=E5=90=8D?= =?UTF-8?q?=E8=A2=AB=E6=8C=A4=E5=87=BA=E5=B1=8F=E5=B9=95=EF=BC=9BiPhone=20?= =?UTF-8?q?=E7=82=B9=E8=BE=93=E5=85=A5=E6=A1=86=E6=95=B4=E9=A1=B5=E6=94=BE?= =?UTF-8?q?=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 题目页:安卓按返回键收键盘时编辑器不失焦,符号键一直贴底、「运行例子 / 提交」不回来。 改成看键盘真弹着没有(可视视口变矮),不只看焦点 - 比赛排名:结束后的领奖台三块共 646px,手机上第一名被切掉、第三名看不见;改成平分一行 - iPhone:点 14/15px 的输入框和代码编辑器,Safari 会整页放大且不缩回;只给 iOS 加 maximum-scale=1 - 登录:手机上选完班不再自动聚焦搜索框(键盘弹出来盖住半张名单) - 题单:窄屏上题目拆成两张没标题的卡片,像分了两组;放不下两栏时合成一张 - 「中等」在题目页是蓝色、在题目列表是橙色,统一成橙色 - 零碎:自学四列表格在 360 宽上收窄格子;统计「错得最多的题」表头不再挤成竖排; 「第 N 名」「14 道」不再把最后一个字甩到下一行 Co-Authored-By: Claude Opus 5.5 --- apps/web/src/main.ts | 14 +++++ apps/web/src/oj/ai/components/StatStrip.vue | 7 ++- apps/web/src/oj/contest/pages/rank.vue | 53 +++++++++++++++++-- .../src/oj/learn/components/LessonBody.vue | 8 +++ .../oj/problem/components/MobileActionBar.vue | 7 +-- .../src/oj/problem/components/SymbolKeys.vue | 24 +++++++-- apps/web/src/oj/problem/utils/symbolKeys.ts | 33 +++++++++++- apps/web/src/oj/problemset/detail.vue | 17 +++--- apps/web/src/oj/rank/components/RankMe.vue | 5 +- .../src/oj/statistics/components/Lessons.vue | 11 ++++ apps/web/src/shared/components/Login.vue | 19 +++++-- apps/web/src/utils/functions.ts | 7 +-- 12 files changed, 177 insertions(+), 28 deletions(-) diff --git a/apps/web/src/main.ts b/apps/web/src/main.ts index dc193b9..e1b1cbf 100644 --- a/apps/web/src/main.ts +++ b/apps/web/src/main.ts @@ -8,6 +8,20 @@ import storage from "utils/storage" import App from "./App.vue" import { admins, ojs } from "./routes" +/** + * iPhone 上点进字号小于 16px 的输入框(Naive 的输入框是 14px、代码编辑器 15px), + * Safari 会自动把整页放大,而且退出输入也不缩回去,得学生自己双指缩。 + * maximum-scale=1 能关掉这个自动放大;iOS 10 起照样允许双指缩放,所以只给 iOS 加 —— + * 安卓上这么写会真的禁掉双指放大,看题面图片、代码就没法放大了。 + */ +const isIOS = + /iPhone|iPad|iPod/.test(navigator.userAgent) || + (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) +if (isIOS) { + const viewport = document.querySelector('meta[name="viewport"]') + viewport?.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1") +} + const router = createRouter({ history: createWebHistory(), routes: [ojs, admins], diff --git a/apps/web/src/oj/ai/components/StatStrip.vue b/apps/web/src/oj/ai/components/StatStrip.vue index 11513d8..5f07e40 100644 --- a/apps/web/src/oj/ai/components/StatStrip.vue +++ b/apps/web/src/oj/ai/components/StatStrip.vue @@ -20,7 +20,12 @@ const cells = computed(() => { const percent = r.solved ? Math.round((r.firstTry / r.solved) * 100) : 0 const firstSub = `一次就对 · 占 ${percent}%` const list: Cell[] = [ - { big: r.solved, unit: "道", sub: c ? `做对 · 班上中间那位 ${c.medianSolved} 道` : "做对" }, + // 数和「道」之间用不换行空格:手机上两列挤,单个「道」会被甩到下一行 + { + big: r.solved, + unit: "道", + sub: c ? `做对 · 班上中间那位 ${c.medianSolved}\u00a0道` : "做对", + }, { big: r.firstTry, unit: "道", diff --git a/apps/web/src/oj/contest/pages/rank.vue b/apps/web/src/oj/contest/pages/rank.vue index 48b04ce..c1a16aa 100644 --- a/apps/web/src/oj/contest/pages/rank.vue +++ b/apps/web/src/oj/contest/pages/rank.vue @@ -137,9 +137,13 @@ const columns = computed(
{{ place }}
@@ -534,4 +538,47 @@ const columns = computed( .empty { padding: 32px var(--oj-pad-x); } + +/* 手机:三级台阶一共 646px 宽,原样摆第一名就被挤到屏幕外了。三块平分一行, + 名字截断、班级和用时折成两行 */ +@media (max-width: 640px) { + .podium-row { + gap: 16px; + } + + .podium { + width: 100%; + gap: 6px; + } + + .step { + flex: 1 1 0; + width: auto; + min-width: 0; + } + + .podium-name, + .p1 .podium-name { + font-size: 15px; + max-width: 100%; + } + + .podium-meta { + font-size: var(--oj-fs-meta); + text-align: center; + } + + .podium-meta > span { + display: block; + white-space: nowrap; + } + + .podium-meta > .sep { + display: none; + } + + .mine { + width: 100%; + } +} diff --git a/apps/web/src/oj/learn/components/LessonBody.vue b/apps/web/src/oj/learn/components/LessonBody.vue index 93b79d6..cee0894 100644 --- a/apps/web/src/oj/learn/components/LessonBody.vue +++ b/apps/web/src/oj/learn/components/LessonBody.vue @@ -75,6 +75,14 @@ function inline(text: string) { .body :deep(.oj-markdown th) { white-space: nowrap; } +/* 360 宽的安卓机上四列表差三十来像素,最后一列被切掉、得横着滑才看得到:格子收窄一点 */ +@media (max-width: 480px) { + .body :deep(.oj-markdown th), + .body :deep(.oj-markdown td) { + min-width: 3.5em; + padding: 6px 8px; + } +} .goals { margin: 4px 0 8px; padding: 12px 16px; diff --git a/apps/web/src/oj/problem/components/MobileActionBar.vue b/apps/web/src/oj/problem/components/MobileActionBar.vue index eecba1b..293f10b 100644 --- a/apps/web/src/oj/problem/components/MobileActionBar.vue +++ b/apps/web/src/oj/problem/components/MobileActionBar.vue @@ -5,7 +5,7 @@ import { useCodeStore } from "oj/store/code" import { useProblemStore } from "oj/store/problem" import { useSubmissionStore } from "oj/store/submission" import SubmitCode from "./SubmitCode.vue" -import { editorFocused } from "../utils/symbolKeys" +import { typing } from "../utils/symbolKeys" const SubmitFlowchart = defineAsyncComponent(() => import("./SubmitFlowchart.vue")) @@ -30,8 +30,9 @@ const canRunSamples = computed(