From 63d57d11bb4f1526b10d3f68b2489c42a128914f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 15 Mar 2019 14:31:31 +0800 Subject: [PATCH 1/4] response.data.message || --- public/react/src/modules/page/component/UpdateDrawer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/component/UpdateDrawer.js b/public/react/src/modules/page/component/UpdateDrawer.js index 70cade00..1a4ab2ac 100644 --- a/public/react/src/modules/page/component/UpdateDrawer.js +++ b/public/react/src/modules/page/component/UpdateDrawer.js @@ -127,7 +127,7 @@ class UpdateDrawer extends Component { const { path, status } = response.data; if (status === -1) { - showSnackbar('更新失败,服务端错误') + showSnackbar(response.data.message || '更新失败,服务端错误') } else if (status === 1) { if (path) { updateChallengePath(path); From 35f4dea04a90eba216ef6ee3ecc9cbb35bfb679b Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 15 Mar 2019 16:32:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/MainContentContainer.js | 3 +++ public/react/src/modules/page/main/CodeEvaluateView.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 77625b73..b24a8255 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -648,6 +648,9 @@ class MainContentContainer extends Component { } return; } + if (gameStatusResponse.data.message) { + + } const { status } = gameStatusResponse.data; if (timeOutFlag === false && (status === 2 || status === 0)) { diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index 907741f1..30ab8630 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -307,6 +307,14 @@ class CodeEvaluateView extends Component { +
+ {/* 正在编译代码。。。 */}
From b6a764f0c6a537854d4c8201234e9c480dfccf10 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 15 Mar 2019 17:20:04 +0800 Subject: [PATCH 3/4] statusMessage --- .../src/modules/page/MainContentContainer.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index b24a8255..9e7954bc 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -587,7 +587,7 @@ class MainContentContainer extends Component { // var timeOut = parseInt(<%= @myshixun.main_mirror.try(:time_limit) %>); // 超时参数 - + this.setEvaluateMiddleStatusText('') this.setState({ gameBuilding: true }) @@ -611,6 +611,9 @@ class MainContentContainer extends Component { this.setGameBuildFalse() }); } + setEvaluateMiddleStatusText = (msg) => { + window.$('#evaluateMiddleStatusText').html(msg) + } // 之前的task_commit方法 gameBuild(fileUpdateResponse, first) { const { st, challenge, output_sets, onRunCodeTestFinish, showSnackbar, time_limit } = this.props @@ -642,15 +645,16 @@ class MainContentContainer extends Component { withCredentials: true, }).then((gameStatusResponse) => { requestTimes++; - if(!gameStatusResponse.data) { - if(requestTimes >= timeOut - 1){ // 最后一次参数改为true + if(!gameStatusResponse.data || gameStatusResponse.data.statusMessage + && gameStatusResponse.data.messageStatus ) { + if(requestTimes >= timeOut - 1) { // 最后一次参数改为true timeOutFlag = true; } + if (gameStatusResponse.data.statusMessage) { + this.setEvaluateMiddleStatusText(gameStatusResponse.data.statusMessage) + } return; } - if (gameStatusResponse.data.message) { - - } const { status } = gameStatusResponse.data; if (timeOutFlag === false && (status === 2 || status === 0)) { From 27240407a0608b986b8b9c758246d2d13bea7ea9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 16 Mar 2019 09:55:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E8=AF=84=E6=B5=8B?= =?UTF-8?q?=E4=B8=AD=20!status=20&&=20status=20!=3D=3D=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/page/MainContentContainer.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index cce183d0..01126075 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -644,18 +644,18 @@ class MainContentContainer extends Component { axios.get(game_status_url, { withCredentials: true, }).then((gameStatusResponse) => { - requestTimes++; - if(!gameStatusResponse.data || gameStatusResponse.data.statusMessage - && gameStatusResponse.data.messageStatus ) { + requestTimes++; + const { status, running_code_message } = gameStatusResponse.data; + + if(!gameStatusResponse.data || !status && status !== 0 ) { if(requestTimes >= timeOut - 1) { // 最后一次参数改为true - timeOutFlag = true; - } - if (gameStatusResponse.data.statusMessage) { - this.setEvaluateMiddleStatusText(gameStatusResponse.data.statusMessage) - } + timeOutFlag = true; + } + if (running_code_message) { + this.setEvaluateMiddleStatusText(running_code_message) + } return; } - const { status } = gameStatusResponse.data; if (timeOutFlag === false && (status === 2 || status === 0)) { // 网络太慢或服务处理较慢的情况下,可能这里会执行第二次