- header.scss: 删旧 .search-box 与 fade1/search-animation/icon-animation 动画段,
新增 app-cmdk-* 面板样式。样式段必须放顶层——面板 Teleport 到 body,嵌进
.default-header 会生成后代选择器而匹配不到
- Header.vue: 搜索 li 收敛为单图标 + openSearch;模板末尾追加 <Teleport to="body">
命令面板,支持实时过滤 / ↑↓ 键盘导航 / Enter 打开 / Esc 关闭 / 空结果态;
删 watch(isSearching) 与空函数 showSeachBox;挂/卸 window keydown
- store/index.ts: 新增 appListLoading 字段与 setAppListLoading
- utils/bschLinkPage.ts: 抽出 openAppPage(app, ifameAppIdArr),与点击应用图标同一路径
- AppList.vue: reloadAppData 写 store(数据 + loading,try/finally);
linkPage(item) 委托 openAppPage
硬约束保持不动:watch(searchAppText) -> mittBus.emit("searchChange")(背景应用网格靠它过滤)、
isSearchIconShow(route.name === "apps")。
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { IframePageParmas, LinkOpenTypeEnum, StateEnum } from "@/types";
|
|
import mittBus from "@/utils/mitt";
|
|
|
|
interface LinkPageOptions {
|
|
url: string;
|
|
type?: number | LinkOpenTypeEnum;
|
|
|
|
id?: number;
|
|
isTicket?: boolean;
|
|
title?: string;
|
|
isHeader?: boolean;
|
|
|
|
modalWidth?: number;
|
|
modalHeight?: number;
|
|
}
|
|
|
|
export function bschLinkPage(options: LinkPageOptions) {
|
|
const { url, type = LinkOpenTypeEnum.Open, title } = options;
|
|
const openType: LinkOpenTypeEnum = type as LinkOpenTypeEnum;
|
|
if (openType === LinkOpenTypeEnum.Open) {
|
|
window.open(url);
|
|
} else if (openType === LinkOpenTypeEnum.Href) {
|
|
window.location.href = url;
|
|
} else if (openType === LinkOpenTypeEnum.IFrame) {
|
|
const { isHeader = false } = options;
|
|
const params: IframePageParmas = {
|
|
url,
|
|
appName: title ?? "",
|
|
isHeader,
|
|
};
|
|
mittBus.emit("openBschIframePage", params);
|
|
} else if (openType === LinkOpenTypeEnum.Modal) {
|
|
const { modalWidth = 80, modalHeight = 70 } = options;
|
|
mittBus.emit("showLightAppModal", { width: modalWidth, height: modalHeight, url, title: title ?? "轻应用" });
|
|
// const { modalTitle = "新窗口", modalWidth = 80, modalHeight = 70 } = options;
|
|
}
|
|
}
|
|
|
|
/** 打开应用页面(与 AppList.vue 点击应用图标同一条路径):
|
|
* 默认新窗口打开;命中 iframe 白名单($conf.ifameAppIdArr)则走站内 iframe(带 Header)。 */
|
|
export function openAppPage(app: any, ifameAppIdArr: number[] = []) {
|
|
const options: LinkPageOptions = {
|
|
url: app.webAddr,
|
|
type: LinkOpenTypeEnum.Open,
|
|
title: app.name,
|
|
};
|
|
if (ifameAppIdArr.includes(app.id)) {
|
|
options.type = LinkOpenTypeEnum.IFrame;
|
|
options.isHeader = true;
|
|
}
|
|
bschLinkPage(options);
|
|
}
|
|
|
|
export function isTickeRoterByName(name: string) {
|
|
return ["BschAppDetails", "AppDetails"].includes(name);
|
|
}
|