forked from Gitlink/forgeplus-react
定制竞赛issue
This commit is contained in:
parent
2f019d688d
commit
fd25431b12
|
@ -104,7 +104,6 @@ const Qz2022 = (props) => {
|
|||
applyStatus = Date.parse(new Date()) < Date.parse(new Date(qzDetail.enroll_date));
|
||||
referStatus = !applyStatus && Date.parse(new Date()) < Date.parse(new Date(qzDetail.upload_date));
|
||||
}
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
{/* banner图+选项 */}
|
||||
|
@ -124,8 +123,11 @@ const Qz2022 = (props) => {
|
|||
<li className={active === "apply" ? "active" : ""}>
|
||||
<Link to={{ pathname: applyStatus ? '/competition/qz2022/apply' :'' }} onClick={()=>{current_user && current_user.login ? !applyStatus && props.showNotification("当前不处于报名时间") : props.showLoginDialog()}}>参赛报名</Link>
|
||||
</li>
|
||||
<li className={active === "refer" ? "active" : ""}>
|
||||
{/* <li className={active === "refer" ? "active" : ""}>
|
||||
<Link to={{ pathname: referStatus ? `/competition/qz2022/refer` : '' }} onClick={()=>{current_user && current_user.login ? !referStatus && props.showNotification("未到作品提交时间,请耐心等待") : props.showLoginDialog()}}>提案提交</Link>
|
||||
</li> */}
|
||||
<li className={active === "refer" ? "active" : ""}>
|
||||
<Link to={{ pathname: `/competition/qz2022/refer`}}>提案提交</Link>
|
||||
</li>
|
||||
<li className={active === "statistics" ? "active" : ""}>
|
||||
<Link to={{ pathname: `/competition/qz2022/statistics` }}>数据统计</Link>
|
||||
|
|
|
@ -162,7 +162,7 @@ export default Form.create()((props) => {
|
|||
<p className="mt10">成员 : </p>
|
||||
<p className="error_message">{errorMessage}</p>
|
||||
{/* */}
|
||||
<EditTable setMembers={setMembers}/>
|
||||
<EditTable setMembers={setMembers} isLocal = {qzDetail && qzDetail.is_local}/>
|
||||
</div>
|
||||
</Form>}
|
||||
{/* 已报名,报名信息 */}
|
||||
|
|
|
@ -18,7 +18,7 @@ function Chat({ form, showNotification, match, history }) {
|
|||
<p>汇聚赛事资讯</p>
|
||||
<p>助您第一时间解读竞赛动态,把握赛事脉搏</p>
|
||||
</div>
|
||||
<div className="chat-btn">
|
||||
<div className="chat-btn" onClick={()=>{window.open('https://fc.osredm.com/forums/theme/105')}}>
|
||||
<span className="detail1">了解详情</span>
|
||||
<img
|
||||
className="iconPlay1"
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
align-items: center;
|
||||
border: 2px solid #2e5bfe;
|
||||
background-color: #2e5bfe;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.detail1 {
|
||||
|
|
|
@ -107,7 +107,7 @@ function Introduce({history:{location:{pathname}},qzDetail }) {
|
|||
title: '作品',
|
||||
dataIndex: 'attachments',
|
||||
render:(text, record)=>{
|
||||
return <Tooltip title={text[0].title}><a href={current_main_site_url+text[0].url} className="attachments_a">{text[0].title}</a></Tooltip>;
|
||||
return <Tooltip title={text && text[0].title}><a href={current_main_site_url+text && text[0].url} className="attachments_a">{text && text[0].title}</a></Tooltip>;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -200,12 +200,12 @@ function Introduce({history:{location:{pathname}},qzDetail }) {
|
|||
赛区:
|
||||
<Select defaultValue="-1" style={{ width: 200 }} onChange={(value)=>{setZone(value)}}>
|
||||
<Option value='-1'>所有赛区</Option>
|
||||
{qzDetail && qzDetail.zones.map((item,i)=> {return <Option value={i} key={i}>{item}</Option>})}
|
||||
{qzDetail && qzDetail.zones.map((item,i)=> {return <Option value={item} key={i}>{item}</Option>})}
|
||||
</Select>
|
||||
<span className="ml30">赛项:</span>
|
||||
<Select defaultValue="-1" style={{ width: 200 }} onChange={(value)=>{setSubCompetition(value)}}>
|
||||
<Option value='-1'>所有赛项</Option>
|
||||
{qzDetail && qzDetail.sub_competitions.map((item,i)=> {return <Option value={i} key={i}>{item}</Option>})}
|
||||
{qzDetail && qzDetail.sub_competitions.map((item,i)=> {return <Option value={item} key={i}>{item}</Option>})}
|
||||
</Select>
|
||||
</div>
|
||||
<a href={current_main_site_url+`/api/competition_infos/qz2022/enroll_list.xlsx${type === "applys"? '':"?upload=true"}`}><Button className="but_2e5">导出</Button></a>
|
||||
|
|
|
@ -38,4 +38,10 @@
|
|||
.attachments_a{
|
||||
color: #2e5bfe;
|
||||
}
|
||||
.qzManageTable .ant-table-tbody > tr > td{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { Upload, Button } from 'antd';
|
||||
import { appendFileSizeToUploadFileAll } from 'educoder';
|
||||
import { httpUrl } from '../fetch';
|
||||
|
||||
function Uploads({ className, size, actionUrl, fileList, showNotification, load, accept, disabled,count }) {
|
||||
const [files, setFiles] = useState(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (fileList) {
|
||||
init();
|
||||
}
|
||||
}, [fileList]);
|
||||
|
||||
function init() {
|
||||
let f = appendFileSizeToUploadFileAll(fileList);
|
||||
setFiles(f);
|
||||
}
|
||||
function onAttachmentRemove(file) {
|
||||
if (!file.percent || file.percent === 100) {
|
||||
deleteAttachment(file);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function deleteAttachment(file) {
|
||||
let id = (file.response && file.response.data && file.response.data.id) || file.id;
|
||||
|
||||
// 暂时不直接删除上传的文件,只在最后保存的时候进行修改
|
||||
let nf = files.filter(item => {
|
||||
let itemId = (item.response && item.response.data && item.response.data.id) || item.id;
|
||||
return itemId !== id;
|
||||
});
|
||||
setFiles(nf);
|
||||
backFiles(nf);
|
||||
}
|
||||
|
||||
function backFiles(fileList) {
|
||||
let filesId = [];
|
||||
for (const item of fileList) {
|
||||
if (item) {
|
||||
let itemId = (item.response && item.response.data && item.response.data.id) || item.id;
|
||||
itemId && filesId.push(itemId);
|
||||
}
|
||||
}
|
||||
load && load(fileList, filesId.join());
|
||||
}
|
||||
|
||||
|
||||
function handleChange(info) {
|
||||
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
|
||||
let fileList = info.fileList;
|
||||
if(count){
|
||||
fileList = fileList.slice(-count);
|
||||
}
|
||||
setFiles(appendFileSizeToUploadFileAll(fileList));
|
||||
if (info.file.response) {
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
if (fileList[i].response && !fileList[i].response.data) {
|
||||
fileList.splice(i, 1);
|
||||
}
|
||||
}
|
||||
backFiles(fileList);
|
||||
if (!info.file.response.data) {
|
||||
info.file.response && showNotification(info.file.response.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function beforeUpload(file) {
|
||||
const isLt100M = file.size / 1024 / 1024 < size;
|
||||
if (!isLt100M) {
|
||||
showNotification(`文件大小必须小于${size}MB!`);
|
||||
}
|
||||
return isLt100M;
|
||||
}
|
||||
|
||||
const upload = {
|
||||
name: 'file',
|
||||
fileList: files,
|
||||
disabled: disabled,
|
||||
action: (httpUrl || actionUrl) + `/busiAttachments/upload`,
|
||||
onChange: handleChange,
|
||||
onRemove: onAttachmentRemove,
|
||||
beforeUpload: beforeUpload,
|
||||
};
|
||||
return (
|
||||
<Upload {...upload} className={className}>
|
||||
<Button type="primary" disabled={disabled}>点击上传</Button>
|
||||
<span className="ml10 color-grey-9">(你可以上传小于<span className="color-red">{size}MB</span>的文件)</span>
|
||||
</Upload>
|
||||
)
|
||||
}
|
||||
export default Uploads;
|
|
@ -49,11 +49,15 @@ function Introduce({ form, showNotification, match, history, enrollStatus }) {
|
|||
|
||||
// 进行文件大小检查
|
||||
function beforeUpload(file){
|
||||
const isZip = file.name.endsWith(".zip") || file.name.endsWith(".tar") || file.name.endsWith(".rar");
|
||||
if(!isZip){
|
||||
showNotification(`只能上传压缩包文件`);
|
||||
}
|
||||
const isLt100M = file.size / 1024 / 1024 < 1024;
|
||||
if (!isLt100M) {
|
||||
showNotification(`文件大小必须小于${1024}MB!`);
|
||||
}
|
||||
return isLt100M;
|
||||
return isLt100M && isZip;
|
||||
}
|
||||
|
||||
// 作品提交
|
||||
|
@ -72,7 +76,7 @@ function Introduce({ form, showNotification, match, history, enrollStatus }) {
|
|||
}
|
||||
}
|
||||
return (
|
||||
<div className="qz_main refer">
|
||||
<div className="qz_main refer mt40 mb60">
|
||||
<img src={refer} className="refer_img mb20"/>
|
||||
<Upload
|
||||
accept=".zip,.rar,.tar"
|
||||
|
@ -84,7 +88,8 @@ function Introduce({ form, showNotification, match, history, enrollStatus }) {
|
|||
beforeUpload={beforeUpload}
|
||||
showUploadList={{
|
||||
showDownloadIcon: true,
|
||||
downloadIcon: <i className="iconfont icon-xiazai-icon"></i>
|
||||
downloadIcon: <i className="iconfont icon-xiazai-icon"></i>,
|
||||
showRemoveIcon: false
|
||||
}}
|
||||
>
|
||||
<Button className="upload"><Icon type="upload" />上传</Button>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 66px 0 86px;
|
||||
margin-top: 50px;
|
||||
.refer_img{
|
||||
width: 48px;
|
||||
}
|
||||
|
@ -43,4 +44,8 @@
|
|||
}
|
||||
}
|
||||
.ant-upload-list-item:hover .ant-upload-list-item-info{background: none;}
|
||||
.ant-upload-list-item{
|
||||
text-overflow: ellipsis;
|
||||
max-width: 46vw;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue