From 8686a514a147cbf5d1291eb7950674e5e12efa16 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 29 Nov 2019 12:07:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E9=92=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leftpane/commitRecord/index.js | 6 ++-- public/react/src/redux/actions/ojForUser.js | 31 +++++++++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js index 468e06d2f..ddb3cf42e 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 09:49:33 * @LastEditors: tangjiang - * @LastEditTime: 2019-11-28 19:54:56 + * @LastEditTime: 2019-11-29 12:06:01 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -92,7 +92,7 @@ const CommitRecord = (props) => { const classes = status === 0 ? 'record_result_suc' : 'record_result_err'; return ( -
+ {/*
执行结果: {reviewResult[status]} @@ -102,7 +102,7 @@ const CommitRecord = (props) => { 显示详情 -
+
*/} {/*
错误代码
*/}
); diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js index 8c57ff216..9173dc0a1 100644 --- a/public/react/src/redux/actions/ojForUser.js +++ b/public/react/src/redux/actions/ojForUser.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 13:42:11 * @LastEditors: tangjiang - * @LastEditTime: 2019-11-29 11:11:13 + * @LastEditTime: 2019-11-29 12:03:51 */ import types from "./actionTypes"; import { Base64 } from 'js-base64'; @@ -90,7 +90,7 @@ export const debuggerCode = (identifier,value, type) => { } fetchDebuggerCode(identifier, value).then(res => { - console.log('调用调试代码成功并返回结果: ', res); + // console.log('调用调试代码成功并返回结果: ', res); const { status } = res; if (status === 200) { // 调试代码成功后,调用轮循接口, 注意: 代码执行的时间要小于设置的时间限制 @@ -141,6 +141,12 @@ export const debuggerCode = (identifier,value, type) => { type: types.CHANGE_USER_CODE_TAB, payload: 'record' }); + + // 将按钮状态回滚 + dispatch({ + type: types.SUBMIT_LOADING_STATUS, + payload: false + }); // 重新调用一下提交记录接口 dispatch(getUserCommitRecord(identifier)); } @@ -153,6 +159,15 @@ export const debuggerCode = (identifier,value, type) => { getCodeSubmit(intervalTime, time_limit, count++, timer); }, intervalTime); } + }).catch(() => { + dispatch({ + type: types.TEST_CODE_STATUS, + payload: '' + }); + dispatch({ + type: types.LOADING_STATUS, + payload: false + }); }); } } @@ -222,10 +237,20 @@ export const submitUserCode = (identifier, inputValue, type) => { flag: false }); fetchUserCodeSubmit(identifier).then(res => { - console.log('用户提交代码成功======》》》》》', res); + // console.log('用户提交代码成功======》》》》》', res); if (res.status === 200) { dispatch(debuggerCode(identifier, inputValue, type || 'submit')); } + }).catch(() => { + dispatch({ + type: types.SUBMIT_LOADING_STATUS, + payload: false + }); + }); + }).catch(() => { + dispatch({ + type: types.SUBMIT_LOADING_STATUS, + payload: false }) }); }