diff --git a/src/military/expert/api.js b/src/military/expert/api.js index d6a8fe6d..f773301f 100644 --- a/src/military/expert/api.js +++ b/src/military/expert/api.js @@ -98,6 +98,14 @@ export function getCompetition(id) { }); } +// 获取竞赛详情接口 +export function getCompetitionDetail(id) { + return fetch({ + url: `${main_web_site_url}/api/v1/competitions/${id}`, + method: 'get', + }); +} + // 查看竞赛/任务的评分细则 export function getScoringDetails(params) { return fetch({ diff --git a/src/military/expert/reviewResult/index.jsx b/src/military/expert/reviewResult/index.jsx index 684d3d54..7aa7e084 100644 --- a/src/military/expert/reviewResult/index.jsx +++ b/src/military/expert/reviewResult/index.jsx @@ -2,8 +2,9 @@ import React, { useEffect, useState } from "react"; import Link from "react-router-dom/Link"; import PaginationTable from "src/military/components/paginationTable"; import GradesModal from "./gradesModal"; -import { getFinalScoreRankingList, getWinnersAndPublicists, selectWinnersAndPublicists } from "../api"; -import { Checkbox, Input, message, Modal } from "antd"; +import { getCompetitionDetail, getFinalScoreRankingList, getWinnersAndPublicists, selectWinnersAndPublicists } from "../api"; +import { getTaskDetail } from "src/military/task/api"; +import { Checkbox, Input, message, Modal, Spin } from "antd"; import sucess from './image/sucess.svg'; import './index.scss'; import '../index.scss'; @@ -21,6 +22,7 @@ function ReviewResult({ history, match, mygetHelmetapi}) { const [errorMessage,setErrorMessage] = useState(); const [result, setResult] = useState(undefined); const [goNum, setGoNum] = useState(-1); + const [loading, setLoading] = useState(false); // 模态框 const [opsDetail, setOpsDetail] = useState(undefined); @@ -93,6 +95,35 @@ function ReviewResult({ history, match, mygetHelmetapi}) { }) },[status]) + //监听status, name, taskModeId 的变化,如果其中任意一个没有值都去请求任务详情接口获取其数据 + useEffect(()=>{ + const bool = status && name && taskModeId; + if(containerType == 1 && !bool){ + setLoading(true); + //创客任务 + containerId && getTaskDetail(containerId).then(response=>{ + if(response){ + window.location.href=`${window.location.href}#status=${response.status}&name=${response.name}&taskModeId=${response.taskModeId}`; + } + }).finally(()=>{ + setLoading(false); + }) + } + + const competitionBool = status && name && identifier; + if(containerType == 2 && !competitionBool){ + setLoading(true); + //竞赛 + containerId && getCompetitionDetail(containerId).then(response=>{ + if(response && response.message == "success"){ + window.location.href=`${window.location.href}#status=${response.data.current_status}&identifier=${response.data.identifier}&name=${response.data.title}`; + } + }).finally(()=>{ + setLoading(false); + }) + } + },[status, name, taskModeId, identifier]) + function detail(item){ setOpsDetail(item); setVisible(true); @@ -151,53 +182,55 @@ function ReviewResult({ history, match, mygetHelmetapi}) { }) } return ( -
{containerType ==1 ? '任务':'竞赛'}名称{decodeURI(name)}
-- {containerType ==1 ? '任务':'竞赛'}链接 - {containerType == 1 && {`${window.location.origin}/task/taskDetail/${containerId}`}} - {containerType == 2 && {`${main_web_site_url}/competitions/${identifier}/home`}} -
-应征者排名
-{errorMessage || "若未填写此排名,则公示所有名次"}
- +{containerType ==1 ? '任务':'竞赛'}名称{decodeURI(name)}
++ {containerType ==1 ? '任务':'竞赛'}链接 + {containerType == 1 && {`${window.location.origin}/task/taskDetail/${containerId}`}} + {containerType == 2 && {`${main_web_site_url}/competitions/${identifier}/home`}} +
+应征者排名
+{errorMessage || "若未填写此排名,则公示所有名次"}
+