Commit 76b5e46a authored by baixian's avatar baixian

成员管理

parent a82ec764
......@@ -18,5 +18,5 @@
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="/dist/main.176234.js"></script></body>
<script type="text/javascript" src="/dist/main.902e50.js"></script></body>
</html>
\ No newline at end of file
......@@ -254,5 +254,7 @@ export default {
clockmember: {
list: `${dakaapi}member/subject_students`,
deleteSubjectStudent: `${dakaapi}member/subject_student/kick_out`,
unlockSubjectNum: `${dakaapi}member/unlock_subject/index`,
subjectDetail: `${dakaapi}member/unlock_subject/show`,
},
};
......@@ -24,6 +24,8 @@ export default {
subject_type: 1,
subject_id: 0,
},
subjectNumList: [],
subjectCount: 0,
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -40,6 +42,9 @@ export default {
school_id: sid,
});
let newTotal = clockListTotal;
if (newParams.subject_type != 3) {
delete newParams.checkpoint_id;
}
const data = yield call(memberListAjax.memberList, {
...newParams,
});
......@@ -89,6 +94,80 @@ export default {
});
}
},
* querySubjectDetail({ payload }, { call, put, select }) {
const { id } = payload;
const { sid } = yield select(state => state.webapp);
const data = yield call(memberListAjax.subjectDetail, {
id,
school_id: sid,
});
if (data.code == 200) {
yield put({
type: 'updateState',
payload: {
subjectCount: (data.data && data.data.subject_count) || {},
},
});
yield put({
type: 'querySubjectList',
payload: {
id,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* querySubjectList({ payload }, { call, put, select }) {
const { id } = payload;
const { sid } = yield select(state => state.webapp);
const { subjectCount } = yield select(state => state.clockmember);
const data = yield call(memberListAjax.unlockSubjectNum, {
id,
school_id: sid,
page: 1,
perPage: 300,
});
if (data.code == 200) {
const newList = data.data.list;
const count = subjectCount - data.data.total;
for (let i = 0; i < count; i++) {
newList.push({
id: 0,
title: '',
content: [],
force_status: 2,
force_num: 0,
text_require_status: 2,
text_require_num: 0,
image_require_status: 2,
image_require_num: 0,
video_require_status: 2,
video_require_num: 0,
audio_require_status: 2,
audio_require_num: 0,
});
}
yield put({
type: 'updateState',
payload: {
subjectNumList: newList,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* goBack({ payload }, { call, put, select }) {
yield put(routerRedux.goBack());
},
......@@ -99,6 +178,7 @@ export default {
params: {
page: 1,
perPage: 10,
checkpoint_id: 0,
},
},
});
......@@ -126,6 +206,8 @@ export default {
subject_type: 1,
subject_id: 0,
},
subjectNumList: [],
subjectCount: 0,
},
});
},
......
......@@ -14,6 +14,7 @@ import * as uploader from '../services/uploader';
import * as themeListAjax from '../services/newthemelist';
import * as themeAjax from '../services/createtheme';
import * as commonAjax from '../services/common';
import * as classMgtAjax from '../services/classmgt';
export default {
namespace: 'newthemelist',
state: {
......@@ -24,7 +25,9 @@ export default {
page: 1,
perPage: 10,
subject_type: 1,
class_id: '',
},
classList: [],
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -40,6 +43,11 @@ export default {
},
},
});
yield put({
type: 'queryClassList',
payload: {
},
});
},
* queryList({ payload }, { call, put, select }) {
const { params } = payload;
......@@ -200,15 +208,38 @@ export default {
* goBack({ payload }, { call, put, select }) {
yield put(routerRedux.goBack());
},
* queryClassList({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const classListData = yield call(classMgtAjax.getClassList, {
school_id: sid,
page: 1,
perPage: 1000,
});
if (classListData.code == 200) {
yield put({
type: 'updateState',
payload: {
classList: (classListData.data && classListData.data.list) || [],
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: classListData,
},
});
}
},
* reset({ payload }, { call, put, select }) {
yield put({
type: 'queryList',
payload: {
params: {
title: '',
status: '',
page: 1,
perPage: 10,
class_id: '',
},
},
});
......@@ -230,7 +261,9 @@ export default {
page: 1,
perPage: 10,
subject_type: 1,
class_id: '',
},
classList: [],
},
});
},
......
......@@ -1034,14 +1034,38 @@ export default {
const clockMemberActive = pathToRegexp('/sjd/member/:type/:id').exec(pathname);
if (clockMemberActive) {
dispatch({
type: 'clockmember/queryList',
type: 'clockmember/pageInit',
payload: {
params: {
subject_type: clockMemberActive[1],
subject_id: clockMemberActive[2],
},
},
});
if (clockMemberActive[1] == 3) {
dispatch({
type: 'clockmember/queryList',
payload: {
params: {
subject_type: clockMemberActive[1],
subject_id: clockMemberActive[2],
checkpoint_id: 0,
},
},
});
dispatch({
type: 'clockmember/querySubjectDetail',
payload: {
id: clockMemberActive[2],
},
});
} else {
dispatch({
type: 'clockmember/queryList',
payload: {
params: {
subject_type: clockMemberActive[1],
subject_id: clockMemberActive[2],
},
},
});
}
dispatch({
type: 'updateState',
payload: {
......@@ -1052,7 +1076,7 @@ export default {
},
{
path: pathname,
name: '员管理',
name: '员管理',
},
],
},
......@@ -1740,6 +1764,10 @@ export default {
yield put({
type: 'newthemelist/pageInit',
});
} else if (pathToRegexp('/sjd/member/:type/:id').exec(locationPathname)) {
yield put({
type: 'clockmember/pageInit',
});
}
// yield put({
// type: 'joinschooladd/pageInit',
......
......@@ -36,7 +36,7 @@ class LiveClass extends React.Component {
};
}
componentDidMount() { // 挂载
pageIn('学生管理');
pageIn('成员管理');
}
componentWillUnmount() { // 卸载
}
......@@ -58,12 +58,62 @@ class LiveClass extends React.Component {
},
});
}
searchParamsChange = (e, type, key) => {
const { dispatch } = this.props;
let getvalue = '';
if (type == 'Input') {
getvalue = e;
} else if (type == 'Select') {
getvalue = e;
}
dispatch({
type: 'clockmember/queryList',
payload: {
params: {
page: 1,
[key]: getvalue || '',
},
},
});
}
changePagination = (page, perPage) => {
const { dispatch } = this.props;
dispatch({
type: 'clockmember/queryList',
payload: {
params: {
page,
perPage,
},
},
});
}
sizeChange = (page, perPage) => {
const { dispatch } = this.props;
dispatch({
type: 'clockmember/queryList',
payload: {
params: {
page: 1,
perPage,
},
},
});
}
reset = () => {
const { dispatch } = this.props;
dispatch({
type: 'clockmember/reset',
});
}
render() {
const {
userPermission,
clockListParams,
clockListTotal,
clockList,
subjectNumList,
subjectCount,
} = this.props;
const columns = [
{
......@@ -109,8 +159,39 @@ class LiveClass extends React.Component {
},
},
];
if (clockListParams.subject_type == 3) {
columns.splice(3, 0, {
title: '已闯关卡',
dataIndex: 'max_clock_count',
key: 'max_clock_count',
});
}
return (
<div className={pageStyle.container}>
{
clockListParams.subject_type == 3 &&
<div className={pageStyle.searchbox}>
<Row
gutter={{
sm: 24, xs: 24, md: 24, lg: 24,
}}
className={pageStyle.searchrow}
>
<Col className={pageStyle.formitem} xs={{ span: 12 }} sm={{ span: 12 }} md={{ span: 4 }} lg={{ span: 4 }} xl={{ span: 4 }}>
<Select allowClear style={{ width: '100%', overflow: 'hidden' }} className={pageStyle.selectitem} value={clockListParams.checkpoint_id ? clockListParams.checkpoint_id : undefined} onChange={e => this.searchParamsChange(e, 'Select', 'checkpoint_id')} placeholder="全部关卡">
{subjectNumList.map((item, index) => <Option disabled={item.id == 0} key={item.id} value={item.id}>{index + 1 }关:{item.title ? item.title : '待完善'}</Option>)}
</Select>
</Col>
<Col className={pageStyle.formitem} xs={{ span: 4 }} sm={{ span: 4 }} md={{ span: 2 }} lg={{ span: 2 }} xl={{ span: 2 }}>
<div className={pageStyle.rightList}>
<Tooltip title="清空筛选">
<img onClick={this.reset} className={pageStyle.resetIcon} src={`${__IMGCDN__}common/reset.png`} alt="" />
</Tooltip>
</div>
</Col>
</Row>
</div>
}
<div className={pageStyle.tablebox}>
<Table
rowKey="id"
......@@ -148,6 +229,8 @@ function mapStateToProps(state) {
clockListParams,
clockListTotal,
clockList,
subjectNumList,
subjectCount,
} = state.clockmember;
const {
guideStep,
......@@ -165,6 +248,8 @@ function mapStateToProps(state) {
clockListParams,
clockListTotal,
clockList,
subjectNumList,
subjectCount,
};
}
export default connect(mapStateToProps)(LiveClassForm);
......
......@@ -13,6 +13,9 @@
}
padding-bottom: 18px;
}
.searchbox {
margin-bottom: 15px;
}
.searchrow {
.formitem {
display: flex;
......
......@@ -117,6 +117,7 @@ class LiveClass extends React.Component {
params: {
subject_type: type,
page: 1,
class_id: '',
},
},
});
......@@ -259,6 +260,7 @@ class LiveClass extends React.Component {
previewQrcodeShow,
previewQrcode,
downloadTitle,
classList,
} = this.props;
const columns = [
{
......@@ -340,10 +342,7 @@ class LiveClass extends React.Component {
{
record.status == 1 && <span className="hreflink" onClick={() => this.savePublish(record)}>发布<Divider type="vertical" /></span>
}
{/* { */}
{/* record.subject_type != 3 && */}
{/* <span className="hreflink" onClick={() => this.goClockMember(record)}>学生管理<Divider type="vertical" /></span> */}
{/* } */}
<span className="hreflink" onClick={() => this.goClockMember(record)}>成员管理<Divider type="vertical" /></span>
<span className="hreflink" onClick={() => this.lookClockMgt(record)}>扫码查看</span>
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.goClockMgt(record)}>点评</span>
......@@ -383,11 +382,19 @@ class LiveClass extends React.Component {
type="flex"
justify="end"
align="middle"
className={pageStyle.searchrow}
>
<Col className={pageStyle.formitem} xs={{ span: 12 }} sm={{ span: 12 }} md={{ span: 12 }} lg={{ span: 8 }} xl={{ span: 8 }}>
<div className={pageStyle.formitemlabel}>打卡名称:</div>
{/* eslint-disable-next-line react/no-string-refs */}
<Search allowClear style={{ width: '100%' }} ref="searchBar" placeholder="请输入打卡名称" onSearch={e => this.searchParamsChange(e, 'Input', 'title')} />
</Col>
<Col className={pageStyle.formitem} xs={{ span: 12 }} sm={{ span: 12 }} md={{ span: 12 }} lg={{ span: 8 }} xl={{ span: 8 }}>
<div className={pageStyle.formitemlabel}>所在班级:</div>
<Select allowClear style={{ width: '100%', overflow: 'hidden' }} className={pageStyle.selectitem} value={clockListParams.class_id ? clockListParams.class_id : undefined} onChange={e => this.searchParamsChange(e, 'Select', 'class_id')} placeholder="全部班级">
{classList.map(ele => <Option key={ele.id} value={ele.id}>{ele.title}</Option>)}
</Select>
</Col>
<Col className={pageStyle.formitem} xs={{ span: 4 }} sm={{ span: 4 }} md={{ span: 2 }} lg={{ span: 2 }} xl={{ span: 2 }}>
<div className={pageStyle.rightList}>
<Tooltip title="清空筛选">
......@@ -444,6 +451,7 @@ function mapStateToProps(state) {
clockListParams,
clockListTotal,
clockList,
classList,
} = state.newthemelist;
const {
guideStep,
......@@ -469,6 +477,7 @@ function mapStateToProps(state) {
previewQrcodeShow,
previewQrcode,
downloadTitle,
classList,
};
}
export default connect(mapStateToProps)(LiveClassForm);
......
......@@ -209,6 +209,15 @@ class LiveClass extends React.Component {
type: 'thememgt/reset',
});
}
goClockMember = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'newthemelist/goClockMember',
payload: {
record,
},
});
}
render() {
const {
userPermission,
......@@ -321,6 +330,7 @@ class LiveClass extends React.Component {
{
record.status == 1 && <span className="hreflink" onClick={() => this.savePublish(record)}>发布<Divider type="vertical" /></span>
}
<span className="hreflink" onClick={() => this.goClockMember(record)}>成员管理<Divider type="vertical" /></span>
<span className="hreflink" onClick={() => this.lookClockMgt(record)}>扫码查看</span>
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.goClockMgt(record)}>点评</span>
......
......@@ -16,3 +16,17 @@ export function deleteSubjectStudent(params) {
data,
});
}
export function unlockSubjectNum(params) {
const data = qs.stringify(params);
return request({
url: `${api.clockmember.unlockSubjectNum}?${data}`,
method: 'GET',
});
}
export function subjectDetail(params) {
const data = qs.stringify(params);
return request({
url: `${api.clockmember.subjectDetail}?${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