dev_haigong
cxt 6 years ago
commit e3a7e90805

@ -587,7 +587,7 @@ class MainContentContainer extends Component {
// var timeOut = parseInt(<%= @myshixun.main_mirror.try(:time_limit) %>); // 超时参数 // var timeOut = parseInt(<%= @myshixun.main_mirror.try(:time_limit) %>); // 超时参数
this.setEvaluateMiddleStatusText('')
this.setState({ this.setState({
gameBuilding: true gameBuilding: true
}) })
@ -611,6 +611,9 @@ class MainContentContainer extends Component {
this.setGameBuildFalse() this.setGameBuildFalse()
}); });
} }
setEvaluateMiddleStatusText = (msg) => {
window.$('#evaluateMiddleStatusText').html(msg)
}
// 之前的task_commit方法 // 之前的task_commit方法
gameBuild(fileUpdateResponse, first) { gameBuild(fileUpdateResponse, first) {
const { st, challenge, output_sets, onRunCodeTestFinish, resetTestSetsExpandedArray, showSnackbar, time_limit } = this.props const { st, challenge, output_sets, onRunCodeTestFinish, resetTestSetsExpandedArray, showSnackbar, time_limit } = this.props
@ -641,14 +644,18 @@ class MainContentContainer extends Component {
axios.get(game_status_url, { axios.get(game_status_url, {
withCredentials: true, withCredentials: true,
}).then((gameStatusResponse) => { }).then((gameStatusResponse) => {
requestTimes++; requestTimes++;
if(!gameStatusResponse.data) { const { status, running_code_message } = gameStatusResponse.data;
if(requestTimes >= timeOut - 1){ // 最后一次参数改为true
timeOutFlag = true; if(!gameStatusResponse.data || !status && status !== 0 ) {
} if(requestTimes >= timeOut - 1) { // 最后一次参数改为true
timeOutFlag = true;
}
if (running_code_message) {
this.setEvaluateMiddleStatusText(running_code_message)
}
return; return;
} }
const { status } = gameStatusResponse.data;
if (timeOutFlag === false && (status === 2 || status === 0)) { if (timeOutFlag === false && (status === 2 || status === 0)) {
// 网络太慢或服务处理较慢的情况下,可能这里会执行第二次 // 网络太慢或服务处理较慢的情况下,可能这里会执行第二次

@ -127,7 +127,7 @@ class UpdateDrawer extends Component {
const { path, status } = response.data; const { path, status } = response.data;
if (status === -1) { if (status === -1) {
showSnackbar('更新失败,服务端错误') showSnackbar(response.data.message || '更新失败,服务端错误')
} else if (status === 1) { } else if (status === 1) {
if (path) { if (path) {
updateChallengePath(path); updateChallengePath(path);

@ -307,6 +307,14 @@ class CodeEvaluateView extends Component {
<CircularProgress size={40} thickness={3} <CircularProgress size={40} thickness={3}
style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '10%', display: gameBuilding ? 'block': 'none' }}/> style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '10%', display: gameBuilding ? 'block': 'none' }}/>
<div id="evaluateMiddleStatusText" style={{
marginTop: "4px",
textAlign: "center",
color: "#4CACFF",
display: gameBuilding ? 'block': 'none'
}}
></div>
{/* 正在编译代码。。。 */}
<div id="game_test_set_results" className="-flex -relative blacktab-inner" <div id="game_test_set_results" className="-flex -relative blacktab-inner"
style={{ display: gameBuilding ? 'none': 'block' }}> style={{ display: gameBuilding ? 'none': 'block' }}>

Loading…
Cancel
Save