|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
import React, { useState, useEffect } from 'react'
|
|
|
|
|
|
|
|
|
|
import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Badge, Popconfirm } from "antd";
|
|
|
|
|
import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Badge, Popconfirm, Result } from "antd";
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
|
|
import { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections } from 'educoder'
|
|
|
|
|
import ClipboardJS from 'clipboard'
|
|
|
|
|
|
|
|
|
|
import './studentsList.css';
|
|
|
|
|
/**
|
|
|
|
|
角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
|
|
|
|
|
course_members_count: 0
|
|
|
|
@ -103,10 +103,30 @@ function CourseGroupListTable(props) {
|
|
|
|
|
dataIndex: 'invite_code',
|
|
|
|
|
key: 'invite_code',
|
|
|
|
|
align:'center',
|
|
|
|
|
width:"10%",
|
|
|
|
|
width:"21%",
|
|
|
|
|
className:"color-grey-6",
|
|
|
|
|
render: (invite_code, record, index) => {
|
|
|
|
|
return invite_code
|
|
|
|
|
return <React.Fragment>
|
|
|
|
|
<span>{invite_code}</span>
|
|
|
|
|
{
|
|
|
|
|
record.edit_auth ?
|
|
|
|
|
<span onClick={()=>changeInviteCode(record.id,record.invite_code_halt)} className={record.invite_code_halt ?"codeBtnStyle codeBtn_green ml10":"codeBtnStyle codeBtn_blue ml10"}>
|
|
|
|
|
{record.invite_code_halt ?"启用":"停用"}
|
|
|
|
|
</span>
|
|
|
|
|
:""
|
|
|
|
|
}
|
|
|
|
|
{isAdmin && !record.invite_code_halt &&
|
|
|
|
|
<Tooltip title={
|
|
|
|
|
<div>
|
|
|
|
|
<div>成员可以通过邀请码主动加入分班</div>
|
|
|
|
|
<div>点击复制邀请码</div>
|
|
|
|
|
</div>
|
|
|
|
|
}>
|
|
|
|
|
<WordsBtn data-clipboard-text={record.invite_code}
|
|
|
|
|
className={`copyBtn_${record.id} codeBtnStyle codeBtn_yellow ml10`} style={''}>复制</WordsBtn>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
}
|
|
|
|
|
} : {
|
|
|
|
|
title: '你当前所在分班',
|
|
|
|
@ -127,22 +147,12 @@ function CourseGroupListTable(props) {
|
|
|
|
|
dataIndex: 'setting',
|
|
|
|
|
key: 'setting',
|
|
|
|
|
align:'center',
|
|
|
|
|
width:"25%",
|
|
|
|
|
width:"14%",
|
|
|
|
|
className:"color-grey-6",
|
|
|
|
|
render: (none, record, index) => {
|
|
|
|
|
return <React.Fragment>
|
|
|
|
|
{!isCourseEnd && isAdmin && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => onDelete(record)} style={'grey'}>删除分班</WordsBtn>}
|
|
|
|
|
{isAdmin &&
|
|
|
|
|
<Tooltip title={
|
|
|
|
|
<div>
|
|
|
|
|
<div>成员可以通过邀请码主动加入分班</div>
|
|
|
|
|
<div>点击复制邀请码</div>
|
|
|
|
|
</div>
|
|
|
|
|
}>
|
|
|
|
|
<WordsBtn style2={{ marginRight: '12px' }} data-clipboard-text={record.invite_code}
|
|
|
|
|
className={`copyBtn_${record.id}`} style={''}>复制邀请码</WordsBtn>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{isStudent && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => addToDir(record)} style={''}>加入分班</WordsBtn>}
|
|
|
|
|
<WordsBtn onClick={() => onGoDetail(record)} style={''}>查看</WordsBtn>
|
|
|
|
|
</React.Fragment>
|
|
|
|
@ -209,6 +219,32 @@ function CourseGroupListTable(props) {
|
|
|
|
|
function onGoDetail(record) {
|
|
|
|
|
props.history.push(`/courses/${courseId}/course_groups/${record.id}`)
|
|
|
|
|
}
|
|
|
|
|
// 停用和启用邀请码
|
|
|
|
|
function changeInviteCode(id,flag){
|
|
|
|
|
if(flag){
|
|
|
|
|
changeInviteCodeFunc(id,flag);
|
|
|
|
|
}else{
|
|
|
|
|
props.confirm({
|
|
|
|
|
content:"分班邀请码停用后,用户不能主动加入该分班了",
|
|
|
|
|
subContent:'您是否确认停用?',
|
|
|
|
|
onOk:() => {
|
|
|
|
|
changeInviteCodeFunc(id,flag)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeInviteCodeFunc(id,flag){
|
|
|
|
|
const url= `/course_groups/${id}/set_invite_code_halt.json`;
|
|
|
|
|
axios.post(url).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
props.showNotification(`邀请码${flag?"启用":"停用"}成功!`);
|
|
|
|
|
props.onOperationSuccess && props.onOperationSuccess();
|
|
|
|
|
}
|
|
|
|
|
}).catch(error=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const isAdmin = props.isAdmin();
|
|
|
|
|
const isSuperAdmin = props.isSuperAdmin();
|
|
|
|
|
const isStudent = props.isStudent()
|
|
|
|
|