forked from Gitlink/forgeplus-react
特殊项目申请列表
This commit is contained in:
parent
6eef4bd09e
commit
3f8f1b8083
|
@ -27,14 +27,14 @@ if (isDev) {
|
|||
}
|
||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || '15243705227'
|
||||
}
|
||||
function clearAllCookie() {
|
||||
cookie.remove('_educoder_session', { path: '/' });
|
||||
cookie.remove('autologin_trustie', { path: '/' });
|
||||
setpostcookie()
|
||||
}
|
||||
clearAllCookie();
|
||||
// clearAllCookie();
|
||||
function setpostcookie() {
|
||||
const str = window.location.pathname;
|
||||
if (str.indexOf("/wxcode") !== -1) {
|
||||
|
|
|
@ -6,12 +6,12 @@ const { Search } = Input;
|
|||
const $ = window.$;
|
||||
const isDev = window.location.port == 3007;
|
||||
const isdev2= window.location.hostname ==='www.educoder.net'
|
||||
export const TEST_HOST = "https://testforgeplus.trustie.net/"
|
||||
export const TEST_HOST = "http://39.105.176.215:49999"
|
||||
export function getImageUrl(path) {
|
||||
// https://www.educoder.net
|
||||
// https://testbdweb.trustie.net
|
||||
// const local = 'http://localhost:3000'
|
||||
const local = 'https://testforgeplus.trustie.net';
|
||||
const local = 'http://39.105.176.215:49999';
|
||||
if (isDev) {
|
||||
return `${local}/${path}`
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export function getImage(path) {
|
|||
// https://www.educoder.net
|
||||
// https://testbdweb.trustie.net
|
||||
// const local = 'http://localhost:3000'
|
||||
const local = 'https://testforgeplus.trustie.net/';
|
||||
const local = 'http://39.105.176.215:49999';
|
||||
if(path.indexOf("http://")===-1){
|
||||
if (isDev) {
|
||||
return `${local}/images/${path}`
|
||||
|
@ -93,7 +93,7 @@ export function setImagesUrl(path){
|
|||
}
|
||||
|
||||
export function getUrl(path, goTest) {
|
||||
const local = 'https://testforgeplus.trustie.net'
|
||||
const local = 'http://39.105.176.215:49999'
|
||||
if (isDev) {
|
||||
return `${local}${path?path:''}`
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ class Detail extends Component {
|
|||
}
|
||||
|
||||
getProject = (num) => {
|
||||
const {user} = this.props;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const url = `/${owner}/${projectsId}/simple.json`;
|
||||
axios.get(url).then((result) => {
|
||||
|
@ -191,7 +192,7 @@ class Detail extends Component {
|
|||
platform:result.data.platform && result.data.platform !== 'educoder'
|
||||
})
|
||||
let signa = result.data.user_apply_signatures && result.data.user_apply_signatures[0];
|
||||
if(result.data.is_secret && (signa && signa.status !== "passed")){
|
||||
if(result.data.is_secret && (!signa || (signa && signa.status !== "passed")) && user.login !== owner){
|
||||
this.setState({
|
||||
visible:true,
|
||||
is_secret:result.data.is_secret,
|
||||
|
|
|
@ -28,6 +28,10 @@ const Tags = Loadable({
|
|||
loader: () => import("./new_tags"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Special = Loadable({
|
||||
loader: () => import("./SpecialProject"),
|
||||
loading: Loading,
|
||||
});
|
||||
const Manage = Loadable({
|
||||
loader: () => import("./ManageWeb"),
|
||||
loading: Loading,
|
||||
|
@ -39,6 +43,7 @@ const ManageNew = Loadable({
|
|||
class Index extends Component {
|
||||
render() {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { user } = this.props;
|
||||
const { pathname } = this.props.history.location;
|
||||
|
||||
const flag = pathname === `/projects/${owner}/${projectsId}/setting`;
|
||||
|
@ -87,6 +92,20 @@ class Index extends Component {
|
|||
</Link>
|
||||
</p>
|
||||
</li>
|
||||
{
|
||||
user && user.login === owner ?
|
||||
<li
|
||||
className={pathname.indexOf("setting/special") > -1 ? "active" : ""}
|
||||
>
|
||||
<p>
|
||||
<Link to={`/projects/${owner}/${projectsId}/setting/special`} className="w-100">
|
||||
<i className="iconfont icon-jingyan font-18 mr10"></i>
|
||||
特殊开源许可证项目管理
|
||||
</Link>
|
||||
</p>
|
||||
</li>
|
||||
:""
|
||||
}
|
||||
|
||||
{/* <li
|
||||
className={
|
||||
|
@ -112,7 +131,15 @@ class Index extends Component {
|
|||
<Collaborator {...this.props} {...props} {...this.state} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
<Route
|
||||
path="/projects/:owner/:projectsId/setting/special"
|
||||
render={(props) => (
|
||||
<Special {...this.props} {...props} {...this.state} />
|
||||
)}
|
||||
></Route>
|
||||
{/* 修改仓库信息 */}
|
||||
|
||||
<Route
|
||||
path="/projects/:owner/:projectsId/setting/tags"
|
||||
render={(props) => (
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
import React , { useEffect , useState} from 'react';
|
||||
import { Input , Table , Pagination, Button , Dropdown , Menu } from 'antd';
|
||||
import { Banner , WhiteBack , AlignCenterBetween } from '../Component/layout';
|
||||
import axios from 'axios';
|
||||
|
||||
const { Search } = Input;
|
||||
|
||||
const LIMIT = 15;
|
||||
function SpecialProject(props){
|
||||
const [ page , setPage] = useState(1);
|
||||
const [ searchValue , SetSearchValue ] = useState(undefined);
|
||||
const [ total , setTotal ] = useState(0);
|
||||
const [ list , setList ] = useState(undefined);
|
||||
const [ status , setStatus ] = useState(undefined);
|
||||
const [ loading ,setLoading ] = useState(true);
|
||||
|
||||
const { owner , projectsId} = props.match.params;
|
||||
console.log(props);
|
||||
const { project_id } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(project_id){
|
||||
setLoading(true);
|
||||
Init(searchValue, status);
|
||||
}
|
||||
},[page,project_id]);
|
||||
|
||||
function Init(search,status){
|
||||
const url = `/apply_signatures.json`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
project_id,
|
||||
page,limit:LIMIT,search,status
|
||||
}
|
||||
}).then(result=>{
|
||||
setLoading(false);
|
||||
if(result){
|
||||
setList(result.data.apply_signatures);
|
||||
setTotal(result.data.total_count);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
||||
function changePage(page){
|
||||
setLoading(true);
|
||||
setPage(page);
|
||||
}
|
||||
|
||||
const column = [
|
||||
{
|
||||
dataIndex:"column",
|
||||
key:1,
|
||||
width:"12%",
|
||||
title:"序号",
|
||||
render:(txt,item,index)=>{
|
||||
return `${index+1}`
|
||||
}
|
||||
},
|
||||
{
|
||||
dataIndex:"name",
|
||||
key:2,
|
||||
title:"申请人",
|
||||
render:(text,item,m)=>{
|
||||
return item.user && <span className="task-hide" style={{maxWidth:"139px",display:"block"}}>{item.user.name}</span>
|
||||
}
|
||||
},
|
||||
{
|
||||
dataIndex:"email",
|
||||
key:2,
|
||||
title:"邮箱",
|
||||
width:"22%",
|
||||
render:(text,item,m)=>{
|
||||
return item.user && <span>{item.user.email}</span>
|
||||
}
|
||||
},
|
||||
{
|
||||
dataIndex:"attachment",
|
||||
key:3,
|
||||
title:"附件",
|
||||
width:"28%",
|
||||
render:(text,item,m)=>{
|
||||
return item.attachment && <a className="task-hide" style={{maxWidth:"173px",display:"block"}} href={`${item.attachment.path}`}>{item.attachment.filename}</a>
|
||||
}
|
||||
},
|
||||
{
|
||||
dataIndex:"operation",
|
||||
key:4,
|
||||
width:"18%",
|
||||
title:"操作",
|
||||
render:(text, item) =>{
|
||||
return(
|
||||
<React.Fragment>
|
||||
{
|
||||
item.status === "waiting" &&
|
||||
<span>
|
||||
<Button size="small" onClick={()=>operation(item.id,"unpassed")}>拒绝</Button>
|
||||
<Button size="small" onClick={()=>operation(item.id,"passed")} type={"primary"} className="ml20">同意</Button>
|
||||
</span>
|
||||
}
|
||||
{
|
||||
item.status === "unpassed" &&
|
||||
<span style={{color:"#ff041c"}}>已拒绝</span>
|
||||
}
|
||||
{
|
||||
item.status === "passed" &&
|
||||
<span style={{color:"#13b4f1"}}>已同意</span>
|
||||
}
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
// 拒绝&同意
|
||||
function operation(ids,s){
|
||||
setLoading(true);
|
||||
const url = `/apply_signatures/${ids}.json`;
|
||||
axios.put(url,{
|
||||
project_id:project_id,
|
||||
status:s
|
||||
}).then(result=>{
|
||||
setLoading(false);
|
||||
if(result){
|
||||
props.showNotification(`${s==="passed"?"同意":"拒绝"}此申请已操作成功!`);
|
||||
Init(searchValue,status);
|
||||
}
|
||||
}).catch(error=>{setLoading(false)})
|
||||
}
|
||||
|
||||
function searchList(){
|
||||
setLoading(true);
|
||||
Init(searchValue,status);
|
||||
}
|
||||
|
||||
const menu=(
|
||||
<Menu onClick={chooseStatus}>
|
||||
<Menu.Item>全部</Menu.Item>
|
||||
<Menu.Item key="waiting">审核中</Menu.Item>
|
||||
<Menu.Item key="unpassed">已拒绝</Menu.Item>
|
||||
<Menu.Item key="passed">已同意</Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
|
||||
function chooseStatus(e){
|
||||
setStatus(e.key);
|
||||
Init(searchValue, e.key);
|
||||
}
|
||||
|
||||
|
||||
return(
|
||||
<WhiteBack style={{minHeight:"500px"}}>
|
||||
<Banner>项目管理</Banner>
|
||||
<AlignCenterBetween style={{padding:"10px 20px",textAlign:"right"}}>
|
||||
<Search
|
||||
placeholder="请输入用户姓名或者邮箱搜索"
|
||||
allowClear
|
||||
enterButton="搜索"
|
||||
style={{width:400}}
|
||||
size="middle"
|
||||
value={searchValue}
|
||||
onChange={(e)=>SetSearchValue(e.target.value)}
|
||||
onSearch={searchList}
|
||||
/>
|
||||
<Dropdown overlay={menu} placement="bottomRight">
|
||||
<span>
|
||||
<span style={{color:status ? "color-blue" : "color-grey-3"}}>{status ==="waiting"?"审核中":status==="unpassed"?"已拒绝":status==="passed"?"已同意":"全部"}</span>
|
||||
<i className="iconfont icon-xiajiantou color-grey-9 font-14 ml8"></i>
|
||||
</span>
|
||||
</Dropdown>
|
||||
</AlignCenterBetween>
|
||||
<Table
|
||||
columns={column}
|
||||
rowKey={(record) => record.id}
|
||||
pagination={false}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
></Table>
|
||||
{
|
||||
total > LIMIT &&
|
||||
<div className="center mt20 mb20">
|
||||
<Pagination simple current={page} total={total} pageSize={LIMIT} onChange={changePage}></Pagination>
|
||||
</div>
|
||||
}
|
||||
|
||||
</WhiteBack>
|
||||
)
|
||||
}
|
||||
export default SpecialProject;
|
|
@ -139,6 +139,7 @@
|
|||
.padding15-10{
|
||||
padding:15px 10px;
|
||||
}
|
||||
.center{text-align: center;}
|
||||
.w-100{width: 100%;}
|
||||
.fwb{font-weight: 600;}
|
||||
.text-black{color: #333;}
|
||||
|
|
Loading…
Reference in New Issue