Commit af0cb5c3 authored by wuyongsheng's avatar wuyongsheng

Merge branch 'feat-20220608-projectdata' into 'release'

fix: 查看文件一直跳转路由

See merge request !59
parents 9705ad07 6eb41dea
...@@ -38,24 +38,8 @@ export interface IDialogProps { ...@@ -38,24 +38,8 @@ export interface IDialogProps {
/** 是否禁用确认按钮 */ /** 是否禁用确认按钮 */
disabledConfirm?: boolean; disabledConfirm?: boolean;
children: React.ReactNode; children: React.ReactNode;
} /** 点击遮罩是否关闭 默认为false*/
clickMaskClose?: boolean;
export interface IFooter {
isHideFooter?: boolean;
footerRender?: () => React.ReactNode;
showCancel?: boolean;
/** 是否显示确定按钮 */
showConfirm?: boolean;
/** 关闭弹窗时的回调函数 */
onClose?: () => void;
/** 点击确定按钮时的回调函数 */
onConfirm?: () => void;
/** 取消按钮文案 */
cancelText?: string;
/** 确认按钮文案 */
okText?: string;
/** 是否禁用确认按钮 */
disabledConfirm?: boolean;
} }
const MyDialog: React.FunctionComponent<IDialogProps> = (props) => { const MyDialog: React.FunctionComponent<IDialogProps> = (props) => {
...@@ -76,7 +60,19 @@ const MyDialog: React.FunctionComponent<IDialogProps> = (props) => { ...@@ -76,7 +60,19 @@ const MyDialog: React.FunctionComponent<IDialogProps> = (props) => {
cancelText, cancelText,
okText, okText,
disabledConfirm, disabledConfirm,
clickMaskClose = false,
} = props; } = props;
const handelClose = (
event: {},
reason: "backdropClick" | "escapeKeyDown"
) => {
if (reason === "backdropClick" && !clickMaskClose) {
return;
}
onClose && onClose();
};
const Footer = () => { const Footer = () => {
if (isHideFooter) return null; if (isHideFooter) return null;
return footerRender ? ( return footerRender ? (
...@@ -104,7 +100,7 @@ const MyDialog: React.FunctionComponent<IDialogProps> = (props) => { ...@@ -104,7 +100,7 @@ const MyDialog: React.FunctionComponent<IDialogProps> = (props) => {
return ( return (
<Dialog <Dialog
open={open} open={open}
onClose={onClose} onClose={handelClose}
style={style} style={style}
className={className} className={className}
aria-labelledby="alert-dialog-title" aria-labelledby="alert-dialog-title"
......
import { toJS } from "mobx"; import { toJS } from "mobx";
import { useNavigate } from "react-router-dom"; import { useNavigate, useLocation } from "react-router-dom";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useMemo } from "react"; import { useMemo } from "react";
...@@ -32,6 +32,7 @@ const FileItem = observer((props: IProps) => { ...@@ -32,6 +32,7 @@ const FileItem = observer((props: IProps) => {
const currentProjectStore = toJS(useGlobalStore("currentProjectStore")); const currentProjectStore = toJS(useGlobalStore("currentProjectStore"));
const Message = useMessage(); const Message = useMessage();
const navigate = useNavigate(); const navigate = useNavigate();
const location: any = useLocation();
/** 时间 */ /** 时间 */
const TimeText = useMemo(() => { const TimeText = useMemo(() => {
...@@ -74,10 +75,15 @@ const FileItem = observer((props: IProps) => { ...@@ -74,10 +75,15 @@ const FileItem = observer((props: IProps) => {
}); });
} }
if (text === "查看文件") { if (text === "查看文件") {
if (
location?.state?.pathName !== fileItemInfo?.path ||
location?.pathname !== "/product/cadd/projectData"
) {
navigate(`/product/cadd/projectData`, { navigate(`/product/cadd/projectData`, {
state: { pathName: fileItemInfo?.path }, state: { pathName: fileItemInfo?.path },
}); });
} }
}
}; };
const speed = useMemo(() => { const speed = useMemo(() => {
...@@ -88,11 +94,6 @@ const FileItem = observer((props: IProps) => { ...@@ -88,11 +94,6 @@ const FileItem = observer((props: IProps) => {
} }
return val; return val;
}, [itemInfo?.bytesUploaded, itemInfo?.endTime, itemInfo.startTime]); }, [itemInfo?.bytesUploaded, itemInfo?.endTime, itemInfo.startTime]);
console.log(
Math.floor((itemInfo?.endTime - itemInfo.startTime) / 1000),
"111111"
);
return ( return (
<div className={styles.itemBox}> <div className={styles.itemBox}>
<div className={styles.leftBox}> <div className={styles.leftBox}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment