refactor(ProjectManage): 优化 iframe 内 window.open 方法的重写逻辑

- 修改了 iframe 内 window.open 方法的实现,使其能够根据 URL 中的参数进行路由跳转
- 新增了对 URL 中其他参数和 sceneCode 参数的处理,提高了跳转的灵活性和可扩展性
- 优化了代码结构,去除了不必要的注释和示例代码,使代码更加清晰和可维护
This commit is contained in:
du.meimei
2025-05-28 09:53:47 +08:00
parent 1b95914976
commit bec58bc948

View File

@@ -666,20 +666,14 @@ function onIframeLoad() {
// 覆盖 window.open 方法
iframeWindow.open = function (url, target, features) {
console.log('拦截到 window.open:', { url, target, features })
// 自定义逻辑,例如:
// return window.open(url, '_blank') // 继续用当前窗口打开
// 或者阻止打开
// return null
// 示例:用主窗口打开链接
router.push({
path:'/survey/planet/design',
path:url,
query:{
sn: url.split('sn=')[1]
sn: url.split('sn=')[1],
other: url.indexOf('other')!==-1?url.split('other=')[1]:'',
sceneCode: url.indexOf('sceneCode')!==-1? url.split('sceneCode=')[1]:''
}
})
// window.open(url, '_blank')
return null // 阻止 iframe 的 window.open
}
}