diff --git a/src/forge/Component/NoticeModal/Index.scss b/src/forge/Component/NoticeModal/Index.scss new file mode 100644 index 00000000..18e4dcda --- /dev/null +++ b/src/forge/Component/NoticeModal/Index.scss @@ -0,0 +1,90 @@ +.systemBox{ + .ant-modal-body{ + padding:1px 0px 0px 0px; + .sysBox{ + background-image: url('./bg.png'); + background-repeat: no-repeat; + background-size: 100% 334px; + margin-top: -55px; + } + .sysnoticeBox{ + width: 100%; + padding:80px 0px 34px; + display: flex; + flex-direction: column; + width: 780px; + margin: 0px auto; + p.ntitle{ + height: 33px; + font-size: 24px; + font-weight: 500; + color: #31FFF7; + line-height: 33px; + text-align: center; + } + p.nSubtitle{ + height: 25px; + line-height: 25px; + font-size: 18px; + font-weight: 500; + color: #FFFFFF; + margin-top: 60px; + padding-left: 20px; + } + .markdown-body{ + box-shadow: 0px 0px 17px rgba(0,0,0,0.2); + border-radius: 4px; + margin-top: 17px!important; + } + .nContent{ + padding:20px 34px; + background-color: #fff; + line-height: 30px; + font-size: 15px; + font-weight: 400; + color: #333; + .realmName{ + margin-top: 20px; + display: flex; + ul{ + width: 50%; + padding-left: 0px!important; + li{ + font-size: 15px; + font-weight: 500; + line-height: 32px; + text-align: left; + color: #000; + list-style-type: none!important; + &:first-child{ + color: #E65714; + } + } + } + } + .nSubdesc{ + font-size: 15px; + font-weight: 400; + color: #000000; + line-height: 31px; + margin-top: 20px; + } + .nInfo{ + font-size: 14px; + font-weight: 400; + color: #333333; + text-align: right; + margin-top: 25px; + p{ + height: 20px; + line-height: 20px; + } + } + } + .nBtn{ + text-align: center; + margin-top: 33px; + } + } + } +} \ No newline at end of file diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx new file mode 100644 index 00000000..917b87c8 --- /dev/null +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -0,0 +1,87 @@ +import React , { useEffect , useState } from 'react'; +import { Modal , Button } from 'antd'; +import './Index.scss'; +import '../../css/index.scss'; +import RenderHtml from '../../../components/render-html'; +import cookie from 'react-cookies'; + +function SystemNotice({system_notification,history}){ + const [ visible , setVisible ] = useState(false); + + useEffect(()=>{ + 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=>{}) + // } + console.log("cookies before:",cookie.load('notice_stage')) ; + cookie.remove('notice_stage'); + let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + // let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 + cookie.save('notice_stage', true,{ expires: inFifteenMinutes }); + console.log("cookies after:",cookie.load('notice_stage')) ; + setVisible(false); + } + + return ( + +
+
+

{system_notification && system_notification.subject}

+

{system_notification && system_notification.sub_subject}

+ {/*
+
+ 为了给用户提供更加稳定、优质的服务,我们即将对平台门户首页、平台名称、平台域名进行一次全面升级与变更。原平台名称:Trustie(中文名:确实)将于2021年10月xx日统一更改为Gitlink(中文名:确实开源)。届时平台域名将统一进行更换,更换规则如下 +
+
+
    +
  • 原域名:
  • +
  • 官网顶级域名https://www.trustie.net
  • +
  • 版本库子域名https://forgeplus.trustie.net
  • +
  • 论坛子域名https://forum.trustie.net/forums
  • +
+
    +
  • 更换后域名:
  • +
  • 官网顶级域名https://www.gitlink.org.cn
  • +
  • 版本库子域名https://www.git.gitlink.org.cn
  • +
  • 论坛子域名https://forum.gitlink.org.cn
  • +
+
+
+ 自2021年10月xx日起,旧域名将停止访问。因平台名称与域名变更给您带来的不便,我们深表歉意!非常感谢您一直以来对本平台的信任与支持,我们将一如既往地为您提供优质的服务。 特此通知! +
+
+

Gitlink运营团队

+

2021年10月xx日

+
+
*/} + +
+ +
+
+
+
+ ) +} +export default SystemNotice; \ No newline at end of file diff --git a/src/forge/Component/NoticeModal/bg.png b/src/forge/Component/NoticeModal/bg.png new file mode 100644 index 00000000..625b3c31 Binary files /dev/null and b/src/forge/Component/NoticeModal/bg.png differ diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 9d8da7d3..2659f2e8 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -150,7 +150,7 @@ class CreateMerge extends Component { }else{ if(pullOwner === mergeOwner){ if (!noMergeBranch) { - this.compareProject(result.data.id, branchParams); + this.compareProject(true, branchParams); } else { this.setState({ showMessage: true, @@ -172,53 +172,51 @@ class CreateMerge extends Component { }; // compare接口,获取分支对比信息 - compareProject = (baseid, branchParams) => { + compareProject = (sameProject, branchParams) => { // const { project } = this.props; // const { owner, projectsId } = this.props.match.params; - const projectObj = this.props.project; const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams; let url = `/${mergeOwner}/${projectId}/compare`; - if (projectObj) { - if (baseid === projectObj.id) { - url += `/${pullBranch}...${mergeBranch}.json`; - } else { - url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`; - } - this.setState({ isSpin: false, isCompareSpin: true }); - axios - .get(url) - .then((result) => { - if (result) { - if (result.data.status === 0) { - this.setState({ - showMessage: false, - }); - } else { - this.setState({ - showMessage: true, - defaultMessage: result.data.message, - }); - } + if (sameProject) { + url += `/${pullBranch}...${mergeBranch}.json`; + } else { + url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`; + } + this.setState({ isSpin: false, isCompareSpin: true }); + axios + .get(url) + .then((result) => { + if (result) { + if (result.data.status === 0) { this.setState({ - comparesData: result.data, + showMessage: false, + }); + } else { + this.setState({ + showMessage: true, + defaultMessage: result.data.message, }); } this.setState({ - isFirstLoading: false, - isSpin: false, - isCompareSpin: false, + comparesData: result.data, }); - }) - .catch((error) => { - this.setState({ isSpin: false, isCompareSpin: false }); + } + this.setState({ + isFirstLoading: false, + isSpin: false, + isCompareSpin: false, }); - } + }) + .catch((error) => { + this.setState({ isSpin: false, isCompareSpin: false }); + }); }; // 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询 - getBranchList = ({ mergeOwner, projectId, mergeBranch }) => { + getBranchList = (branchParams) => { + const { mergeOwner, projectId, mergeBranch } = branchParams; this.setState({ isSpin: true }); const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`; axios @@ -234,6 +232,7 @@ class CreateMerge extends Component { defaultMessage: '目标分支不存在', isCompareSpin: false, }); + !noMergeBranch && this.compareProject(false, branchParams); } this.setState({ isSpin: false }); }) diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index b9215568..c20e75b1 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -7,6 +7,7 @@ import './TPMIndex.css'; import LoginDialog from '../login/LoginDialog'; import EducoderAccount from '../../forge/Component/EducoderAccount'; import ProfileModal from '../../forge/Component/ProfileModal/Index'; +import SystemNotice from '../../forge/Component/NoticeModal/SystemNotice'; export function TPMIndexHOC(WrappedComponent) { return class II extends React.Component { @@ -27,7 +28,7 @@ export function TPMIndexHOC(WrappedComponent) { giteaVisible:false, email:undefined, completeProfile:false, - showCP:false + showCP:false, } } @@ -214,9 +215,8 @@ export function TPMIndexHOC(WrappedComponent) { }) } - render() { - let { isRender , current_user , giteaVisible , email , completeProfile , showCP } = this.state; + let { isRender , current_user , giteaVisible , email , completeProfile , showCP , mygetHelmetapi } = this.state; const common = { showLoginDialog: this.showLoginDialog, checkIfLogin: this.checkIfLogin, @@ -225,6 +225,11 @@ export function TPMIndexHOC(WrappedComponent) { }; return (
+