@ -7,7 +7,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent'
import Titlesearchsection from '../common/titleSearch/TitleSearchSection'
import Titlesearchsection from '../common/titleSearch/TitleSearchSection'
import ColorCountText from '../common/titleSearch/ColorCountText'
import ColorCountText from '../common/titleSearch/ColorCountText'
import { WordsBtn , trigger , on , off , get Url, downloadFile , sortDirections } from 'educoder'
import { WordsBtn , trigger , on , off , get Randomcode, getRandomNumber , sortDirections } from 'educoder'
import Modals from "../../modals/Modals" ;
import Modals from "../../modals/Modals" ;
import axios from 'axios'
import axios from 'axios'
import _ from 'lodash'
import _ from 'lodash'
@ -24,7 +24,7 @@ const TYPE_COURSE_GOURP_CHILD = 3
const buildColumns = ( that , isParent ) => {
const buildColumns = ( that , isParent ) => {
const { course _groups , sortedInfo } = that . state
const { course _groups , sortedInfo } = that . state
let showSorter = isParent == true
let showSorter = isParent == true
const courseId = that . props . match . params . coursesId
const courseId = that . props . match . params . coursesId
const columns = [ {
const columns = [ {
title : '序号' ,
title : '序号' ,
dataIndex : 'id' ,
dataIndex : 'id' ,
@ -35,7 +35,7 @@ const buildColumns = (that,isParent) => {
render : ( id , student , index ) => {
render : ( id , student , index ) => {
return ( that . state . page - 1 ) * 20 + index + 1
return ( that . state . page - 1 ) * 20 + index + 1
}
}
} ,
} ,
// {
// {
// title: '用户id',
// title: '用户id',
// dataIndex: 'login',
// dataIndex: 'login',
@ -48,7 +48,7 @@ const buildColumns = (that,isParent) => {
// title={login && login.length > 10 ? login : ''}
// title={login && login.length > 10 ? login : ''}
// >{login}</span>
// >{login}</span>
// }
// }
// },
// },
{
{
title : '姓名' ,
title : '姓名' ,
dataIndex : 'name' ,
dataIndex : 'name' ,
@ -57,7 +57,7 @@ const buildColumns = (that,isParent) => {
width : "10%" ,
width : "10%" ,
className : "color-grey-6" ,
className : "color-grey-6" ,
render : ( name , record ) => {
render : ( name , record ) => {
return < a className = "color-dark overflowHidden1" target = "_blank"
return < a className = "color-dark overflowHidden1" target = "_blank"
style = { { maxWidth : '120px' } } href = { ` /users/ ${ record . login } ` } > { name } < / a >
style = { { maxWidth : '120px' } } href = { ` /users/ ${ record . login } ` } > { name } < / a >
}
}
} , {
} , {
@ -106,7 +106,7 @@ const buildColumns = (that,isParent) => {
}
}
}
}
] ;
] ;
if ( that . hasGroupModule ( ) ) {
if ( that . hasGroupModule ( ) ) {
that . isStudentPage && columns . push ( {
that . isStudentPage && columns . push ( {
title : '分班' ,
title : '分班' ,
@ -126,7 +126,7 @@ const buildColumns = (that,isParent) => {
if ( item . title === "学号" ) {
if ( item . title === "学号" ) {
columns . splice ( key , 1 )
columns . splice ( key , 1 )
return true
return true
}
}
} )
} )
}
}
const isAdmin = that . props . isAdmin ( )
const isAdmin = that . props . isAdmin ( )
@ -149,7 +149,7 @@ const buildColumns = (that,isParent) => {
render : ( text , record ) => {
render : ( text , record ) => {
return (
return (
< React . Fragment >
< React . Fragment >
< WordsBtn onClick = { ( ) => that . onDelete ( record ) } style = { 'grey' } > 删除学生 < / W o r d s B t n >
< WordsBtn onClick = { ( ) => that . onDelete ( record ) } style = { 'grey' } > 删除学生 < / W o r d s B t n >
{ record . member _roles && record . member _roles . length && < ChangeRolePop
{ record . member _roles && record . member _roles . length && < ChangeRolePop
style = { { marginLeft : '12px' } }
style = { { marginLeft : '12px' } }
courseId = { courseId }
courseId = { courseId }
@ -164,7 +164,7 @@ const buildColumns = (that,isParent) => {
)
)
} ,
} ,
} )
} )
}
}
return columns ;
return columns ;
@ -199,7 +199,7 @@ class studentsList extends Component{
}
}
}
}
/// 确认是否下载
/// 确认是否下载
confirmysl ( url ){
confirmysl ( url ,urls ){
// this.props.showGlobalLoading('正在生成文件,请稍后...')
// this.props.showGlobalLoading('正在生成文件,请稍后...')
axios . get ( url + 'export=true' ) . then ( ( response ) => {
axios . get ( url + 'export=true' ) . then ( ( response ) => {
if ( response === undefined ) {
if ( response === undefined ) {
@ -223,11 +223,11 @@ class studentsList extends Component{
} )
} )
}
}
} else {
} else {
// this.props.showNotification(`正在下载中`);
// this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank');
// window.open("/api"+url, '_blank');
this . props . slowDownload ( url)
this . props . slowDownload ( getRandomcode( url) )
// getUrl() + "/api"+
// getUrl() + "/api"+
// const fileUrl = url;
// const fileUrl = url;
@ -263,7 +263,7 @@ class studentsList extends Component{
DownloadMessageval : undefined
DownloadMessageval : undefined
} )
} )
}
}
inputStudent = ( e ) => {
inputStudent = ( e ) => {
this . setState ( {
this . setState ( {
StudentList _value : e . target . value
StudentList _value : e . target . value
@ -307,7 +307,7 @@ class studentsList extends Component{
modalCancel : false
modalCancel : false
} )
} )
}
}
onChange = ( ) => {
onChange = ( ) => {
}
}
@ -344,7 +344,7 @@ class studentsList extends Component{
this . fetchCourseGroups ( )
this . fetchCourseGroups ( )
this . fetchAll ( )
this . fetchAll ( )
}
}
addStudentSuccessListener = ( e , data ) => {
addStudentSuccessListener = ( e , data ) => {
const params = JSON . parse ( data )
const params = JSON . parse ( data )
this . props . updataleftNavfun ( )
this . props . updataleftNavfun ( )
@ -358,10 +358,10 @@ class studentsList extends Component{
// console.log('addStudentSuccessListener', data)
// console.log('addStudentSuccessListener', data)
}
}
fetchCourseGroups = ( ) => {
fetchCourseGroups = ( ) => {
const courseId = this . props . match . params . coursesId
const courseId = this . props . match . params . coursesId
let url = ` /courses/ ${ courseId } /all_course_groups.json `
let url = ` /courses/ ${ courseId } /all_course_groups.json `
axios . get ( url , {
axios . get ( url , {
} )
} )
. then ( ( response ) => {
. then ( ( response ) => {
@ -382,7 +382,7 @@ class studentsList extends Component{
this . setState ( { checkBoxValues : [ ] , checkAllValue : false } )
this . setState ( { checkBoxValues : [ ] , checkAllValue : false } )
this . fetchAll ( 1 )
this . fetchAll ( 1 )
}
}
// 加载了2次
// 加载了2次
// else if (prevProps.coursesids != this.props.coursesids) {
// else if (prevProps.coursesids != this.props.coursesids) {
// this.fetchAll(1)
// this.fetchAll(1)
@ -392,7 +392,7 @@ class studentsList extends Component{
this . setState ( {
this . setState ( {
isSpin : true
isSpin : true
} )
} )
let id = this . props . match . params . coursesId
let id = this . props . match . params . coursesId
let course _group _id = this . props . match . params . course _group _id
let course _group _id = this . props . match . params . course _group _id
const { coursesids } = this . props
const { coursesids } = this . props
@ -424,7 +424,7 @@ class studentsList extends Component{
}
}
axios . get ( encodeURI ( url ) ) . then ( ( result ) => {
axios . get ( encodeURI ( url ) ) . then ( ( result ) => {
if ( result . data . students ) {
if ( result . data . students ) {
this . setState ( {
this . setState ( {
students : result . data . students ,
students : result . data . students ,
total _count : result . data . students _count ,
total _count : result . data . students _count ,
course _group _name : result . data . course _group _name ,
course _group _name : result . data . course _group _name ,
@ -468,7 +468,7 @@ class studentsList extends Component{
} )
} )
}
}
onPageChange = ( page ) => {
onPageChange = ( page ) => {
this . fetchAll ( page )
this . fetchAll ( page )
this . setState ( { checkAllValue : false } )
this . setState ( { checkAllValue : false } )
}
}
@ -490,7 +490,7 @@ class studentsList extends Component{
return ;
return ;
}
}
let id = this . props . match . params . coursesId
let id = this . props . match . params . coursesId
let { order , searchValue } = this . state
let { order , searchValue } = this . state
let url = ` /courses/ ${ id } /transfer_to_course_group.json ` ;
let url = ` /courses/ ${ id } /transfer_to_course_group.json ` ;
axios . post ( ( url ) , {
axios . post ( ( url ) , {
@ -541,7 +541,7 @@ class studentsList extends Component{
// content: `确认要删除所选的${len}个学生吗?`,
// content: `确认要删除所选的${len}个学生吗?`,
content : ` 是否确认删除? ` ,
content : ` 是否确认删除? ` ,
onOk : ( ) => {
onOk : ( ) => {
let id = this . props . match . params . coursesId
let id = this . props . match . params . coursesId
let url = ` /courses/ ${ id } /delete_from_course.json ` ;
let url = ` /courses/ ${ id } /delete_from_course.json ` ;
axios . post ( ( url ) , {
axios . post ( ( url ) , {
students : [ { course _member _id : record . course _member _id } ] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
students : [ { course _member _id : record . course _member _id } ] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
@ -563,7 +563,7 @@ class studentsList extends Component{
trigger ( 'groupAdd' , this . props . coursesids )
trigger ( 'groupAdd' , this . props . coursesids )
}
}
doAddToDir = async ( ) => {
doAddToDir = async ( ) => {
const courseId = this . props . match . params . coursesId
const courseId = this . props . match . params . coursesId
const url = ` /courses/ ${ courseId } /join_course_group.json `
const url = ` /courses/ ${ courseId } /join_course_group.json `
const course _group _id = this . props . match . params . course _group _id
const course _group _id = this . props . match . params . course _group _id
@ -578,12 +578,12 @@ class studentsList extends Component{
}
}
addToDir = ( record ) => {
addToDir = ( record ) => {
this . props . confirm ( {
this . props . confirm ( {
content : ` 是否确认加入分班: ${ this . state . course _group _name } ? ` ,
content : ` 是否确认加入分班: ${ this . state . course _group _name } ? ` ,
okText : '确认' ,
okText : '确认' ,
cancelText : '取消' ,
cancelText : '取消' ,
onOk : ( ) => {
onOk : ( ) => {
this . doAddToDir ( )
this . doAddToDir ( )
} ,
} ,
@ -604,7 +604,7 @@ class studentsList extends Component{
< / d i v > ,
< / d i v > ,
onOk : ( ) => {
onOk : ( ) => {
const course _group _id = this . props . match . params . course _group _id
const course _group _id = this . props . match . params . course _group _id
const courseId = this . props . match . params . coursesId
const courseId = this . props . match . params . coursesId
const url = ` /course_groups/ ${ course _group _id } .json `
const url = ` /course_groups/ ${ course _group _id } .json `
axios . delete ( url )
axios . delete ( url )
@ -616,7 +616,7 @@ class studentsList extends Component{
} )
} )
. catch ( function ( error ) {
. catch ( function ( error ) {
console . log ( error ) ;
console . log ( error ) ;
} ) ;
} ) ;
}
}
} )
} )
}
}
@ -643,7 +643,7 @@ class studentsList extends Component{
const isCourseEnd = this . props . isCourseEnd ( )
const isCourseEnd = this . props . isCourseEnd ( )
let {
let {
page ,
page ,
order ,
order ,
StudentList _value ,
StudentList _value ,
stu _new _flag ,
stu _new _flag ,
@ -662,17 +662,19 @@ class studentsList extends Component{
let currentOrderName = '学生学号排序'
let currentOrderName = '学生学号排序'
if ( order == ORDER _BY _GROUP ) {
if ( order == ORDER _BY _GROUP ) {
currentOrderName = '分班名称排序'
currentOrderName = '分班名称排序'
}
}
const { coursesids } = this . props
const { coursesids } = this . props
const course _group _id = this . props . match . params . course _group _id
const course _group _id = this . props . match . params . course _group _id
const isParent = ! course _group _id || course _group _id == coursesids
const isParent = ! course _group _id || course _group _id == coursesids
const { course _group _name , invite _code } = this . state ;
const { course _group _name , invite _code } = this . state ;
const courseId = this . props . match . params . coursesId
const courseId = this . props . match . params . coursesId
let exportUrl = ` /courses/ ${ courseId } /export_member_scores_excel.xlsx? ` ; //总成绩
let exportUrl = ` /courses/ ${ courseId } /export_member_scores_excel.xlsx? ` ; //总成绩
let exportUrltwo = ` /courses/ ${ courseId } /export_couser_info.xlsx? ` ; //课堂信息
let exportUrltwo = ` /courses/ ${ courseId } /export_couser_info.xlsx? ` ; //课堂信息
let exportUrlthree = ` /courses/ ${ courseId } /export_member_act_score.xlsx? ` ; //活跃度
let exportUrlthree = ` /courses/ ${ courseId } /export_member_act_score.xlsx? ` ; //活跃度
const params = { }
const params = { }
if ( course _group _id ) {
if ( course _group _id ) {
params . group _id = course _group _id
params . group _id = course _group _id
@ -685,11 +687,13 @@ class studentsList extends Component{
}
}
let paramsString = ''
let paramsString = ''
for ( let key in params ) {
for ( let key in params ) {
paramsString += ` ${ key } = ${ params [ key ] } & `
paramsString += ` & ${ key } = ${ params [ key ] } & `
}
}
exportUrl += paramsString ;
exportUrl += paramsString ;
exportUrltwo += paramsString ;
exportUrltwo += paramsString ;
exportUrlthree += paramsString ;
exportUrlthree += paramsString ;
// console.log(paramsString);
// console.log(paramsString);
// console.log(checkBoxValues);
// console.log(checkBoxValues);
// console.log(searchValue);
// console.log(searchValue);
@ -725,7 +729,7 @@ class studentsList extends Component{
}
}
)
)
}
}
return (
return (
< React . Fragment >
< React . Fragment >
< DownloadMessageysl
< DownloadMessageysl
@ -735,7 +739,7 @@ class studentsList extends Component{
modalsType = { this . state . DownloadType }
modalsType = { this . state . DownloadType }
/ >
/ >
< Titlesearchsection
< Titlesearchsection
title = { isParent ? ( pageType == TYPE _STUDENTS ? "全部学生" : "学生列表" ) :
title = { isParent ? ( pageType == TYPE _STUDENTS ? "全部学生" : "学生列表" ) :
< React . Fragment >
< React . Fragment >
< span >
< span >
< Tooltip title = "返回至分班列表" >
< Tooltip title = "返回至分班列表" >
@ -756,9 +760,9 @@ class studentsList extends Component{
< i class = "iconfont icon-fuzhi font-14 ml10 copybtn" style = { { color : '#FF6800' , cursor : 'pointer' , verticalAlign : 'baseline' } } data - clipboard - text = { invite _code } > < / i >
< i class = "iconfont icon-fuzhi font-14 ml10 copybtn" style = { { color : '#FF6800' , cursor : 'pointer' , verticalAlign : 'baseline' } } data - clipboard - text = { invite _code } > < / i >
< / s p a n >
< / s p a n >
< / T o o l t i p >
< / T o o l t i p >
< / R e a c t . F r a g m e n t >
< / R e a c t . F r a g m e n t >
}
}
< / R e a c t . F r a g m e n t >
< / R e a c t . F r a g m e n t >
}
}
searchValue = { searchValue }
searchValue = { searchValue }
@ -766,24 +770,24 @@ class studentsList extends Component{
showSearchInput = { total _count >= 10 }
showSearchInput = { total _count >= 10 }
searchPlaceholder = { '请输入姓名、学号进行搜索' }
searchPlaceholder = { '请输入姓名、学号进行搜索' }
firstRowRight = {
firstRowRight = {
< React . Fragment >
< React . Fragment >
{ / * {
{ / * {
// pageType !== TYPE_STUDENTS &&
// pageType !== TYPE_STUDENTS &&
! isStudentPage && isSuperAdmin && < React . Fragment >
! isStudentPage && isSuperAdmin && < React . Fragment >
< CreateGroupByImportModal ref = "createGroupByImportModal" { ... this . props }
< CreateGroupByImportModal ref = "createGroupByImportModal" { ... this . props }
createGroupImportSuccess = { this . createGroupImportSuccess }
createGroupImportSuccess = { this . createGroupImportSuccess }
> < / C r e a t e G r o u p B y I m p o r t M o d a l >
> < / C r e a t e G r o u p B y I m p o r t M o d a l >
< WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . refs [ 'createGroupByImportModal' ] . setVisible ( true ) } > 导入创建分班 < / W o r d s B t n >
< WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . refs [ 'createGroupByImportModal' ] . setVisible ( true ) } > 导入创建分班 < / W o r d s B t n >
< /React.Fragment> } */ }
< /React.Fragment> } */ }
{
{
! isStudentPage && isAdmin && ! isParent && course _group _id != 0 && < WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . deleteDir ( ) } > 删除分班 < / W o r d s B t n > }
! isStudentPage && isAdmin && ! isParent && course _group _id != 0 && < WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . deleteDir ( ) } > 删除分班 < / W o r d s B t n > }
{
{
! isStudentPage && isAdmin && ! isParent && course _group _id != 0 && < WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . renameDir ( ) } > 分班重命名 < / W o r d s B t n > }
! isStudentPage && isAdmin && ! isParent && course _group _id != 0 && < WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . renameDir ( ) } > 分班重命名 < / W o r d s B t n > }
{
{
! isStudentPage && ! isCourseEnd && isAdmin && < WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . addDir ( ) } > 新建分班 < / W o r d s B t n > }
! isStudentPage && ! isCourseEnd && isAdmin && < WordsBtn style = "blue" className = "mr30" onClick = { ( ) => this . addDir ( ) } > 新建分班 < / W o r d s B t n > }
{
{
! isStudentPage && isStudent && ! isParent && course _group _id != 0 && < WordsBtn style = "blue" className = "" onClick = { ( ) => this . addToDir ( ) } > 加入分班 < / W o r d s B t n > }
! isStudentPage && isStudent && ! isParent && course _group _id != 0 && < WordsBtn style = "blue" className = "" onClick = { ( ) => this . addToDir ( ) } > 加入分班 < / W o r d s B t n > }
< style > { `
< style > { `
. drop _down _menu li a {
. drop _down _menu li a {
@ -815,6 +819,7 @@ class studentsList extends Component{
< li className = "li_line drop_down fr color-blue font-16" >
< li className = "li_line drop_down fr color-blue font-16" >
导出 < i className = "iconfont icon-xiajiantou font-12 ml2" > < / i >
导出 < i className = "iconfont icon-xiajiantou font-12 ml2" > < / i >
< ul className = "drop_down_menu" style = { { "right" : "-20px" , "left" : "unset" , "height" : "auto" } } >
< ul className = "drop_down_menu" style = { { "right" : "-20px" , "left" : "unset" , "height" : "auto" } } >
< li > < a
< li > < a
onClick = { ( i ) => this . confirmysl ( exportUrltwo ) } > 课堂信息 < / a >
onClick = { ( i ) => this . confirmysl ( exportUrltwo ) } > 课堂信息 < / a >
< / l i >
< / l i >
@ -824,6 +829,7 @@ class studentsList extends Component{
< li > < a
< li > < a
onClick = { ( i ) => this . confirmysl ( exportUrl ) } > 总成绩 < / a >
onClick = { ( i ) => this . confirmysl ( exportUrl ) } > 总成绩 < / a >
< / l i >
< / l i >
< / u l >
< / u l >
< / l i >
< / l i >
}
}
@ -854,7 +860,7 @@ class studentsList extends Component{
''
''
}
}
{
{
course _group _id != 0 && course _groups && course _groups . length > 0 &&
course _group _id != 0 && course _groups && course _groups . length > 0 &&
< li key = { 0 } onClick = { ( ) => this . moveToGroup ( { id : 0 } ) } > 未分班 < / l i >
< li key = { 0 } onClick = { ( ) => this . moveToGroup ( { id : 0 } ) } > 未分班 < / l i >
}
}
{ course _groups . filter ( ( item ) => {
{ course _groups . filter ( ( item ) => {
@ -865,8 +871,8 @@ class studentsList extends Component{
)
)
} ) }
} ) }
{ course _groups && course _groups . length > 0 && < Divider className = "dividerStyle" > < / D i v i d e r > }
{ course _groups && course _groups . length > 0 && < Divider className = "dividerStyle" > < / D i v i d e r > }
{ isAdmin && ! isCourseEnd &&
{ isAdmin && ! isCourseEnd &&
< p className = "drop_down_btn" >
< p className = "drop_down_btn" >
< a href = "javascript:void(0)" className = "color-grey-6"
< a href = "javascript:void(0)" className = "color-grey-6"
onClick = { ( ) => this . addDir ( ) }
onClick = { ( ) => this . addDir ( ) }
@ -876,10 +882,10 @@ class studentsList extends Component{
}
}
< / u l >
< / u l >
< / l i > }
< / l i > }
{ / * < l i c l a s s N a m e = " d r o p _ d o w n " >
{ / * < l i c l a s s N a m e = " d r o p _ d o w n " >
{ currentOrderName }
{ currentOrderName }
{ course _groups && ! ! course _groups . length &&
{ course _groups && ! ! course _groups . length &&
< React . Fragment >
< React . Fragment >
< i className = "iconfont icon-xiajiantou font-12 ml2" > < / i >
< i className = "iconfont icon-xiajiantou font-12 ml2" > < / i >
< ul className = "drop_down_normal" style = { { width : '124px' } } >
< ul className = "drop_down_normal" style = { { width : '124px' } } >
@ -893,7 +899,7 @@ class studentsList extends Component{
< / d i v >
< / d i v >
< Spin size = "large" spinning = { this . state . isSpin } >
< Spin size = "large" spinning = { this . state . isSpin } >
< div className = "clearfix stu_table" >
< div className = "clearfix stu_table" >
{ students && ! ! students . length && < Checkbox . Group style = { { width : '100%' } } onChange = { this . onCheckBoxChange } value = { checkBoxValues } >
{ students && ! ! students . length && < Checkbox . Group style = { { width : '100%' } } onChange = { this . onCheckBoxChange } value = { checkBoxValues } >
< Table columns = { studentlist } dataSource = { students } onChange = { this . onTableChange } pagination = { false } > < / T a b l e >
< Table columns = { studentlist } dataSource = { students } onChange = { this . onTableChange } pagination = { false } > < / T a b l e >
< / C h e c k b o x . G r o u p > }
< / C h e c k b o x . G r o u p > }
< / d i v >
< / d i v >