Commit df2d853f authored by wangxuelai's avatar wangxuelai

''

parent 3130d81f
......@@ -21,6 +21,7 @@ export default {
generateQrcode: `${dakaapi}common/qr_code_unlimit`,
myNickname: `${dakaapi}member/me`,
schedulesTime: `${dakaapi}member/erp/schedules_time`,
courseTemplate: `${dakaapi}member/erp/course_template`,
newLogin: {
loginPost: `${dakaapi}common/business_login`,
},
......
......@@ -12,6 +12,7 @@ import * as studentsAjax from '../services/students';
import * as teachersAjax from '../services/teachers';
import * as courseAjax from '../services/course';
import * as classMgtAjax from '../services/classmgt';
import * as commonAjax from '../services/common';
export default {
namespace: 'students',
......@@ -107,6 +108,19 @@ export default {
id: '',
nickname: '',
},
courseModuleList: [],
courseModuleTotal: 0,
selfJoinShow: false,
queryCourseModuleLoading: false,
courseModuleInfo: {
id: 0,
teacher_id: '',
course_id: '',
mode_type: '',
buy: '',
give: '',
class_ids: '',
},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -651,6 +665,80 @@ export default {
message.error(classListData.msg);
}
},
// 自主报名相关代码
* queryCourseModule({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { queryCourseModuleLoading } = yield select(state => state.students);
yield put({
type: 'updateState',
payload: {
queryCourseModuleLoading: true,
},
});
const listData = yield call(commonAjax.courseTemplateList, {
school_id: sid,
});
yield put({
type: 'updateState',
payload: {
queryCourseModuleLoading: false,
},
});
if (listData.code == 200) {
// courseModuleList: [],
// courseModuleTotal: 0,
yield put({
type: 'updateState',
payload: {
courseModuleTotal: listData.data.total,
courseModuleList: listData.data.list,
},
});
} else {
message.error(listData.msg, 1);
}
},
* saveAddCourseModule({ payload }, { call, put, select }) {
const { values, callback, errorCallback } = payload;
const { sid } = yield select(state => state.webapp);
const saveData = yield call(commonAjax.courseTemplateAdd, {
school_id: sid,
teacher_id: values.operator_id,
course_id: values.course_id,
mode_type: values.mode_type,
buy: values.buy || 0,
give: values.give || 0,
class_ids: !values.class_ids ? '' : values.class_ids.join(','),
});
if (saveData.code == 200) {
yield put({
type: 'queryCourseModule',
});
if (callback && (typeof callback == 'function')) {
callback();
}
} else {
if (errorCallback && (typeof errorCallback == 'function')) {
errorCallback();
}
message.error(saveData.msg, 1);
}
},
* delCourseModule({ payload }, { call, put, select }) {
const { info } = payload;
const { sid } = yield select(state => state.webapp);
const delData = yield call(commonAjax.courseTemplateDelete, {
id: info.id,
});
if (delData.code == 200) {
message.success('删除成功', 1);
yield put({
type: 'queryCourseModule',
});
} else {
message.error(delData.msg, 1);
}
},
},
reducers: {
save(state, action) {
......
This diff is collapsed.
.changeOperate {
margin-left: 10px;
}
.divideline {
color: #E9E9E9;
padding: 0 8px;
}
\ No newline at end of file
......@@ -6,15 +6,13 @@ import { pageIn, hasBtnPower } from '../../utils/index';
import RenewEdit from './RenewEdit';
import OperatorChange from '../../components/operatorChange';
import EliminateEdit from './eliminateEdit';
import SelfJoin from './SelfJoin';
import StudentAdd from './StudentAdd';
const { Option } = Select;
const { TextArea } = Input;
class StudentMgt extends React.Component {
state = {
cage: 0,
// ages: 0,
// addVisible: false,
// delVisible: false,
};
componentDidMount() { // 挂载
pageIn('学员管理');
......@@ -260,6 +258,116 @@ class StudentMgt extends React.Component {
},
});
}
// 自主报名相关代码
toSetSelfJoin = () => {
const { dispatch, schoolUserInfo } = this.props;
dispatch({
type: 'students/updateState',
payload: {
selfJoinShow: true,
operator: { ...schoolUserInfo },
},
});
dispatch({
type: 'students/queryCourseModule',
});
}
hideSelfJoin = () => {
const { dispatch } = this.props;
dispatch({
type: 'students/updateState',
payload: {
selfJoinShow: false,
},
});
}
saveAddCourseModule = (values, callback, errorCallback) => {
const { dispatch } = this.props;
dispatch({
type: 'students/saveAddCourseModule',
payload: {
values,
callback,
errorCallback,
},
});
}
delCourseModule = (info) => {
const { dispatch } = this.props;
Modal.confirm({
title: '确定删除报名课程模板吗?',
okButtonProps: {
type: 'danger',
style: {
color: '#fff',
backgroundColor: '#ff4d4f',
borderColor: '#ff4d4f',
},
},
centered: true,
icon: <Icon type="close-circle" style={{ color: 'red' }} />,
onOk: () => {
dispatch({
type: 'students/delCourseModule',
payload: {
info,
},
});
},
});
}
editCourseModule = (info) => {
const { dispatch } = this.props;
dispatch({
type: 'students/updateState',
payload: {
courseModuleInfo: {
id: info.id,
teacher_id: info.operator_id,
course_id: info.course_id,
mode_type: info.course_mode,
buy: info.buy,
give: info.give,
class_ids: JSON.parse(info.class_ids),
},
},
});
}
closeCourseQrcode = () => {
const { dispatch } = this.props;
dispatch({
type: 'students/updateState',
payload: {
courseModuleInfo: {
id: 0,
teacher_id: '',
course_id: '',
mode_type: '',
buy: '',
give: '',
class_ids: '',
},
},
});
}
toAddCourseQrcode = () => {
const { dispatch } = this.props;
dispatch({
type: 'students/updateState',
payload: {
courseModuleInfo: {
id: 0,
teacher_id: '',
course_id: '',
mode_type: '',
buy: '',
give: '',
class_ids: '',
},
},
});
}
// 自主报名相关代码
render() {
const { getFieldDecorator } = this.props.form;
const {
......@@ -285,6 +393,11 @@ class StudentMgt extends React.Component {
schoolUserInfo,
changeOperatorShow,
operator,
selfJoinShow,
queryCourseModuleLoading,
courseModuleTotal,
courseModuleList,
courseModuleInfo,
} = this.props;
const columns = [
{
......@@ -386,7 +499,7 @@ class StudentMgt extends React.Component {
<div className={pageStyle.headerbox}>
{hasBtnPower('sjd/student', 'addStudent') && <Button icon="plus" className={pageStyle.headerbtn} type="primary" onClick={() => this.setModal1Visible(true)}>添加</Button>}
{/* <Button className={pageStyle.headerbtn}>批量操作</Button> */}
{hasBtnPower('sjd/student', 'enrolCode') && <Button className={pageStyle.headerbtn}>自助报名二维码</Button>}
{hasBtnPower('sjd/student', 'enrolCode') && <Button className={pageStyle.headerbtn} onClick={this.toSetSelfJoin}>自助报名二维码</Button>}
{hasBtnPower('sjd/student', 'bundlingCode') && <Button className={pageStyle.headerbtn}>自助绑定二维码</Button>}
</div>
<div className={pageStyle.search}>
......@@ -547,6 +660,24 @@ class StudentMgt extends React.Component {
onHide={() => this.toChangeOperator(false)}
sureOperateChange={this.sureOperateChange}
/>
<SelfJoin
courseList={courseList}
classList={courseRelateClassList}
searchCourseRelateClass={this.searchCourseRelateClass}
saveAddCourseModule={this.saveAddCourseModule}
operator={operator}
toChangeOperator={this.toChangeOperator}
visible={selfJoinShow}
hide={this.hideSelfJoin}
queryCourseModuleLoading={queryCourseModuleLoading}
courseModuleTotal={courseModuleTotal}
courseModuleList={courseModuleList}
delCourseModule={this.delCourseModule}
courseModuleInfo={courseModuleInfo}
editCourseModule={this.editCourseModule}
closeCourseQrcode={this.closeCourseQrcode}
toAddCourseQrcode={this.toAddCourseQrcode}
/>
</div>
);
}
......@@ -577,6 +708,11 @@ function mapStateToProps(state) {
teacherList,
changeOperatorShow,
operator,
selfJoinShow,
queryCourseModuleLoading,
courseModuleTotal,
courseModuleList,
courseModuleInfo,
} = state.students;
const {
schoolUserInfo,
......@@ -603,6 +739,11 @@ function mapStateToProps(state) {
schoolUserInfo,
changeOperatorShow,
operator,
selfJoinShow,
queryCourseModuleLoading,
courseModuleTotal,
courseModuleList,
courseModuleInfo,
};
}
export default connect(mapStateToProps)(ForgotPassword);
......
......@@ -29,3 +29,40 @@ export function schedulesTimeList(params) {
method: 'GET',
});
}
export function courseTemplateList(params) {
const data = qs.stringify(params);
return request({
url: `${api.courseTemplate}?${data}`,
method: 'GET',
});
}
export function courseTemplateAdd(params) {
const data = qs.stringify(params);
return request({
url: `${api.courseTemplate}`,
method: 'POST',
data,
});
}
export function courseTemplateUpdate(params) {
const data = qs.stringify(params);
return request({
url: `${api.courseTemplate}/${params.id}`,
method: 'PUT',
data,
});
}
export function courseTemplateDelete(params) {
const data = qs.stringify(params);
return request({
url: `${api.courseTemplate}/${params.id}`,
method: 'DELETE',
});
}
export function courseTemplateDetail(params) {
const data = qs.stringify(params);
return request({
url: `${api.courseTemplate}/${params.id}`,
method: 'GET',
});
}
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