From 419d36af64b61a4148fab7a0064fcd883bbaad97 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 15 Oct 2019 14:49:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/members/CourseGroupList.js | 2 +-
.../courses/members/CourseGroupListTable.js | 21 +++++++--
.../modules/courses/members/studentsList.js | 46 +++++++++++++------
3 files changed, 51 insertions(+), 18 deletions(-)
diff --git a/public/react/src/modules/courses/members/CourseGroupList.js b/public/react/src/modules/courses/members/CourseGroupList.js
index ec0b23fb3..664e0d95a 100644
--- a/public/react/src/modules/courses/members/CourseGroupList.js
+++ b/public/react/src/modules/courses/members/CourseGroupList.js
@@ -152,7 +152,7 @@ function CourseGroupList(props) {
}
{
// pageType !== TYPE_STUDENTS &&
- !isCourseEnd && isAdmin && isParent && addDir()}>新建分班 }
+ !isCourseEnd && isAdmin && addDir()}>新建分班 }
{/* {
isAdmin && !isParent && course_group_id != 0 && deleteDir()}>删除分班 } */}
{/* {
diff --git a/public/react/src/modules/courses/members/CourseGroupListTable.js b/public/react/src/modules/courses/members/CourseGroupListTable.js
index 4645cf838..1560183f5 100644
--- a/public/react/src/modules/courses/members/CourseGroupListTable.js
+++ b/public/react/src/modules/courses/members/CourseGroupListTable.js
@@ -28,7 +28,6 @@ function CourseGroupListTable(props) {
}
course_groups.forEach((record) => {
const id = record.id
- debugger;
let _clipboard = new ClipboardJS(`.copyBtn_${id}`);
_clipboard.on('success', (e) => {
props.showNotification('复制成功')
@@ -142,7 +141,7 @@ function CourseGroupListTable(props) {
return columns
}
- const addToDir = async (record) => {
+ const doAddToDir = async (record) => {
const courseId = props.match.params.coursesId
const url = `/courses/${courseId}/join_course_group.json`
const course_group_id = record.id
@@ -151,11 +150,27 @@ function CourseGroupListTable(props) {
course_group_id
})
if (response && response.data.status == 0) {
- props.showNotification('加入成功')
+ props.showNotification(`已加入分班:${record.name}`)
props.updataleftNavfun()
props.onOperationSuccess && props.onOperationSuccess()
}
}
+ const addToDir = (record) => {
+ props.confirm({
+
+ content: `是否确认加入分班: ${record.name}?`,
+
+ okText: '确认',
+ cancelText: '取消',
+
+ onOk: () => {
+ doAddToDir(record)
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ }
function onDelete(record) {
props.confirm({
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index 9acc4c0bf..38a89584d 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -130,7 +130,7 @@ const buildColumns = (that,isParent) => {
}
const isAdmin = that.props.isAdmin()
if (isAdmin) {
- columns.unshift({
+ !that.isStudentPage && columns.unshift({
title: '',
dataIndex: 'check',
key: 'check',
@@ -547,7 +547,7 @@ class studentsList extends Component{
addDir = () => {
trigger('groupAdd', this.props.coursesids)
}
- addToDir = async () => {
+ doAddToDir = async () => {
const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/join_course_group.json`
const course_group_id = this.props.match.params.course_group_id
@@ -556,11 +556,27 @@ class studentsList extends Component{
course_group_id
})
if (response && response.data.status == 0) {
- this.props.showNotification('加入成功')
+ this.props.showNotification(`已加入分班:${this.state.course_group_name}`)
this.props.updataleftNavfun()
this.fetchAll()
}
}
+ addToDir = (record) => {
+ this.props.confirm({
+
+ content: `是否确认加入分班: ${this.state.course_group_name}?`,
+
+ okText: '确认',
+ cancelText: '取消',
+
+ onOk: () => {
+ this.doAddToDir()
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ }
renameDir = () => {
const course_group_id = this.props.match.params.course_group_id
trigger('groupRename', { id: parseInt(course_group_id), name: this.state.course_group_name})
@@ -670,7 +686,8 @@ class studentsList extends Component{
} else {
pageType = TYPE_COURSE_GOURP_CHILD
}
-
+ const isStudentPage = pageType == TYPE_STUDENTS
+ this.isStudentPage = isStudentPage
return(
@@ -708,23 +725,24 @@ class studentsList extends Component{
searchPlaceholder={ '请输入姓名、学号进行搜索' }
firstRowRight={
- {
+ {/* {
// pageType !== TYPE_STUDENTS &&
- isSuperAdmin &&
+ !isStudentPage && isSuperAdmin &&
this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班
- }
+ } */}
+
{
- // pageType !== TYPE_STUDENTS &&
- !isCourseEnd && isAdmin && isParent && this.addDir()}>添加分班 }
+ !isStudentPage && isAdmin && !isParent && course_group_id != 0 && this.deleteDir()}>删除分班 }
{
- isStudent && !isParent && course_group_id != 0 && this.addToDir()}>加入分班 }
+ !isStudentPage && isAdmin && !isParent && course_group_id != 0 && this.renameDir()}>分班重命名 }
{
- isAdmin && !isParent && course_group_id != 0 && this.deleteDir()}>删除分班 }
+ !isStudentPage && !isCourseEnd && isAdmin && isParent && this.addDir()}>新建分班 }
+
{
- isAdmin && !isParent && course_group_id != 0 && this.renameDir()}>分班重命名 }
+ !isStudentPage && isStudent && !isParent && course_group_id != 0 && this.addToDir()}>加入分班 }