增加竞赛开始接口

This commit is contained in:
joylink_zhaoerwei 2024-03-04 12:15:57 +08:00
parent c60127798c
commit 41e46a983e
2 changed files with 25 additions and 6 deletions

View File

@ -329,3 +329,22 @@ export function getTaskTree(paperId, moduleId) {
method: 'get'
});
}
/**
* @param {String} paperId 试卷id
* @param {String} moduleId 模块id
*/
export function beginContestExercise(paperId, moduleId) {
return request({
url: `/api/race/${paperId}/${moduleId}`,
method: 'POST'
});
}
/** 竞赛完成训练 */
export function finishContestExercise() {
return request({
url: '/api/race/finish',
method: 'PUT'
});
}

View File

@ -45,7 +45,7 @@
import paperList from './paperList';
import drapLeft from '@/views/components/drapLeft/index';
import ScoreRule from './scoreRule';
import { getPaperDetail, getContextScoreDetail} from '@/api/contest';
import { getPaperDetail, getContextScoreDetail, beginContestExercise} from '@/api/contest';
let id = 1;
export default {
@ -64,7 +64,6 @@ export default {
moduleList:[],
moduleTreeDatas:[],
taskTreeDatas:[],
ruleData:[],
defaultProps: {
disabled: true
}
@ -100,9 +99,6 @@ export default {
};
});
this.taskTreeDatas = this.moduleTreeDatas[0].children;
getContextScoreDetail(this.moduleTreeDatas[0].moduleScoreRuleId).then(res => {
this.ruleData = res.data.rule ? res.data.rule.units : [];
}).catch(() => { this.ruleData = []; });
}).catch(error => {
this.$message.error(error.message);
});
@ -111,7 +107,11 @@ export default {
this.$refs.scoreRule.doShow(moduleScoreRuleId);
},
beginExercise(moduleId) {
beginContestExercise(this.paperId, moduleId).then(res => {
this.$router.push({path: '/contest/detail', query:{paperId:this.paperId, moduleId }});
}).catch(error => {
this.$message.error(error.message);
});
},
transformTree(data) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };