From 96f5a895761474315cff8be55979785ef94f5095 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 14 Oct 2019 11:30:49 +0800 Subject: [PATCH] CourseGroupListTable --- public/react/src/common/course/WordsBtn.js | 8 +- .../courses/members/CourseGroupList.js | 42 ++- .../courses/members/CourseGroupListTable.js | 240 ++++++++++++------ .../modules/courses/members/studentsList.css | 3 +- 4 files changed, 195 insertions(+), 98 deletions(-) diff --git a/public/react/src/common/course/WordsBtn.js b/public/react/src/common/course/WordsBtn.js index 85a85cfb6..e1fc5683d 100644 --- a/public/react/src/common/course/WordsBtn.js +++ b/public/react/src/common/course/WordsBtn.js @@ -8,20 +8,20 @@ class WordsBtn extends Component { } render() { - let{to, href,targets, style2 }=this.props + let{to, href,targets, style2, style, ...others }=this.props return( { to==undefined&&targets==undefined ? {this.props.children}: targets!=undefined? {this.props.children} : {this.props.children} } diff --git a/public/react/src/modules/courses/members/CourseGroupList.js b/public/react/src/modules/courses/members/CourseGroupList.js index 248a4d52d..e749adcf1 100644 --- a/public/react/src/modules/courses/members/CourseGroupList.js +++ b/public/react/src/modules/courses/members/CourseGroupList.js @@ -1,6 +1,6 @@ // 分班列表 加入分班 -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, useRef } from 'react' import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Divider, Popconfirm } from "antd"; import ClipboardJS from 'clipboard' @@ -21,6 +21,8 @@ import DownloadMessageysl from "../../modals/DownloadMessageysl"; import CreateGroupByImportModal from './modal/CreateGroupByImportModal' import ChangeRolePop from './ChangeRolePop' import CourseGroupListTable from './CourseGroupListTable' + +import './studentsList.css' /** 角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生 */ @@ -31,12 +33,20 @@ function CourseGroupList(props) { const [DownloadMessageval, setDownloadMessageval] = useState() const [listRes, setListRes] = useState({}) + const createGroupModalEl = useRef(null); const courseId = props.match.params.coursesId useEffect(() => { fetchAll() + on('updateNavSuccess', onOperationSuccess) + return () => { + off('updateNavSuccess', onOperationSuccess) + } }, []) + function onOperationSuccess() { + fetchAll() + } async function fetchAll() { const url = `/courses/${courseId}/course_groups.json` const response = await axios.get(url, { params: { @@ -54,7 +64,7 @@ function CourseGroupList(props) { } function addDir() { - + trigger('groupAdd', props.coursesids) } function deleteDir() { @@ -96,8 +106,8 @@ function CourseGroupList(props) { }); } - const isAdmin = true; - const isSuperAdmin = true; + const isAdmin = props.isAdmin(); + const isSuperAdmin = props.isSuperAdmin(); const isParent = true; const searchValue = ''; const isCourseEnd= ''; @@ -107,6 +117,7 @@ function CourseGroupList(props) { const total_count = listRes.group_count; const none_group_member_count = listRes.none_group_member_count; const course_groups = listRes.course_groups + const current_group_id = listRes.current_group_id let exportUrl = `/courses/${courseId}/export_member_scores_excel.xlsx?`; //总成绩 let exportUrltwo = `/courses/${courseId}/export_couser_info.xlsx?`; //课堂信息 @@ -131,16 +142,17 @@ function CourseGroupList(props) { isSuperAdmin && {/* ref="createGroupByImportModal" */} {/* this.refs['createGroupByImportModal'].setVisible(true) */} - {}}>导入创建分班 + {createGroupModalEl.current.setVisible(true)}}>导入创建分班 } { // pageType !== TYPE_STUDENTS && - !isCourseEnd && isAdmin && isParent && addDir()}>添加分班 } - { - isAdmin && !isParent && course_group_id != 0 && deleteDir()}>删除分班 } + !isCourseEnd && isAdmin && isParent && addDir()}>新建分班 } + {/* { + isAdmin && !isParent && course_group_id != 0 && deleteDir()}>删除分班 } */} {/* { isAdmin && !isParent && course_group_id != 0 && this.renameDir()}>分班重命名 } */}