fix: 说明页只保留复制地址
This commit is contained in:
@@ -676,9 +676,9 @@ class _WebFiles(StaticFiles):
|
|||||||
_dist = Path(__file__).resolve().parents[2] / "web" / "dist"
|
_dist = Path(__file__).resolve().parents[2] / "web" / "dist"
|
||||||
|
|
||||||
|
|
||||||
@app.get("/msg01", include_in_schema=False)
|
@app.get("/tool-upgrade", include_in_schema=False)
|
||||||
@app.get("/msg01/", include_in_schema=False)
|
@app.get("/tool-upgrade/", include_in_schema=False)
|
||||||
def notice_page() -> FileResponse:
|
def tool_upgrade_page() -> FileResponse:
|
||||||
index = _dist / "index.html"
|
index = _dist / "index.html"
|
||||||
if not index.is_file():
|
if not index.is_file():
|
||||||
raise HTTPException(status_code=404, detail="页面不存在")
|
raise HTTPException(status_code=404, detail="页面不存在")
|
||||||
|
|||||||
@@ -1222,10 +1222,10 @@ def test_exam_list_rejects_unrecognized_page() -> None:
|
|||||||
client.my_exams()
|
client.my_exams()
|
||||||
|
|
||||||
|
|
||||||
def test_notice_page_is_reachable_only_by_its_address() -> None:
|
def test_tool_upgrade_page_is_reachable_only_by_its_address() -> None:
|
||||||
import euniv.api as api_module
|
import euniv.api as api_module
|
||||||
|
|
||||||
response = TestClient(api_module.app).get("/msg01")
|
response = TestClient(api_module.app).get("/tool-upgrade")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert 'id="app"' in response.text
|
assert 'id="app"' in response.text
|
||||||
assert response.headers["cache-control"] == "no-cache"
|
assert response.headers["cache-control"] == "no-cache"
|
||||||
|
|||||||
+4
-4
@@ -3,7 +3,7 @@ import { onMounted, onUnmounted, ref } from "vue";
|
|||||||
import { apiFetch, setSessionDenied } from "./shared/http";
|
import { apiFetch, setSessionDenied } from "./shared/http";
|
||||||
import { darkTheme, dateZhCN, NButton, NConfigProvider, NDialogProvider, zhCN } from "naive-ui";
|
import { darkTheme, dateZhCN, NButton, NConfigProvider, NDialogProvider, zhCN } from "naive-ui";
|
||||||
import LoginView from "./features/auth/LoginView.vue";
|
import LoginView from "./features/auth/LoginView.vue";
|
||||||
import NoticeView from "./features/notice/NoticeView.vue";
|
import ToolUpgradeView from "./features/tool-upgrade/ToolUpgradeView.vue";
|
||||||
import Shell from "./shell/Shell.vue";
|
import Shell from "./shell/Shell.vue";
|
||||||
import AdminShell from "./shell/AdminShell.vue";
|
import AdminShell from "./shell/AdminShell.vue";
|
||||||
import { isDark, themeOverrides } from "./shared/theme";
|
import { isDark, themeOverrides } from "./shared/theme";
|
||||||
@@ -12,7 +12,7 @@ import { sessionFromPayload, type AppSession } from "./shared/session";
|
|||||||
const ready = ref(false);
|
const ready = ref(false);
|
||||||
const session = ref<AppSession | null>(null);
|
const session = ref<AppSession | null>(null);
|
||||||
const sessionError = ref("");
|
const sessionError = ref("");
|
||||||
const isNotice = window.location.pathname.replace(/\/+$/, "") === "/msg01";
|
const isToolUpgrade = window.location.pathname.replace(/\/+$/, "") === "/tool-upgrade";
|
||||||
|
|
||||||
function applyPayload(payload: unknown) {
|
function applyPayload(payload: unknown) {
|
||||||
if (!payload || typeof payload !== "object") return null;
|
if (!payload || typeof payload !== "object") return null;
|
||||||
@@ -46,7 +46,7 @@ async function loadSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (isNotice) return;
|
if (isToolUpgrade) return;
|
||||||
setSessionDenied(() => {
|
setSessionDenied(() => {
|
||||||
void loadSession();
|
void loadSession();
|
||||||
});
|
});
|
||||||
@@ -112,7 +112,7 @@ function onLogin(next: AppSession) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-config-provider class="app-root" :locale="zhCN" :date-locale="dateZhCN" :theme="isDark ? darkTheme : null" :theme-overrides="themeOverrides">
|
<n-config-provider class="app-root" :locale="zhCN" :date-locale="dateZhCN" :theme="isDark ? darkTheme : null" :theme-overrides="themeOverrides">
|
||||||
<NoticeView v-if="isNotice" />
|
<ToolUpgradeView v-if="isToolUpgrade" />
|
||||||
<n-dialog-provider v-else>
|
<n-dialog-provider v-else>
|
||||||
<div v-if="ready && sessionError && !session" class="gate">
|
<div v-if="ready && sessionError && !session" class="gate">
|
||||||
<section class="gate-card">
|
<section class="gate-card">
|
||||||
|
|||||||
+6
-6
@@ -33,17 +33,17 @@ async function copyUrl() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="notice-page">
|
<main class="upgrade-page">
|
||||||
<section class="notice-card">
|
<section class="upgrade-card">
|
||||||
<h1>旧版工具已失效</h1>
|
<h1>旧版工具已失效</h1>
|
||||||
<p>因目标平台升级,旧版工具已失效,无法登录使用。新版工具已上线。</p>
|
<p>因目标平台升级,旧版工具已失效,无法登录使用。新版工具已上线。</p>
|
||||||
<p>请复制下面的地址,打开浏览器,粘贴到地址栏后访问。</p>
|
<p>请复制下面的地址,打开浏览器,粘贴到地址栏后访问。</p>
|
||||||
<p ref="urlEl" class="notice-url">{{ toolUrl }}</p>
|
<p ref="urlEl" class="upgrade-url">{{ toolUrl }}</p>
|
||||||
<div class="notice-actions">
|
<div class="upgrade-actions">
|
||||||
<n-button type="primary" @click="copyUrl">{{ copied ? "已复制" : "复制地址" }}</n-button>
|
<n-button type="primary" @click="copyUrl">{{ copied ? "已复制" : "复制地址" }}</n-button>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="copied" class="notice-done">已复制。请到浏览器地址栏粘贴后访问。</p>
|
<p v-if="copied" class="upgrade-done">已复制。请到浏览器地址栏粘贴后访问。</p>
|
||||||
<p v-else-if="copyFailed" class="notice-missed">没有复制成功,地址已选中,请手动使用CTRL+C复制。</p>
|
<p v-else-if="copyFailed" class="upgrade-missed">没有复制成功,地址已选中,请手动使用CTRL+C复制。</p>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
+8
-8
@@ -1657,14 +1657,14 @@ select {
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-page {
|
.upgrade-page {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
padding: 32px 16px;
|
padding: 32px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-card {
|
.upgrade-card {
|
||||||
width: min(440px, 100%);
|
width: min(440px, 100%);
|
||||||
padding: 28px 24px;
|
padding: 28px 24px;
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
@@ -1672,18 +1672,18 @@ select {
|
|||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-card h1 {
|
.upgrade-card h1 {
|
||||||
margin: 0 0 16px;
|
margin: 0 0 16px;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-card p {
|
.upgrade-card p {
|
||||||
margin: 0 0 12px;
|
margin: 0 0 12px;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-url {
|
.upgrade-url {
|
||||||
margin: 0 0 20px;
|
margin: 0 0 20px;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
border: 1px solid var(--line);
|
border: 1px solid var(--line);
|
||||||
@@ -1694,17 +1694,17 @@ select {
|
|||||||
user-select: all;
|
user-select: all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-actions {
|
.upgrade-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-done {
|
.upgrade-done {
|
||||||
margin: 12px 0 0;
|
margin: 12px 0 0;
|
||||||
color: var(--ok);
|
color: var(--ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-missed {
|
.upgrade-missed {
|
||||||
margin: 12px 0 0;
|
margin: 12px 0 0;
|
||||||
color: var(--warn);
|
color: var(--warn);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user