From e4c305082725bcf1e7741f575798b2607713bf96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 22 Aug 2019 10:48:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=80=89=E6=8B=A9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/HomeworkModal.js | 1 + .../courses/coursesPublic/SelectResource.js | 1 + .../courses/coursesPublic/SendToFilesModal.js | 2 +- .../coursesPublic/modal/CheckCodeModal.js | 2 +- .../coursesPublic/modal/SendToCourseModal.js | 418 +++++------ .../coursesPublic/modal/ShixunModal2.js | 4 +- .../courses/exercise/question/multiple.js | 2 +- .../courses/members/modal/AddStudentModal.js | 576 +++++++------- .../courses/members/modal/AddTeacherModal.js | 710 +++++++++--------- .../courses/poll/PollDetailTabThird.js | 4 +- .../src/modules/courses/poll/PollInfo.js | 2 +- .../Shixunworkdetails/ShixunWorkModal.js | 1 + .../courses/shixunHomework/shixunHomework.js | 2 +- .../src/modules/user/usersInfo/InfosBank.js | 496 ++++++------ 14 files changed, 1113 insertions(+), 1108 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js index deb329fb9..89e747004 100644 --- a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js +++ b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js @@ -241,6 +241,7 @@ class HomeworkModal extends Component{ className="task-hide edu-txt-left" name="shixun_homework[]" value={item.id} + key={item.id} > {item.name} diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index 84afa9e2c..f9433ddf7 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -351,6 +351,7 @@ class Selectresource extends Component{
  • { return (

    - +

    ) diff --git a/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js b/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js index d38c0a515..b0061445a 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js +++ b/public/react/src/modules/courses/coursesPublic/modal/CheckCodeModal.js @@ -208,7 +208,7 @@ class CheckCodeModal extends Component{ { candidates && candidates.map( candidate => { return (

    - + 12 }> diff --git a/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js b/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js index 3ad35f6ea..af3fc1a30 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js +++ b/public/react/src/modules/courses/coursesPublic/modal/SendToCourseModal.js @@ -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( - - -

    选择的{moduleName}发送到指定课堂

    - - - -
    - {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} -
    - - - - { course_lists && course_lists.map( course => { - return ( -

    - - -

    - ) - }) } -
    - {loading && hasMore && ( -
    - -
    - )} - {/* TODO */} - {/* { - !hasMore &&
    没有更多了。。
    - } */} -
    -
    -
    - - ) - } -} -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( + + +

    选择的{moduleName}发送到指定课堂

    + + + +
    + {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} +
    + + + + { course_lists && course_lists.map( course => { + return ( +

    + + +

    + ) + }) } +
    + {loading && hasMore && ( +
    + +
    + )} + {/* TODO */} + {/* { + !hasMore &&
    没有更多了。。
    + } */} +
    +
    +
    +
    + ) + } +} +export default SendToCourseModal; + + diff --git a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js index 127abf5cf..59f157597 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js +++ b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js @@ -286,7 +286,9 @@ class ShixunModal extends Component{
  • - {prefix} + {prefix} {/* */} {/* */} { - 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( - - -
    - 姓名: - {this.setState({name: e.target.value})}} - style={{ width: '221px'}} - > - 单位: - {/* {this.setState({school_name: e.target.value})}} - style={{ width: '200px'}}> - */} - {this.setState({school_name: value})}} - > - this.fetchMemberList(1)} - style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} - >搜索 -
    - {/* */} - - -

    - - - - - - -

    - - { loading || users.length ?
    - {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} -
    - - - - { users.map( candidate => { - return ( -

    - - - 12 }> - - - - - 12 }> - - - - - - -

    - ) - }) } -
    - {loading && hasMore && ( -
    - -
    - )} - -
    -
    - {course_groups && course_groups.length &&
    - 所选学生分班至(选填): - -
    } -
    : } -
    -
    - ) - } -} - -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( + + +
    + 姓名: + {this.setState({name: e.target.value})}} + style={{ width: '221px'}} + > + 单位: + {/* {this.setState({school_name: e.target.value})}} + style={{ width: '200px'}}> + */} + {this.setState({school_name: value})}} + > + this.fetchMemberList(1)} + style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} + >搜索 +
    + {/* */} + + +

    + + + + + + +

    + + { loading || users.length ?
    + {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} +
    + + + + { users.map( candidate => { + return ( +

    + + + 12 }> + + + + + 12 }> + + + + + + +

    + ) + }) } +
    + {loading && hasMore && ( +
    + +
    + )} + +
    +
    + {course_groups && course_groups.length &&
    + 所选学生分班至(选填): + +
    } +
    : } +
    +
    + ) + } +} + +AddStudentModal.contextType = ThemeContext; +export default AddStudentModal; diff --git a/public/react/src/modules/courses/members/modal/AddTeacherModal.js b/public/react/src/modules/courses/members/modal/AddTeacherModal.js index 720ca870f..21902a782 100644 --- a/public/react/src/modules/courses/members/modal/AddTeacherModal.js +++ b/public/react/src/modules/courses/members/modal/AddTeacherModal.js @@ -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( - - - -
    - 姓名: - {this.setState({name: e.target.value})}} - style={{ width: '200px', marginRight: '18px' }}> - - 单位: - - {/* */} - this.fetchMemberList(1)} - style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} - >搜索 -
    - {/* graduation_groups && !!graduation_groups.length */} - - -

    - - - - - - -

    - { loading || candidates.length ?
    - {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} -
    - - - - { candidates && candidates.map( candidate => { - return ( -

    - - - {/* "color":"#4c4c4c" */} - 12 }> - - - - - 12 }> - - - - - - -

    - ) - }) } -
    - {loading && hasMore && ( -
    - -
    - )} - -
    -
    -
    : } -
    - { this.hasGraduationModule() &&
    - 添加至答辩组: - -
    } - - { course_groups && !!course_groups.length &&
    - 管理权限: - -
    } -
    -
    - ) - } -} -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( + + + +
    + 姓名: + {this.setState({name: e.target.value})}} + style={{ width: '200px', marginRight: '18px' }}> + + 单位: + + {/* */} + this.fetchMemberList(1)} + style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} + >搜索 +
    + {/* graduation_groups && !!graduation_groups.length */} + + +

    + + + + + + +

    + { loading || candidates.length ?
    + {/* https://github.com/CassetteRocks/react-infinite-scroller/issues/70 */} +
    + + + + { candidates && candidates.map( candidate => { + return ( +

    + + + {/* "color":"#4c4c4c" */} + 12 }> + + + + + 12 }> + + + + + + +

    + ) + }) } +
    + {loading && hasMore && ( +
    + +
    + )} + +
    +
    +
    : } +
    + { this.hasGraduationModule() &&
    + 添加至答辩组: + +
    } + + { course_groups && !!course_groups.length &&
    + 管理权限: + +
    } +
    +
    + ) + } +} +export default AddTeacherModal; diff --git a/public/react/src/modules/courses/poll/PollDetailTabThird.js b/public/react/src/modules/courses/poll/PollDetailTabThird.js index b0bc95cea..47fcaf52f 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThird.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThird.js @@ -108,8 +108,8 @@ class PollDetailTabThird extends Component{ { item.question.answers.map((index,k)=>{ return( -
  • - +
  • + {index.answer_text} { index.answer_text=="其他" ?

    :"" diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index dfbfd3a74..bce3d2753 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -445,7 +445,7 @@ class PollInfo extends Component{ item.question.answers && item.question.answers.map((i,k)=>{ return(
  • - + {i.answer_text} { i.answer_text=="其他"? diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js index 977b459d4..293310a90 100644 --- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js +++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js @@ -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} > diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index e168dcf6e..71fd8744e 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -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={this.props.isAdmin()?:""} match={this.props.match} coursedata={this.props.coursedata} coursupdata={()=>this.homeworkupdatalist(Coursename,page,order)} diff --git a/public/react/src/modules/user/usersInfo/InfosBank.js b/public/react/src/modules/user/usersInfo/InfosBank.js index eb07a066c..8adc7ba50 100644 --- a/public/react/src/modules/user/usersInfo/InfosBank.js +++ b/public/react/src/modules/user/usersInfo/InfosBank.js @@ -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( -
    - - -
    -
  • this.changeType("publicly")}>{is_current ? "我":"TA"}的题库
  • -
  • this.changeType("personal")}>公共题库
  • - -
    - -
    - -
    -
    -

    - 共参与{totalCount}个题库 -

    -
  • - {sort_by=="updated_at"?"时间最新":sort_by=="name"?"作业名称":"贡献者"} - -
  • -
    -

    -
    - { - !data || data.question_banks.length==0 && - } - { - data && data.question_banks && data.question_banks.map((item,key)=>{ - return( -
    -
    - -
    -
    -

    - {item.name} - 发送 - { - item.is_public ==false ? - this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开:"" - } -

    -

    - {item.quotes_count}次引用 - {item.solve_count}次答题 - {moment(item.updated_at).format('YYYY-MM-DD HH:mm')} - this.setPublic(2)}>删除 - {item.course_list_name} -

    -
    -
    - ) - }) - } -
    - { - totalCount > 15 && -
    - -
    - } - - - ) - } -} +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( +
    + + +
    +
  • this.changeType("publicly")}>{is_current ? "我":"TA"}的题库
  • +
  • this.changeType("personal")}>公共题库
  • +
    +
    + +
    +
      +
    • this.changeCourseListId()}> + 全部 +
    • + { + data && data.course_list && data.course_list.map((item,key)=>{ + return( +
    • this.changeCourseListId(`${item.id}`)}> + {item.name} +
    • + ) + }) + } +
    +
    +
    +

    + 共参与{totalCount}个题库 +

    +
  • + {sort_by=="updated_at"?"时间最新":sort_by=="name"?"作业名称":"贡献者"} +
      +
    • this.changeOrder("updated_at")}>时间最新
    • +
    • this.changeOrder("name")}>作业名称
    • +
    • this.changeOrder("contributor")}>贡献者
    • +
    +
  • +
    +

    +
    + { + !data || data.question_banks.length==0 && + } + { + data && data.question_banks && data.question_banks.map((item,key)=>{ + return( +
    +
    + +
    +
    +

    + {item.name} + 发送 + { + item.is_public ==false ? + this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开:"" + } +

    +

    + {item.quotes_count}次引用 + {item.solve_count}次答题 + {moment(item.updated_at).format('YYYY-MM-DD HH:mm')} + this.setPublic(2)}>删除 + {item.course_list_name} +

    +
    +
    + ) + }) + } +
    + { + totalCount > 15 && +
    + +
    + } +
    +
    + ) + } +} export default InfosBank; \ No newline at end of file