hb_zhgd_screen/js/publics/openIframe.js

87 lines
2.5 KiB
JavaScript
Raw Normal View History

2025-10-13 09:33:54 +08:00
/*子页面*/
function openIframe(id, title, content, width, height) {
let layerIndex = layer.open({
id: id,
type: 2,
2025-10-17 14:53:52 +08:00
title: [
'<div style="border-left: 3px solid #00377A;color:#00377A;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;font-weight: bold;">' +
title +
"</div>",
"font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;",
],
2025-10-13 09:33:54 +08:00
content: content,
shade: 0.3,
shadeClose: false,
area: [width, height],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
2025-10-17 14:53:52 +08:00
},
2025-10-13 09:33:54 +08:00
});
}
/*新增页面*/
function openIframe2(id, title, content, width, height, params) {
let layerIndex = layer.open({
id: id,
type: 2,
2025-10-17 14:53:52 +08:00
title: [
'<div style="border-left: 3px solid #00377A;color:#00377A;font-size:18px;display: flex;letter-spacing:1px;align-items: center;height: 20px;padding: 0 10px;font-weight: bold;">' +
title +
"</div>",
"font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;",
],
2025-10-13 09:33:54 +08:00
content: content,
shade: 0.3,
shadeClose: false,
area: [width, height],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
2025-10-17 14:53:52 +08:00
console.log(params);
2025-10-13 09:33:54 +08:00
iframeWin.setParams(JSON.stringify(params));
},
cancel: function () {
// 视频监控-历史回放关闭前回调
if (params.videoMonitor) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.clickLogout();
}
2025-10-17 14:53:52 +08:00
},
2025-10-13 09:33:54 +08:00
});
}
2025-10-17 14:53:52 +08:00
function openIframeByParamObj(
id,
title,
content,
width,
height,
paramsObj,
type
) {
2025-10-13 09:33:54 +08:00
let layerIndex = layer.open({
id: id,
type: 2,
2025-10-17 14:53:52 +08:00
title: false,
2025-10-13 09:33:54 +08:00
content: content,
shade: 0.3,
anim: 2,
skin: "my-skin child-skin",
shadeClose: false,
area: [width, height],
move: false,
success: function () {
if (paramsObj) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(JSON.stringify(paramsObj));
}
},
end: function () {
if (type) {
showPlugin();
}
2025-10-17 14:53:52 +08:00
},
2025-10-13 09:33:54 +08:00
});
}