Commit a0b030aa authored by wangxuelai's avatar wangxuelai

''

parent cef4e8b6
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="dist/main.js?1575359807220" charset="utf-8"></script> <script src="dist/main.js?1575374432412" charset="utf-8"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -77,20 +77,28 @@ class CallStudentsForm extends React.Component { ...@@ -77,20 +77,28 @@ class CallStudentsForm extends React.Component {
}, delay); }, delay);
}; };
} }
checkData = (value) => {
let str = value.replace(/[^\d\.]/g, '');
const pointIndex = str.search(/\./);
if (pointIndex !== -1) {
str = str.substr(0, pointIndex + 1).replace(/\./, '.5');
}
return str;
}
changeExpand = (e) => { changeExpand = (e) => {
const { dispatch } = this.props; const { dispatch } = this.props;
(this.debounce(() => { (this.debounce(() => {
dispatch({ dispatch({
type: 'callstudents/changeExpandA', // 更新点名状态是到课或迟到学生为输入的课时数 type: 'callstudents/changeExpandA', // 更新点名状态是到课或迟到学生为输入的课时数
payload: { payload: {
value: e, value: this.checkData(String(e)),
}, },
}); });
}, 300))(); }, 300))();
dispatch({ dispatch({
type: 'callstudents/changeExpand', type: 'callstudents/changeExpand',
payload: { payload: {
value: e, value: this.checkData(String(e)),
}, },
}); });
} }
...@@ -99,7 +107,7 @@ class CallStudentsForm extends React.Component { ...@@ -99,7 +107,7 @@ class CallStudentsForm extends React.Component {
dispatch({ dispatch({
type: 'callstudents/callStudentExpendChange', type: 'callstudents/callStudentExpendChange',
payload: { payload: {
value: e, value: this.checkData(String(e)),
index, index,
}, },
}); });
......
...@@ -511,6 +511,7 @@ export default { ...@@ -511,6 +511,7 @@ export default {
}, },
* changeExpandA({ payload }, { call, put, select }) { * changeExpandA({ payload }, { call, put, select }) {
const { value } = payload; const { value } = payload;
console.log(value);
const { callStudentOperateList, copyExpend } = yield select(state => state.callstudents); const { callStudentOperateList, copyExpend } = yield select(state => state.callstudents);
let newValue = copyExpend; let newValue = copyExpend;
if (value >= copyExpend) { if (value >= copyExpend) {
......
...@@ -66,6 +66,19 @@ class EditClassModal extends React.Component { ...@@ -66,6 +66,19 @@ class EditClassModal extends React.Component {
title: e.target.value, title: e.target.value,
}); });
} }
checkData = (value) => {
let str = value.replace(/[^\d\.]/g, '');
const pointIndex = str.search(/\./);
if (pointIndex !== -1) {
str = str.substr(0, pointIndex + 1).replace(/\./, '.5');
}
return str;
}
changeValue = (e, type) => {
this.props.form.setFieldsValue({
[type]: this.checkData(e.target.value),
});
}
render() { render() {
const { const {
visible, visible,
...@@ -223,13 +236,9 @@ class EditClassModal extends React.Component { ...@@ -223,13 +236,9 @@ class EditClassModal extends React.Component {
{getFieldDecorator('expend', { {getFieldDecorator('expend', {
initialValue: editClassInfo.expend, initialValue: editClassInfo.expend,
rules: [ rules: [
{
pattern: /^\d+$/,
message: '请输入大于0的整数',
},
{ required: true, message: '课次消耗不能为空' }, { required: true, message: '课次消耗不能为空' },
], ],
})(<InputNumber placeholder="请输入课次消耗" style={{ width: '100%' }} />)} })(<InputNumber min={0} onBlur={e => this.changeValue(e, 'expend')} placeholder="请输入课次消耗" style={{ width: '100%' }} />)}
</Col> </Col>
<Col span={5} style={{ color: '#000000', fontSize: '14px' }}> <Col span={5} style={{ color: '#000000', fontSize: '14px' }}>
课时 课时
......
...@@ -210,12 +210,12 @@ class RenewEdit extends React.Component { ...@@ -210,12 +210,12 @@ class RenewEdit extends React.Component {
{getFieldDecorator('buy', { {getFieldDecorator('buy', {
rules: [ rules: [
{ {
required: false, required: true,
message: '请输入购买课时', message: '请输入购买课时',
}, },
], ],
})( })(
<InputNumber onBlur={e => this.changeValue(e, 'buy')} placeholder="请输入购买课时" style={{ width: 200 }} />, <InputNumber min={0} onBlur={e => this.changeValue(e, 'buy')} placeholder="请输入购买课时" style={{ width: 200 }} />,
)} )}
</Form.Item> </Form.Item>
</Col> </Col>
......
...@@ -31,7 +31,7 @@ class eliminateEdit extends React.Component { ...@@ -31,7 +31,7 @@ class eliminateEdit extends React.Component {
const { currentCourse } = this.state; const { currentCourse } = this.state;
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) { if (!err) {
if (currentCourse.surplus <= 0 && Number(currentCourse.give) < 0) { if (Number(currentCourse.surplus) <= 0) {
Modal.warn({ Modal.warn({
title: '学生的这个课程已经没有课时了,请提醒续费', title: '学生的这个课程已经没有课时了,请提醒续费',
}); });
...@@ -219,8 +219,13 @@ class eliminateEdit extends React.Component { ...@@ -219,8 +219,13 @@ class eliminateEdit extends React.Component {
> >
{getFieldDecorator('expend', { {getFieldDecorator('expend', {
rules: [ rules: [
{ required: false, message: currentCourse.course_mode == 1 ? '消耗课时不能为空' : '消耗时段不能为空' },
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (currentCourse.course_mode == 1 && value == '') {
callback('消耗课时不能为空');
return;
}
if (currentCourse.course_mode == 2 && !/^[1-9]\d*$/.test(value)) { if (currentCourse.course_mode == 2 && !/^[1-9]\d*$/.test(value)) {
callback('请输入大于0的整数'); callback('请输入大于0的整数');
return; return;
......
...@@ -634,7 +634,7 @@ class StudentMgt extends React.Component { ...@@ -634,7 +634,7 @@ class StudentMgt extends React.Component {
children: children:
<div className={pageStyle.classNamebox}> <div className={pageStyle.classNamebox}>
{record.course_mode == 1 && <span>{record.expend_buy}/{record.expend_give}</span>} {record.course_mode == 1 && <span>{record.expend_buy}/{record.expend_give}</span>}
{record.course_mode == 2 && <div style={{ textAlign: 'center' }}>剩余天数: {record.expend} </div>} {record.course_mode == 2 && <div style={{ textAlign: 'center' }}>剩余天数: {record.surplus} </div>}
{record.course_mode == 3 && '-'} {record.course_mode == 3 && '-'}
</div>, </div>,
props: {}, props: {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment