From ba862bc5bdb08612ccac46cdd39d096ad72cce1c Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 10 Oct 2019 15:55:15 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=88=86=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Index.js | 5 ++++ .../src/modules/courses/ListPageIndex.js | 5 ++++ .../modules/courses/members/studentsList.js | 27 ++++++++++++++----- .../modules/courses/members/teacherList.js | 5 +++- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index c414df55a..70cc43f4c 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -661,6 +661,11 @@ class CoursesIndex extends Component{ (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) } ></Route> + <Route path="/courses/:coursesId/course_groups" + render={ + (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) + } + ></Route> {/* 普通作业 */} <Route path="/courses/:coursesId/common_homeworks/:category_id" exact diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js index c16959ab9..730a1bdce 100644 --- a/public/react/src/modules/courses/ListPageIndex.js +++ b/public/react/src/modules/courses/ListPageIndex.js @@ -232,6 +232,11 @@ class ListPageIndex extends Component{ (props) => (<StudentsList {...this.props} {...props} {...this.state} />) } ></Route> + <Route path="/courses/:coursesId/course_groups" + render={ + (props) => (<StudentsList {...this.props} {...props} {...this.state} />) + } + ></Route> <Route path="/courses/:coursesId/exercises/:Id" render={ diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index a30f63464..bb84a6def 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -16,7 +16,9 @@ import DownloadMessageysl from "../../modals/DownloadMessageysl"; import CreateGroupByImportModal from './modal/CreateGroupByImportModal' const Search =Input.Search; - +const TYPE_STUDENTS = 1 +const TYPE_COURSE_GOURP_PARENT = 2 +const TYPE_COURSE_GOURP_CHILD = 3 const buildColumns = (that,isParent) => { const { course_groups , sortedInfo } = that.state let showSorter = isParent==true @@ -581,6 +583,16 @@ class studentsList extends Component{ // console.log(paramsString); // console.log(checkBoxValues); // console.log(searchValue); + let pageType = TYPE_STUDENTS + if (this.props.match.path.endsWith('students')) { + + } else if (course_group_id) { + pageType = TYPE_COURSE_GOURP_PARENT + } else { + pageType = TYPE_COURSE_GOURP_CHILD + } + + return( <React.Fragment > <DownloadMessageysl @@ -590,7 +602,7 @@ class studentsList extends Component{ modalsType={this.state.DownloadType} /> <Titlesearchsection - title={isParent ? "学生列表" : + title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"): <React.Fragment> <span>{course_group_name || '未分班'}</span> {isAdmin && invite_code && <React.Fragment> @@ -617,15 +629,18 @@ class studentsList extends Component{ searchPlaceholder={ '请输入姓名、学号进行搜索' } firstRowRight={ <React.Fragment> - { isSuperAdmin && <React.Fragment> + { pageType !== TYPE_STUDENTS && isSuperAdmin && <React.Fragment> <CreateGroupByImportModal ref="createGroupByImportModal" {...this.props} createGroupImportSuccess={this.createGroupImportSuccess} ></CreateGroupByImportModal> <WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn> </React.Fragment> } - { !isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> } - { isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> } - { isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> } + { pageType !== TYPE_STUDENTS && + !isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> } + { + isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> } + { + isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> } <style>{` .drop_down_menu li a { padding: 0px; diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index c22b490ef..86ae7aa0b 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -98,7 +98,7 @@ function buildColumns(that) { return ( <ConditionToolTip title={`暂未有分班信息,不能操作`} condition={noGroups}> <span className="drop_down" style={{color: '#29BD8B', display: 'inline-block'}}> - { arg_course_groups.length == 0 ? '不限' : arg_course_groups.map(item => item.name).join(', ') } + { arg_course_groups.length == 0 ? '全部分班' : arg_course_groups.map(item => item.name).join(', ') } { isAdmin && <React.Fragment> <i className="iconfont icon-xiajiantou font-12 ml2"></i> @@ -645,6 +645,9 @@ class studentsList extends Component{ <React.Fragment> {/* { isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addTeacher()}>添加教师</WordsBtn> } { isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addStudent()}>添加学生</WordsBtn> } */} + + { isAdmin && <WordsBtn style="blue" className="fr" onClick={()=>this.showChangeAdminModal()}>更换管理员</WordsBtn>} + </React.Fragment> } secondRowLeft={ From b09659dcaf9464cf7cff78c0a9754c7d8ceeabb4 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 10 Oct 2019 16:11:16 +0800 Subject: [PATCH 2/5] pageType !== TYPE_STUDENTS && --- public/react/src/modules/courses/members/studentsList.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index bb84a6def..1b0b19d6f 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -629,13 +629,16 @@ class studentsList extends Component{ searchPlaceholder={ '请输入姓名、学号进行搜索' } firstRowRight={ <React.Fragment> - { pageType !== TYPE_STUDENTS && isSuperAdmin && <React.Fragment> + { + // pageType !== TYPE_STUDENTS && + isSuperAdmin && <React.Fragment> <CreateGroupByImportModal ref="createGroupByImportModal" {...this.props} createGroupImportSuccess={this.createGroupImportSuccess} ></CreateGroupByImportModal> <WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn> </React.Fragment> } - { pageType !== TYPE_STUDENTS && + { + // pageType !== TYPE_STUDENTS && !isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> } { isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> } From 0bf4455c61d754f41ae7965ad2e5e396e1586ed2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Oct 2019 16:29:49 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=B8=BB=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/shixun.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 4912ea15a..da6853ac0 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -129,7 +129,7 @@ class Shixun < ApplicationRecord end def main_mirror_id - mirror_repositories.published_main_mirror.first.try(:id) || -1 + mirror_repositories.where(main_type: 1).first.try(:id) || -1 end # 实训对应的镜像小类别名(已选) From f97277cb284037c7c3f9a8cb542f19f5fc0a8238 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Oct 2019 16:38:21 +0800 Subject: [PATCH 4/5] 1 --- app/models/mirror_repository.rb | 2 +- app/models/shixun.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb index e29b008ad..ddbc64e39 100644 --- a/app/models/mirror_repository.rb +++ b/app/models/mirror_repository.rb @@ -5,7 +5,7 @@ class MirrorRepository < ApplicationRecord - scope :published_mirror, -> { where(status: 1) } + scope :published_mirror, -> { where(status: [0,1]) } scope :published_main_mirror, -> { published_mirror.where(main_type: 1) } scope :published_small_mirror, -> { published_mirror.where(main_type: 0) } diff --git a/app/models/shixun.rb b/app/models/shixun.rb index da6853ac0..4912ea15a 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -129,7 +129,7 @@ class Shixun < ApplicationRecord end def main_mirror_id - mirror_repositories.where(main_type: 1).first.try(:id) || -1 + mirror_repositories.published_main_mirror.first.try(:id) || -1 end # 实训对应的镜像小类别名(已选) From 94b7e91bb29ec3b61b7b95578e1f7a26f6f3c770 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Oct 2019 16:42:55 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=95=9C=E5=83=8F=E8=A2=AB=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B9=9F=E8=83=BD=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mirror_repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb index ddbc64e39..96a92e5e7 100644 --- a/app/models/mirror_repository.rb +++ b/app/models/mirror_repository.rb @@ -5,7 +5,7 @@ class MirrorRepository < ApplicationRecord - scope :published_mirror, -> { where(status: [0,1]) } + scope :published_mirror, -> { where(status: [1,2,3,5]) } scope :published_main_mirror, -> { published_mirror.where(main_type: 1) } scope :published_small_mirror, -> { published_mirror.where(main_type: 0) }