forked from Gitlink/forgeplus-react
我的评审任务接入竞赛
This commit is contained in:
parent
8386e95676
commit
fdc9d9432e
|
@ -1,4 +1,4 @@
|
|||
import fetch from './fetch';
|
||||
import fetch,{main_web_site_url} from './fetch';
|
||||
import { notification } from 'antd';
|
||||
|
||||
// 专家列表查询
|
||||
|
@ -90,6 +90,14 @@ export function getExpertTasks(params) {
|
|||
});
|
||||
}
|
||||
|
||||
// 获取竞赛作品列表
|
||||
export function getCompetition(id) {
|
||||
return fetch({
|
||||
url: `${main_web_site_url}/api/v1/competitions/${id}/works`,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 查看竞赛/任务的评分细则
|
||||
export function getScoringDetails(params) {
|
||||
return fetch({
|
||||
|
|
|
@ -4,9 +4,9 @@ import { Link } from "react-router-dom";
|
|||
import Paginationtable from "../../../components/paginationTable";
|
||||
import { Info, Confirm } from '../../../components/ModalFun';
|
||||
import WordsInput from 'military/expert/components/wordsInput';
|
||||
import { getScoringDetails, initScoringDetails, getRules, updateScoringDetails } from "../../api";
|
||||
import { getScoringDetails, initScoringDetails, getRules, updateScoringDetails, getCompetition } from "../../api";
|
||||
import { readyCheckPapers } from "../../../task/api";
|
||||
import { httpUrl } from '../../fetch';
|
||||
import { httpUrl, main_web_site_url } from '../../fetch';
|
||||
|
||||
import './index.scss';
|
||||
import '../../index.scss';
|
||||
|
@ -22,7 +22,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
const [dataList, setDataList] = useState([]);
|
||||
|
||||
const [taskId, setTaskId] = useState();
|
||||
const [competitionId, setCompetitionId] = useState(461);
|
||||
const [competitionId, setCompetitionId] = useState();
|
||||
|
||||
// 评分规则
|
||||
const [rules, setRules] = useState({});
|
||||
|
@ -61,8 +61,9 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
className: 'text-tooltip',
|
||||
render: (text, record) => {
|
||||
return text && text.map(item => {
|
||||
return <Tooltip key={item.id} overlayClassName="expert-tooltip" title={item.fileName} placement="top">
|
||||
<p className="link" onClick={() => { downFile(item.id) }}>{item.fileName}</p>
|
||||
return <Tooltip key={item.id} overlayClassName="expert-tooltip" title={item.fileName} placement="top">
|
||||
<p className="link" onClick={() => { downFile(item) }}>{item.fileName}</p>
|
||||
{/* <a className="link" href={main_web_site_url + item.fileDownPath} download={item.fileName}>{item.fileName}</a> */}
|
||||
</Tooltip>
|
||||
})
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
return <Tooltip overlayClassName="expert-tooltip" title={text} placement="top">
|
||||
<a className="link" onClick={() => { writeComments(text, index, 'comments') }}>{record.status === 2 ? text ? '编辑' : '填写' : '查看'}意见</a>
|
||||
</Tooltip>
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -204,9 +205,55 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
});
|
||||
}, [taskId, disabled, current_user.expertId]);
|
||||
|
||||
function downFile(id) {
|
||||
let url = httpUrl + '/busiAttachments/download/' + id;
|
||||
window.open(url);
|
||||
// 获取竞赛作品列表
|
||||
useEffect(() => {
|
||||
// 没有数据才能去查作品列表,并展示数据
|
||||
!dataList.length && competitionId && current_user.expertId && getCompetition(competitionId).then(res => {
|
||||
let dataArr = [];
|
||||
if (res && Array.isArray(res.data)) {
|
||||
for (const item of res.data) {
|
||||
let fileId = item.work_attachments && item.work_attachments.split('?')[0].split('/')[3];
|
||||
console.log(fileId);
|
||||
dataArr.push({
|
||||
comments: "",
|
||||
expertId: current_user.expertId,
|
||||
gradesAverage: '',
|
||||
gradesFive: '',
|
||||
gradesFour: '',
|
||||
gradesOne: '',
|
||||
gradesThree: '',
|
||||
gradesTwo: '',
|
||||
opsContent: item.works_remark,
|
||||
opsFiles: fileId,
|
||||
opsFilesAttachments: item.work_attachments ? [{ id: fileId, fileName: '作品下载', fileDownPath: item.work_attachments }] : [],
|
||||
opsId: item.id,
|
||||
opsParentId: containerId,
|
||||
opsParentType: containerType,
|
||||
opsType: containerType,
|
||||
status: 2
|
||||
});
|
||||
}
|
||||
}
|
||||
setDataList(dataArr);
|
||||
disabled && setLoading(false);
|
||||
!disabled && dataArr.length && rules && initScoringDetails(dataArr).then(res => {
|
||||
if (res) {
|
||||
setReload(Math.random());
|
||||
setLoading(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, [competitionId, disabled, current_user.expertId]);
|
||||
|
||||
|
||||
function downFile(item) {
|
||||
if (containerType == 1) {
|
||||
let url = httpUrl + '/busiAttachments/download/' + item.id;
|
||||
window.open(url);
|
||||
} else {
|
||||
let url = main_web_site_url + item.fileDownPath;
|
||||
window.open(url);
|
||||
}
|
||||
}
|
||||
|
||||
function editGrade(value, index, dataIndex) {
|
||||
|
@ -329,9 +376,9 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
typeof item.gradesFour === 'number' && gradesArr.push(item.gradesFour);
|
||||
typeof item.gradesFive === 'number' && gradesArr.push(item.gradesFive);
|
||||
if (gradesArr.length < gradesNum && gradesArr.length) {
|
||||
errorArr.push(index+1);
|
||||
errorArr.push(index + 1);
|
||||
} else if (!item.comments && gradesArr.length) {
|
||||
commentsError.push(index+1);
|
||||
commentsError.push(index + 1);
|
||||
} else if (gradesArr.length) {
|
||||
scoringArr.push(index);
|
||||
}
|
||||
|
@ -378,7 +425,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
return (
|
||||
<div className='register_right task_detail'>
|
||||
<p className="task-head">
|
||||
创客成果评审
|
||||
{containerType == 1 ? '创客成果' : '竞赛作品'}评审
|
||||
<button className="back-button but41_border" onClick={() => { history.goBack() }}>返回上一页</button>
|
||||
</p>
|
||||
|
||||
|
@ -387,14 +434,20 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
<TabPane tab="评审信息" key="0">
|
||||
<div className="task-rules">
|
||||
<div className="rules-box">
|
||||
<p className="rules-head">任务信息</p>
|
||||
<p className="rules-head">{containerType == 1 ? '任务信息' : '赛事信息'}</p>
|
||||
<div className="rules-content">
|
||||
<div className="rules-content-item"><span className="font-w">任务名称</span><span className="ml10">{rules.containerName}</span></div>
|
||||
<div className="rules-content-item"><span className="font-w">任务链接</span><Link className="taskLink ml10" target="_blank" to={`/task/taskDetail/${rules.containerId}`} >{`${window.location.origin}/task/taskDetail/${rules.containerId}`}</Link></div>
|
||||
<div className="rules-content-item">
|
||||
<span className="font-w">{containerType == 1 ? '任务' : '赛事'}名称</span>
|
||||
<span className="ml10">{rules.containerName}</span>
|
||||
</div>
|
||||
<div className="rules-content-item">
|
||||
<span className="font-w">{containerType == 1 ? '任务' : '赛事'}链接</span>
|
||||
{containerType == 1 && <Link className="taskLink ml10" target="_blank" to={`/task/taskDetail/${rules.containerId}`} >{`${window.location.origin}/task/taskDetail/${rules.containerId}`}</Link>}
|
||||
{containerType == 2 && <Link className="taskLink ml10" target="_blank" to={`${main_web_site_url}/competitions/${rules.containerId}/home`} >{`${main_web_site_url}/competitions/${rules.containerId}/home`}</Link>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="rules-box">
|
||||
<p className="rules-head">评审规则</p>
|
||||
<div className="rules-content">{rules.rule}</div>
|
||||
|
|
|
@ -7,4 +7,5 @@ let actionUrl = settings.api_urls && settings.api_urls.expert ? settings.api_url
|
|||
// http://117.50.100.12:8067/
|
||||
const service = javaFetch(actionUrl);
|
||||
export const httpUrl = actionUrl;
|
||||
export const main_web_site_url=settings.main_web_site_url;
|
||||
export default service;
|
|
@ -41,10 +41,10 @@ class http500 extends Component {
|
|||
<p className="font-18 mt40">
|
||||
您可以稍后尝试 <a href="/"
|
||||
className="color-blue">返回首页</a>
|
||||
,或者
|
||||
{/* ,或者
|
||||
<a target="_blank"
|
||||
href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd"
|
||||
className="color-blue">QQ反馈>></a>
|
||||
className="color-blue">QQ反馈>></a> */}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue