Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2025-09-25 17:13:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b02b778f5186066734fc78a330a383d86b546c01
b02b778f
1 parent
a99d9c81
feat: 添加对iframe项目标识的支持并处理表单提交消息
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletions
src/views/index.vue
src/views/index.vue
View file @
b02b778
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-0
7-03 17:44:43
* @LastEditTime: 2025-0
9-25 14:31:46
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -281,6 +281,8 @@ const data_id = $route.query.data_id ? $route.query.data_id : null;
const x_field_1 = $route.query.x_field_1 ? $route.query.x_field_1 : null;
// 周期ID标识
const x_cycle = $route.query.x_cycle ? $route.query.x_cycle : null;
// iframe项目标识 - 现在是美乐爱觉使用
const x_project = $route.query.x_project ? $route.query.x_project : null;
// iframe传值openid
const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : '';
// 强制后台检查标识
...
...
@@ -1076,6 +1078,30 @@ const successHandle = () => { // 表单成功提交后续操作
getChildVal();
return false;
}
// iframe 项目标识 - 现在是美乐爱觉使用
if (x_project === 'behalo') {
// 向父页面发送消息
const messageData = {
id: successInfo.value?.id,
type: 'formSubmit',
timestamp: Date.now(),
};
try {
// 发送消息到父页面
if (window.parent && window.parent !== window) {
window.parent.postMessage(messageData, '*');
console.log('已向父页面发送消息:', messageData);
}
} catch (error) {
console.error('发送消息到父页面失败:', error);
}
// 提交成功,直接返回
return false;
}
// 如果类型为跳转网页
if (successInfo.value.commit_action === 'url') {
window.location.href = successInfo.value.commit_url;
...
...
Please
register
or
login
to post a comment