commit
build / build (push) Successful in 9m55s

This commit is contained in:
wanghu
2026-10-10 15:58:02 +08:00
parent 6faa332d2b
commit 2e36d7a9c8
1842 changed files with 70537 additions and 0 deletions
+94
View File
@@ -0,0 +1,94 @@
// 「教师时长」页独立预览入口 —— 仅用于本地视觉/交互验收,不参与业务构建
//
// 为什么需要它:
// 业务 dev(8079) 打开设置页会经后端 CAS 过滤器跳 SSO,无登录态的自动化浏览器
// 拿不到页面,导致「改完只能靠静态检查」。这里用mock 服务提供数据、独立 vite
// 配置单独起实例,从而在无登录态下真实渲染 + 交互 + 截图。
//
// 用法(三条命令,两个终端):
// node preview-ut/mock-server.mjs # 终端 1:mock 数据 8109
// npx vite --config preview.vite.config.ts# 终端 2:预览服务 8099
// 打开 http://localhost:8099/preview-ut.html
//
// 截图(无头 Edge,Windows):
// msedge --headless=new --disable-gpu --hide-scrollbars --window-size=1500,880 \
// --virtual-time-budget=16000 --screenshot=out.png http://localhost:8099/preview-ut.html
import { createApp } from "vue";
import ViewUIPlus from "view-ui-plus";
import "view-ui-plus/dist/styles/viewuiplus.css";
import "@/assets/styles/main.scss";
import "@/assets/styles/layout.css";
import "@/assets/styles/icons.css";
import "virtual:svg-icons-register";
import LeaveSetting from "@/views/leave/LeaveSetting.vue";
const app = createApp(LeaveSetting);
app.use(ViewUIPlus);
app.mount("#app");
/** 自动验收脚本:?probe=1 教师时长 / ?probe=flow 流程管理,结果写入 document.title 供 --dump-dom 读取 */
const PROBE = new URLSearchParams(location.search).get("probe");
// 按 ?tab= 切换 tab(flow=流程管理 / 其他值按文案匹配),默认「教师时长」,便于截图核对
setTimeout(() => {
const want = new URLSearchParams(location.search).get("tab");
const label = !want || want === "usertime" ? "教师时长" : want === "flow" ? "流程管理" : want;
document.querySelectorAll(".sett-tabs .ivu-tabs-tab").forEach((t) => {
if ((t.textContent || "").includes(label)) (t as HTMLElement).click();
});
const host = document.getElementById("app");
if (host) {
host.style.padding = "16px 20px 28px";
host.style.minHeight = "100vh";
host.style.boxSizing = "border-box";
}
}, 500);
if (PROBE === "flow") {
// 流程管理自动验收:点第 4 行(通知流程,mock 默认「未启用」)的启用绑定开关,
// 等 loadFlowManage 刷新后核对开关是否翻为选中态(链路:Switch → Enable 接口 → mock → List 刷新)。
setTimeout(() => {
const sw = document.querySelectorAll(".flow-table tbody tr")[3]?.querySelector(".ivu-switch");
sw?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
setTimeout(() => {
const rows2 = document.querySelectorAll(".flow-table tbody tr");
const sw2 = rows2[3]?.querySelector(".ivu-switch");
document.title = [
"flowProbe",
"switches=" + document.querySelectorAll(".flow-table .ivu-switch").length,
"enabledChecked=" + (sw2?.classList.contains("ivu-switch-checked") ? 1 : 0),
].join(" | ");
}, 1800);
}, 1600);
}
if (PROBE && PROBE !== "flow") {
// 自动验收:点 +4 / +1 / -1,核对高亮行、调整后预览、底部统计、提交按钮启用态。
// 注意:必须读原始数据源(userTimes)而非 DOM——view-ui-plus Table 传���cell 的
// row 是深拷贝副本,DOM 上的值仅用于视觉,不反映真实状态。
setTimeout(() => {
const rows = document.querySelectorAll("tbody tr");
const btnsOf = (r: Element) => Array.from(r.querySelectorAll(".q-btn"));
const click = (i: number, b: number) => {
const r = rows[i];
const btn = r && btnsOf(r)[b];
btn?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
};
click(0, 1); // 王雅静 +4
click(1, 0); // 李国栋 +1
click(2, 2); // 张明远 -1
setTimeout(() => {
const q = (s: string) => Array.from(document.querySelectorAll(s)).map((e) => e.textContent).join(",");
const foot = document.querySelector(".usertime-footer");
document.title = [
"editedRows=" + document.querySelectorAll("tr.row-edited").length,
"pf=[" + q(".pf-num") + "]",
"delta=[" + q(".pf-delta") + "]",
"resetLinks=" + document.querySelectorAll(".act-link.reset").length,
"submitDisabled=" + foot?.querySelector(".ivu-btn-primary")?.hasAttribute("disabled"),
"footer=" + (foot?.textContent || "").replace(/\s+/g, " ").trim().slice(0, 80),
].join(" | ");
}, 1000);
}, 1600);
}