From 7696e2f8a9f29053a9351f571a711df7e98ad5cb Mon Sep 17 00:00:00 2001 From: harry Date: Sun, 8 Mar 2020 01:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E4=B8=8E=E9=87=8D=E5=A4=8D=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=9B=B4=E6=96=B0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/monacoSetting/index.js | 4 +- .../components/myMonacoEditor/index.less | 22 +----- .../modules/developer/recordDetail/index.js | 1 - .../modules/developer/recordDetail/index.less | 74 ++++++++++++------- .../modules/developer/studentStudy/index.js | 8 +- .../developer/studentStudy/rightpane/index.js | 2 +- .../src/redux/reducers/ojForUserReducer.js | 41 +++++----- 7 files changed, 74 insertions(+), 78 deletions(-) diff --git a/public/react/src/modules/developer/components/monacoSetting/index.js b/public/react/src/modules/developer/components/monacoSetting/index.js index 6ddf74258..86ac9372f 100644 --- a/public/react/src/modules/developer/components/monacoSetting/index.js +++ b/public/react/src/modules/developer/components/monacoSetting/index.js @@ -19,7 +19,7 @@ const SettingDrawer = (props) => { return +fromStore('oj_fontSize') || 14; }); const [theme, setTheme] = useState(() => { - return fromStore('oj_theme') || 'dark'; + return fromStore('oj_theme') || 'vs-dark'; }); const { title, type = 'label', content = [] } = props; @@ -92,7 +92,7 @@ const SettingDrawer = (props) => { return (

{title}

- { result } + {result}
); } diff --git a/public/react/src/modules/developer/components/myMonacoEditor/index.less b/public/react/src/modules/developer/components/myMonacoEditor/index.less index ce8f22d8e..65b66fb69 100644 --- a/public/react/src/modules/developer/components/myMonacoEditor/index.less +++ b/public/react/src/modules/developer/components/myMonacoEditor/index.less @@ -1,13 +1,12 @@ .monaco_editor_area { height: 100%; - background-color: rgba(7, 15, 25, 1); .code_title { display: flex; align-items: center; - background-color: rgba(18, 28, 36, 1); color: #fff; height: 56px; + background-color: rgba(18, 28, 36, 1); padding: 0 20px; .flex_strict { @@ -31,17 +30,6 @@ } } - // .margin, - // .margin-view-overlays, - // .current-line{ - // width: 40px !important; - // } - // .monaco-editor .margin-view-overlays .line-numbers{ - // text-align: center; - // } - // .monaco-scrollable-element{ - // left: 40px !important; - // } } .setting_drawer { @@ -77,18 +65,12 @@ } .flex_has_save { + // animation: blink 3s line 3; animation-name: blink; animation-duration: .4s; animation-iteration-count: 3; } -// .monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input, -// .monaco-editor .margin, -// .minimap slider-mouseover, -// .minimap-decorations-layer{ -// background:rgba(3,19,40,1) !important; -// } - @keyframes blink { 50% { color: #fff; diff --git a/public/react/src/modules/developer/recordDetail/index.js b/public/react/src/modules/developer/recordDetail/index.js index 92bcacb7f..4653bd419 100644 --- a/public/react/src/modules/developer/recordDetail/index.js +++ b/public/react/src/modules/developer/recordDetail/index.js @@ -63,7 +63,6 @@ function RecordDetail(props) { const handleEditorCode = (identifier, code) => { if (identifier) { - console.log(code); saveEditorCodeForDetail(code); props.history.push(`/myproblems/${identifier}`); } diff --git a/public/react/src/modules/developer/recordDetail/index.less b/public/react/src/modules/developer/recordDetail/index.less index 10eabbc04..b7c093fdd 100644 --- a/public/react/src/modules/developer/recordDetail/index.less +++ b/public/react/src/modules/developer/recordDetail/index.less @@ -1,69 +1,89 @@ @import '../split_pane_resizer.scss'; -.result_code_area .monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input{ - background-color: #f9f9f9!important; + +.result_code_area .monaco-editor, +.monaco-editor-background, +.monaco-editor .inputarea.ime-input { + background-color: #f9f9f9 !important; } -.result_code_area .monaco-editor .line-numbers{ - color: #999!important; + +.result_code_area .monaco-editor .line-numbers { + color: #999 !important; } -.result_code_area .monaco-editor .current-line ~ .line-numbers { - color: #0b216f!important; + +.result_code_area .monaco-editor .current-line~.line-numbers { + color: #0b216f !important; } -.result_code_area .minimap-decorations-layer{ - background: rgba(225,225,225,0.2)!important; + +.result_code_area .minimap-decorations-layer { + background: rgba(225, 225, 225, 0.2) !important; } -.result_code_area .monaco-editor .margin{ - background-color: #eee!important; + +.result_code_area .monaco-editor .margin { + background-color: #eee !important; } -.record_detail_area{ + +.record_detail_area { background: #fff; - .record_detail_ctx{ + + .record_detail_ctx { padding: 0 20px; - .detail_ctx_header{ + + .detail_ctx_header { position: relative; height: 56px; } - .header_h2{ + + .header_h2 { line-height: 56px; } - .header_btn{ + + .header_btn { position: absolute; right: 0; top: 14px; } - .detail_ctx_status{ + + .detail_ctx_status { height: 18px; line-height: 18px; - .status_label{ - color: rgba(153,153,153,1); + + .status_label { + color: rgba(153, 153, 153, 1); margin-right: 40px; } - .status_label_error{ + + .status_label_error { color: #E51C24; } - .status_label_success{ + + .status_label_success { color: #28BD8B; } - .status_label_sub{ + + .status_label_sub { color: #333333; } - .pass_case{ + + .pass_case { float: right; margin-right: 0; } - .pass_case_span{ + + .pass_case_span { margin-right: 10px; } } - .result_code_area{ + .result_code_area { // height: 500px; height: calc(100vh - 360px); } - .result_error_area{ + + .result_error_area { margin-top: 15px; - background: rgba(250,250,250,1); + background: rgba(250, 250, 250, 1); color: #E51C24; border-radius: 3px; } } -} +} \ No newline at end of file diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 185c292a4..a7f55e1b4 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -15,11 +15,7 @@ import RightPane from './rightpane'; import { Icon } from 'antd'; import UserInfo from '../components/userInfo'; import actions from '../../../redux/actions'; -<<<<<<< HEAD import { CNotificationHOC } from 'educoder'; -======= -import { fromStore, CNotificationHOC } from 'educoder'; ->>>>>>> 73d555c... fix import { withRouter } from 'react-router'; function StudentStudy(props) { @@ -28,8 +24,6 @@ function StudentStudy(props) { const { hack, userInfo, - // hack_identifier, - // user_program_identifier, restoreInitialCode, changeUserCodeTab, changeShowOrHideControl, @@ -75,7 +69,7 @@ function StudentStudy(props) { changeUserCodeTab(tab); } }, []); - + // console.log(hack, hack.modify_code) useEffect(() => { if (hack && hack.modify_code && hasUpdate) { // 代码更改,提示是否需要更新代码 setHasUpdate(false); diff --git a/public/react/src/modules/developer/studentStudy/rightpane/index.js b/public/react/src/modules/developer/studentStudy/rightpane/index.js index 6fd291eff..09263d16c 100644 --- a/public/react/src/modules/developer/studentStudy/rightpane/index.js +++ b/public/react/src/modules/developer/studentStudy/rightpane/index.js @@ -52,7 +52,7 @@ const RightPane = (props) => { clearInterval(timer); timer = null; saveUserCodeForInterval(identifier); - }, 10000); + }, 5000); } } diff --git a/public/react/src/redux/reducers/ojForUserReducer.js b/public/react/src/redux/reducers/ojForUserReducer.js index 8a751f86b..d257067bc 100644 --- a/public/react/src/redux/reducers/ojForUserReducer.js +++ b/public/react/src/redux/reducers/ojForUserReducer.js @@ -45,7 +45,7 @@ const ojForUserReducer = (state = initialState, action) => { } case types.USER_PROGRAM_DETAIL: const { hack, test_case } = action.payload; - const { code }= hack; + const { code } = hack; let tempCode = Base64.decode(code) let tempDesc; try { @@ -53,7 +53,7 @@ const ojForUserReducer = (state = initialState, action) => { } catch (error) { tempDesc = hack.description; } - Object.assign(hack, {code: tempCode, description: tempDesc}); + Object.assign(hack, { code: tempCode, description: tempDesc }); return { ...state, hack: Object.assign({}, hack), @@ -73,21 +73,21 @@ const ojForUserReducer = (state = initialState, action) => { result['error_msg'] = Base64.decode(result['error_msg']); } catch (e) { console.log('错误信息:', e); - } + } if (action.payload.type === 'submit') { - return { + return { ...state, commitRecordDetail: Object.assign({}, result) } } else { - return { + return { ...state, commitTestRecordDetail: Object.assign({}, result) } } - + case types.COMMIT_RECORD: - const {records, records_count} = action.payload; + const { records, records_count } = action.payload; return { ...state, commitRecord: records, @@ -115,7 +115,7 @@ const ojForUserReducer = (state = initialState, action) => { tempDetail = action.payload.data; if (tempDetail['error_msg']) { tempDetail['error_msg'] = Base64.decode(tempDetail['error_msg']); - } + } if (tempDetail['expected_output']) { tempDetail['expected_output'] = Base64.decode(tempDetail['expected_output']); } @@ -137,6 +137,7 @@ const ojForUserReducer = (state = initialState, action) => { } else { curHack['code'] = ''; } + curHack['modify_code'] = false return { ...state, hack: Object.assign({}, state.hack, curHack), @@ -167,9 +168,9 @@ const ojForUserReducer = (state = initialState, action) => { ...state, hadCodeUpdate: action.payload }; - case types.CLICK_OPERATE_TYPE: + case types.CLICK_OPERATE_TYPE: return { - ...state, + ...state, operateType: action.payload } case types.CLEAR_OJ_FOR_USER_REDUCER: @@ -204,18 +205,18 @@ const ojForUserReducer = (state = initialState, action) => { let _user_praise = state.hack.user_praise; _count = +action.payload > 0 ? _count + 1 : _count - 1; _user_praise = +action.payload > 0 ? true : false; - const _hack = Object.assign({}, state.hack, {praises_count: _count, user_praise: _user_praise}); + const _hack = Object.assign({}, state.hack, { praises_count: _count, user_praise: _user_praise }); return { ...state, hack: _hack } - case types.CHANGE_RECORD_PAGINATION_PAGE: + case types.CHANGE_RECORD_PAGINATION_PAGE: return { ...state, - pages: Object.assign({}, state.pages, { page: action.payload}) + pages: Object.assign({}, state.pages, { page: action.payload }) } case types.UPDATE_OJ_FOR_USER_COMMENT_COUNT: - const {comments_count} = state.hack; + const { comments_count } = state.hack; const _comments_count = action.payload === 'add' ? comments_count + 1 : comments_count - 1; return { ...state, @@ -223,18 +224,18 @@ const ojForUserReducer = (state = initialState, action) => { } // 修改笔记内容 case types.UPDATE_NOTE_CONTENT: - const _hack1 = Object.assign({}, state.hack, {notes: action.payload }); + const _hack1 = Object.assign({}, state.hack, { notes: action.payload }); return { ...state, hack: _hack1 } // 修改 hack passed值 case types.UPDATE_HACK_PASSED: - const _hack2 = Object.assign({}, state.hack, {passed: action.payload }); - return { - ...state, - hack: _hack2 - } + const _hack2 = Object.assign({}, state.hack, { passed: action.payload }); + return { + ...state, + hack: _hack2 + } default: return state; }