|
|
@ -41,17 +41,17 @@ const styles = MUIDialogStyleUtil.getTwoButtonStyle()
|
|
|
|
// 主题自定义
|
|
|
|
// 主题自定义
|
|
|
|
const theme = createMuiTheme({
|
|
|
|
const theme = createMuiTheme({
|
|
|
|
palette: {
|
|
|
|
palette: {
|
|
|
|
primary: {
|
|
|
|
primary: {
|
|
|
|
main: '#4CACFF',
|
|
|
|
main: '#4CACFF',
|
|
|
|
contrastText: 'rgba(255, 255, 255, 0.87)'
|
|
|
|
contrastText: 'rgba(255, 255, 255, 0.87)'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
secondary: { main: '#4CACFF' }, // This is just green.A700 as hex.
|
|
|
|
secondary: { main: '#4CACFF' }, // This is just green.A700 as hex.
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const testSetsExpandedArrayInitVal = [false, false, false, false, false,
|
|
|
|
const testSetsExpandedArrayInitVal = [false, false, false, false, false,
|
|
|
|
false, false, false, false, false,
|
|
|
|
false, false, false, false, false,
|
|
|
|
false, false, false, false, false,
|
|
|
|
false, false, false, false, false,
|
|
|
|
false, false, false, false, false]
|
|
|
|
false, false, false, false, false]
|
|
|
|
window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider?
|
|
|
|
window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider?
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +70,7 @@ class TPIContextProvider extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
this.readGameAnswer = this.readGameAnswer.bind(this)
|
|
|
|
this.readGameAnswer = this.readGameAnswer.bind(this)
|
|
|
|
this.praisePlus = this.praisePlus.bind(this)
|
|
|
|
this.praisePlus = this.praisePlus.bind(this)
|
|
|
|
|
|
|
|
|
|
|
|
this.onGamePassed = this.onGamePassed.bind(this)
|
|
|
|
this.onGamePassed = this.onGamePassed.bind(this)
|
|
|
|
|
|
|
|
|
|
|
|
this.onPathChange = this.onPathChange.bind(this)
|
|
|
|
this.onPathChange = this.onPathChange.bind(this)
|
|
|
@ -80,7 +80,7 @@ class TPIContextProvider extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
this.onShowUpdateDialog = this.onShowUpdateDialog.bind(this)
|
|
|
|
this.onShowUpdateDialog = this.onShowUpdateDialog.bind(this)
|
|
|
|
this.updateDialogClose = this.updateDialogClose.bind(this)
|
|
|
|
this.updateDialogClose = this.updateDialogClose.bind(this)
|
|
|
|
|
|
|
|
|
|
|
|
// this.showEffectDisplay();
|
|
|
|
// this.showEffectDisplay();
|
|
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
@ -142,7 +142,7 @@ class TPIContextProvider extends Component {
|
|
|
|
// request
|
|
|
|
// request
|
|
|
|
// var shixunId = this.props.match.params.shixunId;
|
|
|
|
// var shixunId = this.props.match.params.shixunId;
|
|
|
|
var stageId = this.props.match.params.stageId;
|
|
|
|
var stageId = this.props.match.params.stageId;
|
|
|
|
|
|
|
|
|
|
|
|
window.__fetchAllFlag = false;
|
|
|
|
window.__fetchAllFlag = false;
|
|
|
|
this.fetchAll(stageId);
|
|
|
|
this.fetchAll(stageId);
|
|
|
|
this.costTimeInterval = window.setInterval(()=> {
|
|
|
|
this.costTimeInterval = window.setInterval(()=> {
|
|
|
@ -192,7 +192,7 @@ class TPIContextProvider extends Component {
|
|
|
|
onGamePassed(passed) {
|
|
|
|
onGamePassed(passed) {
|
|
|
|
const { game } = this.state
|
|
|
|
const { game } = this.state
|
|
|
|
// 随便给个分,以免重新评测时又出现评星组件(注意:目前game.star没有显示在界面上,如果有则不能这么做)
|
|
|
|
// 随便给个分,以免重新评测时又出现评星组件(注意:目前game.star没有显示在界面上,如果有则不能这么做)
|
|
|
|
// game.star = 6;
|
|
|
|
// game.star = 6;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
game: update(game, {star: { $set: 6 }}),
|
|
|
|
game: update(game, {star: { $set: 6 }}),
|
|
|
|
currentGamePassed: !!passed
|
|
|
|
currentGamePassed: !!passed
|
|
|
@ -253,14 +253,14 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
const { praise_count, praise } = response.data;
|
|
|
|
const { praise_count, praise } = response.data;
|
|
|
|
// challenge.praise_count = praise_tread_count;
|
|
|
|
// challenge.praise_count = praise_tread_count;
|
|
|
|
// challenge.user_praise = praise;
|
|
|
|
// challenge.user_praise = praise;
|
|
|
|
this.setState({ challenge: update(challenge,
|
|
|
|
this.setState({ challenge: update(challenge,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
praise_count: { $set: praise_count },
|
|
|
|
praise_count: { $set: praise_count },
|
|
|
|
user_praise: { $set: praise },
|
|
|
|
user_praise: { $set: praise },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
@ -286,11 +286,11 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const { myshixun } = this.state;
|
|
|
|
const { myshixun } = this.state;
|
|
|
|
// myshixun.system_tip = false;
|
|
|
|
// myshixun.system_tip = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
challenge.path = path;
|
|
|
|
challenge.path = path;
|
|
|
|
const newChallenge = this.handleChallengePath(challenge);
|
|
|
|
const newChallenge = this.handleChallengePath(challenge);
|
|
|
|
this.setState({ challenge: newChallenge,
|
|
|
|
this.setState({ challenge: newChallenge,
|
|
|
|
myshixun: update(myshixun, {system_tip: { $set: false }}),
|
|
|
|
myshixun: update(myshixun, {system_tip: { $set: false }}),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -313,7 +313,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
|
|
newResData2OldResData(newResData) {
|
|
|
|
newResData2OldResData(newResData) {
|
|
|
|
newResData.latest_output = newResData.last_compile_output
|
|
|
|
newResData.latest_output = newResData.last_compile_output
|
|
|
|
// newResData.power
|
|
|
|
// newResData.power
|
|
|
|
newResData.record = newResData.record_onsume_time
|
|
|
|
newResData.record = newResData.record_onsume_time
|
|
|
|
|
|
|
|
|
|
|
|
// 老版用的hide_code
|
|
|
|
// 老版用的hide_code
|
|
|
@ -329,7 +329,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
newResData.output_sets.test_sets = newResData.test_sets // JSON.stringify()
|
|
|
|
newResData.output_sets.test_sets = newResData.test_sets // JSON.stringify()
|
|
|
|
newResData.output_sets.test_sets_count = newResData.test_sets_count
|
|
|
|
newResData.output_sets.test_sets_count = newResData.test_sets_count
|
|
|
|
// newResData.output_sets.had_passed_testsests_error_count = newResData.sets_error_count
|
|
|
|
// newResData.output_sets.had_passed_testsests_error_count = newResData.sets_error_count
|
|
|
|
newResData.output_sets.had_passed_testsests_error_count = newResData.test_sets_count
|
|
|
|
newResData.output_sets.had_passed_testsests_error_count = newResData.test_sets_count
|
|
|
|
- newResData.sets_error_count
|
|
|
|
- newResData.sets_error_count
|
|
|
|
// allowed_hidden_testset
|
|
|
|
// allowed_hidden_testset
|
|
|
|
// sets_error_count
|
|
|
|
// sets_error_count
|
|
|
@ -354,8 +354,8 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
let output_sets = resData.output_sets;
|
|
|
|
let output_sets = resData.output_sets;
|
|
|
|
if (resData.st === 0) { // 代码题
|
|
|
|
if (resData.st === 0) { // 代码题
|
|
|
|
challenge = this.handleChallengePath(challenge)
|
|
|
|
challenge = this.handleChallengePath(challenge)
|
|
|
|
|
|
|
|
|
|
|
|
const mirror_name = (resData.mirror_name && resData.mirror_name.join)
|
|
|
|
const mirror_name = (resData.mirror_name && resData.mirror_name.join)
|
|
|
|
? resData.mirror_name.join(';') : (resData.mirror_name || '');
|
|
|
|
? resData.mirror_name.join(';') : (resData.mirror_name || '');
|
|
|
|
if (mirror_name.indexOf('Html') !== -1) {
|
|
|
|
if (mirror_name.indexOf('Html') !== -1) {
|
|
|
|
challenge.isHtml = true;
|
|
|
|
challenge.isHtml = true;
|
|
|
@ -364,7 +364,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
challenge.isWeb = true;
|
|
|
|
challenge.isWeb = true;
|
|
|
|
} else if (mirror_name.indexOf('Android') !== -1) {
|
|
|
|
} else if (mirror_name.indexOf('Android') !== -1) {
|
|
|
|
challenge.isAndroid = true;
|
|
|
|
challenge.isAndroid = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (output_sets && output_sets.test_sets && typeof output_sets.test_sets == 'string') {
|
|
|
|
if (output_sets && output_sets.test_sets && typeof output_sets.test_sets == 'string') {
|
|
|
|
const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
|
|
|
|
const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
|
|
|
@ -378,7 +378,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
const $ = window.$
|
|
|
|
const $ = window.$
|
|
|
|
window.setTimeout(()=>{
|
|
|
|
window.setTimeout(()=>{
|
|
|
|
var lens = $("#choiceRepositoryView textarea").length;
|
|
|
|
var lens = $("#choiceRepositoryView textarea").length;
|
|
|
|
|
|
|
|
|
|
|
|
for(var i = 1; i <= lens; i++){
|
|
|
|
for(var i = 1; i <= lens; i++){
|
|
|
|
window.editormd.markdownToHTML("choose_subject_" + i, {
|
|
|
|
window.editormd.markdownToHTML("choose_subject_" + i, {
|
|
|
|
htmlDecode: "style,script,iframe", // you can filter tags decode
|
|
|
|
htmlDecode: "style,script,iframe", // you can filter tags decode
|
|
|
@ -404,14 +404,14 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
game.isPassThrough = true
|
|
|
|
game.isPassThrough = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resData.game = game;
|
|
|
|
resData.game = game;
|
|
|
|
|
|
|
|
|
|
|
|
const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData;
|
|
|
|
const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData;
|
|
|
|
if (myshixun.system_tip) {
|
|
|
|
if (myshixun.system_tip) {
|
|
|
|
// system_tip为true的时候 不弹框提示用户更新
|
|
|
|
// system_tip为true的时候 不弹框提示用户更新
|
|
|
|
resData.showUpdateDialog = false
|
|
|
|
resData.showUpdateDialog = false
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
let needUpdateScript = (tpm_modified || tpm_script_modified) && challenge.st === 0;
|
|
|
|
let needUpdateScript = (tpm_modified || tpm_script_modified) && challenge.st === 0;
|
|
|
|
resData.showUpdateDialog = needUpdateScript || tpm_cases_modified
|
|
|
|
resData.showUpdateDialog = needUpdateScript || tpm_cases_modified
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -458,7 +458,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
// const EDU_NORMAL = 7 // 普通用户
|
|
|
|
// const EDU_NORMAL = 7 // 普通用户
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
EDU_ADMIN = 1 # 超级管理员
|
|
|
|
EDU_ADMIN = 1 # 超级管理员
|
|
|
|
EDU_BUSINESS = 2 # 运营人员
|
|
|
|
EDU_BUSINESS = 2 # 运营人员
|
|
|
|
EDU_SHIXUN_MANAGER = 3 # 实训管理员
|
|
|
|
EDU_SHIXUN_MANAGER = 3 # 实训管理员
|
|
|
@ -467,7 +467,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
EDU_GAME_MANAGER = 6 # TPI的创建者
|
|
|
|
EDU_GAME_MANAGER = 6 # TPI的创建者
|
|
|
|
EDU_TEACHER = 7 # 平台老师,但是未认证
|
|
|
|
EDU_TEACHER = 7 # 平台老师,但是未认证
|
|
|
|
EDU_NORMAL = 8 # 普通用户
|
|
|
|
EDU_NORMAL = 8 # 普通用户
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// myshixun_manager power is_teacher
|
|
|
|
// myshixun_manager power is_teacher
|
|
|
|
resData.power = 0
|
|
|
|
resData.power = 0
|
|
|
@ -495,8 +495,8 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
} else if (resData.user.identity === EDU_TEACHER) {
|
|
|
|
} else if (resData.user.identity === EDU_TEACHER) {
|
|
|
|
// resData.is_teacher = true
|
|
|
|
// resData.is_teacher = true
|
|
|
|
} else if (resData.user.identity === EDU_NORMAL) {
|
|
|
|
} else if (resData.user.identity === EDU_NORMAL) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resData
|
|
|
|
return resData
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -524,7 +524,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
loading: true,
|
|
|
|
loading: true,
|
|
|
|
currentGamePassed: false, // 切换game时重置passed字段
|
|
|
|
currentGamePassed: false, // 切换game时重置passed字段
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// test
|
|
|
|
// test
|
|
|
|
// var data = {"st":0,"discusses_count":0,"game_count":3,"record_onsume_time":0.36,"prev_game":null,"next_game":"7p9xwo2hklqv","praise_count":0,"user_praise":false,"time_limit":20,"tomcat_url":"http://47.96.157.89","is_teacher":false,"myshixun_manager":true,"game":{"id":2192828,"myshixun_id":580911,"user_id":57844,"created_at":"2019-09-03T15:50:49.000+08:00","updated_at":"2019-09-03T15:51:05.000+08:00","status":2,"final_score":0,"challenge_id":10010,"open_time":"2019-09-03T15:50:49.000+08:00","identifier":"hknvz4oaw825","answer_open":0,"end_time":"2019-09-03T15:51:04.000+08:00","retry_status":0,"resubmit_identifier":null,"test_sets_view":false,"picture_path":null,"accuracy":1.0,"modify_time":"2019-09-03T15:23:33.000+08:00","star":0,"cost_time":14,"evaluate_count":1,"answer_deduction":0},"challenge":{"id":10010,"shixun_id":3516,"subject":"1.1 列表操作","position":1,"task_pass":"[TOC]\n\n---\n\n####任务描述\n\n\n数据集a包含1-10共10个整数,请以a为输入数据,编写python程序,实现如下功能:\n①\t用2种方法输出a中所有奇数\n②\t输出大于3,小于7的偶数\n③\t用2种方法输出[1,2,3,…10,11,…20]\n④\t输出a的最大值、最小值。\n⑤\t用2种方法输出[10,9,…2,1]\n⑥\t输出[1,2,3,1,2,3,1,2,3,1,2,3]\n\n\n####相关知识\n\n\n请自行学习相关知识\n\n\n---\n开始你的任务吧,祝你成功!","score":100,"path":"1-1-stu.py","st":0,"web_route":null,"modify_time":"2019-09-03T15:23:33.000+08:00","exec_time":20,"praises_count":0},"shixun":{"id":3516,"name":"作业1——Python程序设计","user_id":77620,"gpid":null,"visits":23,"created_at":"2019-09-03T14:18:17.000+08:00","updated_at":"2019-09-03T15:58:16.000+08:00","status":0,"language":null,"authentication":false,"identifier":"6lzjig58","trainee":1,"major_id":null,"webssh":2,"homepage_show":false,"hidden":false,"fork_from":null,"can_copy":true,"modify_time":"2019-09-03T14:18:17.000+08:00","reset_time":"2019-09-03T14:18:17.000+08:00","publish_time":null,"closer_id":null,"end_time":null,"git_url":null,"vnc":null,"myshixuns_count":3,"challenges_count":3,"use_scope":0,"mirror_script_id":20,"image_text":null,"code_hidden":false,"task_pass":true,"exec_time":20,"test_set_permission":true,"sigle_training":false,"hide_code":false,"multi_webssh":false,"excute_time":null,"repo_name":"p09218567/6lzjig58","averge_star":5.0,"opening_time":null,"users_count":1,"forbid_copy":false,"pod_life":0},"myshixun":{"id":580911,"shixun_id":3516,"is_public":true,"user_id":57844,"gpid":null,"created_at":"2019-09-03T15:50:49.000+08:00","updated_at":"2019-09-03T15:59:04.000+08:00","status":0,"identifier":"k36hm4rwav","commit_id":"f25e1713882156480fc45ce0af57eff395a5037f","modify_time":"2019-09-03T14:18:17.000+08:00","reset_time":"2019-09-03T14:18:17.000+08:00","system_tip":false,"git_url":null,"onclick_time":"2019-09-03T15:50:49.000+08:00","repo_name":"p53276410/k36hm4rwav20190903155049"},"user":{"user_id":57844,"login":"p53276410","name":"文振乾","grade":24624,"identity":1,"image_url":"avatars/User/57844","school":"EduCoder团队"},"tpm_modified":true,"tpm_cases_modified":false,"mirror_name":["Python3.6"],"has_answer":false,"test_sets":[{"is_public":true,"result":true,"input":"","output":"result of a:\n[1, 3, 5, 7, 9]\n[1, 3, 5, 7, 9]\nresult of b:\n[2, 4, 6, 8, 10]\nresult of c:\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\nresult of d:\nThe minimum is:1\nThe maxium is:10\nresult of e:\n[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nresult of f:\n[10, 9, 8, 10, 9, 8, 10, 9, 8, 10, 9, 8]\n","actual_output":"result of a:\r\n[1, 3, 5, 7, 9]\r\n[1, 3, 5, 7, 9]\r\nresult of b:\r\n[2, 4, 6, 8, 10]\r\nresult of c:\r\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\r\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\r\nresult of d:\r\nThe minimum is:1\r\nThe maxium is:10\r\nresult of e:\r\n[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\r\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\r\nresult of f:\r\n[10, 9, 8, 10, 9, 8, 10, 9, 8, 10, 9, 8]\r\n","compile_success":1,"ts_time":0.05,"ts_mem":8.77}],"allowed_unlock":true,"last_compile_output":"compile successfully","test_sets_count":1,"sets_error_count":0}
|
|
|
|
// var data = {"st":0,"discusses_count":0,"game_count":3,"record_onsume_time":0.36,"prev_game":null,"next_game":"7p9xwo2hklqv","praise_count":0,"user_praise":false,"time_limit":20,"tomcat_url":"http://47.96.157.89","is_teacher":false,"myshixun_manager":true,"game":{"id":2192828,"myshixun_id":580911,"user_id":57844,"created_at":"2019-09-03T15:50:49.000+08:00","updated_at":"2019-09-03T15:51:05.000+08:00","status":2,"final_score":0,"challenge_id":10010,"open_time":"2019-09-03T15:50:49.000+08:00","identifier":"hknvz4oaw825","answer_open":0,"end_time":"2019-09-03T15:51:04.000+08:00","retry_status":0,"resubmit_identifier":null,"test_sets_view":false,"picture_path":null,"accuracy":1.0,"modify_time":"2019-09-03T15:23:33.000+08:00","star":0,"cost_time":14,"evaluate_count":1,"answer_deduction":0},"challenge":{"id":10010,"shixun_id":3516,"subject":"1.1 列表操作","position":1,"task_pass":"[TOC]\n\n---\n\n####任务描述\n\n\n数据集a包含1-10共10个整数,请以a为输入数据,编写python程序,实现如下功能:\n①\t用2种方法输出a中所有奇数\n②\t输出大于3,小于7的偶数\n③\t用2种方法输出[1,2,3,…10,11,…20]\n④\t输出a的最大值、最小值。\n⑤\t用2种方法输出[10,9,…2,1]\n⑥\t输出[1,2,3,1,2,3,1,2,3,1,2,3]\n\n\n####相关知识\n\n\n请自行学习相关知识\n\n\n---\n开始你的任务吧,祝你成功!","score":100,"path":"1-1-stu.py","st":0,"web_route":null,"modify_time":"2019-09-03T15:23:33.000+08:00","exec_time":20,"praises_count":0},"shixun":{"id":3516,"name":"作业1——Python程序设计","user_id":77620,"gpid":null,"visits":23,"created_at":"2019-09-03T14:18:17.000+08:00","updated_at":"2019-09-03T15:58:16.000+08:00","status":0,"language":null,"authentication":false,"identifier":"6lzjig58","trainee":1,"major_id":null,"webssh":2,"homepage_show":false,"hidden":false,"fork_from":null,"can_copy":true,"modify_time":"2019-09-03T14:18:17.000+08:00","reset_time":"2019-09-03T14:18:17.000+08:00","publish_time":null,"closer_id":null,"end_time":null,"git_url":null,"vnc":null,"myshixuns_count":3,"challenges_count":3,"use_scope":0,"mirror_script_id":20,"image_text":null,"code_hidden":false,"task_pass":true,"exec_time":20,"test_set_permission":true,"sigle_training":false,"hide_code":false,"multi_webssh":false,"excute_time":null,"repo_name":"p09218567/6lzjig58","averge_star":5.0,"opening_time":null,"users_count":1,"forbid_copy":false,"pod_life":0},"myshixun":{"id":580911,"shixun_id":3516,"is_public":true,"user_id":57844,"gpid":null,"created_at":"2019-09-03T15:50:49.000+08:00","updated_at":"2019-09-03T15:59:04.000+08:00","status":0,"identifier":"k36hm4rwav","commit_id":"f25e1713882156480fc45ce0af57eff395a5037f","modify_time":"2019-09-03T14:18:17.000+08:00","reset_time":"2019-09-03T14:18:17.000+08:00","system_tip":false,"git_url":null,"onclick_time":"2019-09-03T15:50:49.000+08:00","repo_name":"p53276410/k36hm4rwav20190903155049"},"user":{"user_id":57844,"login":"p53276410","name":"文振乾","grade":24624,"identity":1,"image_url":"avatars/User/57844","school":"EduCoder团队"},"tpm_modified":true,"tpm_cases_modified":false,"mirror_name":["Python3.6"],"has_answer":false,"test_sets":[{"is_public":true,"result":true,"input":"","output":"result of a:\n[1, 3, 5, 7, 9]\n[1, 3, 5, 7, 9]\nresult of b:\n[2, 4, 6, 8, 10]\nresult of c:\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\nresult of d:\nThe minimum is:1\nThe maxium is:10\nresult of e:\n[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nresult of f:\n[10, 9, 8, 10, 9, 8, 10, 9, 8, 10, 9, 8]\n","actual_output":"result of a:\r\n[1, 3, 5, 7, 9]\r\n[1, 3, 5, 7, 9]\r\nresult of b:\r\n[2, 4, 6, 8, 10]\r\nresult of c:\r\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\r\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\r\nresult of d:\r\nThe minimum is:1\r\nThe maxium is:10\r\nresult of e:\r\n[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\r\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\r\nresult of f:\r\n[10, 9, 8, 10, 9, 8, 10, 9, 8, 10, 9, 8]\r\n","compile_success":1,"ts_time":0.05,"ts_mem":8.77}],"allowed_unlock":true,"last_compile_output":"compile successfully","test_sets_count":1,"sets_error_count":0}
|
|
|
|
// data.test_sets[0].actual_output = data.test_sets[0].actual_output.replace(/\r\n/g, '\n')
|
|
|
|
// data.test_sets[0].actual_output = data.test_sets[0].actual_output.replace(/\r\n/g, '\n')
|
|
|
@ -534,7 +534,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
// data.vnc_url= "http://47.96.157.89:41158/vnc_lite.html?password=headless"
|
|
|
|
// data.vnc_url= "http://47.96.157.89:41158/vnc_lite.html?password=headless"
|
|
|
|
|
|
|
|
|
|
|
|
// this._handleResponseData(data)
|
|
|
|
// this._handleResponseData(data)
|
|
|
|
// return
|
|
|
|
// return
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(url, {
|
|
|
|
axios.get(url, {
|
|
|
|
// https://stackoverflow.com/questions/48861290/the-value-of-the-access-control-allow-origin-header-in-the-response-must-not-b
|
|
|
|
// https://stackoverflow.com/questions/48861290/the-value-of-the-access-control-allow-origin-header-in-the-response-must-not-b
|
|
|
@ -550,7 +550,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (response.data.status == 404) {
|
|
|
|
if (response.data.status == 404) {
|
|
|
|
// 如果第一次发生404,则隔1s后再调用一次本接口;(因为ucloud主从同步可能有延迟)
|
|
|
|
// 如果第一次发生404,则隔1s后再调用一次本接口;(因为ucloud主从同步可能有延迟)
|
|
|
|
if (!noTimeout) {
|
|
|
|
if (!noTimeout) {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.fetchAll(stageId, true)
|
|
|
|
this.fetchAll(stageId, true)
|
|
|
@ -562,12 +562,12 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this._handleResponseData(response.data)
|
|
|
|
this._handleResponseData(response.data)
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
readGameAnswer(resData) {
|
|
|
|
readGameAnswer(resData) {
|
|
|
@ -583,7 +583,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
grade: resData.grade
|
|
|
|
grade: resData.grade
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closeTaskResultLayer() {
|
|
|
|
closeTaskResultLayer() {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
@ -605,7 +605,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
|
|
currentGamePassed = true;
|
|
|
|
currentGamePassed = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._updateCostTime(true, true);
|
|
|
|
this._updateCostTime(true, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
@ -618,14 +618,14 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
currentPassedGameGainGold: gold,
|
|
|
|
currentPassedGameGainGold: gold,
|
|
|
|
currentPassedGameGainExperience: experience,
|
|
|
|
currentPassedGameGainExperience: experience,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
initDisplayInterval = () => {
|
|
|
|
initDisplayInterval = () => {
|
|
|
|
const challenge = this.state.challenge
|
|
|
|
const challenge = this.state.challenge
|
|
|
|
if (this.showWebDisplayButtonTimeout) {
|
|
|
|
if (this.showWebDisplayButtonTimeout) {
|
|
|
|
window.clearTimeout(this.showWebDisplayButtonTimeout)
|
|
|
|
window.clearTimeout(this.showWebDisplayButtonTimeout)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.showWebDisplayButtonTimeout = window.setTimeout(() => {
|
|
|
|
this.showWebDisplayButtonTimeout = window.setTimeout(() => {
|
|
|
|
this.setState({ challenge: update(challenge,
|
|
|
|
this.setState({ challenge: update(challenge,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
showWebDisplayButton: { $set: false },
|
|
|
|
showWebDisplayButton: { $set: false },
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -650,7 +650,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
this.displayInterval = null
|
|
|
|
this.displayInterval = null
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
remain -= 1;
|
|
|
|
remain -= 1;
|
|
|
|
}, 1000)
|
|
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -716,7 +716,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
|
|
const currentGamePassed = this.props.game !== 2 && status === 2
|
|
|
|
const currentGamePassed = this.props.game !== 2 && status === 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 评测通过了,立即同步costTime
|
|
|
|
// 评测通过了,立即同步costTime
|
|
|
|
currentGamePassed && this._updateCostTime(true, true);
|
|
|
|
currentGamePassed && this._updateCostTime(true, true);
|
|
|
@ -738,7 +738,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
// const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
|
|
|
|
// const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
|
|
|
|
// output_sets.test_sets_array = test_sets_array;
|
|
|
|
// output_sets.test_sets_array = test_sets_array;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否编译通过
|
|
|
|
// 检查是否编译通过
|
|
|
|
let compileSuccess = false;
|
|
|
|
let compileSuccess = false;
|
|
|
|
if (test_sets && test_sets.length) {
|
|
|
|
if (test_sets && test_sets.length) {
|
|
|
@ -754,7 +754,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
if (currentGamePassed) {
|
|
|
|
if (currentGamePassed) {
|
|
|
|
game.status = 2;
|
|
|
|
game.status = 2;
|
|
|
|
// game.isPassThrough = true
|
|
|
|
// game.isPassThrough = true
|
|
|
|
game.next_game = next_game;
|
|
|
|
game.next_game = next_game;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.showDialog({
|
|
|
|
this.showDialog({
|
|
|
|
contentText: <div>
|
|
|
|
contentText: <div>
|
|
|
@ -764,7 +764,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
isSingleButton: true
|
|
|
|
isSingleButton: true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
|
|
|
@ -775,12 +775,12 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
output_sets,
|
|
|
|
output_sets,
|
|
|
|
game,
|
|
|
|
game,
|
|
|
|
next_game,
|
|
|
|
next_game,
|
|
|
|
|
|
|
|
|
|
|
|
latest_output: last_compile_output,
|
|
|
|
latest_output: last_compile_output,
|
|
|
|
record: record_consume_time,
|
|
|
|
record: record_consume_time,
|
|
|
|
grade,
|
|
|
|
grade,
|
|
|
|
had_done,
|
|
|
|
had_done,
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resetTestSetsExpandedArray = () => {
|
|
|
|
resetTestSetsExpandedArray = () => {
|
|
|
@ -809,15 +809,15 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
output_sets = Object.assign({}, output_sets);
|
|
|
|
output_sets = Object.assign({}, output_sets);
|
|
|
|
// const test_sets_array = JSON.parse("[" + response.data.test_sets + "]");
|
|
|
|
// const test_sets_array = JSON.parse("[" + response.data.test_sets + "]");
|
|
|
|
output_sets.test_sets_array = response.data.test_sets;
|
|
|
|
output_sets.test_sets_array = response.data.test_sets;
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
output_sets: output_sets,
|
|
|
|
output_sets: output_sets,
|
|
|
|
grade: this.state.grade + deltaScore,
|
|
|
|
grade: this.state.grade + deltaScore,
|
|
|
|
game : update(game, {test_sets_view: { $set: true }}),
|
|
|
|
game : update(game, {test_sets_view: { $set: true }}),
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0)
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.handleGdialogClose();
|
|
|
|
this.handleGdialogClose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
@ -841,10 +841,10 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
TODO 写成HOC组件,更好复用
|
|
|
|
TODO 写成HOC组件,更好复用
|
|
|
|
全局的Dialog this.props.showDialog调用即可
|
|
|
|
全局的Dialog this.props.showDialog调用即可
|
|
|
|
@param contentText dialog显示的提示文本
|
|
|
|
@param contentText dialog显示的提示文本
|
|
|
|
@param callback 确定按钮回调方法
|
|
|
|
@param callback 确定按钮回调方法
|
|
|
|
@param moreButtonsRender 除了“确定”、“取消”按钮外的其他按钮
|
|
|
|
@param moreButtonsRender 除了“确定”、“取消”按钮外的其他按钮
|
|
|
|
@param okButtonText “确定”按钮显示文本,如 继续查看
|
|
|
|
@param okButtonText “确定”按钮显示文本,如 继续查看
|
|
|
@ -908,13 +908,13 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
|
|
match: this.props.match
|
|
|
|
match: this.props.match
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Dialog
|
|
|
|
<Dialog
|
|
|
|
id="tpi-dialog"
|
|
|
|
id="tpi-dialog"
|
|
|
|
open={this.state.gDialogOpen}
|
|
|
|
open={this.state.gDialogOpen}
|
|
|
|
disableEscapeKeyDown={true}
|
|
|
|
disableEscapeKeyDown={true}
|
|
|
|
onClose={() => this.handleGdialogClose()}
|
|
|
|
onClose={() => this.handleGdialogClose()}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<DialogTitle id="alert-dialog-title">{"提示"}</DialogTitle>
|
|
|
|
<DialogTitle id="alert-dialog-title">{"提示"}</DialogTitle>
|
|
|
|
<DialogContent id="dialog-content">
|
|
|
|
<DialogContent id="dialog-content">
|
|
|
|
<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}>
|
|
|
|
<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}>
|
|
|
@ -930,7 +930,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
>知道啦</a>
|
|
|
|
>知道啦</a>
|
|
|
|
</div> :
|
|
|
|
</div> :
|
|
|
|
<React.Fragment>
|
|
|
|
<React.Fragment>
|
|
|
|
<Button onClick={() => this.handleGdialogClose()} color="primary"
|
|
|
|
<Button onClick={() => this.handleGdialogClose()} color="primary"
|
|
|
|
className={`${classes.button} ${classes.buttonGray} ${classes.borderRadiusNone}`}>
|
|
|
|
className={`${classes.button} ${classes.buttonGray} ${classes.borderRadiusNone}`}>
|
|
|
|
关闭
|
|
|
|
关闭
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
@ -938,7 +938,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
onClick={() => this.onGdialogOkBtnClick() } color="primary" autoFocus>
|
|
|
|
onClick={() => this.onGdialogOkBtnClick() } color="primary" autoFocus>
|
|
|
|
{ this.okButtonText ? this.okButtonText : '确定' }
|
|
|
|
{ this.okButtonText ? this.okButtonText : '确定' }
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
</React.Fragment> }
|
|
|
|
</React.Fragment> }
|
|
|
|
{this.moreButtonsRender && this.moreButtonsRender()}
|
|
|
|
{this.moreButtonsRender && this.moreButtonsRender()}
|
|
|
|
</DialogActions>
|
|
|
|
</DialogActions>
|
|
|
|
</Dialog>
|
|
|
|
</Dialog>
|
|
|
|