调整选择问题

dev_hs
杨树明 5 years ago
parent 824d6cdca9
commit e4c3050827

@ -241,6 +241,7 @@ class HomeworkModal extends Component{
className="task-hide edu-txt-left"
name="shixun_homework[]"
value={item.id}
key={item.id}
>
<span style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name">{item.name}</span>
</Checkbox>

@ -351,6 +351,7 @@ class Selectresource extends Component{
<li className="fl" style={{width:'220px'}}>
<Checkbox
value={item.id}
key={item.id}
className="fl task-hide edu-txt-left"
style={{"width":"220px"}}
name="shixun_homework[]"

@ -198,7 +198,7 @@ class Sendtofilesmodal extends Component{
{ course_lists && course_lists.map( course => {
return (
<p className="clearfix mb7" key={course.id}>
<Checkbox className="fl" value={course.id} ></Checkbox>
<Checkbox className="fl" value={course.id} key={course.id} ></Checkbox>
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{course.name}</label></span>
</p>
)

@ -208,7 +208,7 @@ class CheckCodeModal extends Component{
{ candidates && candidates.map( candidate => {
return (
<p className="clearfix mb7" key={candidate.id}>
<Checkbox className="fl" value={candidate.id} ></Checkbox>
<Checkbox className="fl" value={candidate.id} key={candidate.id}></Checkbox>
<span className="fl with25">
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.name}</label>

@ -1,209 +1,209 @@
import React, { Component } from "react";
import { Modal, Checkbox, Input, Spin} from "antd";
import axios from 'axios'
import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller';
const Search = Input.Search
const pageCount = 15;
class SendToCourseModal extends Component{
constructor(props){
super(props);
this.state={
checkBoxValues: [],
course_lists: [],
course_lists_after_filter: [],
searchValue: '',
hasMore: true,
loading: false,
page: 1
}
}
fetchCourseList = (arg_page) => {
const page = arg_page || this.state.page;
// search=''&
let url = `/courses/mine.json?page=${page}&page_size=${pageCount}`
const searchValue = this.state.searchValue.trim()
if (searchValue) {
url += `&search=${searchValue}`
}
this.setState({ loading: true })
axios.get(url, {
})
.then((response) => {
if (!response.data.data || response.data.data.length == 0) {
this.setState({
course_lists: page == 1 ? [] : this.state.course_lists,
page,
loading: false,
hasMore: false,
})
} else {
this.setState({
course_lists: page == 1 ? response.data.data : this.state.course_lists.concat(response.data.data),
course_lists_after_filter: response.data.data,
page,
loading: false,
hasMore: response.data.data.length == pageCount
})
}
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
setTimeout(() => {
this.fetchCourseList()
}, 500)
}
setVisible = (visible) => {
this.refs.modalWrapper.setVisible(visible)
if (visible == false) {
this.setState({
checkBoxValues: []
})
}
}
onSendOk = () => {
if (!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) {
this.props.showNotification('请先选择要发送至的课堂')
return;
}
if(this.props.url==="/files/bulk_send.json"){
axios.post("/files/bulk_send.json", {
course_id:this.props.match.params.coursesId,
ids: this.props.selectedMessageIds,
to_course_ids: this.state.checkBoxValues
})
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.gobackonSend(response.data.message)
}
})
.catch(function (error) {
console.log(error);
});
}else{
const bid = this.props.match.params.boardId
const url = `/boards/${bid}/messages/bulk_send.json`
axios.post(url, {
ids: this.props.selectedMessageIds,
to_course_ids: this.state.checkBoxValues
})
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.showNotification('发送成功')
}
})
.catch(function (error) {
console.log(error);
});
}
}
onOk = () => {
const { course_lists, checkBoxValues } = this.state
this.onSendOk()
// this.props.onOk && this.props.onOk(checkBoxValues)
// this.refs.modalWrapper.setVisible(false)
}
onCheckBoxChange = (checkBoxValues) => {
this.setState({
checkBoxValues: checkBoxValues
})
}
onSearchChange = (e) => {
this.setState({
searchValue: e.target.value
})
}
handleInfiniteOnLoad = () => {
console.log('loadmore...')
this.fetchCourseList(this.state.page + 1)
}
onSearch = () => {
// const course_lists_after_filter = this.state.course_lists.filter( item => item.name.indexOf(this.state.searchValue) != -1 )
// this.setState({ course_lists_after_filter })
this.fetchCourseList(1)
}
render(){
const { course_lists, checkBoxValues, searchValue, loading, hasMore } = this.state
const { moduleName } = this.props
return(
<ModalWrapper
ref="modalWrapper"
title={`发送${moduleName}`}
{...this.props }
onOk={this.onOk}
>
<style>
{`
.demo-loading-container {
position: absolute;
bottom: 93px;
width: 82%;
text-align: center;
}`}
</style>
<p className="color-grey-6 mb20 edu-txt-center" style={{ fontWeight: "bold" }} >选择的{moduleName}发送到<span className="color-orange-tip">指定课堂</span></p>
<Search
className="mb14"
value={searchValue}
placeholder="请输入课堂名称进行搜索"
onChange={this.onSearchChange}
onSearch={this.onSearch}
></Search>
<div>
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
<div className="edu-back-skyblue padding15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
<InfiniteScroll
threshold={10}
initialLoad={false}
pageStart={0}
loadMore={this.handleInfiniteOnLoad}
hasMore={!loading && hasMore}
useWindow={false}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ course_lists && course_lists.map( course => {
return (
<p className="clearfix mb7" key={course.id}>
<Checkbox className="fl" value={course.id} ></Checkbox>
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{course.name}</label></span>
</p>
)
}) }
</Checkbox.Group>
{loading && hasMore && (
<div className="demo-loading-container">
<Spin />
</div>
)}
{/* TODO */}
{/* {
!hasMore && <div>没有更多了</div>
} */}
</InfiniteScroll>
</div>
</div>
</ModalWrapper>
)
}
}
export default SendToCourseModal;
import React, { Component } from "react";
import { Modal, Checkbox, Input, Spin} from "antd";
import axios from 'axios'
import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller';
const Search = Input.Search
const pageCount = 15;
class SendToCourseModal extends Component{
constructor(props){
super(props);
this.state={
checkBoxValues: [],
course_lists: [],
course_lists_after_filter: [],
searchValue: '',
hasMore: true,
loading: false,
page: 1
}
}
fetchCourseList = (arg_page) => {
const page = arg_page || this.state.page;
// search=''&
let url = `/courses/mine.json?page=${page}&page_size=${pageCount}`
const searchValue = this.state.searchValue.trim()
if (searchValue) {
url += `&search=${searchValue}`
}
this.setState({ loading: true })
axios.get(url, {
})
.then((response) => {
if (!response.data.data || response.data.data.length == 0) {
this.setState({
course_lists: page == 1 ? [] : this.state.course_lists,
page,
loading: false,
hasMore: false,
})
} else {
this.setState({
course_lists: page == 1 ? response.data.data : this.state.course_lists.concat(response.data.data),
course_lists_after_filter: response.data.data,
page,
loading: false,
hasMore: response.data.data.length == pageCount
})
}
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
setTimeout(() => {
this.fetchCourseList()
}, 500)
}
setVisible = (visible) => {
this.refs.modalWrapper.setVisible(visible)
if (visible == false) {
this.setState({
checkBoxValues: []
})
}
}
onSendOk = () => {
if (!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) {
this.props.showNotification('请先选择要发送至的课堂')
return;
}
if(this.props.url==="/files/bulk_send.json"){
axios.post("/files/bulk_send.json", {
course_id:this.props.match.params.coursesId,
ids: this.props.selectedMessageIds,
to_course_ids: this.state.checkBoxValues
})
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.gobackonSend(response.data.message)
}
})
.catch(function (error) {
console.log(error);
});
}else{
const bid = this.props.match.params.boardId
const url = `/boards/${bid}/messages/bulk_send.json`
axios.post(url, {
ids: this.props.selectedMessageIds,
to_course_ids: this.state.checkBoxValues
})
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.showNotification('发送成功')
}
})
.catch(function (error) {
console.log(error);
});
}
}
onOk = () => {
const { course_lists, checkBoxValues } = this.state
this.onSendOk()
// this.props.onOk && this.props.onOk(checkBoxValues)
// this.refs.modalWrapper.setVisible(false)
}
onCheckBoxChange = (checkBoxValues) => {
this.setState({
checkBoxValues: checkBoxValues
})
}
onSearchChange = (e) => {
this.setState({
searchValue: e.target.value
})
}
handleInfiniteOnLoad = () => {
console.log('loadmore...')
this.fetchCourseList(this.state.page + 1)
}
onSearch = () => {
// const course_lists_after_filter = this.state.course_lists.filter( item => item.name.indexOf(this.state.searchValue) != -1 )
// this.setState({ course_lists_after_filter })
this.fetchCourseList(1)
}
render(){
const { course_lists, checkBoxValues, searchValue, loading, hasMore } = this.state
const { moduleName } = this.props
return(
<ModalWrapper
ref="modalWrapper"
title={`发送${moduleName}`}
{...this.props }
onOk={this.onOk}
>
<style>
{`
.demo-loading-container {
position: absolute;
bottom: 93px;
width: 82%;
text-align: center;
}`}
</style>
<p className="color-grey-6 mb20 edu-txt-center" style={{ fontWeight: "bold" }} >选择的{moduleName}发送到<span className="color-orange-tip">指定课堂</span></p>
<Search
className="mb14"
value={searchValue}
placeholder="请输入课堂名称进行搜索"
onChange={this.onSearchChange}
onSearch={this.onSearch}
></Search>
<div>
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
<div className="edu-back-skyblue padding15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
<InfiniteScroll
threshold={10}
initialLoad={false}
pageStart={0}
loadMore={this.handleInfiniteOnLoad}
hasMore={!loading && hasMore}
useWindow={false}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ course_lists && course_lists.map( course => {
return (
<p className="clearfix mb7" key={course.id}>
<Checkbox className="fl" value={course.id} key={course.id}></Checkbox>
<span className="fl with45"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{course.name}</label></span>
</p>
)
}) }
</Checkbox.Group>
{loading && hasMore && (
<div className="demo-loading-container">
<Spin />
</div>
)}
{/* TODO */}
{/* {
!hasMore && <div>没有更多了</div>
} */}
</InfiniteScroll>
</div>
</div>
</ModalWrapper>
)
}
}
export default SendToCourseModal;

@ -286,7 +286,9 @@ class ShixunModal extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40 edu-txt-left task-hide paddingl5 newtaskhide">
<Checkbox
id={"shixun_input_"+item.shixun_id} value={item.shixun_id}
id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className=" task-hide edu-txt-left newtaskhide"
style={{"width":"280px"}}
name="shixun_homework[]"

@ -51,7 +51,7 @@ class Multiple extends Component{
return(
<p className="clearfix mb15 df">
<Checkbox className="fl lineh-15 df mr8 mt2" value={item.choice_id}>{prefix}</Checkbox>
<Checkbox className="fl lineh-15 df mr8 mt2" value={item.choice_id} key={item.choice_id}>{prefix}</Checkbox>
{/* <span class="fl lineh-20 mt1"></span> */}
{/* <span style={{display:"inline-block"}} className="markdown-body " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
<MarkdownToHtml content={item.choice_text} selector={'multiple_' + (this.props.index + 1) + (key + 1)}

@ -1,288 +1,288 @@
import React, { Component } from "react";
import { Modal, Checkbox, Input, Spin, Select, Divider } from "antd";
import axios from 'axios'
import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller';
import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common'
import NoneData from '../../coursesPublic/NoneData'
import { ConditionToolTip, ThemeContext } from 'educoder'
import SchoolSelect from '../../coursesPublic/form/SchoolSelect'
const Option = Select.Option;
const pageCount = 15;
class AddStudentModal extends Component{
constructor(props){
super(props);
this.state={
checkBoxValues: [],
users: [],
hasMore: true,
loading: false,
courseGroup: '',
page: 1,
isSpin:false
}
}
fetchMemberList = (arg_page) => {
const courseId = this.props.match.params.coursesId
const page = arg_page || this.state.page;
const { name, school_name } = this.state
let url = `/courses/${courseId}/search_users.json?page=${page}&limit=${pageCount}&school_name=${school_name || ''}&name=${name || ''}`
this.setState({ loading: true })
axios.get(url)
.then((response) => {
if (!response.data.users || response.data.users.length == 0) {
this.setState({
users: page == 1 ? response.data.users : this.state.users,
page,
loading: false,
hasMore: false,
})
} else {
this.setState({
users: page == 1 ? response.data.users : this.state.users.concat(response.data.users),
page,
loading: false,
hasMore: response.data.users.length == pageCount
})
}
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
}
fetchOptions = () => {
// add_teacher_popup
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/all_course_groups.json`
axios.get(url, {
})
.then((response) => {
if (response.data.course_groups && response.data.course_groups.length) {
this.setState({
course_groups: response.data.course_groups,
courseGroup: response.data.course_groups[0].id
})
} else {
// showNotification('')
}
})
.catch(function (error) {
console.log(error);
});
}
setVisible = (visible) => {
if (visible) {
this.setState({school_name: this.props.user.user_school})
this.fetchMemberList()
this.fetchOptions()
}
this.refs.modalWrapper.setVisible(visible)
if (visible == false) {
this.setState({
checkBoxValues: []
})
}
}
onSendOk = () => {
if(!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) {
this.props.showNotification('请从列表中先选择用户。')
return;
}
this.setState({
isSpin:true
})
const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/add_students_by_search.json`
const params = {
"user_ids": this.state.checkBoxValues
}
const { courseGroup } = this.state
if (courseGroup) {
params.course_group_id = courseGroup
}
axios.post(url, params)
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.showNotification('添加成功')
this.props.addStudentSuccess && this.props.addStudentSuccess(params)
this.setState({
isSpin:false
})
}
})
.catch(function (error) {
console.log(error);
});
}
onOk = () => {
this.onSendOk()
}
onCheckBoxChange = (checkBoxValues) => {
this.setState({
checkBoxValues: checkBoxValues
})
}
handleInfiniteOnLoad = () => {
this.fetchMemberList(this.state.page + 1)
}
onSearch = () => {
this.fetchMemberList(1)
}
handleCourseGroupChange = (value) => {
this.setState({
courseGroup: value
})
}
render(){
const { users, checkBoxValues, loading, hasMore, name, school_name
, courseGroup, course_groups,isSpin } = this.state
const { moduleName } = this.props
let theme = this.context;
return(
<ModalWrapper
ref="modalWrapper"
width="700px"
title={`添加${moduleName}`}
{...this.props }
onOk={this.onOk}
className="addStudentModal courseForm"
>
<style>
{`
.demo-loading-container {
position: absolute;
bottom: 93px;
width: 82%;
text-align: center;
}
.df {
display: flex;
align-items: baseline;
margin: 12px 0;
}
.firstLabel {
flex: 0 0 60px;
}
.df span.label {
margin-right: 8px;
text-align: right;
margin-left: 12px;
}
.df .ant-input-affix-wrapper {
width: 32%;
}
.addTeacherModal label.task-hide {
width: 100%;
}
`}
</style>
<div className="df">
<span className="mr10">姓名:</span>
<Input allowClear placeholder="请输入真实姓名" value={name} onChange={(e) => {this.setState({name: e.target.value})}}
style={{ width: '221px'}}
></Input>
<span className="label" style={{ minWidth: '36px' }}>单位:</span>
{/* <Input allowClear placeholder="" value={school_name} onChange={(e) => {this.setState({school_name: e.target.value})}}
style={{ width: '200px'}}>
</Input> */}
<SchoolSelect
value={school_name}
onChange={(value) => {this.setState({school_name: value})}}
></SchoolSelect>
<a className="task-btn task-btn-orange" onClick={() => this.fetchMemberList(1)}
style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}}
>搜索</a>
</div>
{/* <Divider /> */}
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'姓名'}</label></span>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'学号'}</label></span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'单位'}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px;"}}>{''}</label></span>
</p>
<Spin size="large" spinning={isSpin}>
{ loading || users.length ? <div>
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
<div className="edu-back-skyblue padding10-15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
<InfiniteScroll
threshold={10}
initialLoad={false}
pageStart={0}
loadMore={this.handleInfiniteOnLoad}
hasMore={!loading && hasMore}
useWindow={false}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ users.map( candidate => {
return (
<p className="clearfix mb7" key={candidate.id}>
<Checkbox className="fl" value={candidate.id} disabled={candidate.added}></Checkbox>
<span className="fl with25">
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>
{ candidate.name ?
<a href={`/users/${candidate.login}`} target="_blank" style={{"maxWidth":"208px;"}}>
{ candidate.name }
</a> : <span> </span> }
</label>
</ConditionToolTip>
</span>
<span className="fl with25">
<ConditionToolTip title={candidate.student_id} condition={candidate.student_id && candidate.student_id.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.student_id || ' '}</label>
</ConditionToolTip>
</span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
<span className="fl with10"><label className="task-hide fl"
style={{"maxWidth":"48px", color: theme.foreground_select }}>{candidate.added ? '已加入' : ''}</label></span>
</p>
)
}) }
</Checkbox.Group>
{loading && hasMore && (
<div className="demo-loading-container">
<Spin />
</div>
)}
</InfiniteScroll>
</div>
{course_groups && course_groups.length && <div className="df" style={{ marginTop: '12px' }} >
<span className="mr10" style={{ width: '148px' }}>所选学生分班至(选填):</span>
<Select style={{ width: 236 }} onChange={this.handleCourseGroupChange} value={courseGroup}>
{ course_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div>}
</div> : <NoneData></NoneData> }
</Spin>
</ModalWrapper>
)
}
}
AddStudentModal.contextType = ThemeContext;
export default AddStudentModal;
import React, { Component } from "react";
import { Modal, Checkbox, Input, Spin, Select, Divider } from "antd";
import axios from 'axios'
import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller';
import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common'
import NoneData from '../../coursesPublic/NoneData'
import { ConditionToolTip, ThemeContext } from 'educoder'
import SchoolSelect from '../../coursesPublic/form/SchoolSelect'
const Option = Select.Option;
const pageCount = 15;
class AddStudentModal extends Component{
constructor(props){
super(props);
this.state={
checkBoxValues: [],
users: [],
hasMore: true,
loading: false,
courseGroup: '',
page: 1,
isSpin:false
}
}
fetchMemberList = (arg_page) => {
const courseId = this.props.match.params.coursesId
const page = arg_page || this.state.page;
const { name, school_name } = this.state
let url = `/courses/${courseId}/search_users.json?page=${page}&limit=${pageCount}&school_name=${school_name || ''}&name=${name || ''}`
this.setState({ loading: true })
axios.get(url)
.then((response) => {
if (!response.data.users || response.data.users.length == 0) {
this.setState({
users: page == 1 ? response.data.users : this.state.users,
page,
loading: false,
hasMore: false,
})
} else {
this.setState({
users: page == 1 ? response.data.users : this.state.users.concat(response.data.users),
page,
loading: false,
hasMore: response.data.users.length == pageCount
})
}
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
}
fetchOptions = () => {
// add_teacher_popup
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/all_course_groups.json`
axios.get(url, {
})
.then((response) => {
if (response.data.course_groups && response.data.course_groups.length) {
this.setState({
course_groups: response.data.course_groups,
courseGroup: response.data.course_groups[0].id
})
} else {
// showNotification('')
}
})
.catch(function (error) {
console.log(error);
});
}
setVisible = (visible) => {
if (visible) {
this.setState({school_name: this.props.user.user_school})
this.fetchMemberList()
this.fetchOptions()
}
this.refs.modalWrapper.setVisible(visible)
if (visible == false) {
this.setState({
checkBoxValues: []
})
}
}
onSendOk = () => {
if(!this.state.checkBoxValues || this.state.checkBoxValues.length == 0) {
this.props.showNotification('请从列表中先选择用户。')
return;
}
this.setState({
isSpin:true
})
const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/add_students_by_search.json`
const params = {
"user_ids": this.state.checkBoxValues
}
const { courseGroup } = this.state
if (courseGroup) {
params.course_group_id = courseGroup
}
axios.post(url, params)
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.showNotification('添加成功')
this.props.addStudentSuccess && this.props.addStudentSuccess(params)
this.setState({
isSpin:false
})
}
})
.catch(function (error) {
console.log(error);
});
}
onOk = () => {
this.onSendOk()
}
onCheckBoxChange = (checkBoxValues) => {
this.setState({
checkBoxValues: checkBoxValues
})
}
handleInfiniteOnLoad = () => {
this.fetchMemberList(this.state.page + 1)
}
onSearch = () => {
this.fetchMemberList(1)
}
handleCourseGroupChange = (value) => {
this.setState({
courseGroup: value
})
}
render(){
const { users, checkBoxValues, loading, hasMore, name, school_name
, courseGroup, course_groups,isSpin } = this.state
const { moduleName } = this.props
let theme = this.context;
return(
<ModalWrapper
ref="modalWrapper"
width="700px"
title={`添加${moduleName}`}
{...this.props }
onOk={this.onOk}
className="addStudentModal courseForm"
>
<style>
{`
.demo-loading-container {
position: absolute;
bottom: 93px;
width: 82%;
text-align: center;
}
.df {
display: flex;
align-items: baseline;
margin: 12px 0;
}
.firstLabel {
flex: 0 0 60px;
}
.df span.label {
margin-right: 8px;
text-align: right;
margin-left: 12px;
}
.df .ant-input-affix-wrapper {
width: 32%;
}
.addTeacherModal label.task-hide {
width: 100%;
}
`}
</style>
<div className="df">
<span className="mr10">姓名:</span>
<Input allowClear placeholder="请输入真实姓名" value={name} onChange={(e) => {this.setState({name: e.target.value})}}
style={{ width: '221px'}}
></Input>
<span className="label" style={{ minWidth: '36px' }}>单位:</span>
{/* <Input allowClear placeholder="" value={school_name} onChange={(e) => {this.setState({school_name: e.target.value})}}
style={{ width: '200px'}}>
</Input> */}
<SchoolSelect
value={school_name}
onChange={(value) => {this.setState({school_name: value})}}
></SchoolSelect>
<a className="task-btn task-btn-orange" onClick={() => this.fetchMemberList(1)}
style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}}
>搜索</a>
</div>
{/* <Divider /> */}
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'姓名'}</label></span>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'学号'}</label></span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'单位'}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px;"}}>{''}</label></span>
</p>
<Spin size="large" spinning={isSpin}>
{ loading || users.length ? <div>
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
<div className="edu-back-skyblue padding10-15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
<InfiniteScroll
threshold={10}
initialLoad={false}
pageStart={0}
loadMore={this.handleInfiniteOnLoad}
hasMore={!loading && hasMore}
useWindow={false}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ users.map( candidate => {
return (
<p className="clearfix mb7" key={candidate.id}>
<Checkbox className="fl" value={candidate.id} key={candidate.id} disabled={candidate.added}></Checkbox>
<span className="fl with25">
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>
{ candidate.name ?
<a href={`/users/${candidate.login}`} target="_blank" style={{"maxWidth":"208px;"}}>
{ candidate.name }
</a> : <span> </span> }
</label>
</ConditionToolTip>
</span>
<span className="fl with25">
<ConditionToolTip title={candidate.student_id} condition={candidate.student_id && candidate.student_id.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.student_id || ' '}</label>
</ConditionToolTip>
</span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
<span className="fl with10"><label className="task-hide fl"
style={{"maxWidth":"48px", color: theme.foreground_select }}>{candidate.added ? '已加入' : ''}</label></span>
</p>
)
}) }
</Checkbox.Group>
{loading && hasMore && (
<div className="demo-loading-container">
<Spin />
</div>
)}
</InfiniteScroll>
</div>
{course_groups && course_groups.length && <div className="df" style={{ marginTop: '12px' }} >
<span className="mr10" style={{ width: '148px' }}>所选学生分班至(选填):</span>
<Select style={{ width: 236 }} onChange={this.handleCourseGroupChange} value={courseGroup}>
{ course_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div>}
</div> : <NoneData></NoneData> }
</Spin>
</ModalWrapper>
)
}
}
AddStudentModal.contextType = ThemeContext;
export default AddStudentModal;

@ -1,355 +1,355 @@
import React, { Component } from "react";
import { Modal, Checkbox, Input, Spin, Select, Divider, Icon } from "antd";
import axios from 'axios'
import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller';
import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common'
import { ConditionToolTip, ActionBtn } from 'educoder'
import NoneData from '../../coursesPublic/NoneData'
import AddGraduationGroupModal from './AddGraduationGroupModal'
import SchoolSelect from '../../coursesPublic/form/SchoolSelect'
const Option = Select.Option;
const pageCount = 15;
let timeout, currentValue
class AddTeacherModal extends Component{
constructor(props){
super(props);
this.state={
school_names: [],
checkBoxValues: [],
candidates: [],
hasMore: true,
loading: false,
page: 1
}
}
fetchMemberList = (arg_page) => {
const courseId = this.props.match.params.coursesId
const page = arg_page || this.state.page;
const { name, school_name } = this.state
let url = `/courses/${courseId}/search_teacher_candidate.json`
this.setState({ loading: true })
axios.post(url, {
page: page,
limit: pageCount,
school_name: school_name || '',
name: name || ''
})
.then((response) => {
if (!response.data.candidates || response.data.candidates.length == 0) {
this.setState({
candidates: page == 1 ? response.data.candidates : this.state.candidates,
page,
loading: false,
hasMore: false,
})
} else {
this.setState({
candidates: page == 1 ? response.data.candidates : this.state.candidates.concat(response.data.candidates),
page,
loading: false,
hasMore: response.data.candidates.length == pageCount
})
}
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
}
onAddGraduationGroupOk = () => {
this.fetchOptions()
}
fetchOptions = () => {
// add_teacher_popup
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/add_teacher_popup.json`
axios.get(url, {
})
.then((response) => {
if (response.data.school_name) {
this.setState({
school_name: response.data.school_name
}, () => this.fetchMemberList())
} else {
this.fetchMemberList()
}
if (response.data.graduation_groups) {
this.setState({
graduation_groups: response.data.graduation_groups
})
}
if (response.data.course_groups) {
this.setState({
course_groups: response.data.course_groups
})
}
})
.catch(function (error) {
console.log(error);
});
}
setVisible = (visible) => {
if (visible) {
this.fetchOptions()
}
this.refs.modalWrapper.setVisible(visible)
if (visible == false) {
this.setState({
checkBoxValues: []
})
}
}
onSendOk = () => {
const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/add_teacher.json`
if (this.state.checkBoxValues.length == 0) {
this.props.showNotification('请先在下面列表中选择要添加教师的成员')
return
}
const params = {
"user_list": this.state.checkBoxValues.map (item => { return { 'user_id': item }}) ,
// "graduation_group_id": "2",
// "course_group_id": "820",
"role": this.props.isTeacher ? ROLE_TEACHER_NUM : ROLE_ASSISTANT_NUM
}
const { graduationGroup, courseGroup } = this.state
if (graduationGroup) {
params.graduation_group_id = graduationGroup
}
if (courseGroup) {
params.course_group_id = courseGroup
}
axios.post(url, params)
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.showNotification('添加成功')
this.props.addTeacherSuccess && this.props.addTeacherSuccess(params)
}
})
.catch(function (error) {
console.log(error);
});
}
onOk = () => {
this.onSendOk()
}
onCheckBoxChange = (checkBoxValues) => {
this.setState({
checkBoxValues: checkBoxValues
})
}
handleInfiniteOnLoad = () => {
this.fetchMemberList(this.state.page + 1)
}
onSearch = () => {
this.fetchMemberList(1)
}
handleGradationGroupChange = (value) => {
this.setState({
graduationGroup: value
})
}
handleCourseGroupChange = (value) => {
this.setState({
courseGroup: value
})
}
onOrgNameChange = (value) => {
// console.log('school_name: ', value)
this.setState({ school_name: value })
}
hasGraduationModule = () => {
const { course_modules } = this.props;
const result = course_modules && course_modules.filter( item => {
return item.type == 'graduation'
})
return result && result.length > 0
}
render(){
const { candidates, checkBoxValues, loading, hasMore, name, school_name, school_names
, graduationGroup, graduation_groups, courseGroup, course_groups } = this.state
const { moduleName } = this.props
return(
<ModalWrapper
ref="modalWrapper"
width="700px"
title={`添加${moduleName}`}
{...this.props }
onOk={this.onOk}
className="addTeacherModal courseForm"
>
<AddGraduationGroupModal ref="addGraduationGroupModal"
{...this.props} onOk={this.onAddGraduationGroupOk}
></AddGraduationGroupModal>
<style>
{`
.demo-loading-container {
position: absolute;
bottom: 210px;
width: 82%;
text-align: center;
}
.df {
display: flex;
align-items: baseline;
margin: 12px 0;
}
.firstLabel {
flex: 0 0 60px;
}
.df span.label {
margin-right: 8px;
text-align: left;
}
.df .ant-input-affix-wrapper {
width: 32%;
}
.addTeacherModal label.task-hide {
width: 100%;
}
`}
</style>
<div className="df">
<span className="firstLabel label" style={{ flex: '0 0 40px' }}>姓名:</span>
<Input allowClear placeholder="请输入真实姓名" value={name} onChange={(e) => {this.setState({name: e.target.value})}}
style={{ width: '200px', marginRight: '18px' }}>
</Input>
<span className="label" style={{ minWidth: '36px', flex: '0 0 40px' }}>单位:</span>
<SchoolSelect
value={school_name}
onChange={this.onOrgNameChange}
></SchoolSelect>
{/* <Select allowClear placeholder="" value={school_name}
style={{ width: '200px'}} showArrow={false}
filterOption={false} onSearch={this.onOrgNameSearch}
onChange={this.onOrgNameChange} notFoundContent={null}
showSearch defaultActiveFirstOption={false}
>
{ school_names && school_names.map((item, index) => {
return <Option value={item} key={index}>{item}</Option>
})}
</Select> */}
<a className="task-btn task-btn-orange" onClick={() => this.fetchMemberList(1)}
style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}}
>搜索</a>
</div>
{/* graduation_groups && !!graduation_groups.length */}
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'姓名'}</label></span>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'昵称'}</label></span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'单位'}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px"}}>{''}</label></span>
</p>
{ loading || candidates.length ? <div>
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
<div className="edu-back-skyblue padding10-15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
<InfiniteScroll
threshold={10}
initialLoad={false}
pageStart={0}
loadMore={this.handleInfiniteOnLoad}
hasMore={!loading && hasMore}
useWindow={false}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ candidates && candidates.map( candidate => {
return (
<p className="clearfix mb7" key={candidate.id}>
<Checkbox className="fl" value={candidate.id} ></Checkbox>
<span className="fl with25">
{/* "color":"#4c4c4c" */}
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}
>
<a href={`/users/${candidate.login}`} target="_blank"
style={{}}
>{candidate.name}</a>
</label>
</ConditionToolTip>
</span>
<span className="fl with25">
<ConditionToolTip title={candidate.nickname} condition={candidate.nickname && candidate.nickname.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.nickname || ' '}</label>
</ConditionToolTip>
</span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px;"}}>{candidate.added ? '已加入' : ''}</label></span>
</p>
)
}) }
</Checkbox.Group>
{loading && hasMore && (
<div className="demo-loading-container">
<Spin />
</div>
)}
</InfiniteScroll>
</div>
</div> : <NoneData></NoneData> }
<div className="df">
{ this.hasGraduationModule() && <div className="df" style={{ marginTop: '24px' }} >
<span className="firstLabel label" style={{ flex: '0 0 96px' }}>添加至答辩组:</span>
<Select style={{ width: 218, marginRight: '18px' }} onChange={this.handleGradationGroupChange} value={graduationGroup}
dropdownRender={menu => (
<div>
{menu}
<Divider style={{ margin: '4px 0' }} />
{/* <ActionBtn
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>添加答辩组</ActionBtn> */}
<div style={{ padding: '8px', cursor: 'pointer' }}
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>
<Icon type="plus" /> 添加答辩组
</div>
</div>
)}
>
{ graduation_groups && graduation_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div>}
{ course_groups && !!course_groups.length && <div className="df">
<span className="firstLabel label">管理权限:</span>
<Select style={{ width: 218 }} onChange={this.handleCourseGroupChange} value={courseGroup}>
{ course_groups && course_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div> }
</div>
</ModalWrapper>
)
}
}
export default AddTeacherModal;
import React, { Component } from "react";
import { Modal, Checkbox, Input, Spin, Select, Divider, Icon } from "antd";
import axios from 'axios'
import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller';
import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common'
import { ConditionToolTip, ActionBtn } from 'educoder'
import NoneData from '../../coursesPublic/NoneData'
import AddGraduationGroupModal from './AddGraduationGroupModal'
import SchoolSelect from '../../coursesPublic/form/SchoolSelect'
const Option = Select.Option;
const pageCount = 15;
let timeout, currentValue
class AddTeacherModal extends Component{
constructor(props){
super(props);
this.state={
school_names: [],
checkBoxValues: [],
candidates: [],
hasMore: true,
loading: false,
page: 1
}
}
fetchMemberList = (arg_page) => {
const courseId = this.props.match.params.coursesId
const page = arg_page || this.state.page;
const { name, school_name } = this.state
let url = `/courses/${courseId}/search_teacher_candidate.json`
this.setState({ loading: true })
axios.post(url, {
page: page,
limit: pageCount,
school_name: school_name || '',
name: name || ''
})
.then((response) => {
if (!response.data.candidates || response.data.candidates.length == 0) {
this.setState({
candidates: page == 1 ? response.data.candidates : this.state.candidates,
page,
loading: false,
hasMore: false,
})
} else {
this.setState({
candidates: page == 1 ? response.data.candidates : this.state.candidates.concat(response.data.candidates),
page,
loading: false,
hasMore: response.data.candidates.length == pageCount
})
}
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
}
onAddGraduationGroupOk = () => {
this.fetchOptions()
}
fetchOptions = () => {
// add_teacher_popup
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/add_teacher_popup.json`
axios.get(url, {
})
.then((response) => {
if (response.data.school_name) {
this.setState({
school_name: response.data.school_name
}, () => this.fetchMemberList())
} else {
this.fetchMemberList()
}
if (response.data.graduation_groups) {
this.setState({
graduation_groups: response.data.graduation_groups
})
}
if (response.data.course_groups) {
this.setState({
course_groups: response.data.course_groups
})
}
})
.catch(function (error) {
console.log(error);
});
}
setVisible = (visible) => {
if (visible) {
this.fetchOptions()
}
this.refs.modalWrapper.setVisible(visible)
if (visible == false) {
this.setState({
checkBoxValues: []
})
}
}
onSendOk = () => {
const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/add_teacher.json`
if (this.state.checkBoxValues.length == 0) {
this.props.showNotification('请先在下面列表中选择要添加教师的成员')
return
}
const params = {
"user_list": this.state.checkBoxValues.map (item => { return { 'user_id': item }}) ,
// "graduation_group_id": "2",
// "course_group_id": "820",
"role": this.props.isTeacher ? ROLE_TEACHER_NUM : ROLE_ASSISTANT_NUM
}
const { graduationGroup, courseGroup } = this.state
if (graduationGroup) {
params.graduation_group_id = graduationGroup
}
if (courseGroup) {
params.course_group_id = courseGroup
}
axios.post(url, params)
.then((response) => {
if (response.data.status == 0) {
this.setVisible(false)
this.props.showNotification('添加成功')
this.props.addTeacherSuccess && this.props.addTeacherSuccess(params)
}
})
.catch(function (error) {
console.log(error);
});
}
onOk = () => {
this.onSendOk()
}
onCheckBoxChange = (checkBoxValues) => {
this.setState({
checkBoxValues: checkBoxValues
})
}
handleInfiniteOnLoad = () => {
this.fetchMemberList(this.state.page + 1)
}
onSearch = () => {
this.fetchMemberList(1)
}
handleGradationGroupChange = (value) => {
this.setState({
graduationGroup: value
})
}
handleCourseGroupChange = (value) => {
this.setState({
courseGroup: value
})
}
onOrgNameChange = (value) => {
// console.log('school_name: ', value)
this.setState({ school_name: value })
}
hasGraduationModule = () => {
const { course_modules } = this.props;
const result = course_modules && course_modules.filter( item => {
return item.type == 'graduation'
})
return result && result.length > 0
}
render(){
const { candidates, checkBoxValues, loading, hasMore, name, school_name, school_names
, graduationGroup, graduation_groups, courseGroup, course_groups } = this.state
const { moduleName } = this.props
return(
<ModalWrapper
ref="modalWrapper"
width="700px"
title={`添加${moduleName}`}
{...this.props }
onOk={this.onOk}
className="addTeacherModal courseForm"
>
<AddGraduationGroupModal ref="addGraduationGroupModal"
{...this.props} onOk={this.onAddGraduationGroupOk}
></AddGraduationGroupModal>
<style>
{`
.demo-loading-container {
position: absolute;
bottom: 210px;
width: 82%;
text-align: center;
}
.df {
display: flex;
align-items: baseline;
margin: 12px 0;
}
.firstLabel {
flex: 0 0 60px;
}
.df span.label {
margin-right: 8px;
text-align: left;
}
.df .ant-input-affix-wrapper {
width: 32%;
}
.addTeacherModal label.task-hide {
width: 100%;
}
`}
</style>
<div className="df">
<span className="firstLabel label" style={{ flex: '0 0 40px' }}>姓名:</span>
<Input allowClear placeholder="请输入真实姓名" value={name} onChange={(e) => {this.setState({name: e.target.value})}}
style={{ width: '200px', marginRight: '18px' }}>
</Input>
<span className="label" style={{ minWidth: '36px', flex: '0 0 40px' }}>单位:</span>
<SchoolSelect
value={school_name}
onChange={this.onOrgNameChange}
></SchoolSelect>
{/* <Select allowClear placeholder="" value={school_name}
style={{ width: '200px'}} showArrow={false}
filterOption={false} onSearch={this.onOrgNameSearch}
onChange={this.onOrgNameChange} notFoundContent={null}
showSearch defaultActiveFirstOption={false}
>
{ school_names && school_names.map((item, index) => {
return <Option value={item} key={index}>{item}</Option>
})}
</Select> */}
<a className="task-btn task-btn-orange" onClick={() => this.fetchMemberList(1)}
style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}}
>搜索</a>
</div>
{/* graduation_groups && !!graduation_groups.length */}
<p className="clearfix mb2" style={{ margin: '0px 15px 6px' }}>
<Checkbox className="fl" style={{ visibility: 'hidden' }} ></Checkbox>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'姓名'}</label></span>
<span className="fl with25"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'昵称'}</label></span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{'单位'}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px"}}>{''}</label></span>
</p>
{ loading || candidates.length ? <div>
{/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */}
<div className="edu-back-skyblue padding10-15" style={{"height":"300px", overflowY: "scroll", overflowAnchor: 'none' }}>
<InfiniteScroll
threshold={10}
initialLoad={false}
pageStart={0}
loadMore={this.handleInfiniteOnLoad}
hasMore={!loading && hasMore}
useWindow={false}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ candidates && candidates.map( candidate => {
return (
<p className="clearfix mb7" key={candidate.id}>
<Checkbox className="fl" value={candidate.id} key={candidate.id}></Checkbox>
<span className="fl with25">
{/* "color":"#4c4c4c" */}
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}
>
<a href={`/users/${candidate.login}`} target="_blank"
style={{}}
>{candidate.name}</a>
</label>
</ConditionToolTip>
</span>
<span className="fl with25">
<ConditionToolTip title={candidate.nickname} condition={candidate.nickname && candidate.nickname.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.nickname || ' '}</label>
</ConditionToolTip>
</span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px;"}}>{candidate.added ? '已加入' : ''}</label></span>
</p>
)
}) }
</Checkbox.Group>
{loading && hasMore && (
<div className="demo-loading-container">
<Spin />
</div>
)}
</InfiniteScroll>
</div>
</div> : <NoneData></NoneData> }
<div className="df">
{ this.hasGraduationModule() && <div className="df" style={{ marginTop: '24px' }} >
<span className="firstLabel label" style={{ flex: '0 0 96px' }}>添加至答辩组:</span>
<Select style={{ width: 218, marginRight: '18px' }} onChange={this.handleGradationGroupChange} value={graduationGroup}
dropdownRender={menu => (
<div>
{menu}
<Divider style={{ margin: '4px 0' }} />
{/* <ActionBtn
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>添加答辩组</ActionBtn> */}
<div style={{ padding: '8px', cursor: 'pointer' }}
onMouseDown={() => { debugger; this.refs['addGraduationGroupModal'].setVisible(true) }}
>
<Icon type="plus" /> 添加答辩组
</div>
</div>
)}
>
{ graduation_groups && graduation_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div>}
{ course_groups && !!course_groups.length && <div className="df">
<span className="firstLabel label">管理权限:</span>
<Select style={{ width: 218 }} onChange={this.handleCourseGroupChange} value={courseGroup}>
{ course_groups && course_groups.map((item) => {
return <Option value={item.id}>{item.name}</Option>
})}
</Select>
</div> }
</div>
</ModalWrapper>
)
}
}
export default AddTeacherModal;

@ -108,8 +108,8 @@ class PollDetailTabThird extends Component{
{
item.question.answers.map((index,k)=>{
return(
<li className="df">
<Checkbox className="fl mr8" value={index.answer_id}></Checkbox>
<li className="df" key={k}>
<Checkbox className="fl mr8" value={index.answer_id} key={index.answer_id}></Checkbox>
<span className={index.answer_text=="其他"?"break-word":"break-word flex1"}>{index.answer_text}</span>
{
index.answer_text=="其他" ? <p className="textLine"></p>:""

@ -445,7 +445,7 @@ class PollInfo extends Component{
item.question.answers && item.question.answers.map((i,k)=>{
return(
<li className={i.answer_text=="其他"?"df clearfix":"clearfix"}>
<Checkbox className="fl mr8" value={i.answer_id}></Checkbox>
<Checkbox className="fl mr8" value={i.answer_id} key={i.answer_id}></Checkbox>
<span className="break-word fl" style={{maxWidth:"1116px"}}>{i.answer_text}</span>
{
i.answer_text=="其他"?

@ -288,6 +288,7 @@ class ShixunWorkModal extends Component{
className="fl task-hide edu-txt-left"
name="shixun_homework[]"
value={item=== undefined?"":item.id}
key={item=== undefined?"":item.id}
>
<label style={{"textAlign": "left", "color": "#05101A"}}
className="task-hide color-grey-name" title="frerere">{item===undefined?"":item.name}</label>

@ -1161,7 +1161,7 @@ class ShixunHomework extends Component{
isStudent={this.props.isStudent()}
isNotMember={this.props.isNotMember()}
isClassManagement={this.props.isClassManagement()}
checkBox={this.props.isAdmin()?<Checkbox value={item.homework_id}></Checkbox>:""}
checkBox={this.props.isAdmin()?<Checkbox value={item.homework_id} key={item.homework_id}></Checkbox>:""}
match={this.props.match}
coursedata={this.props.coursedata}
coursupdata={()=>this.homeworkupdatalist(Coursename,page,order)}

@ -1,249 +1,249 @@
import React, { Component } from 'react';
import {Pagination,Spin,Checkbox,Modal} from 'antd';
import moment from 'moment';
import axios from 'axios';
import NoneData from '../../courses/coursesPublic/NoneData'
import {getImageUrl} from 'educoder';
import "./usersInfo.css"
import Modals from '../../modals/Modals'
const dateFormat ="YYYY-MM-DD HH:mm"
class InfosBank extends Component{
constructor(props){
super(props);
this.state={
category:"common",
type:"publicly",
page:1,
per_page:16,
sort_by:"updated_at",
CoursesId:undefined,
totalCount:undefined,
data:undefined,
isSpin:false,
dialogOpen:false,
modalsTopval:undefined,
modalsBottomval:undefined,
modalSave:undefined
}
}
componentDidMount=()=>{
this.setState({
isSpin:true
})
let{category,type,page,sort_by,CoursesId}=this.state;
this.getCourses(category,type,page,sort_by,CoursesId);
}
getCourses=(category,type,page,sort_by,CoursesId)=>{
let url=`/users/${this.props.match.params.username}/question_banks.json`;
axios.get((url),{params:{
category,
type,
page,
sort_by,
per_page:category && page ==1?17:16,
course_list_id:CoursesId
}}).then((result)=>{
if(result){
this.setState({
totalCount:result.data.count,
data:result.data,
isSpin:false
})
}
}).catch((error)=>{
console.log(error);
})
}
//切换种类
changeCategory=(cate)=>{
this.setState({
category:cate,
page:1,
isSpin:true
})
let{type,sort_by,CoursesId}=this.state;
this.getCourses(cate,type,1,sort_by,CoursesId);
}
//切换状态
changeType=(type)=>{
this.setState({
type:type,
page:1,
isSpin:true
})
let{category,sort_by,CoursesId}=this.state;
this.getCourses(category,type,1,sort_by,CoursesId);
}
//切换页数
changePage=(page)=>{
this.setState({
page,
isSpin:true
})
let{category,type,sort_by,CoursesId}=this.state;
this.getCourses(category,type,page,sort_by,CoursesId);
}
// 进入课堂
turnToCourses=(url)=>{
this.props.history.push(url);
}
// 切换排序方式
changeOrder= (sort)=>{
this.setState({
sort_by:sort,
isSpin:true
})
let{category,type,page,CoursesId}=this.state;
this.getCourses(category,type,page,sort,CoursesId);
}
changeCourseListId =(CoursesId)=>{
this.setState({
CoursesId,
isSpin:true
})
let{category,type,sort,page}=this.state;
this.getCourses(category,type,page,sort,CoursesId);
}
//设为公开/删除
setPublic=(index)=>{
this.setState({
dialogOpen:true,
modalsTopval:index==1?"您确定要公开吗?":"确定要删除该题吗?",
modalsBottomval:index==1?"公开后不能重设为私有":"",
modalSave:()=>this.sureOperation(index)
})
}
// 确定--设为公开/删除
sureOperation=()=>{
}
//弹框隐藏
handleDialogClose=()=>{
this.setState({
dialogOpen:false
})
}
render(){
let{
category,
type,
page,
data,
totalCount,
sort_by,
isSpin,
CoursesId,
dialogOpen,
modalsTopval,
modalsBottomval,modalSave
} = this.state;
let isStudent = this.props.isStudent();
let is_current=this.props.is_current;
return(
<div className="educontent">
<Modals
modalsType={dialogOpen}
modalsTopval={modalsTopval}
modalsBottomval={modalsBottomval}
modalCancel={this.handleDialogClose}
modalSave={modalSave}
></Modals>
<Spin size="large" spinning={isSpin}>
<div className="white-panel edu-back-white pt20 pb20 clearfix ">
<li className={type=="publicly" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("publicly")}>{is_current ? "我":"TA"}的题库</a></li>
<li className={type=="personal" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("personal")}>公共题库</a></li>
</div>
<div className="edu-back-white padding20-30 bor-top-greyE">
<ul className="clearfix secondNav">
<li className={category=="common" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("common")}>普通作业</a></li>
<li className={category=="group" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("group")}>分组作业</a></li>
<li className={category=="exercise" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("exercise")}>试卷</a></li>
<li className={category=="poll" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("poll")}>问卷</a></li>
</ul>
<div className="edu-txt-left mt10 bankTag">
<ul className="inline" id="sourceTag">
<li className={ CoursesId ? "" : "active" } onClick={()=>this.changeCourseListId()}>
<a href="javascript:void(0)">全部</a>
</li>
{
data && data.course_list && data.course_list.map((item,key)=>{
return(
<li className={CoursesId==item.id?"active":""} key={key} onClick={()=>this.changeCourseListId(`${item.id}`)}>
<a href="javascript:void(0)">{item.name}</a>
</li>
)
})
}
</ul>
</div>
</div>
<p className="pl25 pr25 clearfix font-12 mb20 mt20">
<span className="fl color-grey-9">共参与{totalCount}个题库</span>
<div className="fr">
<li className="drop_down">
<span className="color-grey-9 font-12">{sort_by=="updated_at"?"时间最新":sort_by=="name"?"作业名称":"贡献者"}</span><i className="iconfont icon-xiajiantou font-12 ml2 color-grey-6"></i>
<ul className="drop_down_normal">
<li onClick={()=>this.changeOrder("updated_at")}>时间最新</li>
<li onClick={()=>this.changeOrder("name")}>作业名称</li>
<li onClick={()=>this.changeOrder("contributor")}>贡献者</li>
</ul>
</li>
</div>
</p>
<div className="dataBank_list edu-back-white educontent">
{
!data || data.question_banks.length==0 && <NoneData></NoneData>
}
{
data && data.question_banks && data.question_banks.map((item,key)=>{
return(
<div className="dataBank_Item clearfix" key={key}>
<div className="fl dataItemLeft">
<Checkbox value={item.id}></Checkbox>
</div>
<div className="fr dataItemRight bank_item">
<p className="mb10 clearfix">
<span className="dataTitle fl mr80">{item.name}</span>
<a href="javascript:void(0)" data-object="2599" className="bank_send fr">发送</a>
{
item.is_public ==false ?
<a href="javascript:void(0)" onClick={()=>this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开</a>:""
}
</p>
<p className="itembottom clearfix">
<span className="fl bottomspan color-grey-9">{item.quotes_count}次引用</span>
<span className="fl bottomspan color-grey-9">{item.solve_count}次答题</span>
<span className="fl bottomspan color-grey-9">{moment(item.updated_at).format('YYYY-MM-DD HH:mm')}</span>
<span className="fr"><a href="javascript:void(0)" className="bank_delete color-grey-9" onClick={()=>this.setPublic(2)}>删除</a></span>
<span className="bank_list_Tag">{item.course_list_name}</span>
</p>
</div>
</div>
)
})
}
</div>
{
totalCount > 15 &&
<div className="mt30 mb50 edu-txt-center">
<Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/>
</div>
}
</Spin>
</div>
)
}
}
import React, { Component } from 'react';
import {Pagination,Spin,Checkbox,Modal} from 'antd';
import moment from 'moment';
import axios from 'axios';
import NoneData from '../../courses/coursesPublic/NoneData'
import {getImageUrl} from 'educoder';
import "./usersInfo.css"
import Modals from '../../modals/Modals'
const dateFormat ="YYYY-MM-DD HH:mm"
class InfosBank extends Component{
constructor(props){
super(props);
this.state={
category:"common",
type:"publicly",
page:1,
per_page:16,
sort_by:"updated_at",
CoursesId:undefined,
totalCount:undefined,
data:undefined,
isSpin:false,
dialogOpen:false,
modalsTopval:undefined,
modalsBottomval:undefined,
modalSave:undefined
}
}
componentDidMount=()=>{
this.setState({
isSpin:true
})
let{category,type,page,sort_by,CoursesId}=this.state;
this.getCourses(category,type,page,sort_by,CoursesId);
}
getCourses=(category,type,page,sort_by,CoursesId)=>{
let url=`/users/${this.props.match.params.username}/question_banks.json`;
axios.get((url),{params:{
category,
type,
page,
sort_by,
per_page:category && page ==1?17:16,
course_list_id:CoursesId
}}).then((result)=>{
if(result){
this.setState({
totalCount:result.data.count,
data:result.data,
isSpin:false
})
}
}).catch((error)=>{
console.log(error);
})
}
//切换种类
changeCategory=(cate)=>{
this.setState({
category:cate,
page:1,
isSpin:true
})
let{type,sort_by,CoursesId}=this.state;
this.getCourses(cate,type,1,sort_by,CoursesId);
}
//切换状态
changeType=(type)=>{
this.setState({
type:type,
page:1,
isSpin:true
})
let{category,sort_by,CoursesId}=this.state;
this.getCourses(category,type,1,sort_by,CoursesId);
}
//切换页数
changePage=(page)=>{
this.setState({
page,
isSpin:true
})
let{category,type,sort_by,CoursesId}=this.state;
this.getCourses(category,type,page,sort_by,CoursesId);
}
// 进入课堂
turnToCourses=(url)=>{
this.props.history.push(url);
}
// 切换排序方式
changeOrder= (sort)=>{
this.setState({
sort_by:sort,
isSpin:true
})
let{category,type,page,CoursesId}=this.state;
this.getCourses(category,type,page,sort,CoursesId);
}
changeCourseListId =(CoursesId)=>{
this.setState({
CoursesId,
isSpin:true
})
let{category,type,sort,page}=this.state;
this.getCourses(category,type,page,sort,CoursesId);
}
//设为公开/删除
setPublic=(index)=>{
this.setState({
dialogOpen:true,
modalsTopval:index==1?"您确定要公开吗?":"确定要删除该题吗?",
modalsBottomval:index==1?"公开后不能重设为私有":"",
modalSave:()=>this.sureOperation(index)
})
}
// 确定--设为公开/删除
sureOperation=()=>{
}
//弹框隐藏
handleDialogClose=()=>{
this.setState({
dialogOpen:false
})
}
render(){
let{
category,
type,
page,
data,
totalCount,
sort_by,
isSpin,
CoursesId,
dialogOpen,
modalsTopval,
modalsBottomval,modalSave
} = this.state;
let isStudent = this.props.isStudent();
let is_current=this.props.is_current;
return(
<div className="educontent">
<Modals
modalsType={dialogOpen}
modalsTopval={modalsTopval}
modalsBottomval={modalsBottomval}
modalCancel={this.handleDialogClose}
modalSave={modalSave}
></Modals>
<Spin size="large" spinning={isSpin}>
<div className="white-panel edu-back-white pt20 pb20 clearfix ">
<li className={type=="publicly" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("publicly")}>{is_current ? "我":"TA"}的题库</a></li>
<li className={type=="personal" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeType("personal")}>公共题库</a></li>
</div>
<div className="edu-back-white padding20-30 bor-top-greyE">
<ul className="clearfix secondNav">
<li className={category=="common" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("common")}>普通作业</a></li>
<li className={category=="group" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("group")}>分组作业</a></li>
<li className={category=="exercise" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("exercise")}>试卷</a></li>
<li className={category=="poll" ? "active" : ""}><a href="javascript:void(0)" onClick={()=>this.changeCategory("poll")}>问卷</a></li>
</ul>
<div className="edu-txt-left mt10 bankTag">
<ul className="inline" id="sourceTag">
<li className={ CoursesId ? "" : "active" } onClick={()=>this.changeCourseListId()}>
<a href="javascript:void(0)">全部</a>
</li>
{
data && data.course_list && data.course_list.map((item,key)=>{
return(
<li className={CoursesId==item.id?"active":""} key={key} onClick={()=>this.changeCourseListId(`${item.id}`)}>
<a href="javascript:void(0)">{item.name}</a>
</li>
)
})
}
</ul>
</div>
</div>
<p className="pl25 pr25 clearfix font-12 mb20 mt20">
<span className="fl color-grey-9">共参与{totalCount}个题库</span>
<div className="fr">
<li className="drop_down">
<span className="color-grey-9 font-12">{sort_by=="updated_at"?"时间最新":sort_by=="name"?"作业名称":"贡献者"}</span><i className="iconfont icon-xiajiantou font-12 ml2 color-grey-6"></i>
<ul className="drop_down_normal">
<li onClick={()=>this.changeOrder("updated_at")}>时间最新</li>
<li onClick={()=>this.changeOrder("name")}>作业名称</li>
<li onClick={()=>this.changeOrder("contributor")}>贡献者</li>
</ul>
</li>
</div>
</p>
<div className="dataBank_list edu-back-white educontent">
{
!data || data.question_banks.length==0 && <NoneData></NoneData>
}
{
data && data.question_banks && data.question_banks.map((item,key)=>{
return(
<div className="dataBank_Item clearfix" key={key}>
<div className="fl dataItemLeft">
<Checkbox value={item.id} key={item.id}></Checkbox>
</div>
<div className="fr dataItemRight bank_item">
<p className="mb10 clearfix">
<span className="dataTitle fl mr80">{item.name}</span>
<a href="javascript:void(0)" data-object="2599" className="bank_send fr">发送</a>
{
item.is_public ==false ?
<a href="javascript:void(0)" onClick={()=>this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开</a>:""
}
</p>
<p className="itembottom clearfix">
<span className="fl bottomspan color-grey-9">{item.quotes_count}次引用</span>
<span className="fl bottomspan color-grey-9">{item.solve_count}次答题</span>
<span className="fl bottomspan color-grey-9">{moment(item.updated_at).format('YYYY-MM-DD HH:mm')}</span>
<span className="fr"><a href="javascript:void(0)" className="bank_delete color-grey-9" onClick={()=>this.setPublic(2)}>删除</a></span>
<span className="bank_list_Tag">{item.course_list_name}</span>
</p>
</div>
</div>
)
})
}
</div>
{
totalCount > 15 &&
<div className="mt30 mb50 edu-txt-center">
<Pagination showQuickJumper total={totalCount} onChange={this.changePage} pageSize={16} current={page}/>
</div>
}
</Spin>
</div>
)
}
}
export default InfosBank;
Loading…
Cancel
Save