diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index 94b197480..8032d50ec 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -3,31 +3,33 @@ import { Modal , Button } from 'antd'; import './Index.scss'; import '../../css/index.scss'; import RenderHtml from '../../../components/render-html'; -import axios from 'axios'; +import cookie from 'react-cookies'; -function SystemNotice({system_notification,history,login,showNotice,hideSystemNotice}){ +function SystemNotice({system_notification,history}){ const [ visible , setVisible ] = useState(false); useEffect(()=>{ - if(system_notification && !system_notification.is_read && showNotice){ + if(system_notification && !cookie.load('notice_stage')){ setVisible(true); } },[system_notification]) function sureContinue() { - if(login && ( system_notification && system_notification.id )){ - const url = `/users/${login}/system_notification_histories.json`; - axios.post(url,{ - system_notification_id:system_notification.id - }).then(result=>{ - if(result && result.status === 0){ - setVisible(false); - hideSystemNotice(); - } - }).catch(error=>{}) - } + // if(login && ( system_notification && system_notification.id )){ + // const url = `/users/${login}/system_notification_histories.json`; + // axios.post(url,{ + // system_notification_id:system_notification.id + // }).then(result=>{ + // if(result && result.status === 0){ + // setVisible(false); + // hideSystemNotice(); + // } + // }).catch(error=>{}) + // } + let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + cookie.save('notice_stage', true,{ expires: inFifteenMinutes }); + console.log("cookies:",cookie.load('notice_stage')) ; setVisible(false); - hideSystemNotice(); } return ( diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index ac141ef6a..c20e75b1f 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -29,7 +29,6 @@ export function TPMIndexHOC(WrappedComponent) { email:undefined, completeProfile:false, showCP:false, - showNotice:true } } @@ -216,15 +215,8 @@ export function TPMIndexHOC(WrappedComponent) { }) } - hideSystemNotice=()=>{ - this.setState({ - showNotice:false - }) - } - - render() { - let { isRender , current_user , giteaVisible , email , completeProfile , showCP , showNotice , mygetHelmetapi } = this.state; + let { isRender , current_user , giteaVisible , email , completeProfile , showCP , mygetHelmetapi } = this.state; const common = { showLoginDialog: this.showLoginDialog, checkIfLogin: this.checkIfLogin, @@ -234,11 +226,9 @@ export function TPMIndexHOC(WrappedComponent) { return (