diff --git a/src/pages/setting/checkUpdate.tsx b/src/pages/setting/checkUpdate.tsx index 811f860b..c5c3b60e 100644 --- a/src/pages/setting/checkUpdate.tsx +++ b/src/pages/setting/checkUpdate.tsx @@ -1,10 +1,10 @@ import React, { useEffect, useState, useRef } from 'react'; -import { Typography, Modal, Tag, Button, Spin, message } from 'antd'; +import { Statistic, Modal, Tag, Button, Spin, message } from 'antd'; import { request } from '@/utils/http'; import config from '@/utils/config'; import { version } from '../../version'; -const { Text, Link } = Typography; +const { Countdown } = Statistic; const CheckUpdate = ({ ws }: any) => { const [updateLoading, setUpdateLoading] = useState(false); @@ -18,19 +18,20 @@ const CheckUpdate = ({ ws }: any) => { request .put(`${config.apiPrefix}system/update-check`) .then((_data: any) => { + message.destroy(); const { code, data } = _data; - if (code === 200 && !data.hasNewVersion) { + if (code === 200 && data.hasNewVersion) { showConfirmUpdateModal(data); } else { message.success('已经是最新版了!'); } }) .catch((error: any) => { + message.destroy(); console.log(error); }) .finally(() => { setUpdateLoading(false); - hide(); }); }; @@ -79,29 +80,10 @@ const CheckUpdate = ({ ws }: any) => { maskClosable: false, closable: false, okButtonProps: { disabled: true }, - title: , + title: '更新日志', centered: true, content: ( -
- {value} -- ), - }); - }; - - useEffect(() => { - ws.onmessage = (e) => { - modalRef.current.update({ - content: ( +
{ paddingTop: 15, fontSize: 12, fontWeight: 400, - minHeight: '60vh', }} > - {e.data + value} + {value}- ), - }); - setValue(e.data); +
+ {value + e.data} ++