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

Merge remote-tracking branch 'origin/master'

...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* web端文件预览功能 * web端文件预览功能
*/ */
import React, {Component} from 'react'; import React, {Component} from 'react';
import { Popconfirm } from 'antd';
import {checkIsImage} from '@/webPublic/one_stop_public/libs/UploadCom'; import {checkIsImage} from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal } from '@/webPublic/one_stop_public/utils/utils'; import { getModal, getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer'); const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer');
const Modal = getModal(); const Modal = getModal();
const Popconfirm = getPopconfirm();
export default class index extends Component { export default class index extends Component {
......
...@@ -6,6 +6,8 @@ const oneSetItemP = { ...@@ -6,6 +6,8 @@ const oneSetItemP = {
marginBottom: 0, marginBottom: 0,
userSelect: 'none', userSelect: 'none',
}; };
let startX = 0;
let startY = 0;
const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => { const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
switch (type) { switch (type) {
...@@ -49,16 +51,22 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => { ...@@ -49,16 +51,22 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
export const dragEventList = (setOtherProps, otherProps) => { export const dragEventList = (setOtherProps, otherProps) => {
let draggedRef = null; let draggedRef = null;
document.addEventListener( let documentThis = window?.parent?.iframeParentComponent?.Modal ? window?.parent?.document : document;
documentThis.onmousedown = function(evt){
startX = evt.offsetX;
startY = evt.offsetY;
}
documentThis.addEventListener(
'dragstart', 'dragstart',
function(event) { function(event) {
// 保存拖动元素的引用(ref.) // 保存拖动元素的引用(ref.)
draggedRef = event.target; draggedRef = event.target;
event.target.style.opacity = 0.5; event.target.style.opacity = 0.2;
}, },
false, false,
); );
document.addEventListener( documentThis.addEventListener(
'dragend', 'dragend',
(event) => { (event) => {
// 重置透明度 // 重置透明度
...@@ -68,7 +76,7 @@ export const dragEventList = (setOtherProps, otherProps) => { ...@@ -68,7 +76,7 @@ export const dragEventList = (setOtherProps, otherProps) => {
); );
/* 放下目标节点时触发事件 */ /* 放下目标节点时触发事件 */
document.addEventListener( documentThis.addEventListener(
'dragover', 'dragover',
(event) => { (event) => {
// 阻止默认动作 // 阻止默认动作
...@@ -76,15 +84,18 @@ export const dragEventList = (setOtherProps, otherProps) => { ...@@ -76,15 +84,18 @@ export const dragEventList = (setOtherProps, otherProps) => {
}, },
false, false,
); );
document.addEventListener( documentThis.addEventListener(
'drop', 'drop',
(event) => { (event) => {
// 阻止默认动作(如打开一些元素的链接) // 阻止默认动作(如打开一些元素的链接)
event.preventDefault(); event.preventDefault();
// 将拖动的元素到所选择的放置目标节点中 // 将拖动的元素到所选择的放置目标节点中
let infoClientRect = document.getElementById('dropZone').getBoundingClientRect(); let infoClientRect = documentThis.getElementById('dropZone').getBoundingClientRect();
let leftNew = Math.ceil(event.clientX - infoClientRect.left); // console.log(startX, typeof startX, startY);
let topNew = Math.ceil(event.clientY - infoClientRect.top); // return ;
let leftNew = Math.ceil(event.clientX - infoClientRect.left) - startX;
let topNew = Math.ceil(event.clientY - infoClientRect.top) - startY;
// console.log(leftNew, topNew);
if(leftNew < 0 || leftNew > infoClientRect.width || topNew < 0 || topNew > infoClientRect.height){ if(leftNew < 0 || leftNew > infoClientRect.width || topNew < 0 || topNew > infoClientRect.height){
console.log('拖拽到了图片区域外部,不能进行拖拽'); console.log('拖拽到了图片区域外部,不能进行拖拽');
return false; return false;
......
...@@ -4,17 +4,14 @@ import { ...@@ -4,17 +4,14 @@ import {
Card, Card,
DatePicker, DatePicker,
Divider, Divider,
Table,
Form, Form,
Row, Row,
Col, Col,
Input, Input,
InputNumber, InputNumber,
message, message,
Modal,
Select, Select,
Tree, Tree,
Popconfirm,
Tooltip, Tooltip,
Spin, Spin,
} from 'antd'; } from 'antd';
...@@ -35,7 +32,10 @@ import { isEmpty } from 'lodash'; ...@@ -35,7 +32,10 @@ import { isEmpty } from 'lodash';
import FilePreview from '@/webPublic/one_stop_public/filePreview'; import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom'; import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal, getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
const Popconfirm = getPopconfirm();
const Modal = getModal();
const FormItem = Form.Item; const FormItem = Form.Item;
let AllWidth = 0; // 表格总长度 let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
......
...@@ -9,9 +9,7 @@ import { ...@@ -9,9 +9,7 @@ import {
Col, Col,
Input, Input,
message, message,
Modal,
Select, Select,
Popconfirm,
Tooltip, Tooltip,
Spin, Spin,
Popover, Popover,
...@@ -37,8 +35,11 @@ import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfi ...@@ -37,8 +35,11 @@ import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfi
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom'; import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import ButtonDiy from '../../App/ButtonDiy/ButtonDiy'; import ButtonDiy from '../../App/ButtonDiy/ButtonDiy';
import { cloneDeep } from '../../copy/index'; import { cloneDeep } from '../../copy/index';
import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils';
const FormItem = Form.Item; const FormItem = Form.Item;
const Popconfirm = getPopconfirm();
const Modal = getModal();
let AllWidth = 0; // 表格总长度 let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
......
...@@ -4,10 +4,14 @@ ...@@ -4,10 +4,14 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import styles from './styles.less'; import styles from './styles.less';
import Location from './components'; import Location from './components';
import { Button, Popconfirm } from 'antd'; import { Button } from 'antd';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { openToast } from './Notification'; import { openToast } from './Notification';
import { successToast, failToast } from './Toast'; import { successToast, failToast } from './Toast';
import { getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
const Popconfirm = getPopconfirm();
export default class location extends Component { export default class location extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
......
/* eslint no-useless-escape:0 import/prefer-default-export:0 */ /* eslint no-useless-escape:0 import/prefer-default-export:0 */
import { Modal } from 'antd'; import { Modal, Popconfirm } from 'antd';
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
...@@ -41,3 +41,19 @@ export const getModal = () => { ...@@ -41,3 +41,19 @@ export const getModal = () => {
return Modal; return Modal;
} }
}; };
export const getPopconfirm = () => {
if (window?.parent?.iframeParentComponent?.Popconfirm) {
return window?.parent?.iframeParentComponent?.Popconfirm;
} else {
return Popconfirm;
}
};
export const getMessage = () => {
if (window?.parent?.iframeParentComponent?.Popconfirm) {
return window?.parent?.iframeParentComponent?.message;
} else {
return message;
}
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论