定制竞赛issue

This commit is contained in:
谢思 2022-03-29 17:47:11 +08:00 committed by 何童崇
parent d6dda2a980
commit 507fe8788f
9 changed files with 123 additions and 104 deletions

View File

@ -100,7 +100,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图+选项 */}
@ -120,8 +119,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>

View File

@ -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>}
{/* 已报名,报名信息 */}

View File

@ -0,0 +1,33 @@
import React from "react";
import chatSvg from "../image/chat.svg";
import btn from "../image/btn-right.png";
import './index.scss';
import '../../index.scss';
function Chat({ form, showNotification, match, history }) {
return (
<div className="chat qz_main clearfix">
<img className="chat-left" src={chatSvg} ></img>
<div className="chat-words">
<div className="chat-tit">交流互动</div>
<div className="chat-content">
<p>集萃群智体会</p>
<p>与论坛成员交流比赛经验分享参赛心得</p>
<p>汇聚赛事资讯</p>
<p>助您第一时间解读竞赛动态把握赛事脉搏</p>
</div>
<div className="chat-btn" onClick={()=>{window.open('https://fc.osredm.com/forums/theme/105')}}>
<span className="detail1">了解详情</span>
<img
className="iconPlay1"
src={btn}
/>
</div>
</div>
</div>
)
}
export default Chat;

View File

@ -0,0 +1,62 @@
.chat {
margin: 9rem auto;
padding: 0 1.5rem;
background: #fff;
.chat-left {
float: left;
position: relative;
top: -5rem;
width: 56.6%;
box-shadow: 0px 3px 8px rgba(219, 227, 255, 0.7) inset;
margin-bottom: -3.5rem;
padding: 1.25rem;
}
.chat-words {
display: inline-block;
padding: 1.5rem;
}
.chat-tit {
display: inline-block;
font-weight: 700;
color: #2e3341;
font-size: 1.25rem;
line-height: 1rem;
&::after {
content: "";
display: inline-block;
width: 100%;
height: 1px;
background-color: #2e5bfe;
}
}
.chat-conten {
font-size: 1rem;
line-height: 1.625rem;
}
.chat-btn {
margin-top:1.5rem;
width: 9.5rem;
height: 2.5rem;
display: flex;
justify-content: space-between;
align-items: center;
border: 2px solid #2e5bfe;
background-color: #2e5bfe;
cursor: pointer;
}
.detail1 {
white-space: nowrap;
color: #ffffff;
font-size: 1rem;
font-weight: 400;
margin-left:1em;
}
.iconPlay1 {
height: 100%;
}
}

View File

@ -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>

View File

@ -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;
}
}

View File

@ -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;

View File

@ -49,11 +49,15 @@ function Introduce({ form, showNotification, match, history, enrollStatus }) {
//
function beforeUpload(file){
const isLt100M = file.size / 1024 / 1024 < 256;
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(`文件大小必须小于${256}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>

View File

@ -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;
}
}