From 2308454f427f266269afac7d73fee69724ff470c Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 8 Jul 2019 16:49:36 +0800 Subject: [PATCH 01/10] del --- .../react/src/modules/tpm/challengesnew/TPManswer2.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)}> From cb6587f393f400299c2bd6cd6ed0135d6aea237b Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 8 Jul 2019 17:19:27 +0800 Subject: [PATCH 02/10] markdown-body --- .../src/modules/courses/shixunHomework/Workquestionandanswer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 170051ca6..5cb496847 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -557,7 +557,7 @@ class Workquestionandanswer extends Component { description={jobsettingsdata === undefined ? "" : jobsettingsdata === null ? "" : jobsettingsdata === "null" ? "" : jobsettingsdata.data.explanation === undefined ? "" : jobsettingsdata.data.explanation === null ? "" : jobsettingsdata.data.explanation}>
: -
+
{jobsettingsdata === undefined ? "无" : jobsettingsdata === null ? "无" : jobsettingsdata === "null" ? "无" : jobsettingsdata.data.explanation === undefined ? "无" : jobsettingsdata.data.explanation === null ? "无" :
Date: Mon, 8 Jul 2019 17:44:53 +0800 Subject: [PATCH 03/10] max-width: 86%; --- public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js | 2 +- public/react/src/modules/page/layers/TaskResultLayer.css | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js b/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js index 61342de37..50072c627 100644 --- a/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js +++ b/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js @@ -18,7 +18,7 @@ export function ImageLayerOfCommentHOC(options = {}) { const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') // 判断imageSrc是否是图片 const fileName = event.target.innerHTML.trim() - if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName)) { + if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG') { // 非回复里的头像图片; 非emoticons if (imageSrc.indexOf('/images/avatars/User') === -1 && imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) { diff --git a/public/react/src/modules/page/layers/TaskResultLayer.css b/public/react/src/modules/page/layers/TaskResultLayer.css index a684abdf4..0dd118470 100644 --- a/public/react/src/modules/page/layers/TaskResultLayer.css +++ b/public/react/src/modules/page/layers/TaskResultLayer.css @@ -41,9 +41,10 @@ align-items: center; display: -webkit-flex; height: 100%; + text-align: center; } .passImg{ - max-width: 100%; + max-width: 86%; max-height: 100%; } /* ImageLayer ----------------- End */ From c4b56bd1c998e4f40d8a9469006dcbe1628f7c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 8 Jul 2019 20:37:09 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/package.json | 2 +- .../tasks/GraduationTaskssetting.js | 47 ++++++++++++-- .../tasks/GraduationTaskssettinglist.js | 62 +++++++++++++++++-- .../tasks/GraduationTaskssettingquestions.js | 47 +++++++++++++- 4 files changed, 146 insertions(+), 12 deletions(-) diff --git a/public/react/package.json b/public/react/package.json index f3565cf45..d2b6a23ea 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -6,7 +6,7 @@ "@flatten/array": "^1.1.7", "@icedesign/base": "^0.2.5", "@novnc/novnc": "^1.1.0", - "antd": "^3.20.1", + "antd": "^3.6.5", "array-flatten": "^2.1.2", "autoprefixer": "7.1.6", "axios": "^0.18.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}*/} {/*/>*/} - + 导出 :""} From 18a37dda3ad1ab61d8d9585b40ed0e81b908f2cf Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 9 Jul 2019 09:15:22 +0800 Subject: [PATCH 05/10] lock --- public/react/src/modules/page/main/CodeEvaluateView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index 6c9ae2c6d..eba71d4fa 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -159,7 +159,7 @@ class CodeEvaluateView extends Component { let headIconClass = ''; let _headLockIconClass = ''; - if (item.is_public === 0) { + if (item.is_public == 0) { if (game.test_sets_view === true || power === 1){ _headLockIconClass = 'fas fa-unlock-alt' } else { From 41c65dc8652db9c01ed79b800707811d3a2e8c7d Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 9 Jul 2019 09:38:23 +0800 Subject: [PATCH 06/10] css --- public/react/src/modules/page/main/LeftView.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/page/main/LeftView.js b/public/react/src/modules/page/main/LeftView.js index b2469ec44..ec3d4665b 100644 --- a/public/react/src/modules/page/main/LeftView.js +++ b/public/react/src/modules/page/main/LeftView.js @@ -283,6 +283,9 @@ class LeftView extends Component { color: #CDCDCD; flex: 0 0 45px; } + .markdown-body ol, .markdown-body ul { + padding-left: 2.5em; + } `}
    @@ -293,7 +296,7 @@ class LeftView extends Component {
    {item.name}
    已解锁
    -
    +
    })} From f7684fb38ad013b27dccb82422917c1f6d692195 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 9 Jul 2019 09:49:37 +0800 Subject: [PATCH 07/10] top --- public/react/src/modules/page/main/CodeEvaluateView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index eba71d4fa..d402e6bce 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -175,7 +175,7 @@ class CodeEvaluateView extends Component { testSetsComponentArray.push(
    + style={{cursor:'pointer', 'margin-top':index == 0 ? '4px' : ''}} key={index+'-0'}>

    From 10ac320117a58c79a9fdfdab80bbfdbb1eb32e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 9 Jul 2019 11:01:28 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/package.json | 3 --- public/react/src/modules/courses/Resource/Fileslistitem.js | 1 - .../src/modules/courses/shixunHomework/ShixunStudentWork.js | 1 - .../src/modules/courses/shixunHomework/ShixunWorkReport.js | 1 - .../src/modules/courses/shixunHomework/Trainingjobsetting.js | 1 - .../modules/courses/shixunHomework/Workquestionandanswer.js | 1 - 6 files changed, 8 deletions(-) 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/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 8a8ff674c..c3998700f 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -6,7 +6,6 @@ import {getImageUrl} from 'educoder'; import axios from 'axios' import {getUrl} from 'educoder'; import moment from 'moment' -import { Base64 } from 'js-base64'; import CoursesListType from '../coursesPublic/CoursesListType'; import Showoldfiles from "../coursesPublic/Showoldfiles"; import Modals from '../../modals/Modals'; diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 90bc23d99..879f90cc7 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -33,7 +33,6 @@ import '../css/Courses.css' import './style.css' import moment from 'moment'; import 'moment/locale/zh-cn'; -import {Base64} from 'js-base64'; const Search = Input.Search; const CheckboxGroup = Checkbox.Group; diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index fc34e0667..9a331cdef 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -20,7 +20,6 @@ import '../css/Courses.css'; import './style.css'; import moment from 'moment'; import 'moment/locale/zh-cn'; -import {Base64} from 'js-base64'; class ShixunWorkReport extends Component { diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 51b491861..06c4dfba2 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -4,7 +4,6 @@ import HomeworkModal from "../coursesPublic/HomeworkModal"; import {WordsBtn, ActionBtn, handleDateString} from 'educoder'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; -import {Base64} from 'js-base64'; import { Button, Checkbox, diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 5cb496847..9616eae58 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -23,7 +23,6 @@ import { import {Link, Switch, Route, Redirect} from 'react-router-dom'; import moment from 'moment'; import 'moment/locale/zh-cn'; -import {Base64} from 'js-base64'; import axios from 'axios'; import '../css/members.css' import "../common/formCommon.css" From b7e2556aaea15193dfc9259d3fa73ed236df7660 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 9 Jul 2019 14:00:37 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E5=B7=B2=E5=AE=A1=E6=89=B9=E5=BE=85?= =?UTF-8?q?=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/members/teacherList.js | 118 +++++++++++++++--- 1 file changed, 98 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 2c5108f8d..18915f20c 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,11 +27,14 @@ 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', @@ -55,6 +58,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 +68,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 +148,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 +213,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 +223,8 @@ class studentsList extends Component{ checkBoxValues: [], isSpin:false, application_list: [], - checkAllArray: [] + checkAllArray: [], + filterKey: 1, // 1 已审批 2 待审批 } } onCheckAllChange = (e, item, index) => { @@ -339,7 +354,7 @@ class studentsList extends Component{ console.log(error); }); } - fetchAll=(argPage)=>{ + fetchAll = (argPage) => { this.setState({ isSpin:true }) @@ -347,9 +362,28 @@ 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; } @@ -358,8 +392,17 @@ class studentsList extends Component{ 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 }) } @@ -529,13 +572,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 +607,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 +649,25 @@ class studentsList extends Component{ } secondRowLeft={ - total_count ? : '' + isAdminOrTeacher ?

    + + 已审批({total_count}) + 待审批({apply_size}) + +
    : + (total_count ? : '') } onPressEnter={this.onPressEnter} >