Commit af0cb5c3 authored by wuyongsheng's avatar wuyongsheng

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

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

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