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

24999 学生签约审核 拖拽范围和组件顺序优化

上级 b7af1ad5
......@@ -2,12 +2,12 @@
* web端文件预览功能
*/
import React, {Component} from 'react';
import { Popconfirm } from 'antd';
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 Modal = getModal();
const Popconfirm = getPopconfirm();
export default class index extends Component {
......
......@@ -6,6 +6,8 @@ const oneSetItemP = {
marginBottom: 0,
userSelect: 'none',
};
let startX = 0;
let startY = 0;
const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
switch (type) {
......@@ -50,13 +52,17 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
export const dragEventList = (setOtherProps, otherProps) => {
let draggedRef = null;
let documentThis = window?.parent?.iframeParentComponent?.Modal ? window?.parent?.document : document;
documentThis.onmousedown = function(evt){
startX = evt.offsetX;
startY = evt.offsetY;
}
documentThis.addEventListener(
'dragstart',
function(event) {
// 保存拖动元素的引用(ref.)
draggedRef = event.target;
event.target.style.opacity = 0.5;
event.target.style.opacity = 0.2;
},
false,
);
......@@ -85,8 +91,11 @@ export const dragEventList = (setOtherProps, otherProps) => {
event.preventDefault();
// 将拖动的元素到所选择的放置目标节点中
let infoClientRect = documentThis.getElementById('dropZone').getBoundingClientRect();
let leftNew = Math.ceil(event.clientX - infoClientRect.left);
let topNew = Math.ceil(event.clientY - infoClientRect.top);
// console.log(startX, typeof startX, startY);
// 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){
console.log('拖拽到了图片区域外部,不能进行拖拽');
return false;
......
......@@ -4,17 +4,14 @@ import {
Card,
DatePicker,
Divider,
Table,
Form,
Row,
Col,
Input,
InputNumber,
message,
Modal,
Select,
Tree,
Popconfirm,
Tooltip,
Spin,
} from 'antd';
......@@ -35,7 +32,10 @@ import { isEmpty } from 'lodash';
import FilePreview from '@/webPublic/one_stop_public/filePreview';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
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;
let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker;
......
......@@ -9,9 +9,7 @@ import {
Col,
Input,
message,
Modal,
Select,
Popconfirm,
Tooltip,
Spin,
Popover,
......@@ -37,8 +35,11 @@ import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfi
import UploadCom from '@/webPublic/one_stop_public/libs/UploadCom';
import ButtonDiy from '../../App/ButtonDiy/ButtonDiy';
import { cloneDeep } from '../../copy/index';
import { getPopconfirm, getModal } from '@/webPublic/one_stop_public/utils/utils';
const FormItem = Form.Item;
const Popconfirm = getPopconfirm();
const Modal = getModal();
let AllWidth = 0; // 表格总长度
const { RangePicker } = DatePicker;
......
......@@ -4,10 +4,14 @@
import React, { Component } from 'react';
import styles from './styles.less';
import Location from './components';
import { Button, Popconfirm } from 'antd';
import { Button } from 'antd';
import { isEmpty } from 'lodash';
import { openToast } from './Notification';
import { successToast, failToast } from './Toast';
import { getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
const Popconfirm = getPopconfirm();
export default class location extends Component {
constructor(props) {
super(props);
......
/* 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]*))?)$/;
......@@ -41,3 +41,19 @@ export const getModal = () => {
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论