update debug

dev_tpm_ui
tangjiang 5 years ago
parent fa3f779b4d
commit 6364cbd279

Binary file not shown.

@ -34,6 +34,7 @@ const NewOrEditTask = (props) => {
startProgramQuestion,
getUserInfoForNew,
handleCancelPublish,
validateOjForm,
// updateTestAndValidate,
} = props;
@ -69,14 +70,20 @@ const NewOrEditTask = (props) => {
// 模拟挑战
const imitationChallenge = () => {
// 调用 start 接口, 成功后跳转到模拟页面
identifier && startProgramQuestion(identifier, props);
// 先调用保存, 再调用 start 接口, 成功后跳转到模拟页面
// identifier && startProgramQuestion(identifier, props);
identifier && validateOjForm(props, 'challenge', () => {
startProgramQuestion(identifier, props);
});
}
// 开始挑战
const startChallenge = () => {
// 调用 start 接口, 成功后跳转到开启实战
// TODO
identifier && startProgramQuestion(identifier, props);
identifier && validateOjForm(props, 'challenge', () => {
startProgramQuestion(identifier, props);
});
// identifier && startProgramQuestion(identifier, props);
}
// 取消
@ -265,7 +272,8 @@ const mapDispatchToProps = (dispatch) => ({
// 开启模拟挑战
startProgramQuestion: (id, props) => dispatch(actions.startProgramQuestion(id, props)),
// 新建时获取信息
getUserInfoForNew: () => dispatch(actions.getUserInfoForNew())
getUserInfoForNew: () => dispatch(actions.getUserInfoForNew()),
validateOjForm: (props, type, cb) => dispatch(actions.validateOjForm(props, type, cb))
});
export default withRouter(connect(

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:35:40
* @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 10:37:58
* @LastEditTime : 2019-12-27 14:30:55
*/
import './index.scss';
// import 'katex/dist/katex.css';
@ -224,9 +224,9 @@ class EditTab extends React.Component {
// 描述信息变化时
const handleContentChange = (content, quill) => {
// console.log('描述信息为: ', content);
// if (quill.getText())
// console.log('========>>>>>', quill.getText().length);
if (quill.getText().length === 1) {
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
this.handleChangeDescription('');
} else {
// 保存获取的描述信息至redux中

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 16:35:46
* @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 15:45:28
* @LastEditTime : 2019-12-27 14:18:02
*/
import types from './actionTypes';
import CONST from '../../constants';
@ -17,6 +17,7 @@ import {
import { Base64 } from 'js-base64';
import { notification } from 'antd';
import { toStore } from 'educoder';
// import { startProgramQuestion } from ''
const { jcLabel } = CONST;
// 表单字段映射
const maps = {
@ -99,7 +100,7 @@ const payloadInfo = (key, value, errMsg, validateInfo) => ({
// }
// 表单提交验证
export const validateOjForm = (props, type) => {
export const validateOjForm = (props, type, cb) => {
return (dispatch, getState) => {
const {ojForm, testCases, identifier, code } = getState().ojFormReducer;
// console.log('code', code);
@ -247,44 +248,44 @@ export const validateOjForm = (props, type) => {
paramsObj['identifier'] = identifier;
}
// 调用保存或更新
if (type === 'publish') {
// 提示发布信息
publishTask(identifier).then(res => {
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
// 先调用保存接口
fetchPostOjForm(paramsObj).then(res => {
if (res.status === 200) { // 保存成功后,重新跳转至列表页
if (res.data.status === 0) {
// message.success('发布成功!');
notification.success({
message: '提示',
description: '发布成功!'
});
// linkToDev(dispatch, props);
// 改变发布状态值 0 => 1
// 改变按钮loading状态
dispatch({
type: types.CHANGE_PUBLISH_VALUE,
payload: 1
type: types.SUBMIT_LOADING_STATUS,
payload: false
});
}
}).catch(() => {
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
});
} else {
// 调用更新
fetchPostOjForm(paramsObj).then(res => {
if (res.status === 200) { // 保存成功后,重新跳转至列表页
if (res.data.status === 0) {
// 改变按钮loading状态
dispatch({
type: types.SUBMIT_LOADING_STATUS,
payload: false
if (type === 'publish') {
publishTask(identifier).then(res => {
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
if (res.data.status === 0) {
// message.success('发布成功!');
notification.success({
message: '提示',
description: '发布成功!'
});
// linkToDev(dispatch, props);
// 改变发布状态值 0 => 1
dispatch({
type: types.CHANGE_PUBLISH_VALUE,
payload: 1
});
}
}).catch(() => {
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
});
} else if (type === 'challenge') {
cb && cb();
} else {
// message.success(paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功');
notification.success({
message: '提示',
@ -296,17 +297,81 @@ export const validateOjForm = (props, type) => {
type: types.SAVE_OJ_FORM_ID,
payload: identifier
});
// 保存或更新后调用start接口
// linkToDev(dispatch, props);
}
}}
).catch(err => {
dispatch({
type: types.SUBMIT_LOADING_STATUS,
payload: false
});
// 保存或更新后调用start接口
// linkToDev(dispatch, props);
}
}}
).catch(err => {
dispatch({
type: types.SUBMIT_LOADING_STATUS,
payload: false
});
}
dispatch({
type: types.PUBLISH_LOADING_STATUS,
payload: false
});
});
// 调用保存或更新
// if (type === 'publish') {
// // 提示发布信息
// publishTask(identifier).then(res => {
// dispatch({
// type: types.PUBLISH_LOADING_STATUS,
// payload: false
// });
// if (res.data.status === 0) {
// // message.success('发布成功!');
// notification.success({
// message: '提示',
// description: '发布成功!'
// });
// // linkToDev(dispatch, props);
// // 改变发布状态值 0 => 1
// dispatch({
// type: types.CHANGE_PUBLISH_VALUE,
// payload: 1
// });
// }
// }).catch(() => {
// dispatch({
// type: types.PUBLISH_LOADING_STATUS,
// payload: false
// });
// });
// } else {
// // 调用更新
// fetchPostOjForm(paramsObj).then(res => {
// if (res.status === 200) { // 保存成功后,重新跳转至列表页
// if (res.data.status === 0) {
// // 改变按钮loading状态
// dispatch({
// type: types.SUBMIT_LOADING_STATUS,
// payload: false
// });
// // message.success(paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功');
// notification.success({
// message: '提示',
// description: paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功'
// });
// const {identifier} = res.data;
// // 保存成功后的identifier
// identifier && dispatch({
// type: types.SAVE_OJ_FORM_ID,
// payload: identifier
// });
// // 保存或更新后调用start接口
// // linkToDev(dispatch, props);
// }
// }}
// ).catch(err => {
// dispatch({
// type: types.SUBMIT_LOADING_STATUS,
// payload: false
// });
// });
// }
}
}
};

Loading…
Cancel
Save