forked from Gitlink/forgeplus-react
定制竞赛上架下架+首页社区动态显示条数更改
This commit is contained in:
parent
98b7f23f48
commit
951c8c2462
|
@ -43,12 +43,13 @@ function SecondSection({ second ,main_web_site_url ,btnUrl}) {
|
|||
if (communicates.length) {
|
||||
setLeftItem(communicates[0]);
|
||||
setList(communicates.slice(1, 5));
|
||||
// 当社区动态较少时,仅展示一条,其余轮播
|
||||
communicates.length < 5 && (setting.slidesToShow = 1)
|
||||
}
|
||||
}
|
||||
}).catch(error => { });
|
||||
}, [])
|
||||
|
||||
|
||||
function goDetail(id) {
|
||||
window.open(`${main_web_site_url}/forums/${id}/detail`);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Button, message, Modal, Select, Tooltip,Table } from "antd";
|
||||
import { Button, message, Modal, Select, Tooltip,Table, Popconfirm } from "antd";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import Link from "react-router-dom/Link";
|
||||
import axios from "axios";
|
||||
|
@ -77,9 +77,14 @@ function Competition(props){
|
|||
title: '操作',
|
||||
dataIndex: 'id',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
align: "center",
|
||||
render: (text, record)=>{
|
||||
return <Button size="small" type="link" href={`/managements/competition/customize/edit/${record.identifier}`}>编辑</Button>
|
||||
return <React.Fragment>
|
||||
<Popconfirm title={`您确定要${record.status? '下' : '上'}架该竞赛吗?`} onConfirm={()=>{confirm(record)}}>
|
||||
<Button size="small" type={record.status? 'danger' : 'primary'} className="mr10">{record.status? '下' : '上'}架</Button>
|
||||
</Popconfirm>
|
||||
<Link to={`/managements/competition/customize/edit/${record.identifier}`}>编辑</Link>
|
||||
</React.Fragment>
|
||||
}
|
||||
}
|
||||
];
|
||||
|
@ -97,7 +102,17 @@ function Competition(props){
|
|||
}).finally(()=>{
|
||||
setLoading(false);
|
||||
})
|
||||
}, [])
|
||||
}, [reload])
|
||||
|
||||
// 上架/下架竞赛
|
||||
function confirm(record){
|
||||
axios.post(`/competition_infos/${record.identifier}/online_switch.json`).then(res=>{
|
||||
if(res && res.data && !res.data.status){
|
||||
setReload(Math.random());
|
||||
message.success('修改成功');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="centerbox competitionList">
|
||||
|
|
Loading…
Reference in New Issue