From 76e7afaf97e746936cd31bf563f4beb7ed811f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 29 Oct 2019 10:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/Studentshavecompletedthelist.js | 168 ++++++++++-------- 1 file changed, 93 insertions(+), 75 deletions(-) diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 1c4d051ff..80b1babc4 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -110,6 +110,7 @@ class Studentshavecompletedthelist extends Component { align: 'center', className: "edu-txt-center font-14 maxnamewidth175", width:'175px', + sorter: true, render: (text, record) => ( ( ( {record.efficiencyscore === "--" ? @@ -1265,7 +1268,7 @@ class Studentshavecompletedthelist extends Component { }) } - this.Searchdata(this.state.order, null, null, null, null, pageNumber, this.state.limit) + this.Searchdata(this.state.order, null, null, null, null, pageNumber, this.state.limit, this.state.order_type); } @@ -1617,60 +1620,8 @@ class Studentshavecompletedthelist extends Component { } -//排序 - funorder = (e) => { - if (e === "end_at") { - // 时间 - // 时间排序是从小到大 - if (this.state.loadingstate === true) { - this.setState({ - order: "end_at", - }) - } else { - this.setState({ - order: "end_at", - loadingstate: true, - }) - } - - this.Searchdata(e, null, null, null, null, this.state.page, this.state.limit) - } - - if (e === "score") { - // 成绩 - //成绩排序是从大到小 - if (this.state.loadingstate === true) { - this.setState({ - order: "score", - }) - } else { - this.setState({ - order: "score", - loadingstate: true, - }) - } - - this.Searchdata(e, null, null, null, null, this.state.page, this.state.limit) - } - - if (e === "student_id") { - //学号 - //学号排序是从大到小 - if (this.state.loadingstate === true) { - this.setState({ - order: "student_id", - }) - } else { - this.setState({ - order: "student_id", - loadingstate: true - }) - } - this.Searchdata(e, null, null, null, null, this.state.page, this.state.limit) - } - } - Searchdata = (order, commit_status, review, exercise_group_id, search, page, limit) => { + Searchdata = (order, commit_status, review, exercise_group_id, search, page, limit, order_type) => { var exercise_id = this.props.match.params.Id; // console.log(731); // 764 935 var url = `/exercises/${exercise_id}/exercise_lists.json`; @@ -1682,6 +1633,7 @@ class Studentshavecompletedthelist extends Component { search: "", page: page, limit: limit, + order_type: order_type, } axios.get(url, { params: params @@ -2421,7 +2373,7 @@ class Studentshavecompletedthelist extends Component { }; - //试卷tbale 列表塞选数据 + //老师试卷table 列表塞选数据 table1handleChange = (pagination, filters, sorter) => { //"ascend" 升序 //"descend" 降序 @@ -2509,6 +2461,89 @@ class Studentshavecompletedthelist extends Component { } } + + //学生问卷table 列表塞选数据 + table1handleChangestuden = (pagination, filters, sorter) => { + if (JSON.stringify(sorter) === "{}") { + //没有选择 + } else { + try { + //时间排序 + if (sorter.columnKey === "updatetime") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + order: "end_at", + loadingstate: true, + order_type: "asc" + }) + this.Searchdata("end_at", null, null, null, null, this.state.page, this.state.limit, "asc"); + } else if (sorter.order === "descend") { + //降序 + this.setState({ + order: "end_at", + loadingstate: true, + order_type: "desc" + }) + this.Searchdata("end_at", null, null, null, null, this.state.page, this.state.limit, "desc"); + } + } + } catch (e) { + + } + + try { + //学生学号排序 + if (sorter.columnKey === "stduynumber") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + order: "student_id", + loadingstate: true, + order_type: "asc" + }) + this.Searchdata("student_id", null, null, null, null, this.state.page, this.state.limit, "asc"); + } else if (sorter.order === "descend") { + //降序 + this.setState({ + order: "student_id", + loadingstate: true, + order_type: "desc" + }) + this.Searchdata("student_id", null, null, null, null, this.state.page, this.state.limit, "desc"); + } + } + } catch (e) { + + } + + try { + //成绩排序排序 + if (sorter.columnKey === "efficiencyscore") { + if (sorter.order === "ascend") { + //升序 + this.setState({ + order: "score", + loadingstate: true, + order_type: "asc" + }) + this.Searchdata("score", null, null, null, null, this.state.page, this.state.limit, "asc"); + + } else if (sorter.order === "descend") { + //降序 + this.setState({ + order: "score", + loadingstate: true, + order_type: "desc" + }) + this.Searchdata("score", null, null, null, null, this.state.page, this.state.limit, "desc"); + } + } + } catch (e) { + + } + } + } setExerciseReviewAndAnswer = () => { } @@ -2903,26 +2938,8 @@ class Studentshavecompletedthelist extends Component { {Teacherliststudentlist === undefined ? "0" : Teacherliststudentlist.exercise_types.exercise_end_time}} -
- -
+ + @@ -2957,6 +2974,7 @@ class Studentshavecompletedthelist extends Component { columns={columns} pagination={false} className="mysjysltable4" + onChange={this.table1handleChangestuden} loading={loadingstate} />}