From 9b6dbb41af3f633a4a970a9a1ce35ada433fd5aa Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Jul 2021 10:58:26 +0800 Subject: [PATCH] =?UTF-8?q?fileStatus:=20=E4=B8=8B=E5=8F=91=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E5=A2=9E=E5=8A=A0=E6=8F=90=E7=A4=BA;=20=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=E6=96=87=E6=A1=88=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileStatus/FileStatus.tsx | 16 ++++--- src/layouts/nav.tsx | 54 ++++++++++++++++-------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/components/FileStatus/FileStatus.tsx b/src/components/FileStatus/FileStatus.tsx index 642df3d..e7c591a 100644 --- a/src/components/FileStatus/FileStatus.tsx +++ b/src/components/FileStatus/FileStatus.tsx @@ -6,13 +6,14 @@ import FileIcon from '../FileIcon'; import ATooltip from '../Tooltip'; import styles from './FileStatus.less'; import { CloseCircleFilled, CheckCircleFilled } from '@ant-design/icons'; -import { Progress, Button, ButtonProps } from 'antd'; +import { Progress, Button, ButtonProps, message } from 'antd'; import { NotificationType, TaskStatus, TaskType } from '@/services/API.helper'; import { DATA } from '@/services/API'; import { identity } from 'lodash'; import { useCallback } from 'react'; import { fetchLocalApi } from '@/utils/request'; import system from '@/services/system'; +import { handleRequest } from '@/utils/tool'; interface FileStatusProps { className?: string; @@ -35,12 +36,17 @@ export default function FileStatus(props: FileStatusProps) { : ''; }, [data]); - const redoTask = useCallback(() => { - fetchLocalApi('restartTask', { taskIds: data.taskId }); + const redoTask = useCallback(async () => { + const res = await fetchLocalApi('restartTask', { taskIds: data.taskId }); + handleRequest(res).success(() => message.success('指令已发送')); }, [data.taskId]); - const downloadFile = useCallback(() => { - fetchLocalApi('downloadFileFromMsg', { fileObject: data.originData }); + const downloadFile = useCallback(async () => { + const res = await fetchLocalApi('downloadFileFromMsg', { + fileObject: data.originData, + }); + 4; + handleRequest(res).success(() => message.success('下载指令已发送')); }, [data.taskId]); const checkFile = useCallback(() => { diff --git a/src/layouts/nav.tsx b/src/layouts/nav.tsx index 4556be4..fec0188 100644 --- a/src/layouts/nav.tsx +++ b/src/layouts/nav.tsx @@ -10,11 +10,25 @@ import classNames from 'classnames'; import ATooltip from '@/components/Tooltip'; import { Link } from 'umi'; - const navList = [ - { pathname: '/sync', name: '同步任务', icon: syncImg, activeIcon: syncActiveImg }, - { pathname: '/messages', name: '消息通知', icon: messagesImg, activeIcon: messagesActiveImg }, - { pathname: '/log', name: '操作记录', icon: logImg, activeIcon: logActiveImg }, + { + pathname: '/sync', + name: '同步任务', + icon: syncImg, + activeIcon: syncActiveImg, + }, + { + pathname: '/messages', + name: '消息中心', + icon: messagesImg, + activeIcon: messagesActiveImg, + }, + { + pathname: '/log', + name: '操作记录', + icon: logImg, + activeIcon: logActiveImg, + }, ]; interface NavProps { @@ -27,18 +41,22 @@ export default function Nav(props: NavProps) { const { pathname: currentPathname } = props; return (
- { - navList.map(({ pathname, name, icon, activeIcon }) => { - const active = pathname.indexOf(currentPathname) === 0; - return ( - - - - - - ) - }) - } + {navList.map(({ pathname, name, icon, activeIcon }) => { + const active = pathname.indexOf(currentPathname) === 0; + return ( + + + + + + ); + })}
- ) -} \ No newline at end of file + ); +}