diff --git a/public/react/package.json b/public/react/package.json index d2b6a23ea..e0989f47c 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -42,8 +42,6 @@ "immutability-helper": "^2.6.6", "install": "^0.12.2", "jest": "20.0.4", - "js-base64": "^2.5.1", - "js-file-download": "^0.4.7", "lodash": "^4.17.5", "loglevel": "^1.6.1", "material-ui": "^1.0.0-beta.40", @@ -165,7 +163,6 @@ "babel-plugin-import": "^1.11.0", "concat": "^1.0.3", "happypack": "^5.0.1", - "videojs-for-react": "^0.0.3", "webpack-bundle-analyzer": "^3.0.3", "webpack-parallel-uglify-plugin": "^1.1.0" } diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 24fbaad81..ba80918dc 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -5,6 +5,7 @@ import locale from 'antd/lib/date-picker/locale/zh_CN'; import { WordsBtn,getUrl ,handleDateString} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; +import DownloadMessage from '../../../modals/DownloadMessage'; import CoursesListType from '../../coursesPublic/CoursesListType'; import PublishModals from "../../coursesPublic/PublishModals"; import HomeworkModal from "../../coursesPublic/HomeworkModal"; @@ -894,7 +895,40 @@ class GraduationTaskssettingapp extends Component{ } - + /// 确认是否下载 + confirmysl(url){ + axios.get(url).then((response) => { + if(response.data.status&&response.data.status===-1){ + + }else if(response.data.status&&response.data.status===-2){ + if(response.data.messages === "100"){ + // 已超出文件导出的上限数量(100 ),建议: + + this.setState({ + DownloadType:true, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:true, + DownloadMessageval:500 + }) + } + }else { + this.props.showNotification(`正在下载中`); + window.open("/api"+url, '_blank'); + } + }).catch((error) => { + console.log(error) + }); + } + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) + } render(){ const { getFieldDecorator } = this.props.form; const dateFormat = 'YYYY-MM-DD HH:mm'; @@ -969,7 +1003,12 @@ class GraduationTaskssettingapp extends Component{ {/*course_groups={course_groups}*/} {/*skipTop={this.skipTop}*/} {/*/>*/} - + 导出 :""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 5d0515535..517c2ec0b 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -6,7 +6,7 @@ import axios from 'axios'; import moment from 'moment'; import HomeworkModal from "../../coursesPublic/HomeworkModal"; import Modals from '../../../modals/Modals'; - +import DownloadMessage from '../../../modals/DownloadMessage'; import CoursesListType from '../../coursesPublic/CoursesListType'; import ModulationModal from "../../coursesPublic/ModulationModal"; @@ -612,7 +612,51 @@ class GraduationTaskssettinglist extends Component{ this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pageNumber); } + /// 确认是否下载 + confirmysl(url){ + + let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state; + axios.get(url,{ + teacher_comment:teacher_comment, + task_status:task_status, + course_group:course_group, + cross_comment:cross_comment, + order:order, + b_order:b_order, + search:search, + }).then((response) => { + if(response.data.status&&response.data.status===-1){ + + }else if(response.data.status&&response.data.status===-2){ + if(response.data.messages === "100"){ + // 已超出文件导出的上限数量(100 ),建议: + + this.setState({ + DownloadType:true, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:true, + DownloadMessageval:500 + }) + } + }else { + this.props.showNotification(`正在下载中`); + window.open("/api"+url, '_blank'); + } + }).catch((error) => { + console.log(error) + }); + } + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) + } render(){ let {coursename,coursesearch,taskname,taskid,taskslistdata,data,page,limit,teacher_comment,task_status,cross_comment,search,loadingstate, @@ -959,7 +1003,17 @@ class GraduationTaskssettinglist extends Component{ Cancel={this.Cancelvisible} categoryid={taskslistdata.work_id} setupdate={this.setupdate} - />:""} {taskslistdata&&taskslistdata? + />:""} + + + + + {taskslistdata&&taskslistdata? // 教师列表 this.props.isAdmin()?
@@ -1025,8 +1079,8 @@ class GraduationTaskssettinglist extends Component{ {this.props.isAdmin()?
  • 导出
  • :""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js index 4e807fde4..7c1a1474a 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js @@ -4,6 +4,7 @@ import {Link} from 'react-router-dom'; import { WordsBtn,markdownToHTML} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; +import DownloadMessage from '../../../modals/DownloadMessage'; import HomeworkModal from "../../coursesPublic/HomeworkModal"; import CoursesListType from '../../coursesPublic/CoursesListType'; import moment from 'moment'; @@ -187,6 +188,41 @@ class GraduationTasksquestions extends Component{ course_groupslist:id }) } + + /// 确认是否下载 + confirmysl(url){ + axios.get(url).then((response) => { + if(response.data.status&&response.data.status===-1){ + + }else if(response.data.status&&response.data.status===-2){ + if(response.data.messages === "100"){ + // 已超出文件导出的上限数量(100 ),建议: + + this.setState({ + DownloadType:true, + DownloadMessageval:100 + }) + }else { + //因附件资料超过500M + this.setState({ + DownloadType:true, + DownloadMessageval:500 + }) + } + }else { + this.props.showNotification(`正在下载中`); + window.open("/api"+url, '_blank'); + } + }).catch((error) => { + console.log(error) + }); + } + Downloadcal=()=>{ + this.setState({ + DownloadType:false, + DownloadMessageval:undefined + }) + } render(){ let { Modalstype,Modalstopval,ModalCancel,ModalSave,questionslist} =this.state; @@ -218,7 +254,12 @@ class GraduationTasksquestions extends Component{ {/*modalSave={ModalSave}*/} {/*loadtype={Loadtype}*/} {/*/>*/} - + 导出 :""} diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 2c5108f8d..a3cc08437 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { Input,Checkbox,Table, Divider, Tooltip,Spin } from "antd"; +import { Input,Checkbox,Table, Divider, Tooltip,Spin, Menu } from "antd"; import CourseLayoutcomponent from '../common/CourseLayoutComponent' @@ -27,18 +27,22 @@ const ROLE_ADMIN = "管理员" const ROLE_TEACHER = "教师" const ROLE_TEACHER_ASSISTANT = "助教" const pageSize = 20; + function buildColumns(that) { + let sortedInfo = that.state.sortedInfo || {} const isAdmin = that.props.isAdmin() const isAdminOrCreator = that.props.isAdminOrCreator(); const isAdminOrTeacher = that.props.isAdminOrTeacher() - const { course_groups } = that.state + const { course_groups, filterKey } = that.state + const showSorter = filterKey == '1' const columns = [{ title: '序号', dataIndex: 'name', key: 'index', render: (content, item, index) => { - return item.isApply == true ? '' : {(that.state.page - 1) * 20 + index + 1 - - (that.state.application_list ? that.state.application_list.length : 0)}  + return index + 1 + // return item.isApply == true ? '' : {(that.state.page - 1) * 20 + index + 1 + // - (that.state.application_list ? that.state.application_list.length : 0)}  } } // ,{ @@ -55,6 +59,8 @@ function buildColumns(that) { dataIndex: 'name', width: 120, key: 'name', + sorter: showSorter, + sortOrder: sortedInfo.columnKey === 'name' && sortedInfo.order, render: (name, record) => { return 4 ? name : ''}`}>{name} @@ -63,6 +69,11 @@ function buildColumns(that) { title: '角色', dataIndex: 'role', key: 'role', + sorter: showSorter, + // 'ascend' | 'descend' + defaultSortOrder: 'ascend', + sortOrder: sortedInfo.columnKey === 'role' && sortedInfo.order, + }] that.state.course_groups && that.state.course_groups.length && columns.push({ title: 管理权限, @@ -138,8 +149,11 @@ function buildColumns(that) { columns.push({ title: '答辩组', // width: 90, + sorter: showSorter, key: 'graduation_group', dataIndex: 'graduation_group', + sortOrder: sortedInfo.columnKey === 'graduation_group' && sortedInfo.order, + render: text => ( {text} @@ -200,6 +214,7 @@ class studentsList extends Component{ this.state={ headIndex:"1", page:1, + sortedInfo: { columnKey: 'role', order: 'ascend'}, totalPage:undefined, searchValue:"", order: ORDER_BY_DATE, @@ -209,7 +224,8 @@ class studentsList extends Component{ checkBoxValues: [], isSpin:false, application_list: [], - checkAllArray: [] + checkAllArray: [], + filterKey: 1, // 1 已审批 2 待审批 } } onCheckAllChange = (e, item, index) => { @@ -339,7 +355,7 @@ class studentsList extends Component{ console.log(error); }); } - fetchAll=(argPage)=>{ + fetchAll = async (argPage) => { this.setState({ isSpin:true }) @@ -347,28 +363,57 @@ class studentsList extends Component{ if (argPage) { this.setState({ page: argPage }) } + + const sortedInfo = this.state.sortedInfo; let page = argPage || this.state.page - let { order, searchValue }=this.state - let url=`/courses/${id}/teachers.json?order=${order}&page=${page}`; + let { searchValue, filterKey }=this.state + let order = 1; + if (sortedInfo.columnKey == 'role') { + order = 1; + } else if (sortedInfo.columnKey == 'name') { + order = 2; + } else if (sortedInfo.columnKey == 'graduation_group') { + order = 3; + } + let sort = 'desc' + if (sortedInfo.order == 'ascend') { + sort = 'asc' + } + let url=`/courses/${id}/teachers.json?order=${order}&page=${page}&sort=${sort}`; + if (filterKey == '1') { + + } else if (filterKey == '2') { + url = `/courses/${id}/apply_teachers.json?_a=1` + } if(searchValue!=""){ url+='&search='+searchValue; } - axios.get((url)).then((result)=>{ + const result = await axios.get(url) + // axios.get((url)).then((result)=>{ if (result.data.teacher_list) { this.setState({ teachers: result.data.teacher_list, total_count: result.data.teacher_list_size, - application_list: result.data.application_list, + application_list: result.data.application_list || [], + is_admin: result.data.is_admin, + apply_size: result.data.apply_size, + isSpin:false + }) + } else if (result.data.application_list) { + this.setState({ + total_count: result.data.teacher_list_size, + application_list: result.data.application_list || [], is_admin: result.data.is_admin, + apply_size: result.data.apply_size, isSpin:false }) } - }).catch((error)=>{ - console.log(error); - this.setState({ - isSpin:false - }) - }) + // }).catch((error)=>{ + // console.log(error); + // this.setState({ + // isSpin:false + // }) + // }) } getGroupList(){ let id = this.props.match.params.coursesId @@ -529,13 +574,33 @@ class studentsList extends Component{ }) return result && result.length > 0 } - + onTableChange = (pagination, filters, sorter) => { + console.log('Various parameters', pagination, filters, sorter); + this.setState({ + sortedInfo: sorter, + }, () => { + this.fetchAll() + }); + }; + clearSelection = () => { + this.setState({ checkBoxValues: [] }) + } + selectedStatus=(e)=>{ + this.clearSelection() + this.setState({ + filterKey: e.key, + page:1, + isSpin:true + }, () => { + this.fetchAll(); + }) + } render(){ const isAdmin = this.props.isAdmin() const columns = buildColumns(this) let { searchValue, checkBoxValues, checkAllValue, - groupList, total_count, teachers, order, page + groupList, total_count, teachers, order, page, apply_size, filterKey }=this.state let currentOrderName = '加入时间排序' @@ -544,12 +609,13 @@ class studentsList extends Component{ } else if (order == ORDER_BY_GRADUATION_GROUP) { currentOrderName = '答辩组排序' } - const combineArray = teachers.slice(0) - if (page == 1) { - this.state.application_list && this.state.application_list.slice(0).reverse().forEach(item => { - item.isApply = true - combineArray.unshift(item) - }) + let combineArray = teachers.slice(0) + if (page == 1 && filterKey == '2') { + // this.state.application_list && this.state.application_list.slice(0).reverse().forEach(item => { + // item.isApply = true + // combineArray.unshift(item) + // }) + combineArray = this.state.application_list } const isAdminOrTeacher = this.props.isAdminOrTeacher() const hasGraduationModule = this.hasGraduationModule() @@ -585,12 +651,25 @@ class studentsList extends Component{ } secondRowLeft={ - total_count ? : '' + isAdminOrTeacher ?
    + + 已审批({total_count}) + 待审批({apply_size}) + +
    : + (total_count ? : '') } onPressEnter={this.onPressEnter} >
    @@ -293,7 +296,7 @@ class LeftView extends Component {
    {item.name}
    已解锁
    -
    +
    })} diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer2.js b/public/react/src/modules/tpm/challengesnew/TPManswer2.js index 98c615065..b5e1b43a6 100644 --- a/public/react/src/modules/tpm/challengesnew/TPManswer2.js +++ b/public/react/src/modules/tpm/challengesnew/TPManswer2.js @@ -195,10 +195,10 @@ export default class TPManswer extends Component { this.setState({ answers: newAnswers}) } answerOnChange = (val, index) => { - // if (!this.state.answers[index]) { - // // 1、2、3删除2会走到这里 - // return; - // } + if (!this.state.answers[index]) { + // 1、2、3删除2会走到这里 + return; + } const newAnswer = Object.assign({}, this.state.answers[index]) newAnswer.contents = val const newAnswers = this.state.answers.slice(0) @@ -314,7 +314,7 @@ export default class TPManswer extends Component { { answers.map((answer, index) => { - return
    + return
    *

    级别{index + 1}

    this.delanswers(index)}>