修改跳转路由

This commit is contained in:
何童崇 2022-05-13 17:21:21 +08:00
parent 018244c368
commit 2d54110047
4 changed files with 8 additions and 7 deletions

View File

@ -25,7 +25,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'a' : parsed.debug || 'admin'
window.location.search.indexOf('debug=a') !== -1 ? 'a' : parsed.debug || 'a'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {

View File

@ -82,10 +82,10 @@ const Qz2022 = (props) => {
const menu = (
<Menu>
<Menu.Item>
<Link to={{ pathname: current_user && current_user.login ? `/competition/qz2022/management/applys` : '' }} onClick={() => { current_user && !current_user.login && props.showLoginDialog() }}>报名列表</Link>
<Link to={{ pathname: current_user && current_user.login ? `/competition/${competitionId}/management/applys` : '' }} onClick={() => { current_user && !current_user.login && props.showLoginDialog() }}>报名列表</Link>
</Menu.Item>
<Menu.Item>
<Link to={{ pathname: current_user && current_user.login ? `/competition/qz2022/management/production` : '' }} onClick={() => { current_user && !current_user.login && props.showLoginDialog() }}>作品列表</Link>
<Link to={{ pathname: current_user && current_user.login ? `/competition/${competitionId}/management/production` : '' }} onClick={() => { current_user && !current_user.login && props.showLoginDialog() }}>作品列表</Link>
</Menu.Item>
</Menu>
);

View File

@ -21,8 +21,8 @@ export async function enrollUpdate(data){
}
// 统计启智2022 竞赛
export async function stattistics(data){
return axios.get( `/competition_infos/qz2022/statistics.json`);
export async function stattistics(competitionId){
return axios.get( `/competition_infos/${competitionId}/statistics.json`);
}
// 竞赛提交作品

View File

@ -12,7 +12,8 @@ import EchartBar from './EchartBar';
const initBarYData = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
function Statistics({ showNotification, qzDetail }) {
function Statistics({ showNotification, qzDetail,match }) {
const {competitionId}=match.params;
const is_local= qzDetail &&qzDetail.is_local;
const [pieArr, setPieArr] = useState([]);
@ -24,7 +25,7 @@ function Statistics({ showNotification, qzDetail }) {
useEffect(() => {
stattistics().then(res => {
stattistics(competitionId).then(res => {
if (res && res.data && Array.isArray(res.data.data)) {
let pieArrList = [];
let xData = [];