Commit a0b030aa authored by wangxuelai's avatar wangxuelai

''

parent cef4e8b6
......@@ -17,6 +17,6 @@
</head>
<body>
<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>
</html>
\ No newline at end of file
......@@ -77,20 +77,28 @@ class CallStudentsForm extends React.Component {
}, 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) => {
const { dispatch } = this.props;
(this.debounce(() => {
dispatch({
type: 'callstudents/changeExpandA', // 更新点名状态是到课或迟到学生为输入的课时数
payload: {
value: e,
value: this.checkData(String(e)),
},
});
}, 300))();
dispatch({
type: 'callstudents/changeExpand',
payload: {
value: e,
value: this.checkData(String(e)),
},
});
}
......@@ -99,7 +107,7 @@ class CallStudentsForm extends React.Component {
dispatch({
type: 'callstudents/callStudentExpendChange',
payload: {
value: e,
value: this.checkData(String(e)),
index,
},
});
......
......@@ -511,6 +511,7 @@ export default {
},
* changeExpandA({ payload }, { call, put, select }) {
const { value } = payload;
console.log(value);
const { callStudentOperateList, copyExpend } = yield select(state => state.callstudents);
let newValue = copyExpend;
if (value >= copyExpend) {
......
......@@ -66,6 +66,19 @@ class EditClassModal extends React.Component {
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() {
const {
visible,
......@@ -223,13 +236,9 @@ class EditClassModal extends React.Component {
{getFieldDecorator('expend', {
initialValue: editClassInfo.expend,
rules: [
{
pattern: /^\d+$/,
message: '请输入大于0的整数',
},
{ required: true, message: '课次消耗不能为空' },
],
})(<InputNumber placeholder="请输入课次消耗" style={{ width: '100%' }} />)}
})(<InputNumber min={0} onBlur={e => this.changeValue(e, 'expend')} placeholder="请输入课次消耗" style={{ width: '100%' }} />)}
</Col>
<Col span={5} style={{ color: '#000000', fontSize: '14px' }}>
课时
......
......@@ -210,12 +210,12 @@ class RenewEdit extends React.Component {
{getFieldDecorator('buy', {
rules: [
{
required: false,
required: true,
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>
</Col>
......
......@@ -31,7 +31,7 @@ class eliminateEdit extends React.Component {
const { currentCourse } = this.state;
this.props.form.validateFields((err, values) => {
if (!err) {
if (currentCourse.surplus <= 0 && Number(currentCourse.give) < 0) {
if (Number(currentCourse.surplus) <= 0) {
Modal.warn({
title: '学生的这个课程已经没有课时了,请提醒续费',
});
......@@ -219,8 +219,13 @@ class eliminateEdit extends React.Component {
>
{getFieldDecorator('expend', {
rules: [
{ required: false, message: currentCourse.course_mode == 1 ? '消耗课时不能为空' : '消耗时段不能为空' },
{
validator: (rule, value, callback) => {
if (currentCourse.course_mode == 1 && value == '') {
callback('消耗课时不能为空');
return;
}
if (currentCourse.course_mode == 2 && !/^[1-9]\d*$/.test(value)) {
callback('请输入大于0的整数');
return;
......
......@@ -634,7 +634,7 @@ class StudentMgt extends React.Component {
children:
<div className={pageStyle.classNamebox}>
{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 && '-'}
</div>,
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