修改无锡测试bug
This commit is contained in:
@@ -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而不是响应式对象本身
|
||||
|
||||
Reference in New Issue
Block a user