优化一把

chromesetting
tangjiang 5 years ago
parent 42f7297459
commit f96f984386

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

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

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

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

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

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

Loading…
Cancel
Save