forked from Gitlink/forgeplus-react
49 lines
1.9 KiB
JavaScript
49 lines
1.9 KiB
JavaScript
import React , { useEffect , useState } from 'react';
|
||
import { Modal } from 'antd';
|
||
import UploadSingle from '../Upload/single';
|
||
import './Index.scss';
|
||
import axios from 'axios';
|
||
import { getUrl } from 'educoder';
|
||
|
||
function SpecialModal({ visible , hideModal , sureModal , showNotification , user_apply_signatures , project_id }){
|
||
const [ id ,setId ] = useState(undefined);
|
||
|
||
|
||
function loadFunc(id){
|
||
setId(id);
|
||
}
|
||
|
||
function sure(){
|
||
if(!user_apply_signatures || (user_apply_signatures && user_apply_signatures.status !== "waiting")){
|
||
if(!id || (id && id.length === 0)){
|
||
showNotification("请先提交文件进行审核!");
|
||
return;
|
||
}
|
||
const url = `/apply_signatures.json`;
|
||
axios.post(url,{
|
||
attachment_id:id,
|
||
project_id:project_id
|
||
}).then(result=>{
|
||
if(result && result.data.id){
|
||
showNotification("已提交文件,正在等待审核!");
|
||
sureModal();
|
||
}
|
||
})
|
||
}else{
|
||
sureModal();
|
||
}
|
||
}
|
||
return(
|
||
<Modal title="提示" visible={visible} closable={false} onCancel={hideModal} onOk={sure}>
|
||
{
|
||
!user_apply_signatures || (user_apply_signatures && user_apply_signatures.status !== "waiting") ?
|
||
<div style={{width:"420px",textAlign:'center',margin:"0 auto",paddingBottom:"30px",position:"relative"}}>
|
||
<div>该项目为私有项目,请先<a href={getUrl(`/api/apply_signatures/template_file`)} className="color-blue">下载</a>开源协议,阅读并填写<br/>相关信息后,将协议<UploadSingle size={"5"} load={loadFunc} showNotification={showNotification} className={'singleBtn'}><span className="color-blue" style={{cursor:"pointer"}}>上传</span></UploadSingle>,平台审核通过后即可进入当前项目</div>
|
||
</div>
|
||
:
|
||
<p style={{textAlign:'center'}}>您上传的文件正在审核中,通过后才能访问当前项目</p>
|
||
}
|
||
</Modal>
|
||
)
|
||
}
|
||
export default SpecialModal; |