|
@@ -4,6 +4,14 @@ import { mainWindow } from "../win/mainWin";
|
|
import log from "electron-log/main";
|
|
import log from "electron-log/main";
|
|
import { handeGet } from "./store";
|
|
import { handeGet } from "./store";
|
|
|
|
|
|
|
|
+const sendNavigateMessage = (path: string) => {
|
|
|
|
+ mainWindow!.webContents.send("navigate", {
|
|
|
|
+ type: "navigate",
|
|
|
|
+ path: `/?iframePath=${encodeURIComponent(path)}`, // 通过 URL 参数传递
|
|
|
|
+ setIframeFlag: true,
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
export const initExpress = () => {
|
|
export const initExpress = () => {
|
|
const app = express();
|
|
const app = express();
|
|
app.use(express.json());
|
|
app.use(express.json());
|
|
@@ -21,6 +29,7 @@ export const initExpress = () => {
|
|
log.error("缺少path参数" + new Date());
|
|
log.error("缺少path参数" + new Date());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ sendNavigateMessage(path);
|
|
mainWindow!.webContents.send("iframe", {
|
|
mainWindow!.webContents.send("iframe", {
|
|
type: "iframe",
|
|
type: "iframe",
|
|
data: path,
|
|
data: path,
|
|
@@ -47,6 +56,7 @@ export const initExpress = () => {
|
|
log.error("缺少path参数" + new Date());
|
|
log.error("缺少path参数" + new Date());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ sendNavigateMessage(path);
|
|
mainWindow!.webContents.send("iframe", {
|
|
mainWindow!.webContents.send("iframe", {
|
|
type: "iframe",
|
|
type: "iframe",
|
|
data: path,
|
|
data: path,
|
|
@@ -76,6 +86,7 @@ export const initExpress = () => {
|
|
log.error("缺少path参数" + new Date());
|
|
log.error("缺少path参数" + new Date());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ sendNavigateMessage(path);
|
|
mainWindow!.webContents.send("iframe", {
|
|
mainWindow!.webContents.send("iframe", {
|
|
type: "iframe",
|
|
type: "iframe",
|
|
data: path,
|
|
data: path,
|