提交 dc6ec632 authored 作者: 钟是志's avatar 钟是志

iframe页面的Modal 直接从父级获取

上级 abd61200
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
* Modal定制样式 * Modal定制样式
*/ */
import React, {Component} from 'react'; import React, {Component} from 'react';
import {Modal, Button} from 'antd'; import { Button } from 'antd';
import styles from './index.less'; import styles from './index.less';
import { getModal } from '@/webPublic/one_stop_public/utils/utils';
const Modal = getModal();
export default class WebModal extends Component { export default class WebModal extends Component {
constructor(props) { constructor(props) {
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
* 事务发起提交多次弹框 * 事务发起提交多次弹框
*/ */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Modal, Button } from 'antd'; import { getModal } from '@/webPublic/one_stop_public/utils/utils';
const Modal = getModal();
export default class AddModal extends Component { export default class AddModal extends Component {
render() { render() {
let { visible, handleCancel, handleOk, loading } = this.props; let { visible, handleCancel, handleOk, loading } = this.props;
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import styles from './styles.less'; import styles from './styles.less';
import { Modal, Button, Icon, message } from 'antd'; import { Button, Icon, message } from 'antd';
import ShowItem, { dragEventList, zipImage } from './ShowItem'; import ShowItem, { dragEventList, zipImage } from './ShowItem';
import { apiRequest } from '../../utils/request'; import { apiRequest } from '../../utils/request';
import { deepCopy } from '@/webPublic/one_stop_public/utils/myutils'; import { deepCopy } from '@/webPublic/one_stop_public/utils/myutils';
import { getModal } from '@/webPublic/one_stop_public/utils/utils';
const Modal = getModal();
let fakeFileInfo = { let fakeFileInfo = {
path: '/u/202112/25143111x0ki.jpg', // 超大的图片 path: '/u/202112/25143111x0ki.jpg', // 超大的图片
......
...@@ -6,34 +6,38 @@ const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|( ...@@ -6,34 +6,38 @@ const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(
const isUrl = (path) => reg.test(path); const isUrl = (path) => reg.test(path);
const isAntDesignPro = () => { const isAntDesignPro = () => {
if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
return true; return true;
} }
return window.location.hostname === 'preview.pro.ant.design'; return window.location.hostname === 'preview.pro.ant.design';
}; // 给官方演示站点用,用于关闭真实开发环境不需要使用的特性 }; // 给官方演示站点用,用于关闭真实开发环境不需要使用的特性
const isAntDesignProOrDev = () => { const isAntDesignProOrDev = () => {
const { NODE_ENV } = process.env; const { NODE_ENV } = process.env;
if (NODE_ENV === 'development') { if (NODE_ENV === 'development') {
return true; return true;
} }
return isAntDesignPro(); return isAntDesignPro();
}; };
export { isAntDesignProOrDev, isAntDesignPro, isUrl }; export { isAntDesignProOrDev, isAntDesignPro, isUrl };
export const dispatch = (type, payload, callback) => { export const dispatch = (type, payload, callback) => {
window.g_app._store.dispatch({ type, payload, callback }); window.g_app._store.dispatch({
type,
payload,
callback,
});
}; };
export const getModal = () =>{ export const getModal = () => {
if(window?.parent?.iframeParentComponent?.Modal){ if (window?.parent?.iframeParentComponent?.Modal) {
return window?.parent?.iframeParentComponent?.Modal; return window?.parent?.iframeParentComponent?.Modal;
}else{ } else {
return Modal; return Modal;
} }
} };
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论