chore(harness): 补齐全局脚本引入 + 命令面板取证钩子
build / build (push) Successful in 42s

- harness.html 照抄 index.html:30-34 的 ztree.css / jquery / lodash / jquery.ztree:
  main.ts 不 import 这几个全局脚本,靠 html 提供;缺 jquery 会稳定报
  "Uncaught ReferenceError: $ is not defined"(本项目既有坑)
- harness-main.ts 新增 /apps 空壳路由(只需 route.name === "apps" 让 Header 渲染放大镜,
  不挂真实 AppList 以免本机无后端时报错污染控制台)与 ?cmd=1[&q=xx] 取证钩子
  (自动点开放大镜并可选输入关键词)
This commit is contained in:
chenxing
2026-10-08 17:45:33 +08:00
parent ec696d5187
commit b2307f583f
2 changed files with 33 additions and 0 deletions
+6
View File
@@ -5,6 +5,12 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>harness-取证</title>
<!-- 照抄 index.html:30-34:main.ts 不 import 这几个全局脚本,靠 html 提供。
缺 jquery ⇒ "$ is not defined" ⇒ v-wave / vuescroll 抛错(本项目固有坑) -->
<link rel="stylesheet" href="./libs/ztree/zTreeStyle.css" />
<script src="./libs/jquery.min.js"></script>
<script src="./libs/lodash.min.js"></script>
<script src="./libs/ztree/jquery.ztree.all.min.js"></script>
</head>
<body>
+27
View File
@@ -27,7 +27,12 @@ import AppHeader from "@/components/AppHeader.vue";
import UserInfoModal from "@/components/UserInfoModal.vue";
import mittBus from "@/utils/mitt";
/** 命令面板取证用空壳路由:只需 route.name === "apps" 让 Header 渲染放大镜,
* 不挂真实 AppList(避免本机无后端时 getUserApp 失败污染控制台) */
const CmdEmptyShell = defineComponent({ setup: () => () => h("div", { style: "height:100%" }) });
const harnessRoutes: any[] = [
{ path: "/apps", name: "apps", component: CmdEmptyShell, meta: { title: "应用" } },
{ path: "/msg", name: "Msg", component: MsgPage, meta: { title: "消息" } },
{ path: "/settings", name: "Settings", component: SettingsPage, meta: { title: "设置" } },
{ path: "/theme-preview", name: "ThemePreview", component: ThemePreviewPage, meta: { title: "主题预览" } },
@@ -258,3 +263,25 @@ function runAssert(attempt: number) {
document.title = "HARNESS-READY";
}
setTimeout(() => runAssert(0), 1500);
// ===== 命令面板取证:?cmd=1[&q=课] 自动点开放大镜并可选输入;配合 #/apps =====
if (params.get("cmd") === "1") {
setTimeout(() => {
const btn = document.querySelector(".operate-container .icon-box") as HTMLElement | null;
btn?.click();
const q = params.get("q");
setTimeout(
() => {
if (q) {
const inp = document.querySelector(".app-cmdk-hd input") as HTMLInputElement | null;
if (inp) {
inp.value = q;
inp.dispatchEvent(new Event("input"));
}
}
setTimeout(() => ((window as any).__CMDK_READY__ = true), 600);
},
q ? 500 : 600
);
}, 900);
}