优化一把

chromesetting
tangjiang 5 years ago
parent 42f7297459
commit f96f984386

@ -4,11 +4,11 @@
* @Github: * @Github:
* @Date: 2019-11-27 15:02:52 * @Date: 2019-11-27 15:02:52
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 17:33:21 * @LastEditTime: 2019-12-20 19:06:48
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { Drawer, Modal, Icon, Badge } from 'antd'; import { Drawer, Tooltip, Badge } from 'antd';
import { fromStore, CNotificationHOC } from 'educoder'; import { fromStore, CNotificationHOC } from 'educoder';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import MonacoEditor from '@monaco-editor/react'; import MonacoEditor from '@monaco-editor/react';
@ -138,16 +138,44 @@ function MyMonacoEditor (props, ref) {
{/* 未保存时 ? '学员初始代码文件' : main.x */} {/* 未保存时 ? '学员初始代码文件' : main.x */}
<span className='flex_strict' style={{ color: '#ddd'}}>{identifier ? language ? maps[language.toLowerCase()] : '' : '学员初始代码文件'}</span> <span className='flex_strict' style={{ color: '#ddd'}}>{identifier ? language ? maps[language.toLowerCase()] : '' : '学员初始代码文件'}</span>
<span className={_classnames}>{hadCodeUpdate ? '已保存' : ''}</span> <span className={_classnames}>{hadCodeUpdate ? '已保存' : ''}</span>
<Badge {/* <Tooltip
className="flex_normal" style={{ background: 'gold' }}
style={{ color: '#666'}} className="tooltip_style"
dot={notice} title="通知"
onClick={handleUpdateNotice} placement="bottom"
> */}
<Tooltip
placement="bottom"
title="通知"
> >
<Icon type="bell" /> <Badge
</Badge> className="flex_normal"
<span onClick={handleRestoreCode} className="flex_normal" style={{ display: identifier ? 'inline-block' : 'none'}}>{renderRestore}</span> style={{ color: '#666'}}
<MyIcon className='code-icon' type="iconshezhi" onClick={handleShowDrawer}/> dot={notice}
onClick={handleUpdateNotice}
>
{/* <Icon type="bell" /> */}
<MyIcon type="iconxiaoxi1" />
</Badge>
</Tooltip>
<Tooltip
placement="bottom"
title="重置"
>
<MyIcon
className="flex_normal"
onClick={handleRestoreCode}
type="iconzaicizairu"
style={{ display: identifier ? 'inline-block' : 'none'}}
/>
{/* <span onClick={handleRestoreCode} className="flex_normal" style={{ display: identifier ? 'inline-block' : 'none'}}>{renderRestore}</span> */}
</Tooltip>
<Tooltip
placement="bottom"
title="设置"
>
<MyIcon className='code-icon' type="iconshezhi" onClick={handleShowDrawer}/>
</Tooltip>
</div> </div>
<MonacoEditor <MonacoEditor
height={height} height={height}

@ -15,7 +15,7 @@
.flex_normal{ .flex_normal{
color: #E51C24; color: #E51C24;
cursor: pointer; cursor: pointer;
margin-right: 30px; margin-right: 20px;
} }
.code-icon{ .code-icon{
cursor: pointer; cursor: pointer;

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-04 08:36:21 * @Date: 2019-12-04 08:36:21
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 10:52:36 * @LastEditTime: 2019-12-20 19:29:39
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -37,8 +37,7 @@ function RecordDetail (props) {
useEffect(() => { useEffect(() => {
// 根据id获取记录详情 // 根据id获取记录详情
console.log('提交记录详情', recordDetail); getUserCommitRecordDetail(id, 'detail');
getUserCommitRecordDetail(id, 'detail');
}, []); }, []);
useEffect(() => { useEffect(() => {

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 09:49:33 * @Date: 2019-11-27 09:49:33
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 13:55:07 * @LastEditTime: 2019-12-20 19:35:01
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -113,7 +113,9 @@ const CommitRecord = (props) => {
<p className={'record_result'}> <p className={'record_result'}>
执行结果: <span className={classes}>{reviewResult[status]}</span> 执行结果: <span className={classes}>{reviewResult[status]}</span>
</p> </p>
<p className={showErrorCopy} data-clipboard-target="#errcode"> <p
onClick={clickCopyErrInfo}
className={showErrorCopy} data-clipboard-target="#errcode">
<span> <span>
复制错误信息 <Icon type="copy" className={'icon_style'}/> 复制错误信息 <Icon type="copy" className={'icon_style'}/>
</span> </span>
@ -155,7 +157,7 @@ const CommitRecord = (props) => {
let count = 0; let count = 0;
useEffect(() => { useEffect(() => {
clipboard = new ClipboardJS('.copy_error'); clipboard = new ClipboardJS('.copy_error');
clipboard.on('success', (e) => { clipboard && clipboard.on('success', (e) => {
e.clearSelection(); e.clearSelection();
if (count > 0) return; if (count > 0) return;
count++; count++;
@ -165,7 +167,10 @@ const CommitRecord = (props) => {
}, 300); }, 300);
}); });
}, []); }, []);
const clickCopyErrInfo = () => {
count = 0;
}
// if (commitRecordDetail.status !== 0) { // if (commitRecordDetail.status !== 0) {
// clipboard.on('success', (e) => { // clipboard.on('success', (e) => {
// console.log('成功=====》》》》》'); // console.log('成功=====》》》》》');

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:42:11 * @Date: 2019-11-27 13:42:11
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 14:47:26 * @LastEditTime: 2019-12-20 19:30:30
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -338,6 +338,10 @@ export const getUserCommitRecordDetail = (identifier) => {
type: types.GET_COMMIT_RECORD_DETAIL_BY_ID, type: types.GET_COMMIT_RECORD_DETAIL_BY_ID,
payload: data payload: data
}); });
dispatch({
type: types.CLICK_OPERATE_TYPE,
payload: ''
});
}); });
} }
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 16:35:46 * @Date: 2019-11-20 16:35:46
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-20 16:40:42 * @LastEditTime: 2019-12-20 18:46:00
*/ */
import types from './actionTypes'; import types from './actionTypes';
import CONST from '../../constants'; import CONST from '../../constants';
@ -142,15 +142,15 @@ export const validateOjForm = (props, type) => {
} }
}); });
if (bool) { // if (bool) {
hasSuccess = false; // hasSuccess = false;
validateResult = { // validateResult = {
[key]: { // [key]: {
validateStatus: 'error', // validateStatus: 'error',
errMsg: key === 'input' ? '输入值必须是唯一的' : '输出值必须是唯一的' // errMsg: key === 'input' ? '输入值必须是唯一的' : '输出值必须是唯一的'
} // }
}; // };
} // }
} }
Object.assign(tempObj, validateResult); Object.assign(tempObj, validateResult);
}); });
@ -496,12 +496,12 @@ export const testCaseOutputChange = (value, index) => {
if (!validate.errMsg) { if (!validate.errMsg) {
// 唯一性校验 // 唯一性校验
const {testCases} = getState().ojFormReducer; const {testCases} = getState().ojFormReducer;
let _errMsg = ''; let _errMsg = '输出值不能为空';
const bool = testCases.some((item, i) => { const bool = testCases.some((item, i) => {
if (i !== index) { if (i !== index) {
if (item['output'] === value) { // if (item['output'] === value) {
_errMsg=`与测试用例${index}的输入值重复了,请重新填写`; // _errMsg=`与测试用例${index}的输入值重复了,请重新填写`;
} // }
return item['output'] === value; return item['output'] === value;
} else { } else {
return false; return false;

Loading…
Cancel
Save