Commit 9c59ba74 authored by baixian's avatar baixian

fix

parent 131fe054
......@@ -588,10 +588,10 @@ export default {
const { callBack } = payload;
let noCallTypeStudent = {};
noCallTypeStudent = callStudentOperateList.find(ele => ele.type == '');
if (noCallTypeStudent) {
message.error(`学生【${noCallTypeStudent.name}】未点名`, 0.5);
return;
}
// if (noCallTypeStudent) {
// message.error(`学生【${noCallTypeStudent.name}】未点名`, 0.5);
// return;
// }
if (callStudentSubmitting) {
return;
}
......@@ -603,9 +603,11 @@ export default {
});
const { sid } = yield select(state => state.webapp);
const callStudent = [];
console.log(callStudentOperateList, 'callStudentOperateList');
callStudentOperateList.forEach((ele) => {
callStudent.push(`${ele.student_id},${ele.type},${ele.student_type},${ele.expend || 0},${encodeURIComponent(ele.remark)},${ele.call_id || ''}`);
});
console.log(callStudent, 'callStudent');
const loading = message.loading('点名处理中...', 0);
const studentCallsDate = yield call(schedulemgtAjax.studentCalls, {
type: (callType == 1 || callType == 3) ? 1 : callType,
......
......@@ -87,8 +87,16 @@ export default {
checked: true,
unlimited: false,
},
type10: {
single: 0,
daily_limit: 0,
checked: true,
unlimited: false,
},
ruleList: [],
goodSaveSubmiting: false,
allStudentListTotal: 0,
allStudentFetching: false,
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -177,24 +185,45 @@ export default {
},
* integralModelStudentsList({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { params } = payload;
const { allStudentFetching, allStudentList } = yield select(state => state.integral);
yield put({
type: 'updateState',
payload: {
allStudentFetching: true,
},
});
if (!sid) {
return;
}
const hash = {};
const { studentListQueryParams } = yield select(state => state.studentclass);
const loadmessage = message.loading('数据加载中...', 0);
const newClassListQueryParams = Object.assign(studentListQueryParams, {
school_id: sid,
});
}, params);
const studentsinfo = yield call(studentsAjax.studentsList, newClassListQueryParams);
setTimeout(loadmessage);
if (studentsinfo.code == 200) {
const _list = allStudentList.concat(studentsinfo.data.list);
const new_list = _list.reduce((preVal, curVal) => {
// eslint-disable-next-line no-unused-expressions
hash[curVal.id] ? '' : hash[curVal.id] = true && preVal.push(curVal);
return preVal;
}, []);
yield put({
type: 'updateState',
payload: {
allStudentList: (studentsinfo.data && studentsinfo.data.list) || [],
allStudentFetching: false,
allStudentList: new_list,
allStudentListTotal: (studentsinfo.data && studentsinfo.data.total) || 0,
},
});
} else {
yield put({
type: 'updateState',
payload: {
allStudentFetching: false,
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
......@@ -458,8 +487,16 @@ export default {
checked: true,
unlimited: false,
},
type10: {
single: 0,
daily_limit: 0,
checked: true,
unlimited: false,
},
ruleList: [],
goodSaveSubmiting: false,
allStudentListTotal: 0,
allStudentFetching: false,
},
});
},
......@@ -472,7 +509,10 @@ export default {
type6,
type7,
type8,
type9, ruleLoading, ruleList,
type9,
ruleLoading,
ruleList,
type10,
} = yield select(state => state.integral);
const { sid } = yield select(state => state.webapp);
if (ruleLoading) {
......@@ -531,6 +571,11 @@ export default {
daily_limit: type9.unlimited ? -1 : type9.daily_limit,
school_id: sid,
},
10: {
single: type10.checked == false ? 0 : type10.single || 0,
daily_limit: type10.unlimited ? -1 : type10.daily_limit,
school_id: sid,
},
};
const newData = JSON.parse(JSON.stringify(data));
const postFunction = ruleList && ruleList.length > 0 ? goodsAjax.ruleEdit : goodsAjax.ruleAdd;
......
import { connect } from 'dva';
import React from 'react';
import { Icon, Button, Row, Col, Input, InputNumber, Select, Checkbox, Table, Modal, Form, Alert, Radio } from 'antd';
import moment from 'moment';
import {
Icon,
Button,
Row,
Col,
Input,
InputNumber,
Select,
Checkbox,
Table,
Modal,
Form,
Alert,
Radio,
DatePicker,
} from 'antd';
import pageStyle from './RenewEdit.less';
import { pageIn } from '../../utils/index';
const { Option } = Select;
const { TextArea } = Input;
const { RangePicker } = DatePicker;
class RenewEdit extends React.Component {
state = {
modeType: 0,
selectedCourse: {},
mybuyCourse: {},
start_date: '',
end_date: '',
};
componentDidMount() { // 挂载
}
......@@ -92,6 +110,9 @@ class RenewEdit extends React.Component {
this.props.form.setFieldsValue({
mode_type: value,
});
this.props.form.setFieldsValue({
buy: '',
});
if (value == 3) {
searchCourseRelateClass(selectedCourse.id || 0);
}
......@@ -100,6 +121,10 @@ class RenewEdit extends React.Component {
const { form, close } = this.props;
form.resetFields();
close();
this.setState({
start_date: '',
end_date: '',
});
}
checkData = (value) => {
let str = value.replace(/[^\d\.]/g, '');
......@@ -114,6 +139,25 @@ class RenewEdit extends React.Component {
[type]: this.checkData(e.target.value),
});
}
chooseTime = (e, dateStrings) => {
const { dispatch } = this.props;
const start = e[0] && moment(e[0]).unix();
const end = e[1] && moment(e[1]).unix();
const day = this.getDay(start, end);
this.props.form.setFieldsValue({
buy: day,
});
this.setState({
start_date: e[0] && moment(e[0]).format('YYYY-MM-DD'),
end_date: e[1] && moment(e[1]).format('YYYY-MM-DD'),
});
}
getDay = (start, end) => {
const days = end - start;
// eslint-disable-next-line radix
const day = parseInt(days / (60 * 60 * 24));
return (day + 1);
}
render() {
const {
visible,
......@@ -125,7 +169,10 @@ class RenewEdit extends React.Component {
toChangeOperator,
studentInfo,
} = this.props;
const { selectedCourse, modeType, mybuyCourse } = this.state;
const {
selectedCourse, modeType, mybuyCourse, start_date,
end_date,
} = this.state;
const { getFieldDecorator } = this.props.form;
return (
<Modal
......@@ -319,6 +366,10 @@ class RenewEdit extends React.Component {
<InputNumber placeholder="请输入购买天数" style={{ width: 200 }} />,
)}
&nbsp;&nbsp;
<span className={pageStyle.chooseDay}>
&nbsp;&nbsp;&nbsp;快速计算时间
<RangePicker value={[start_date == '' ? null : moment(start_date), end_date == '' ? null : moment(end_date)]} className={pageStyle.picker} onChange={this.chooseTime} />
</span>
</Form.Item>
</Col>
<Col className={pageStyle.course}>
......
......@@ -4,4 +4,16 @@
}
.changeOperate {
margin-left: 10px;
}
\ No newline at end of file
}
.chooseDay {
color: #1890ff;
font-size: 12px;
position: relative;
cursor: pointer;
.picker {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
}
import { connect } from 'dva';
import React from 'react';
import { Icon, Button, Tabs, Select, Form, InputNumber, Row, Col, Input, Radio, Modal, message } from 'antd';
import debounce from 'lodash/debounce';
import { Icon, Button, Tabs, Select, Form, InputNumber, Spin, Col, Input, Radio, Modal, message } from 'antd';
import pageStyle from './index.less';
import {
pageIn, hasBtnPower, btnPermission,
......@@ -16,6 +17,10 @@ const { TextArea } = Input;
class ClassMgtForm extends React.Component {
constructor(props) {
super(props);
this.onSearchStudent = debounce(this.onSearchStudent, 500);
}
componentDidMount() { // 挂载
pageIn('轻校-积分管理');
}
......@@ -38,6 +43,9 @@ class ClassMgtForm extends React.Component {
dispatch({
type: 'integral/integralModelStudentsList',
payload: {
params: {
perPage: 10,
},
},
});
dispatch({
......@@ -82,6 +90,56 @@ class ClassMgtForm extends React.Component {
}
handleScoreCancel = () => {
}
onPopupScrollStundent = (e) => {
e.persist();
const {
allStudentListTotal, allStudentList, studentListQueryParams, dispatch,
allStudentFetching,
} = this.props;
const { target } = e;
const st = target.scrollTop;
if (allStudentList.length == allStudentListTotal) {
return;
}
// eslint-disable-next-line no-empty
if (st + target.offsetHeight === target.scrollHeight) {
const nextScrollPage = studentListQueryParams.page + 1;
dispatch({
type: 'integral/updateState',
payload: {
allStudentFetching: true,
},
});
dispatch({
type: 'integral/integralModelStudentsList',
payload: {
params: {
page: nextScrollPage,
},
},
});
target.scrollTop -= 50;
}
}
onSearchStudent = (e) => {
const { dispatch } = this.props;
dispatch({
type: 'integral/updateState',
payload: {
allStudentFetching: true,
allStudentList: [],
},
});
dispatch({
type: 'integral/integralModelStudentsList',
payload: {
params: {
page: 1,
keyword: e,
},
},
});
}
render() {
const that = this;
const {
......@@ -90,6 +148,9 @@ class ClassMgtForm extends React.Component {
allStudentList,
editScoreVisible,
userPermission,
allStudentListTotal,
studentListQueryParams,
allStudentFetching,
} = this.props;
const operations = hasBtnPower('sjd/integralmanage', 'scoreChange') && btnPermission(userPermission, 902) && <BtnPermission btnId="90004"><Button onClick={() => this.integralBtn(true)} type="primary">积分变动</Button></BtnPermission>;
const formItemModalLineLayout = {
......@@ -143,7 +204,18 @@ class ClassMgtForm extends React.Component {
},
],
})(
<Select placeholder="请选择学员" style={{ width: 174 }} showSearch onChange={this.handleStudentChange}>
<Select
placeholder="请选择学员"
style={{ width: 174 }}
showSearch
allowClear
onPopupScroll={this.onPopupScrollStundent}
onSearch={this.onSearchStudent}
filterOption={(input, option) => {
return option && option.props && option.props.children && option.props.children.indexOf(input) >= 0;
}}
notFoundContent={allStudentFetching ? <Spin size="small" /> : null}
>
{allStudentList.map(ele => <Option key={ele.id} value={ele.id}>{ele.name}</Option>)}
</Select>,
)}
......@@ -209,15 +281,23 @@ function mapStateToProps(state) {
courseSubmiting,
editScoreVisible,
allStudentList,
allStudentListTotal,
allStudentFetching,
} = state.integral;
const {
userPermission,
} = state.webapp;
const {
studentListQueryParams,
} = state.studentclass;
return {
courseSubmiting,
editScoreVisible,
allStudentList,
userPermission,
allStudentListTotal,
studentListQueryParams,
allStudentFetching,
};
}
export default connect(mapStateToProps)(ClassMgt);
......
......@@ -57,6 +57,7 @@ class Integralsetting extends React.Component {
type7,
type8,
type9,
type10,
ruleLoading,
} = this.props;
const formItemLayout = {
......@@ -258,6 +259,25 @@ class Integralsetting extends React.Component {
</div>
</div>
</Col>
<Col span={24}>
<Checkbox onChange={e => this.valueChange(e, 10, 'checked')} className={pageStyle.checkItem} checked={type10.checked} />
<div className={pageStyle.checkLeftTip} style={{ display: 'inline-block' }}>
课后点评 <span className={pageStyle.checkboxTip}>(课后做出点评时送积分)</span>
</div>
<div className={pageStyle.formItem}>
<div className={pageStyle.formflex}>
<span className="ant-form-text">获得</span>
<InputNumber disabled={!type10.checked} onChange={e => this.valueChange(e, 10, 'single')} value={type10.single} min={0} />
<span className="ant-form-text">积分</span>
</div>
<div className={pageStyle.formflex1}>
<span className="ant-form-text">每日最高次数</span>
<InputNumber onClick={() => this.focusChange(10)} min={0} className={type10.unlimited == true ? pageStyle.number : pageStyle.numberActive} disabled={!type10.checked} onChange={e => this.valueChange(e, 10, 'daily_limit')} value={type10.daily_limit} />
<div className={pageStyle.sprit}>/</div>
<div onClick={e => this.valueChange(e, 10, 'unlimited')} className={type10.unlimited == true ? pageStyle.switchActive : pageStyle.switch}>不限</div>
</div>
</div>
</Col>
</Row>
</div>
</Form>
......@@ -281,6 +301,7 @@ function mapStateToProps(state) {
type7,
type8,
type9,
type10,
ruleLoading,
ruleList,
} = state.integral;
......@@ -294,6 +315,7 @@ function mapStateToProps(state) {
type7,
type8,
type9,
type10,
ruleLoading,
ruleList,
};
......
import { connect } from 'dva';
import React from 'react';
import { Icon, Button, Row, Col, Input, InputNumber, Select, Checkbox, Table, Modal, Form, Alert } from 'antd';
import moment from 'moment';
import {
Icon,
Button,
Row,
Col,
Input,
InputNumber,
Select,
Checkbox,
DatePicker,
Modal,
Form,
Alert,
} from 'antd';
import pageStyle from './RenewEdit.less';
import { pageIn } from '../../utils/index';
const { Option } = Select;
const { TextArea } = Input;
const { RangePicker } = DatePicker;
class RenewEdit extends React.Component {
state = {
modeType: 0,
selectedCourse: {},
mybuyCourse: {},
start_date: '',
end_date: '',
};
componentDidMount() { // 挂载
pageIn('续费管理');
// 初始化地图函数 自定义函数名init
// 定义map变量 调用 qq.maps.Map() 构造函数 获取地图显示容器
}
componentWillUnmount() { // 卸载
}
......@@ -98,6 +113,9 @@ class RenewEdit extends React.Component {
this.props.form.setFieldsValue({
mode_type: value,
});
this.props.form.setFieldsValue({
buy: '',
});
if (value == 3) {
searchCourseRelateClass(selectedCourse.id || 0);
}
......@@ -106,6 +124,10 @@ class RenewEdit extends React.Component {
const { form, close } = this.props;
form.resetFields();
close();
this.setState({
start_date: '',
end_date: '',
});
}
checkData = (value) => {
let str = value.replace(/[^\d\.]/g, '');
......@@ -120,6 +142,25 @@ class RenewEdit extends React.Component {
[type]: this.checkData(e.target.value),
});
}
chooseTime = (e, dateStrings) => {
const { dispatch } = this.props;
const start = e[0] && moment(e[0]).unix();
const end = e[1] && moment(e[1]).unix();
const day = this.getDay(start, end);
this.props.form.setFieldsValue({
buy: day,
});
this.setState({
start_date: e[0] && moment(e[0]).format('YYYY-MM-DD'),
end_date: e[1] && moment(e[1]).format('YYYY-MM-DD'),
});
}
getDay = (start, end) => {
const days = end - start;
// eslint-disable-next-line radix
const day = parseInt(days / (60 * 60 * 24));
return (day + 1);
}
render() {
const {
visible,
......@@ -130,7 +171,10 @@ class RenewEdit extends React.Component {
operator,
toChangeOperator,
} = this.props;
const { selectedCourse, modeType, mybuyCourse } = this.state;
const {
selectedCourse, modeType, mybuyCourse, start_date,
end_date,
} = this.state;
const { getFieldDecorator } = this.props.form;
return (
<Modal
......@@ -277,6 +321,10 @@ class RenewEdit extends React.Component {
<InputNumber placeholder="请输入购买天数" style={{ width: 200 }} />,
)}
&nbsp;&nbsp;
<span className={pageStyle.chooseDay}>
&nbsp;&nbsp;&nbsp;快速计算时间
<RangePicker value={[start_date == '' ? null : moment(start_date), end_date == '' ? null : moment(end_date)]} className={pageStyle.picker} onChange={this.chooseTime} />
</span>
</Form.Item>
</Col>
<Col className={pageStyle.course}>
......
......@@ -4,4 +4,16 @@
}
.changeOperate {
margin-left: 10px;
}
\ No newline at end of file
}
.chooseDay {
color: #1890ff;
font-size: 12px;
position: relative;
cursor: pointer;
.picker {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
}
......@@ -6,6 +6,7 @@ import pageStyle from './Renew.less';
import { pageIn } from '../../utils/index';
const { Option } = Select;
const { TextArea } = Input;
const { RangePicker } = DatePicker;
class StudentAddForm extends React.Component {
state = {
......@@ -22,6 +23,8 @@ class StudentAddForm extends React.Component {
},
],
modeType: 1,
start_date: '',
end_date: '',
// ages: 0,
// addVisible: false,
// delVisible: false,
......@@ -60,6 +63,29 @@ class StudentAddForm extends React.Component {
const { form, hide } = this.props;
form.resetFields();
hide();
this.setState({
start_date: '',
end_date: '',
});
}
chooseTime = (e, dateStrings) => {
const { dispatch } = this.props;
const start = e[0] && moment(e[0]).unix();
const end = e[1] && moment(e[1]).unix();
const day = this.getDay(start, end);
this.props.form.setFieldsValue({
buy: day,
});
this.setState({
start_date: e[0] && moment(e[0]).format('YYYY-MM-DD'),
end_date: e[1] && moment(e[1]).format('YYYY-MM-DD'),
});
}
getDay = (start, end) => {
const days = end - start;
// eslint-disable-next-line radix
const day = parseInt(days / (60 * 60 * 24));
return (day + 1);
}
render() {
const {
......@@ -70,7 +96,10 @@ class StudentAddForm extends React.Component {
operator,
toChangeOperator,
} = this.props;
const { modeType, modeTypeArr } = this.state;
const {
modeType, modeTypeArr, start_date,
end_date,
} = this.state;
const { getFieldDecorator } = this.props.form;
return (
<Modal
......@@ -232,6 +261,10 @@ class StudentAddForm extends React.Component {
<InputNumber min={1} style={{ width: 200 }} />,
)}
&nbsp;&nbsp;
<div className={pageStyle.chooseDay}>
&nbsp;&nbsp;&nbsp;快速计算时间
<RangePicker value={[start_date == '' ? null : moment(start_date), end_date == '' ? null : moment(end_date)]} className={pageStyle.picker} onChange={this.chooseTime} />
</div>
</Form.Item>
</Col>
<Col className={pageStyle.course}>
......
......@@ -3,4 +3,16 @@
}
.changeOperate {
margin-left: 10px;
}
\ No newline at end of file
}
.chooseDay {
color: #1890ff;
font-size: 12px;
position: relative;
cursor: pointer;
.picker {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
}
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