|
|
@ -54,6 +54,8 @@ 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]
|
|
|
|
window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider?
|
|
|
|
window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const $ = window.$
|
|
|
|
class TPIContextProvider extends Component {
|
|
|
|
class TPIContextProvider extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
|
super(props)
|
|
|
|
super(props)
|
|
|
@ -592,13 +594,49 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
currentPassedGameGainExperience: experience,
|
|
|
|
currentPassedGameGainExperience: experience,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
initDisplayInterval = () => {
|
|
|
|
|
|
|
|
const challenge = this.state.challenge
|
|
|
|
|
|
|
|
if (this.showWebDisplayButtonTimeout) {
|
|
|
|
|
|
|
|
window.clearTimeout(this.showWebDisplayButtonTimeout)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.showWebDisplayButtonTimeout = window.setTimeout(() => {
|
|
|
|
|
|
|
|
this.setState({ challenge: update(challenge,
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
showWebDisplayButton: { $set: false },
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.showWebDisplayButtonTimeout = null
|
|
|
|
|
|
|
|
}, 61 * 1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let remain = 60
|
|
|
|
|
|
|
|
if (this.displayInterval) {
|
|
|
|
|
|
|
|
window.clearInterval(this.displayInterval)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.displayInterval = window.setInterval(() => {
|
|
|
|
|
|
|
|
const button = $('#showWebDisplayButton');
|
|
|
|
|
|
|
|
if (button.length) {
|
|
|
|
|
|
|
|
button.html(`查看效果(${remain})`)
|
|
|
|
|
|
|
|
if (remain == 0) {
|
|
|
|
|
|
|
|
button.html('查看效果')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (remain == 0) {
|
|
|
|
|
|
|
|
window.clearInterval(this.displayInterval)
|
|
|
|
|
|
|
|
this.displayInterval = null
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
remain -= 1;
|
|
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
}
|
|
|
|
language_display(data) {
|
|
|
|
language_display(data) {
|
|
|
|
const { game, tomcat_url } = this.state;
|
|
|
|
const { game, tomcat_url } = this.state;
|
|
|
|
const $ = window.$;
|
|
|
|
|
|
|
|
const challenge = Object.assign({}, this.state.challenge)
|
|
|
|
const challenge = Object.assign({}, this.state.challenge)
|
|
|
|
if(challenge.isWeb && data.port != -1) {
|
|
|
|
if(challenge.isWeb && data.port != -1) {
|
|
|
|
// var $result = $("#php_display");
|
|
|
|
// var $result = $("#php_display");
|
|
|
|
challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮
|
|
|
|
challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮
|
|
|
|
|
|
|
|
this.initDisplayInterval()
|
|
|
|
|
|
|
|
|
|
|
|
const path = challenge.web_route || challenge.path
|
|
|
|
const path = challenge.web_route || challenge.path
|
|
|
|
const webDisplayUrl = `${tomcat_url}:${data.port}/${path}`
|
|
|
|
const webDisplayUrl = `${tomcat_url}:${data.port}/${path}`
|
|
|
|
challenge.webDisplayUrl = webDisplayUrl
|
|
|
|
challenge.webDisplayUrl = webDisplayUrl
|
|
|
@ -653,24 +691,11 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
|
|
const currentGamePassed = this.props.game !== 2 && status === 2
|
|
|
|
const currentGamePassed = this.props.game !== 2 && status === 2
|
|
|
|
|
|
|
|
|
|
|
|
currentGamePassed && this.language_display(response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 评测通过了,立即同步costTime
|
|
|
|
// 评测通过了,立即同步costTime
|
|
|
|
currentGamePassed && this._updateCostTime(true, true);
|
|
|
|
currentGamePassed && this._updateCostTime(true, true);
|
|
|
|
|
|
|
|
|
|
|
|
if (currentGamePassed) {
|
|
|
|
|
|
|
|
game.status = 2;
|
|
|
|
|
|
|
|
game.next_game = next_game;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.showDialog({
|
|
|
|
|
|
|
|
contentText: <div>
|
|
|
|
|
|
|
|
<div>评测未通过</div>
|
|
|
|
|
|
|
|
<div>详情请参见“测试结果”</div>
|
|
|
|
|
|
|
|
</div>,
|
|
|
|
|
|
|
|
isSingleButton: true
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const output_sets = {
|
|
|
|
const output_sets = {
|
|
|
|
"test_sets": test_sets,
|
|
|
|
"test_sets": test_sets,
|
|
|
@ -689,6 +714,31 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
// output_sets.test_sets_array = test_sets_array;
|
|
|
|
// output_sets.test_sets_array = test_sets_array;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否编译通过
|
|
|
|
|
|
|
|
let compileSuccess = false;
|
|
|
|
|
|
|
|
if (test_sets && test_sets.length) {
|
|
|
|
|
|
|
|
test_sets.some((item) => {
|
|
|
|
|
|
|
|
if (item.compile_success) {
|
|
|
|
|
|
|
|
compileSuccess = true;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compileSuccess && this.language_display(response);
|
|
|
|
|
|
|
|
if (currentGamePassed) {
|
|
|
|
|
|
|
|
game.status = 2;
|
|
|
|
|
|
|
|
game.next_game = next_game;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.showDialog({
|
|
|
|
|
|
|
|
contentText: <div>
|
|
|
|
|
|
|
|
<div>评测未通过</div>
|
|
|
|
|
|
|
|
<div>详情请参见“测试结果”</div>
|
|
|
|
|
|
|
|
</div>,
|
|
|
|
|
|
|
|
isSingleButton: true
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
|
|
|
|