Commit 9463cde5 authored by baixian's avatar baixian

bug修改

parent fe5c7eed
import { routerRedux } from 'dva/router';
import { message } from 'antd';
import { delay } from 'redux-saga';
import co from 'co';
import {
LocalStorage,
SessionStorage,
isExpired,
getRandomFilename,
} from '../utils/index';
import * as classRecordAjax from '../services/classrecord';
import errorcode from '../common/errorcode';
import * as schedulemgtAjax from '../services/schedulemgt';
export default {
namespace: 'classrecord',
state: {
teacherList: [],
classList: [],
roomList: [],
courseList: [],
recordParams: {
teacher_id: '',
start_time: '',
end_time: '',
class_id: '',
status: '',
course_id: '',
class_room_id: '',
page: 1,
perPage: 10,
extra: 'student_count,call_teacher',
},
recordTotal: 0,
queryCallStudentListParams: {
school_id: 0,
page: 1,
perPage: 10,
schedule_id: 0,
},
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
},
},
effects: {
* queryinfo({ payload }, { call, put, select }) {
yield put({
type: 'webapp/querymemberinfo',
payload: {
},
});
yield delay(260);
yield put({
type: 'selectTeacher',
});
yield put({
type: 'selectClass',
});
yield put({
type: 'selectRoom',
});
yield put({
type: 'selectCourse',
});
yield put({
type: 'selectRecord',
payload: {
params: {
},
},
});
},
* selectRecord({ payload }, { call, put, select }) {
const { params } = payload;
const { sid, schoolUserInfo } = yield select(state => state.webapp);
const { recordParams, recordTotal } = yield select(state => state.classrecord);
const loading = message.loading('数据加载中...', 0.5);
let newParams;
if (schoolUserInfo && schoolUserInfo.type === 1) {
newParams = Object.assign(recordParams, params, {
school_id: sid,
teacher_id: schoolUserInfo.id,
});
} else {
newParams = Object.assign(recordParams, params, {
school_id: sid,
});
}
let newTotal = recordTotal;
const data = yield call(classRecordAjax.getRecordList, newParams);
setTimeout(loading);
if (data.code == 200) {
if (data.data.total != undefined) {
newTotal = data.data.total;
}
yield put({
type: 'updateState',
payload: {
recordList: data.data && data.data.list,
recordTotal: newTotal,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* selectTeacher({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const data = yield call(classRecordAjax.getTeacherList, {
school_id: sid,
page: 1,
perPage: 1000,
extra: 'schedules',
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
teacherList: data.data && data.data.list,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* selectClass({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const data = yield call(classRecordAjax.getClassList, {
school_id: sid,
page: 1,
perPage: 1000,
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
classList: data.data && data.data.list,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* selectRoom({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const data = yield call(classRecordAjax.getRoomsList, {
school_id: sid,
page: 1,
perPage: 1000,
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
roomList: data.data && data.data.list,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* selectCourse({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const data = yield call(classRecordAjax.getCourseList, {
school_id: sid,
page: 1,
perPage: 1000,
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
courseList: data.data && data.data.list,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* showCallDetail({ payload }, { call, put, select }) {
const { schedule } = payload;
yield put({
type: 'updateState',
payload: {
callDetailShow: true,
},
});
yield put({
type: 'queryEditCallStudentList',
payload: {
schedule,
params: {},
},
});
},
* queryEditCallStudentList({ payload }, { call, put, select }) {
const {
queryCallStudentListParams, callStudentTotal, callStudentListLoading,
} = yield select(state => state.classrecord);
const { schedule, params } = payload;
if (callStudentListLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
callStudentListLoading: true,
},
});
const { sid } = yield select(state => state.webapp);
let newcallStudentTotal = callStudentTotal;
let newqueryScheduleStudentListParams;
if (schedule) {
newqueryScheduleStudentListParams = Object.assign(queryCallStudentListParams, {
school_id: sid,
extra: 'time,recently_course',
schedule_id: schedule.id,
course_id: schedule.course_id,
});
}
newqueryScheduleStudentListParams = Object.assign(queryCallStudentListParams, params, {
school_id: sid,
extra: 'time,recently_course',
});
const callStudengListDate = yield call(schedulemgtAjax.getStudentCalls, newqueryScheduleStudentListParams);
yield put({
type: 'updateState',
payload: {
callStudentListLoading: false,
},
});
if (callStudengListDate.code == 200) {
if (callStudengListDate.data && callStudengListDate.data.total !== undefined) {
newcallStudentTotal = callStudengListDate.data.total;
}
const callStudentOperateList = [];
callStudengListDate.data.list.forEach((ele) => {
const ELE = {};
ELE.student_id = ele.student_id;
ELE.type = ele.type;
ELE.student_type = ele.student_type;
ELE.expend = ele.expend; // 统一的扣课时
ELE.remark = decodeURIComponent(ele.remark);
ELE.name = ele.formal_school_student.name;
ELE.mobile = ele.formal_school_student.mobile;
ELE.surplus = ele.surplus;
callStudentOperateList.push(ELE);
});
yield put({
type: 'updateState',
payload: {
queryScheduleStudentListParams: { ...newqueryScheduleStudentListParams },
callStudentList: callStudengListDate.data.list,
callStudentTotal: newcallStudentTotal,
callStudentOperateList,
},
});
}
},
* pageInit({ payload }, { call, put, select }) {
yield put({
type: 'updateState',
payload: {
teacherList: [],
classList: [],
roomList: [],
courseList: [],
recordParams: {
teacher_id: '',
start_time: '',
end_time: '',
class_id: '',
status: '',
course_id: '',
class_room_id: '',
page: 1,
perPage: 10,
extra: 'student_count,call_teacher',
},
recordTotal: 0,
queryCallStudentListParams: {
school_id: 0,
page: 1,
perPage: 10,
schedule_id: 0,
},
},
});
},
},
reducers: {
save(state, action) {
return { ...state, ...action.payload };
},
updateState(state, action) {
return { ...state, ...action.payload };
},
},
};
......@@ -44,6 +44,7 @@ import coursegatherindex from './coursegatherindex';
import coursemateria from './coursemateria';
import coursegatherdetail from './coursegatherdetail';
import uploadcourseware from './uploadcourseware';
import classrecord from './classrecord';
export default {
loginModel,
indexstaicModel,
......@@ -82,4 +83,5 @@ export default {
coursegatherindex,
coursegatherdetail,
uploadcourseware,
classrecord,
};
......@@ -337,6 +337,36 @@ export default {
// message.error(teacherstatus.msg, 1);
}
},
* deleteTeacher({ payload }, { call, put, select }) {
const { id, status } = payload;
const teacherstatus = yield call(teachersAjax.teachersStatus, {
status,
id,
});
if (teacherstatus.code == 200) {
message.success('删除成功', 1);
yield put({
type: 'teachersList',
payload: {
params: {},
},
});
} else {
yield put({
type: 'teachersList',
payload: {
params: {},
},
});
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: teacherstatus,
},
});
// message.error(teacherstatus.msg, 1);
}
},
* checkClass({ payload }, { call, put, select }) {
const { courseId } = payload;
const { teacher_id } = yield select(state => state.teachers);
......
......@@ -928,6 +928,20 @@ export default {
},
});
}
if (pathname === '/sjd/record') {
dispatch({
type: 'classrecord/queryinfo',
});
dispatch({
type: 'updateState',
payload: {
breadcrumbList: [{
path: pathname,
name: '上课记录',
}],
},
});
}
});
},
},
......@@ -1053,6 +1067,9 @@ export default {
yield put({
type: 'onlineclasses/pageInit',
});
yield put({
type: 'classrecord/pageInit',
});
},
* onPageEnter({ payload }, { put, call, select }) {
const { pathname } = payload;
......@@ -1208,6 +1225,7 @@ export default {
nickname: (nickname.data.schoolTeacher && nickname.data.schoolTeacher.nickname) || '',
avatar: (nickname.data.schoolTeacher && nickname.data.schoolTeacher.avatar) || '',
id: (nickname.data.schoolTeacher && nickname.data.schoolTeacher.id) || '',
type: (nickname.data.schoolTeacher && nickname.data.schoolTeacher.type) || '',
},
},
});
......
This diff is collapsed.
.container {
.totoalNum {
font-size:16px;
font-family:Microsoft YaHei;
font-weight:bold;
color:rgba(102,102,102,1);
background-color: #fff;
border-radius: 6px;
.headerWrap {
:global {
.ant-form-item {
margin-bottom: 15px;
}
}
}
.sizeColor1 {
font-size:14px;
font-weight:400;
color:#FF3434;
}
.hreflink {
color: #3A80E9;
.sizeColor2 {
font-size:14px;
font-weight:400;
color:#7BD762;
cursor: pointer;
}
:global {
.ant-form-inline .ant-form-item-with-help {
margin-bottom: 0;
}
}
.typeColor {
.typeColor1,.typeColor2,.typeColor3,.typeColor4 {
width: 48px;
height: 24px;
line-height: 24px;
font-size: 13px;
border-radius: 4px;
text-align: center;
}
}
.typeColor1 {
color: #66BD93;
background:rgba(102,189,147,0.15);
}
.typeColor2 {
color: #FFB97A;
background:rgba(255,185,122,0.15);
}
.typeColor3 {
color: #65B8F4;
background:rgba(101,184,244,0.15);
}
.typeColor4 {
color: #FF6B6B;
background:rgba(255,107,107,0.15);
}
.tableWrap {
padding: 20px;
}
import { connect } from 'dva';
import React from 'react';
import { Icon, Button, Row, Col, Input, Select, Checkbox, Table, Modal, Form, Alert } from 'antd';
import { Icon, Button, Row, Col, Input, Select, Checkbox, Table, Modal, Form, Alert, Tooltip } from 'antd';
import pageStyle from './index.less';
import EditClassModal from '../classmgt/EditClassModal';
import ClassRoomMgt from '../classmgt/classRoomMgt';
......@@ -208,8 +208,13 @@ class classChange extends React.Component {
key: 'title',
render: (text, record, index) => {
return (
<div className={pageStyle.classNamebox} >
{record.title}
<div>
<div className={pageStyle.classNamebox} >{record.title}</div>
<span className={pageStyle.lookTeacher}>
<Tooltip title={record.school_teachers.map((item, index) => <span>{item.nickname}&nbsp;&nbsp;&nbsp;</span>)}>
查看老师
</Tooltip>
</span>
</div>
);
},
......@@ -221,7 +226,7 @@ class classChange extends React.Component {
render: (text, record, index) => {
return (
<div >
{record.class_student_count}/{record.capacity}
在读{record.class_student_count}/容量{record.capacity}
</div>
);
},
......
......@@ -78,6 +78,7 @@
.classNamebox {
max-width: 250px;
word-break: break-all;
display: inline-block;
}
.tableoperatebox {
min-width: 160px;
......@@ -101,6 +102,13 @@
padding-left: 21px;
}
}
.lookTeacher {
color: #2194FF;
font-size:14px;
display: inline-block;
margin-left: 10px;
cursor: pointer;
}
.coursetd {
position: absolute;
top: 0;
......
import { connect } from 'dva';
import React from 'react';
import { Icon, Button, Row, Col, Input, Select, Modal, InputNumber, Radio, Table, Form, Pagination, message } from 'antd';
import {
Divider,
Button,
Row,
Col,
Input,
Select,
Modal,
InputNumber,
Radio,
Table,
Form,
Pagination,
message,
Icon,
} from 'antd';
import pageStyle from './index.less';
import EditTeacher from './EditTeacher';
import InviteCodeDialog from '../../components/InviteCodeDialog';
......@@ -258,6 +273,35 @@ class ClassMgt extends React.Component {
},
});
}
deleteTeacher = (record) => {
const { dispatch } = this.props;
console.log(record, 'record');
Modal.confirm({
title: `确认删除${record.nickname}老师吗?`,
okButtonProps: {
type: 'danger',
style: {
color: '#fff',
backgroundColor: '#ff4d4f',
borderColor: '#ff4d4f',
},
},
centered: true,
icon: <Icon type="info-circle" style={{ color: 'red' }} />,
onOk() {
dispatch({
type: 'teachers/deleteTeacher',
payload: {
status: 3,
id: record.id,
},
});
},
zIndex: 1100,
onCancel() {
},
});
}
render() {
const {
teachersinfo,
......@@ -367,6 +411,8 @@ class ClassMgt extends React.Component {
<div>
{record.status == 2 && '-'}
{record.status == 1 && <span disabled={record.status == 2} className="hreflink" onClick={() => this.handleChooseClass(record)} >选班</span>}
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.deleteTeacher(record)} >删除</span>
</div>
);
},
......
......@@ -50,7 +50,6 @@
color: #1890FF;
}
.tableoperatebox {
min-width: 160px;
line-height: 30px;
}
.formitemlabel {
......
......@@ -811,19 +811,15 @@ class teachersForm extends React.Component {
</div>
</div>
<div className={pageStyle.searchbox}>
<Row className={pageStyle.settingcontent}>
<Row type="flex" align="middle" className={pageStyle.settingcontent}>
<Col xs={{ span: 12 }} sm={{ span: 5 }} lg={{ span: 5 }} xl={{ span: 3 }} xxl={{ span: 2 }} className={pageStyle.avatarbox}>
<img className={pageStyle.avatar} src={(teachersdetail.avatar && imagify(teachersdetail.avatar)) || `${__IMGCDN__}defaultavatar.png`} alt={teachersdetail.nickname} />
</Col>
<Col span={12}>
<Descriptions>
<Descriptions.Item label="姓名" className={pageStyle.item}>{teachersdetail.nickname}</Descriptions.Item>
</Descriptions>
<Descriptions>
<Descriptions.Item label="号码">{teachersdetail.phone}</Descriptions.Item>
</Descriptions>
<Descriptions>
<Descriptions.Item label="备注">{teachersdetail.remark}</Descriptions.Item>
<Descriptions style={{ width: 600 }}>
<Descriptions.Item className={pageStyle.item}><img src={`${__IMGCDN__}/teacher/people_icon.png`} alt="" />{teachersdetail.nickname}</Descriptions.Item>
<Descriptions.Item className={pageStyle.item}><img src={`${__IMGCDN__}/teacher/phone_icon.png`} alt="" />{teachersdetail.phone}</Descriptions.Item>
<Descriptions.Item className={pageStyle.item} label="备注">{teachersdetail.remark}</Descriptions.Item>
</Descriptions>
</Col>
</Row>
......
......@@ -7,6 +7,18 @@
margin-bottom: 20px;
background-color: #fff;
}
.item {
:global {
.ant-descriptions-item-content {
&>img {
width: 22px;
height: 22px;
margin-right: 11px;
}
}
}
}
.headerbtn{
margin-right: 15px;
}
......
import qs from 'qs';
import request from '../utils/request';
import api from '../common/api';
export function getRecordList(params) {
const data = qs.stringify(params);
return request({
url: `${api.schedule}?${data}`,
method: 'GET',
});
}
export function getTeacherList(params) {
const data = qs.stringify(params);
return request({
url: `${api.teachers}?${data}`,
method: 'GET',
});
}
export function getRoomsList(params) {
const data = qs.stringify(params);
return request({
url: `${api.classroomMgt}?${data}`,
method: 'GET',
});
}
export function getCourseList(params) {
const data = qs.stringify(params);
return request({
url: `${api.courses.courses}?${data}`,
method: 'GET',
});
}
export function getClassList(params) {
const data = qs.stringify(params);
return request({
url: `${api.classMgt.common}?${data}`,
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