增加竞赛开始接口
This commit is contained in:
parent
c60127798c
commit
41e46a983e
@ -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'
|
||||
});
|
||||
}
|
||||
|
@ -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) {
|
||||
this.$router.push({path: '/contest/detail', query:{paperId:this.paperId, 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' };
|
||||
|
Loading…
Reference in New Issue
Block a user