Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

video_transcode
daiao 5 years ago
commit 7cfe99af39

@ -326,8 +326,8 @@ module.exports = {
comments: false comments: false
}, },
compress: { compress: {
drop_debugger: false, drop_debugger: true,
drop_console: false drop_console: true
} }
} }
}), }),

@ -116,7 +116,7 @@ function CommentForm (props) {
wrapStyle={{ wrapStyle={{
height: showQuill ? 'auto' : '0px', height: showQuill ? 'auto' : '0px',
opacity: showQuill ? 1 : 0, opacity: showQuill ? 1 : 0,
overflow: showQuill ? 'none' : 'hidden', overflow: showQuill ? 'none' : 'none',
transition: 'all 0.3s' transition: 'all 0.3s'
}} }}
autoFocus={focus} autoFocus={focus}

@ -435,7 +435,7 @@ a.white-btn.use_scope-btn:hover{
.maxwidth190{max-width: 190px; color:#666666;font-size: 14px;} .maxwidth190{max-width: 190px; color:#666666;font-size: 14px;}
.color05101A{color:#05101A;} .color05101A{color:#05101A;}
.liactive{border-left: 1px solid #4CACFF;} .liactive{border-left: 1px solid #4CACFF;}
.ant-btn-lg{height: 39px;}
.bannername{ .bannername{
max-width: 907px; max-width: 907px;
overflow: hidden; overflow: hidden;

@ -50,9 +50,6 @@ function InitTabCtx (props, ref) {
> >
{ {
getFieldDecorator('input', { getFieldDecorator('input', {
rules: [
{ required: true, message: '输入值不能为空'}
],
initialValue: inputValue initialValue: inputValue
})(<TextArea })(<TextArea
className="input_textarea_style" className="input_textarea_style"

@ -93,7 +93,7 @@ const SettingDrawer = (props) => {
}); });
return ( return (
<React.Fragment> <React.Fragment>
<h2 className={'setting_h2'}>{title}</h2> <h3 className={'setting_h2'}>{title}</h3>
{ result } { result }
</React.Fragment> </React.Fragment>
); );

@ -16,8 +16,6 @@ import SettingDrawer from '../../components/monacoSetting';
import CONST from '../../../../constants'; import CONST from '../../../../constants';
import MyIcon from '../../../../common/components/MyIcon'; import MyIcon from '../../../../common/components/MyIcon';
// import actions from '../../../../redux/actions';
const { fontSetting, opacitySetting } = CONST; const { fontSetting, opacitySetting } = CONST;
const maps = { const maps = {
'c': 'main.c', 'c': 'main.c',
@ -42,8 +40,6 @@ function MyMonacoEditor (props, ref) {
} = props; } = props;
const [showDrawer, setShowDrawer] = useState(false); // 控制配置滑框 const [showDrawer, setShowDrawer] = useState(false); // 控制配置滑框
// const [editCode, setEditCode] = useState('');
// const [curLang, setCurLang] = useState('C');
const [fontSize, setFontSize] = useState(() => { // 字体 const [fontSize, setFontSize] = useState(() => { // 字体
return +fromStore('oj_fontSize') || 14; return +fromStore('oj_fontSize') || 14;
}); });
@ -52,10 +48,7 @@ function MyMonacoEditor (props, ref) {
}); });
const [height, setHeight] = useState('calc(100% - 56px)'); const [height, setHeight] = useState('calc(100% - 56px)');
const editorRef = useRef(null); const editorRef = useRef(null);
console.log(language, code, '-------========----------')
// useEffect(() => {
// setEditCode(props.code || '');
// }, [props]);
useEffect(() => { useEffect(() => {
setHeight(showOrHideControl ? 'calc(100% - 378px)' : 'calc(100% - 56px)'); setHeight(showOrHideControl ? 'calc(100% - 378px)' : 'calc(100% - 56px)');
@ -79,19 +72,20 @@ function MyMonacoEditor (props, ref) {
} }
// 文本框内容变化时,记录文本框内容 // 文本框内容变化时,记录文本框内容
const handleEditorChange = (origin, monaco) => { const handleEditorChange = (_, monaco) => {
editorRef.current = monaco; // 获取当前monaco实例 editorRef.current = monaco; // 获取当前monaco实例
// setEditCode(origin); // 保存编辑器初始值 }
useEffect(() => {
if (editorRef.current) {
editorRef.current.onDidChangeModelContent(e => { // 监听编辑器内容的变化 editorRef.current.onDidChangeModelContent(e => { // 监听编辑器内容的变化
// TODO 需要优化 节流
const val = editorRef.current.getValue(); const val = editorRef.current.getValue();
// setEditCode(val);
// console.log('编辑器代码====>>>>', val);
onCodeChange(val); onCodeChange(val);
// 值一变化保存当前代码值
// saveUserInputCode(val);
}); });
} }
}, [
editorRef.current
])
// 配置编辑器属性 // 配置编辑器属性
const editorOptions = { const editorOptions = {
@ -109,14 +103,6 @@ function MyMonacoEditor (props, ref) {
onRestoreInitialCode && onRestoreInitialCode(); onRestoreInitialCode && onRestoreInitialCode();
} }
}) })
// Modal.confirm({
// content: '确定要恢复代码吗?',
// okText: '确定',
// cancelText: '取消',
// onOk () {
// onRestoreInitialCode && onRestoreInitialCode();
// }
// })
} }
const handleUpdateNotice = () => { const handleUpdateNotice = () => {
@ -125,11 +111,6 @@ function MyMonacoEditor (props, ref) {
} }
} }
// const renderRestore = identifier ? (
// <MyIcon type="iconzaicizairu" />
// ) : '';
// lex_has_save ${hadCodeUpdate} ? : ''
const _classnames = hadCodeUpdate ? `flex_strict flex_has_save` : 'flex_strict'; const _classnames = hadCodeUpdate ? `flex_strict flex_has_save` : 'flex_strict';
return ( return (
<React.Fragment> <React.Fragment>
@ -138,12 +119,6 @@ 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>
{/* <Tooltip
style={{ background: 'gold' }}
className="tooltip_style"
title="通知"
placement="bottom"
> */}
<Tooltip <Tooltip
placement="bottom" placement="bottom"
title="通知" title="通知"
@ -212,12 +187,6 @@ const mapStateToProps = (state) => {
} }
}; };
// const mapDispatchToProps = (dispatch) => ({
// // saveUserInputCode: (code) => dispatch(actions.saveUserInputCode(code)),
// });
// MyMonacoEditor = React.forwardRef(MyMonacoEditor);
export default connect( export default connect(
mapStateToProps, mapStateToProps,
// mapDispatchToProps
)(CNotificationHOC()(MyMonacoEditor)); )(CNotificationHOC()(MyMonacoEditor));

@ -8,23 +8,19 @@
import './index.scss'; import './index.scss';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import SplitPane from 'react-split-pane';// import { Form } from 'antd'; import SplitPane from 'react-split-pane';
import { Button } from 'antd'; import { Button } from 'antd';
import LeftPane from './leftpane'; import LeftPane from './leftpane';
import RightPane from './rightpane'; import RightPane from './rightpane';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { toStore, CNotificationHOC } from 'educoder'; import { toStore, CNotificationHOC } from 'educoder';
import UserInfo from '../components/userInfo'; import UserInfo from '../components/userInfo';
// import RightPane from './rightpane/index';
import actions from '../../../redux/actions'; import actions from '../../../redux/actions';
// import {ModalConfirm} from '../../../common/components/ModalConfirm';
const NewOrEditTask = (props) => { const NewOrEditTask = (props) => {
const { const {
publishLoading, publishLoading,
handlePublish, handlePublish,
// testCases = [],
// ojTestCaseValidate = [],
identifier, identifier,
isPublish, isPublish,
userInfo, userInfo,
@ -38,15 +34,10 @@ const NewOrEditTask = (props) => {
getQuestion, getQuestion,
saveSearchParams, saveSearchParams,
setOjInitialValue, setOjInitialValue,
courseQuestions
// updateTestAndValidate,
} = props; } = props;
// 表单提交
const handleSubmitForm = () => { const handleSubmitForm = () => {
// 改变loading状态
changeSubmitLoadingStatus(true); changeSubmitLoadingStatus(true);
// 调用输入表单验证功能
if (props.identifier) { if (props.identifier) {
props.handleUpdateOjForm(props); props.handleUpdateOjForm(props);
} else { } else {
@ -54,12 +45,10 @@ const NewOrEditTask = (props) => {
} }
}; };
const id = props.match.params.id;
useEffect(() => { useEffect(() => {
// 获取用户信息 // 获取用户信息
getUserInfoForNew(); getUserInfoForNew();
// console.log('获取路由参数: ====', props.match.params);
const id = props.match.params.id;
// 保存OJForm的id号指明是编辑还是新增
props.saveOJFormId(id); props.saveOJFormId(id);
// 获取地址栏查询参数 // 获取地址栏查询参数
const $searchs = window.location.search && window.location.search.substring(1); const $searchs = window.location.search && window.location.search.substring(1);
@ -87,14 +76,9 @@ const NewOrEditTask = (props) => {
source: 'question' source: 'question'
}); });
if (id) { // id号即 identifier if (id) { // id号即 identifier
// TODO id 存在时, 编辑, 获取 store 中的记录数
props.getOJFormById(id); props.getOJFormById(id);
} else {
// 清空store中的测试用例集合
// props.clearOJFormStore();
} }
return () => {} }, [id])
}, []);
// 模拟挑战 // 模拟挑战
const imitationChallenge = () => { const imitationChallenge = () => {
@ -107,11 +91,9 @@ const NewOrEditTask = (props) => {
// 开始挑战 // 开始挑战
const startChallenge = () => { const startChallenge = () => {
// 调用 start 接口, 成功后跳转到开启实战 // 调用 start 接口, 成功后跳转到开启实战
// TODO
identifier && validateOjForm(props, 'challenge', () => { identifier && validateOjForm(props, 'challenge', () => {
startProgramQuestion(identifier, props); startProgramQuestion(identifier, props);
}); });
// identifier && startProgramQuestion(identifier, props);
} }
// 取消 // 取消
@ -120,16 +102,11 @@ const NewOrEditTask = (props) => {
props.clearOJFormStore(); props.clearOJFormStore();
// 清空描述信息 // 清空描述信息
toStore('oj_description', ''); toStore('oj_description', '');
// props.history.push('/problems');
props.history.push(`/problemset?${props.searchParams}`); props.history.push(`/problemset?${props.searchParams}`);
} }
// 发布 // 发布
const handleClickPublish = () => { const handleClickPublish = () => {
// ModalConfirm('提示', (<p>发布后即可应用到自己管理的课堂<br /> 是否确认发布?</p>), () => {
// changePublishLoadingStatus(true);
// handlePublish(props, 'publish');
// });
props.confirm({ props.confirm({
title: '提示', title: '提示',
content: (<p>发布后即可应用到自己管理的课堂<br /> 是否确认发布?</p>), content: (<p>发布后即可应用到自己管理的课堂<br /> 是否确认发布?</p>),
@ -141,10 +118,6 @@ const NewOrEditTask = (props) => {
} }
// 撤销发布 // 撤销发布
const handleClickCancelPublish = () => { const handleClickCancelPublish = () => {
// ModalConfirm('提示', (<p>是否确认撤销发布?</p>), () => {
// changePublishLoadingStatus(true);
// handleCancelPublish(props, identifier);
// });
props.confirm({ props.confirm({
title: '提示', title: '提示',
content: ((<p>是否确认撤销发布?</p>)), content: ((<p>是否确认撤销发布?</p>)),
@ -248,7 +221,6 @@ const NewOrEditTask = (props) => {
</SplitPane> </SplitPane>
</SplitPane> </SplitPane>
</div> </div>
{/* 控制台 */}
<div className='new_add_task_ctl'> <div className='new_add_task_ctl'>
{ {
/* 录入时: 取消 保存 */ /* 录入时: 取消 保存 */

@ -147,7 +147,7 @@ const AddTestDemo = (props) => {
return ( return (
<Collapse className={'collapse_area'} activeKey={isOpen?'1':''} onChange={() => handleChangeCollapse()}> <Collapse className={'collapse_area'} activeKey={isOpen?'1':''} onChange={() => handleChangeCollapse()}>
<Panel header={`测试用例${props.index + 1}`} extra={genExtra()} key="1"> <Panel header={`测试用例${props.index + 1}`} extra={props.index===0?false:genExtra()} key="1">
<Form> <Form>
<FormItem <FormItem
label={<span className={'label_text'}>输入</span>} label={<span className={'label_text'}>输入</span>}

@ -25,20 +25,17 @@ const FormItem = Form.Item;
const { Option } = Select; const { Option } = Select;
const maps = { const maps = {
language: [ language: [
{ title: (<span style={{ color: 'rgba(0, 0, 0, 0.35)' }}>请选择</span>), key: '' },
{ title: 'C', key: 'C' }, { title: 'C', key: 'C' },
{ title: 'C++', key: 'C++' }, { title: 'C++', key: 'C++' },
{ title: 'Python', key: 'Python' }, { title: 'Python', key: 'Python' },
{ title: 'Java', key: 'Java' } { title: 'Java', key: 'Java' }
], ],
difficult: [ difficult: [
{ title: (<span style={{ color: 'rgba(0, 0, 0, 0.35)' }}>请选择</span>), key: '' },
{ title: '简单', key: '1' }, { title: '简单', key: '1' },
{ title: '中等', key: '2' }, { title: '中等', key: '2' },
{ title: '困难', key: '3' } { title: '困难', key: '3' }
], ],
category: [ category: [
{ title: (<span style={{ color: 'rgba(0, 0, 0, 0.35)' }}>请选择</span>), key: '' },
{ title: '程序设计', key: '1' }, { title: '程序设计', key: '1' },
{ title: '算法', key: '2' } { title: '算法', key: '2' }
], ],
@ -85,6 +82,25 @@ class EditTab extends React.Component {
// this.props.getQuestion({ // this.props.getQuestion({
// source: 'question' // source: 'question'
// }); // });
const obj = { // 测试用例参数
input: '',
output: '',
position: 1,
isAdd: true // 新增的测试用例
}
const validateObj = { // 测试用例验证参数
input: {
validateStatus: '',
errMsg: ''
},
output: {
validateStatus: '',
errMsg: ''
}
}
// this.scrollRef.current.scrollTo(1000);
this.props.addTestCase({ testCase: obj, tcValidate: validateObj });
} }
// componentDidUpdate (nextProp) { // componentDidUpdate (nextProp) {
@ -424,7 +440,7 @@ class EditTab extends React.Component {
help={ojFormValidate.language.errMsg} help={ojFormValidate.language.errMsg}
colon={false} colon={false}
> >
<Select onChange={this.handleLanguageChange} value={`${ojForm.language}`}> <Select onChange={this.handleLanguageChange} defaultValue={'C'} value={`${ojForm.language}`}>
{getOptions('language')} {getOptions('language')}
</Select> </Select>
</FormItem> </FormItem>
@ -462,23 +478,11 @@ class EditTab extends React.Component {
/> />
</FormItem> </FormItem>
{/* <FormItem
className={`input_area flex_50 flex_50_right`}
label={<span>{myLabel(jcLabel['openOrNot'], '社区:您的任务将向整个社会公开')}</span>}
validateStatus={ojFormValidate.openOrNot.validateStatus}
help={ojFormValidate.openOrNot.errMsg}
colon={ false }
>
<Select onChange={this.handleChangeOpenOrNot} value={`${ojForm.openOrNot}`}>
{getOptions('openOrNot')}
</Select>
</FormItem> */}
</Form> </Form>
{/* 添加测试用例 */} {/* 添加测试用例 */}
<div className={'test_demo_title'} ref={this.headerRef}> <div className={'test_demo_title'} ref={this.headerRef}>
<h2>测试用例</h2> <h3>测试用例</h3>
<Button type="primary" ghost onClick={handleAddTest}>添加测试用例</Button> <Button type="primary" ghost onClick={handleAddTest}>添加测试用例</Button>
</div> </div>
<div className="test_demo_ctx"> <div className="test_demo_ctx">

@ -7,55 +7,25 @@
* @LastEditTime : 2019-12-27 19:33:50 * @LastEditTime : 2019-12-27 19:33:50
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import MyMonacoEditor from '../../components/myMonacoEditor'; import MyMonacoEditor from '../../components/myMonacoEditor';
// import ControlSetting from '../../components/controlSetting';
import actions from '../../../../redux/actions'; import actions from '../../../../redux/actions';
function RightPane (props, ref) { function RightPane(props) {
const { const { code, language = 'C', saveOjFormCode } = props;
// identifier,
code,
showCode,
language,
// onSubmitForm,
saveOjFormCode
} = props;
// let timer = null;
// 代码改变时,保存
const handleCodeChange = (updateCode) => { const handleCodeChange = (updateCode) => {
// if (props.identifier) {
// // 保存用户输入的代码
// if (!timer) {
// timer = setInterval(() => {
// clearInterval(timer);
// timer = null;
// }, 3000);
// }
// }
saveOjFormCode(updateCode); saveOjFormCode(updateCode);
} }
// 启动调试代码
// const handleDebuggerCode = (value) => {
// console.log('调用的代码调试====', value);
// }
return ( return (
<div className={'right_pane_code_wrap'}> <div className={'right_pane_code_wrap'}>
<MyMonacoEditor <MyMonacoEditor
language={language} language={language}
code={showCode} code={code}
onCodeChange={handleCodeChange} /> onCodeChange={handleCodeChange} />
{/* <ControlSetting
// identifier={identifier}
inputValue={props.input}
onSubmitForm={onSubmitForm}
// onDebuggerCode={handleDebuggerCode}
/> */}
</div> </div>
) )
} }

@ -112,7 +112,7 @@ function RecordDetail (props) {
<span className="status_label pass_case" style={{ display: [-1, 0, 2, 5].includes(detail.status) ? 'inline-block' : 'none'}}> <span className="status_label pass_case" style={{ display: [-1, 0, 2, 5].includes(detail.status) ? 'inline-block' : 'none'}}>
<span className="status_label_sub">{detail.pass_sets_count}</span> <span className="status_label_sub">{detail.pass_sets_count}</span>
<span className="pass_case_span"> / {detail.set_count}</span> <span className="pass_case_span"> / {detail.set_count}</span>
个通过测试用例 个通过测试用例
</span> </span>
</div> </div>
<div className="result_error_area"> <div className="result_error_area">
@ -134,9 +134,9 @@ function RecordDetail (props) {
<MonacoEditor <MonacoEditor
height="100%" height="100%"
width="100%" width="100%"
className="code_area_Style"
language={(detail.language && detail.language.toLowerCase()) || ''} language={(detail.language && detail.language.toLowerCase()) || ''}
value={detail.code || ''} value={detail.code || ''}
theme="dark"
readOnly={true} readOnly={true}
/> />
</div> </div>

@ -1,5 +1,19 @@
@import '../split_pane_resizer.scss'; @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 .line-numbers{
color: #999!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 .monaco-editor .margin{
background-color: #eee!important;
}
.record_detail_area{ .record_detail_area{
background: #fff; background: #fff;
.record_detail_ctx{ .record_detail_ctx{

@ -6,15 +6,12 @@
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-02 14:23:43 * @LastEditTime : 2020-01-02 14:23:43
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import MyMonacoEditor from '../../components/myMonacoEditor'; import MyMonacoEditor from '../../components/myMonacoEditor';
import ControlSetting from '../../components/controlSetting'; import ControlSetting from '../../components/controlSetting';
import actions from '../../../../redux/actions'; import actions from '../../../../redux/actions';
// import QuillForEditor from '../../../../common/quillForEditor';
// import TextArea from 'antd/lib/input/TextArea';
import { Input, Form, Button } from 'antd'; import { Input, Form, Button } from 'antd';
// import FormItem from 'antd/lib/form/FormItem';
const { TextArea } = Input; const { TextArea } = Input;
const FormItem = Form.Item; const FormItem = Form.Item;
const RightPane = (props) => { const RightPane = (props) => {
@ -33,54 +30,34 @@ const RightPane = (props) => {
updateNotice, updateNotice,
saveUserInputCode, saveUserInputCode,
restoreInitialCode, restoreInitialCode,
// saveOpacityType,
saveUserCodeForInterval, saveUserCodeForInterval,
addNotes, addNotes,
changeLoadingState changeLoadingState
} = props; } = props;
// const [editorCode, setEditorCode] = useState(editor_code || hack.code);
const [noteClazz, setNoteClazz] = useState('editor_nodte_area'); const [noteClazz, setNoteClazz] = useState('editor_nodte_area');
const [noteCount] = useState(5000); const [noteCount] = useState(5000);
// const [code, setCode] = useState(editor_code || hack.code);
// let initFlag = true;
// useEffect(() => {
// if (editor_code) {
// setEditorCode(editor_code);
// } else {
// setEditorCode(hack.code);
// }
// }, [hack, editor_code]);
const handleSubmitForm = () => { const handleSubmitForm = () => {
// 提交时, 先调用提交接口,提交成功后,循环调用测评接口
// saveOpacityType('submit');
submitUserCode(identifier, submitInput, 'submit'); submitUserCode(identifier, submitInput, 'submit');
// // 提交时,先调用评测接口, 评测通过后才调用保存接口
// updateCode(identifier, submitInput, 'submit');
} }
let timer = null; // 定时器 let timer = null; // 定时器
// 代码块内容变化时 // 代码块内容变化时
const handleCodeChange = (value) => { const handleCodeChange = (value) => {
// console.log('编辑器代码 ======》》》》》》》》》++++++++++', value);
saveUserInputCode(value); saveUserInputCode(value);
// setEditorCode(value);
if (!timer) { if (!timer) {
timer = setInterval(function () { timer = setInterval(function () {
clearInterval(timer); clearInterval(timer);
timer = null; timer = null;
saveUserCodeForInterval(identifier); saveUserCodeForInterval(identifier);
}, 3000); }, 10000);
} }
} }
// 代码调试 // 代码调试
const handleDebuggerCode = (value) => { const handleDebuggerCode = (value) => {
// 调用保存代码块接口,成功后,调用调试接口
// saveOpacityType('debug');
updateCode(identifier, value, 'debug'); updateCode(identifier, value, 'debug');
} }
// 恢复初始代码 // 恢复初始代码
@ -113,7 +90,6 @@ const RightPane = (props) => {
} }
}); });
} }
const { getFieldDecorator } = props.form; const { getFieldDecorator } = props.form;
return ( return (
<div className={'right_pane_code_wrap'}> <div className={'right_pane_code_wrap'}>

@ -21,6 +21,7 @@ import NoneData from './component/NoneData';
import './questioncss/questioncom.css'; import './questioncss/questioncom.css';
import Bottomsubmit from "../modals/Bottomsubmit"; import Bottomsubmit from "../modals/Bottomsubmit";
import QuestionModalys from "./component/QuestionModalys"; import QuestionModalys from "./component/QuestionModalys";
import Listjihe from "./component/Listjihe";
//exam_id 试卷的id //exam_id 试卷的id
var Undoclickable=true; var Undoclickable=true;
@ -264,12 +265,6 @@ class NewMyShixunModel extends Component {
} }
this.callback(defaultActiveKeys); this.callback(defaultActiveKeys);
} }
if(prevProps.Contentdata !== this.props.Contentdata){
this.setState({
Contentdata:this.props.Contentdata,
})
}
} }
//公共和我的 //公共和我的
@ -721,33 +716,33 @@ class NewMyShixunModel extends Component {
getbasket_listdata = () => { getbasket_listdata = () => {
// 获取试题篮展开的数据 // 获取试题篮展开的数据
// const url = "/item_baskets/basket_list.json"; const url = "/item_baskets/basket_list.json";
// axios.get(url) axios.get(url)
// .then((result) => { .then((result) => {
// // ////console.log("getbasket_listdata"); // ////console.log("getbasket_listdata");
// // ////console.log(result.data); // ////console.log(result.data);
// this.setState({ this.setState({
// completion_questions_count: result.data.completion_questions_count, completion_questions_count: result.data.completion_questions_count,
// judgement_questions_count: result.data.judgement_questions_count, judgement_questions_count: result.data.judgement_questions_count,
// multiple_questions_count: result.data.multiple_questions_count, multiple_questions_count: result.data.multiple_questions_count,
// practical_questions_count: result.data.practical_questions_count, practical_questions_count: result.data.practical_questions_count,
// program_questions_count: result.data.program_questions_count, program_questions_count: result.data.program_questions_count,
// single_questions_count: result.data.single_questions_count, single_questions_count: result.data.single_questions_count,
// subjective_questions_count: result.data.subjective_questions_count, subjective_questions_count: result.data.subjective_questions_count,
// }) })
//
// }).catch((error) => { }).catch((error) => {
// // ////console.log(error); // ////console.log(error);
// this.setState({ this.setState({
// completion_questions_count: 0, completion_questions_count: 0,
// judgement_questions_count: 0, judgement_questions_count: 0,
// multiple_questions_count: 0, multiple_questions_count: 0,
// practical_questions_count: 0, practical_questions_count: 0,
// program_questions_count: 0, program_questions_count: 0,
// single_questions_count: 0, single_questions_count: 0,
// subjective_questions_count: 0, subjective_questions_count: 0,
// }) })
// }) })
} }
@ -1030,7 +1025,9 @@ class NewMyShixunModel extends Component {
+ subjective_questions_count; + subjective_questions_count;
// console.log("弹出框"); // console.log("弹出框");
// console.log(Datacount)
// console.log(Contentdata) // console.log(Contentdata)
return ( return (
<div className="newMain clearfix " ref={this.saveContainer}> <div className="newMain clearfix " ref={this.saveContainer}>
@ -1103,6 +1100,8 @@ class NewMyShixunModel extends Component {
Contentdata={Contentdata} Contentdata={Contentdata}
exam_id={this.props.exam_id} exam_id={this.props.exam_id}
Isitapopup={"true"} Isitapopup={"true"}
Datacount={Datacount}
Datacountbool={true}
chakanjiexiboolindex={this.state.chakanjiexiboolindex} chakanjiexiboolindex={this.state.chakanjiexiboolindex}
chakanjiexibool={(e)=>this.chakanjiexibool(e)} chakanjiexibool={(e)=>this.chakanjiexibool(e)}
getitem_basketss={(id)=>this.getitem_basketss(id)} getitem_basketss={(id)=>this.getitem_basketss(id)}

@ -788,12 +788,37 @@ class Question extends Component {
} }
//全选试题库 //全选试题库
selectallquestionsonthispage=(bool)=>{ selectallquestionsonthispage=(bool)=>{
if(bool===true){
//bool 是选中状态
let {
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
program_questions_count, single_questions_count, subjective_questions_count,
} = this.state;
const Datacount = completion_questions_count + judgement_questions_count
+ multiple_questions_count + practical_questions_count
+ program_questions_count
+ single_questions_count
+ subjective_questions_count;
if(Datacount===100){
this.props.showNotification(`已选100个试题不能在选用更多试题`);
return;
}
}
if(myGrandtotal===true){ if(myGrandtotal===true){
this.props.showNotification(`本页全部试题未发布,不能选择`); this.props.showNotification(`本页全部试题未发布,不能选择`);
return return
} }
var item_idsdata=[]; var item_idsdata=[];
var arr= this.state.Contentdata.items; var arr= this.state.Contentdata.items;
@ -1083,6 +1108,8 @@ class Question extends Component {
<Contentpart {...this.state} {...this.props} <Contentpart {...this.state} {...this.props}
pages={this.state.page} pages={this.state.page}
Isitapopup={"false"} Isitapopup={"false"}
Datacount={Datacount}
Datacountbool={true}
chakanjiexiboolindex={this.state.chakanjiexiboolindex} chakanjiexiboolindex={this.state.chakanjiexiboolindex}
chakanjiexibool={(e)=>this.chakanjiexibool(e)} chakanjiexibool={(e)=>this.chakanjiexibool(e)}
getitem_basketss={(id)=>this.getitem_basketss(id)} getitem_basketss={(id)=>this.getitem_basketss(id)}

@ -143,7 +143,7 @@ class ChoquesEditor extends Component{
} }
} }
if(!answerArray || answerArray.length == 0) { if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项'); this.props.showNotification('请设置本题的正确答案点击选项A/B...即可完成设置');
return editordata; return editordata;
} }
if(!answerArray || answerArray.length < 2) { if(!answerArray || answerArray.length < 2) {

@ -369,7 +369,6 @@ class Contentpart extends Component {
</style> </style>
<div className="xaxisreverseorder"> <div className="xaxisreverseorder">
{ {
defaultActiveKey===0||defaultActiveKey==="0"?
isysladmins===true||is_teacher===true? isysladmins===true||is_teacher===true?
this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.Isitapopup&&this.props.Isitapopup==="true"?
"" ""
@ -380,7 +379,6 @@ class Contentpart extends Component {
</div> </div>
</a> </a>
:"" :""
:""
} }
{item_type==="PROGRAM"? {item_type==="PROGRAM"?
@ -400,7 +398,6 @@ class Contentpart extends Component {
{ {
defaultActiveKey===0||defaultActiveKey==="0"?
this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.Isitapopup&&this.props.Isitapopup==="true"?
<Search <Search
style={isysladmins===true||is_teacher===true?{ marginRight:"0px"}:{marginRight:"0px"}} style={isysladmins===true||is_teacher===true?{ marginRight:"0px"}:{marginRight:"0px"}}
@ -419,14 +416,6 @@ class Contentpart extends Component {
size="large" size="large"
onInput={(e)=>this.props.setdatafunsval(e)} onInput={(e)=>this.props.setdatafunsval(e)}
onSearch={ (value)=>this.props.setdatafuns(value)} /> onSearch={ (value)=>this.props.setdatafuns(value)} />
:
<Search
className={"xaxisreverseorder searchwidth"}
placeholder="请输入题目名称、内容"
enterButton
size="large"
onInput={(e)=>this.props.setdatafunsval(e)}
onSearch={ (value)=>this.props.setdatafuns(value)} />
} }
</div> </div>
@ -466,6 +455,8 @@ class Contentpart extends Component {
: this.props.Contentdata.items.map((object, index) => { : this.props.Contentdata.items.map((object, index) => {
return ( return (
<Listjihe {...this.state} {...this.props} <Listjihe {...this.state} {...this.props}
Datacountbool={this.props.Datacountbool}
Datacount={this.props.Datacount}
Isitapopup={this.props.Isitapopup} Isitapopup={this.props.Isitapopup}
chakanjiexiboolindex={this.props.chakanjiexiboolindex} chakanjiexiboolindex={this.props.chakanjiexiboolindex}
chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)} chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)}

@ -97,6 +97,19 @@ class Listjihe extends Component {
} }
//选用 //选用
Selectingpracticaltraining = (id) => { Selectingpracticaltraining = (id) => {
try {
if(this.props.Datacountbool){
if(this.props.Datacount===100){
this.props.showNotification(`已选100个试题不能在选用更多试题`);
return;
}
}
}catch (e) {
}
let data = {} let data = {}
if (this.props.exam_id === undefined) { if (this.props.exam_id === undefined) {
data = { data = {

@ -156,7 +156,7 @@ class SingleEditor extends Component{
} }
if(!answerArray || answerArray.length == 0) { if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项'); this.props.showNotification('请设置本题的正确答案点击选项A/B...即可完成设置');
return editordata; return editordata;
} }

@ -25,7 +25,6 @@ import { notification } from "antd";
// 进入编程页面时,首先调用开启编程题接口 // 进入编程页面时,首先调用开启编程题接口
export const startProgramQuestion = (id, props) => { export const startProgramQuestion = (id, props) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const {searchParams} = getState().ojFormReducer;
fetchStartProgram(id).then(res => { fetchStartProgram(id).then(res => {
const { status, data } = res; const { status, data } = res;
if (status === 200) { if (status === 200) {
@ -41,13 +40,6 @@ export const startProgramQuestion = (id, props) => {
}); });
// 跳转至开启编程 // 跳转至开启编程
if (identifier) { if (identifier) {
// let data = Object.assign({}, props);
// const path = {
// pathname: `/myproblems/${identifier}`,
// state: data
// }
// console.log(path);
// props.history.push(`/myproblems/${identifier}`);
props.history.push({ props.history.push({
pathname: `/myproblems/${identifier}`, pathname: `/myproblems/${identifier}`,
}); });
@ -115,24 +107,18 @@ export const saveUserCodeForInterval = (identifier, code) => {
type: types.AUTO_UPDATE_CODE, type: types.AUTO_UPDATE_CODE,
payload: true payload: true
}); });
// console.log('+++', userCode);
fetchUpdateCode(identifier, { fetchUpdateCode(identifier, {
code: Base64.encode(userCode) code: Base64.encode(userCode)
}).then(res => { }).then(res => {
if (res.data.status === 401) { if (res.data.status === 401) {
return; return;
}; };
// dispatch({
// type: types.RESTORE_INITIAL_CODE,
// payload: userCode
// });
setTimeout(() => { setTimeout(() => {
dispatch({ dispatch({
type: types.AUTO_UPDATE_CODE, type: types.AUTO_UPDATE_CODE,
payload: false payload: false
}) })
}, 1000); }, 1000);
// console.log('代码保存成功', res);
}).catch(() => { }).catch(() => {
dispatch({ dispatch({
type: types.AUTO_UPDATE_CODE, type: types.AUTO_UPDATE_CODE,
@ -337,11 +323,13 @@ export const debuggerCode = (identifier,value, type) => {
// 获取提交记录 // 获取提交记录
export const getUserCommitRecord = (identifier) => { export const getUserCommitRecord = (identifier) => {
return (dispatch, getState) => { return (dispatch, getState) => {
try {
const { pages: { limit, page } } = getState().ojForUserReducer; const { pages: { limit, page } } = getState().ojForUserReducer;
fetchUserCommitRecord(identifier, { fetchUserCommitRecord(identifier, {
limit, limit,
page page
}).then(res => { }).then(res => {
if (res) {
const { status, data } = res; const { status, data } = res;
if (status === 200) { if (status === 200) {
dispatch({ dispatch({
@ -349,7 +337,12 @@ export const getUserCommitRecord = (identifier) => {
payload: data payload: data
}) })
} }
}); }
})
} catch (error) {
console.log(error, '-------')
}
;
} }
} }
// 获取提交记录详情 // 获取提交记录详情
@ -405,7 +398,6 @@ export const submitUserCode = (identifier, inputValue, type) => {
function userCodeSubmit() { function userCodeSubmit() {
fetchUserCodeSubmit(identifier).then(res => { fetchUserCodeSubmit(identifier).then(res => {
// console.log('用户提交代码成功======》》》》》', res);
if (res.status === 200) { if (res.status === 200) {
if (res.data.status === 401) { if (res.data.status === 401) {
dispatch({ dispatch({
@ -415,7 +407,6 @@ export const submitUserCode = (identifier, inputValue, type) => {
return; return;
}; };
// 测评 // 测评
console.log('hack=====', hack);
codeEvaluate(dispatch, identifier, type, hack.time_limit, hack.status, hack.score, hack.passed); codeEvaluate(dispatch, identifier, type, hack.time_limit, hack.status, hack.score, hack.passed);
} }
}).catch(() => { }).catch(() => {
@ -427,10 +418,9 @@ export const submitUserCode = (identifier, inputValue, type) => {
} }
if (isUpdateCode) { if (isUpdateCode) {
fetchUpdateCode(identifier, { fetchUpdateCode(identifier, {
code: userCode code: Base64.encode(userCode)
}).then(res => { }).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化
if (res.data.status === 401) { if (res.data.status === 401) {
dispatch({ dispatch({
type: types.SUBMIT_LOADING_STATUS, type: types.SUBMIT_LOADING_STATUS,
@ -460,7 +450,6 @@ export const restoreInitialCode = (identifier, msg) => {
return (dispatch) => { return (dispatch) => {
fetchRestoreInitialCode(identifier).then(res => { fetchRestoreInitialCode(identifier).then(res => {
if (res.data.status === 401) return; if (res.data.status === 401) return;
// console.log('恢复初始代码====》》》》', res);
const { status, data } = res; const { status, data } = res;
if (status === 200) { if (status === 200) {
dispatch({ dispatch({
@ -515,7 +504,6 @@ export const changeRecordPagination = (page) => {
export const addNotes = (identifier, params, cb) => { export const addNotes = (identifier, params, cb) => {
return (dispatch) => { return (dispatch) => {
fetchAddNotes(identifier, params).then(res => { fetchAddNotes(identifier, params).then(res => {
// console.log('添加笔记成功===>>', res);
dispatch({ dispatch({
type: types.LOADING_STATUS, type: types.LOADING_STATUS,
payload: false payload: false

@ -12,9 +12,9 @@ import types from '../actions/actionTypes';
const init = { const init = {
ojForm: { ojForm: {
name: '', // 任务名称 name: '', // 任务名称
language: '', language: 'C',
description: '', description: '',
difficult: '', difficult: '1',
sub_discipline_id: '', // 方向 sub_discipline_id: '', // 方向
// category: '', // category: '',
// openOrNot: 1, // openOrNot: 1,

Loading…
Cancel
Save