|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Description: 新建或编辑任务
|
|
|
|
|
* @Author: tangjiang
|
|
|
|
|
* @Date: 2019-11-15 16:38:34
|
|
|
|
|
* @Author: tangjiang
|
|
|
|
|
* @Date: 2019-11-15 16:38:34
|
|
|
|
|
* @Last Modified by: tangjiang
|
|
|
|
|
* @Last Modified time: 2019-11-19 23:23:41
|
|
|
|
|
*/
|
|
|
|
@ -20,7 +20,7 @@ import actions from '../../../redux/actions';
|
|
|
|
|
// import {ModalConfirm} from '../../../common/components/ModalConfirm';
|
|
|
|
|
|
|
|
|
|
const NewOrEditTask = (props) => {
|
|
|
|
|
const {
|
|
|
|
|
const {
|
|
|
|
|
publishLoading,
|
|
|
|
|
handlePublish,
|
|
|
|
|
// testCases = [],
|
|
|
|
@ -41,7 +41,7 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
courseQuestions
|
|
|
|
|
// updateTestAndValidate,
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表单提交
|
|
|
|
|
const handleSubmitForm = () => {
|
|
|
|
|
// 改变loading状态
|
|
|
|
@ -53,7 +53,7 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
props.handleFormSubmit(props); // 提交表单
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// 获取用户信息
|
|
|
|
|
getUserInfoForNew();
|
|
|
|
@ -121,7 +121,7 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
// 清空描述信息
|
|
|
|
|
toStore('oj_description', '');
|
|
|
|
|
// props.history.push('/problems');
|
|
|
|
|
props.history.push(`/question?${props.searchParams}`);
|
|
|
|
|
props.history.push(`/problemset?${props.searchParams}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 发布
|
|
|
|
@ -163,8 +163,8 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
onClick={handleClickCancel}
|
|
|
|
|
style={{ background: '#666666', color: '#fff', border: 'none' }}
|
|
|
|
|
>取消</Button>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
loading={submitLoading}
|
|
|
|
|
onClick={handleSubmitForm}
|
|
|
|
|
>保存</Button>
|
|
|
|
@ -174,14 +174,14 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
// 发布/模拟挑战
|
|
|
|
|
const renderPubOrFight = () => {
|
|
|
|
|
const pubButton = isPublish
|
|
|
|
|
? (<Button
|
|
|
|
|
? (<Button
|
|
|
|
|
style={{ background: 'rgba(102,102,102,1)', border: 'none' }}
|
|
|
|
|
type="primary"
|
|
|
|
|
type="primary"
|
|
|
|
|
loading={publishLoading}
|
|
|
|
|
onClick={handleClickCancelPublish}
|
|
|
|
|
>撤销发布</Button>)
|
|
|
|
|
: (<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
: (<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
loading={publishLoading}
|
|
|
|
|
onClick={handleClickPublish}
|
|
|
|
|
>立即发布</Button>);
|
|
|
|
@ -191,13 +191,13 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
) : (
|
|
|
|
|
<Button type="primary" onClick={imitationChallenge}>模拟挑战</Button>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isPublish) {
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{pubButton}
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
loading={submitLoading}
|
|
|
|
|
onClick={handleSubmitForm}
|
|
|
|
|
>保存</Button>
|
|
|
|
@ -207,8 +207,8 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
} else {
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
loading={submitLoading}
|
|
|
|
|
onClick={handleSubmitForm}
|
|
|
|
|
>保存</Button>
|
|
|
|
@ -217,7 +217,7 @@ const NewOrEditTask = (props) => {
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 渲染退出
|
|
|
|
@ -296,7 +296,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|
|
|
|
clearOJFormStore: () => dispatch(actions.clearOJFormStore()),
|
|
|
|
|
// 按钮状态
|
|
|
|
|
changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)),
|
|
|
|
|
// 发布按钮状态
|
|
|
|
|
// 发布按钮状态
|
|
|
|
|
changePublishLoadingStatus: (flag) => dispatch(actions.changePublishLoadingStatus(flag)),
|
|
|
|
|
// 测试用例及验证
|
|
|
|
|
updateTestAndValidate: (obj) => dispatch(actions.updateTestAndValidate(obj)),
|
|
|
|
|