Commit 112079dc authored by sujie@126.com's avatar sujie@126.com

dd

parent 0f796515
......@@ -46,6 +46,26 @@ export default {
courseList: [],
teacherList: [],
classroomList: [],
allStudentList: [],
studentListQueryParams: {
school_id: 0,
page: 1,
perPage: 999,
keyword: '',
course_id: '',
class_id: '',
student_status: '',
age_start: '',
age_end: '',
birthday_month: '',
min_time: 0,
wechat_status: '',
assign_class_status: '',
schedule_id: '',
extra: 'time,recently_course',
birthday_start: '',
birthday_end: '',
},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -53,6 +73,42 @@ export default {
},
effects: {
* studentsList({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
if (!sid) {
return;
}
const { studentListQueryParams } = yield select(state => state.studentclass);
const loadmessage = message.loading('数据加载中...', 0);
const newClassListQueryParams = Object.assign(studentListQueryParams, {
school_id: sid,
});
const studentsinfo = yield call(studentsAjax.studentsList, newClassListQueryParams);
setTimeout(loadmessage);
if (studentsinfo.code == 200) {
yield put({
type: 'updateState',
payload: {
allStudentList: (studentsinfo.data && studentsinfo.data.list) || [],
},
});
} else {
message.error(studentsinfo.msg, 1);
}
},
* studentChange({ payload }, { call, put, select }) {
const { studentId } = payload;
if (!studentId) {
return;
}
const { allStudentList } = yield select(state => state.studentclass);
yield put({
type: 'updateState',
payload: {
studentDetail: allStudentList.find(ele => ele.id == studentId),
},
});
},
* addClassRoom({ payload }, { call, put, select }) {
const { value, form } = payload;
const { sid } = yield select(state => state.webapp);
......@@ -136,7 +192,8 @@ export default {
});
},
* queryinfo({ payload }, { call, put, select }) {
const { id } = payload;
const { id, isChang } = payload;
console.log(id, 'id');
yield put({
type: 'updateState',
payload: {
......@@ -155,6 +212,11 @@ export default {
yield put({
type: 'queryClassroomList',
});
if (!isChang) {
yield put({
type: 'studentsList',
});
}
},
* queryCoureList({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
......@@ -210,17 +272,19 @@ export default {
extra: 'honors,valid_course,classes_count',
});
if (studentsdetailData.code == 200) {
const studentCourses = studentsdetailData.data.student_courses;
const studentCourses = studentsdetailData.data.student_courses || [];
const courseIdsArr = [];
const coursesObj = {};
studentCourses.forEach((ele) => {
if (courseIdsArr.indexOf(ele.course_id) != -1) {
coursesObj[ele.course_id].push(ele);
} else {
coursesObj[ele.course_id] = [ele];
courseIdsArr.push(ele.course_id);
}
});
if (studentCourses.length > 0) {
studentCourses.forEach((ele) => {
if (courseIdsArr.indexOf(ele.course_id) != -1) {
coursesObj[ele.course_id].push(ele);
} else {
coursesObj[ele.course_id] = [ele];
courseIdsArr.push(ele.course_id);
}
});
}
studentsdetailData.data.courseIdsArr = courseIdsArr;
studentsdetailData.data.coursesObj = coursesObj;
yield put({
......@@ -331,7 +395,7 @@ export default {
yield put({
type: 'updateState',
payload: {
selectedCourse: studentCourseAndClassInfo[0],
selectedCourse: studentCourseAndClassInfo[0] || {},
studentClassObj,
studentCourseAndClassInfo,
},
......
......@@ -90,6 +90,15 @@ class JoinSchoolAddForm extends React.Component {
},
});
}
quitSystem = () => {
const { dispatch } = this.props;
dispatch({
type: 'webapp/signout',
payload: {
dispatch,
},
});
}
render() {
const {
schoolList,
......@@ -111,7 +120,8 @@ class JoinSchoolAddForm extends React.Component {
}
<span className={pageStyles.nickname}>{userInfo.nickname}</span>
</div>
<Button type="primary" onClick={this.goUserSetting} id="set" >设置</Button>
<Button type="primary" className={pageStyles.setbtn} onClick={this.goUserSetting} id="set" >设置</Button>
<Button type="" className={pageStyles.quitebtn} onClick={this.quitSystem} id="" >退出</Button>
</Row>
<Row className={pageStyles.schoollistbox}>
<div className={pageStyles.titlebox}>我的机构({schoolList.length})</div>
......
......@@ -18,6 +18,7 @@
background-color: #fff;
border-radius: 2px;
margin-bottom: 24px;
position: relative;
}
.userinfobox {
display: flex;
......@@ -102,6 +103,7 @@
border-radius: 3px;
line-height: 18px;
padding: 0 2px;
height: 20px;
}
.logintimebox {
padding: 0 31px;
......@@ -172,6 +174,14 @@
background-color: rgba(16,142,233,0.7);
}
}
.quitebtn {
position: absolute;
right: 20px;
}
.setbtn {
position: absolute;
right: 100px;
}
@media (max-width: 768px){
.content {
padding: 23px 8px 33px;
......
......@@ -174,6 +174,16 @@ class classChange extends React.Component {
// },
// });
// }
studentChange = (value) => {
const { dispatch } = this.props;
dispatch({
type: 'studentclass/queryinfo',
payload: {
id: value,
isChange: 1,
},
});
}
render() {
const { getFieldDecorator } = this.props.form;
const {
......@@ -191,6 +201,8 @@ class classChange extends React.Component {
classroomList,
classRoomMgtShow,
classRoomSubmitting,
allStudentList,
studentDetail,
} = this.props;
const visible = false;
const columnsr = [
......@@ -275,7 +287,9 @@ class classChange extends React.Component {
return (
<div className={`${pageStyle.container} studentclasscontainer`}>
<div className={pageStyle.headerbox}>
<Button icon="plus" className={pageStyle.headerbtn} type="primary" >选择学员</Button>
<Select className={pageStyle.selectitem} placeholder="请选择学员" value={studentDetail.id} onChange={e => this.studentChange(e)}>
{allStudentList.map(ele => <Option value={ele.id}>{ele.name}</Option>)}
</Select>
<Button className={pageStyle.headerbtn} >重置</Button>
</div>
<Row gutter={15}>
......@@ -363,6 +377,7 @@ function mapStateToProps(state) {
classroomList,
classRoomMgtShow,
classRoomSubmitting,
allStudentList,
} = state.studentclass;
return {
editClassModalShow,
......@@ -381,6 +396,7 @@ function mapStateToProps(state) {
classroomList,
classRoomMgtShow,
classRoomSubmitting,
allStudentList,
};
}
export default connect(mapStateToProps)(ClassMgt);
......
......@@ -18,7 +18,9 @@
margin-bottom: 8px;
}
.selectitem {
display: block;
// display: block;
margin-right: 10px;
width: 150px;
}
.formitem {
margin-bottom: 32px;
......
......@@ -348,6 +348,16 @@ class StudentMgt extends React.Component {
},
});
}
tabChange = (activeKey) => {
const { dispatch } = this.props;
if (activeKey == 3) {
dispatch({
type: 'studentsinfo/studentsModelLogs',
payload: {
},
});
}
}
render() {
const {
studentsdetail,
......@@ -635,7 +645,7 @@ class StudentMgt extends React.Component {
</div>
<div className={pageStyle.table}>
<div className={pageStyle.title}>
<Tabs defaultActiveKey="1">
<Tabs defaultActiveKey="1" onChange={this.tabChange}>
<TabPane tab="报读班级" key="1">
<div className={pageStyle.tabsbtn}>
<Button type={currentCourseQueryParams.type == 1 ? 'primary' : ''} style={{ marginRight: '15px' }} onClick={() => this.HistoryRead(1)}>当前报读班级</Button>
......
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