修改无锡测试bug

This commit is contained in:
guanj
2025-10-27 08:55:54 +08:00
parent 7c8917a2cd
commit ea14a290b7
17 changed files with 556 additions and 201 deletions

View File

@@ -307,7 +307,7 @@ import {
nextTick,
onBeforeUnmount,
} from "vue";
import { ElMessage,ElMessageBox } from "element-plus";
import { ElMessage, ElMessageBox } from "element-plus";
import {
eventSource,
eventAggregation,
@@ -321,6 +321,7 @@ import {
harmOneImage,
hasUpEventList,
} from "@/api/manage_wx/index";
import { HelpFilled, Aim, Memo } from "@element-plus/icons-vue";
const flag = ref(0); // 0 for 暂降, 1 for 谐波, 2 for 谐波放大
const time = ref(0); // 0 for 周, 1 for 月
@@ -686,13 +687,42 @@ const initialAggregation = () => {
// 提取发送消息到iframe的公共方法
const sendMessageToIframe = (type: string, payload: any) => {
window.parent.postMessage(
{
type,
payload,
},
"*"
);
// console.log(123,store.state.iframeLoad);
// window.parent.postMessage(
// {
// type,
// payload,
// },
// "*"
// );
// 如果 iframe 已加载完成,直接发送消息
if (store.state.iframeLoad) {
window.parent.postMessage(
{
type,
payload,
},
"*" // 建议替换为具体域名,如 'https://父页面域名'
);
return;
}
// 如果未加载完成,每 1 秒尝试发送一次
const interval = setInterval(() => {
console.log("等待 iframe 加载1 秒后重试...");
if (store.state.iframeLoad) {
// 加载完成后发送消息并清除定时器
window.parent.postMessage(
{
type,
payload,
},
"*" // 建议替换为具体域名
);
clearInterval(interval);
}
}, 1000);
};
// 闪烁点
@@ -752,7 +782,7 @@ const initHasUpEventList = () => {
const dataObject = {
eventList: [...eventList.value],
color: "#fcfc57",
flagValue: '2',
flagValue: "2",
};
// 发送eventList数据到iframe注意发送的是.value而不是响应式对象本身