diff --git a/src/military/expert/api.js b/src/military/expert/api.js index 048da61a..30448ac9 100644 --- a/src/military/expert/api.js +++ b/src/military/expert/api.js @@ -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({ diff --git a/src/military/expert/expertUser/taskDetail/index.jsx b/src/military/expert/expertUser/taskDetail/index.jsx index cbfe59bb..e2229491 100644 --- a/src/military/expert/expertUser/taskDetail/index.jsx +++ b/src/military/expert/expertUser/taskDetail/index.jsx @@ -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 -

{ downFile(item.id) }}>{item.fileName}

+ return +

{ downFile(item) }}>{item.fileName}

+ {/* {item.fileName} */}
}) } @@ -83,7 +84,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) { return { writeComments(text, index, 'comments') }}>{record.status === 2 ? text ? '编辑' : '填写' : '查看'}意见 - + } }, ]; @@ -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 (

- 创客成果评审 + {containerType == 1 ? '创客成果' : '竞赛作品'}评审

@@ -387,14 +434,20 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
-

任务信息

+

{containerType == 1 ? '任务信息' : '赛事信息'}

-
任务名称{rules.containerName}
-
任务链接{`${window.location.origin}/task/taskDetail/${rules.containerId}`}
+
+ {containerType == 1 ? '任务' : '赛事'}名称 + {rules.containerName} +
+
+ {containerType == 1 ? '任务' : '赛事'}链接 + {containerType == 1 && {`${window.location.origin}/task/taskDetail/${rules.containerId}`}} + {containerType == 2 && {`${main_web_site_url}/competitions/${rules.containerId}/home`}} +
-

评审规则

{rules.rule}
diff --git a/src/military/expert/fetch.js b/src/military/expert/fetch.js index 2797e2a6..09a9cfed 100644 --- a/src/military/expert/fetch.js +++ b/src/military/expert/fetch.js @@ -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; \ No newline at end of file diff --git a/src/modules/404/Shixunnopage.js b/src/modules/404/Shixunnopage.js index 5b59b472..c530bc6d 100644 --- a/src/modules/404/Shixunnopage.js +++ b/src/modules/404/Shixunnopage.js @@ -41,10 +41,10 @@ class http500 extends Component {

您可以稍后尝试 返回首页 - ,或者  + {/* ,或者  QQ反馈>> + className="color-blue">QQ反馈>> */}

}