diff --git a/public/react/src/college/College.js b/public/react/src/college/College.js index 53fe9d5e3..5f3459928 100644 --- a/public/react/src/college/College.js +++ b/public/react/src/college/College.js @@ -1,5 +1,5 @@ -import React, { Component } from "react"; -import { SnackbarHOC, getImageUrl } from 'educoder'; +import React, {Component} from "react"; +import {SnackbarHOC,getImageUrl} from 'educoder'; import axios from 'axios'; import { Spin, @@ -8,15 +8,16 @@ import { } from "antd"; import Colleagechart from './colleagechart/Colleagechart' import Colleagechartzu from './colleagechart/Colleagechartzu' -import TPMIndexHOC from "../modules/tpm/TPMIndexHOC"; +import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; import NoneData from './../modules/courses/coursesPublic/NoneData'; import './colleagecss/colleage.css'; class College extends Component { constructor(props) { super(props); + // this.answerMdRef = React.createRef(); this.state = { - coursesloading: false, + coursesloading:false, columns: [ { title: '名称', @@ -41,13 +42,13 @@ class College extends Component { align: 'center', className: "edu-txt-center font-14 maxnamewidth340", render: (text, record) => ( - { record.teachers } - + ) }, { @@ -61,7 +62,7 @@ class College extends Component { { record.evaluating_count } - + ), }, { @@ -89,7 +90,7 @@ class College extends Component { { record.shixun_work_count } - + ) }, @@ -104,7 +105,7 @@ class College extends Component { { record.attachment_count } - + ), }, { @@ -130,7 +131,7 @@ class College extends Component { { record.other_work_count } - + ) }, { @@ -140,14 +141,14 @@ class College extends Component { align: 'center', className: "edu-txt-center font-14", render: (text, record) => ( - + { - record.is_end ? - "已结束" + record.is_end? + "已结束" : "正在进行" } - + ) }, { @@ -161,15 +162,15 @@ class College extends Component { { record.activity_time } - + ) }, ], - page: 1, - limit: 10, - total_users: 50, - teachersloading: false, - teacherranking: [ + page:1, + limit:10, + total_users:50, + teachersloading:false, + teacherranking:[ { title: '排名', dataIndex: 'ranking', @@ -181,7 +182,7 @@ class College extends Component { { record.id } - + ) }, { @@ -191,13 +192,13 @@ class College extends Component { align: 'center', className: "edu-txt-center font-14 maxnamewidth105", render: (text, record) => ( - { record.name - } - + } + ) }, { @@ -211,7 +212,7 @@ class College extends Component { { record.course_count } - + ), }, { @@ -239,7 +240,7 @@ class College extends Component { { record.un_shixun_work_count } - + ) }, @@ -251,10 +252,10 @@ class College extends Component { className: "edu-txt-center font-14", render: (text, record) => ( - { - record.student_count - } - + { + record.student_count + } + ), }, { @@ -266,7 +267,7 @@ class College extends Component { render: (text, record) => ( { - record.complete_rate + "%" + record.complete_rate+"%" } ) @@ -279,32 +280,32 @@ class College extends Component { className: "edu-txt-center font-14", render: (text, record) => ( - { - record.publish_shixun_count - } - + { + record.publish_shixun_count + } + ) } ], - studentranking: [ + studentranking:[ { title: '排名', dataIndex: 'ranking', key: 'ranking', align: 'center', className: "edu-txt-center font-14", - width: '100px', + width:'100px', render: (text, record) => ( { - record.id === 1 ? - : record.id === 2 ? - - : record.id === 3 ? - - : record.id + record.id===1? + :record.id===2? + + :record.id===3? + + :record.id } - + ) }, { @@ -313,14 +314,14 @@ class College extends Component { key: 'name', align: 'center', className: "edu-txt-center font-14 maxnamewidth105", - width: '100px', + width:'100px', render: (text, record) => ( { - record.name - } + record.name + } ) }, @@ -335,7 +336,7 @@ class College extends Component { { record.student_id } - + ), }, { @@ -346,9 +347,9 @@ class College extends Component { className: "edu-txt-center font-14 maxnamewidth255", render: (text, record) => ( - { - record.shixun_count - } + { + record.shixun_count + } ) }, @@ -360,10 +361,10 @@ class College extends Component { className: "edu-txt-center font-14", render: (text, record) => ( - { - record.study_shixun_count - } - + { + record.study_shixun_count + } + ) }, @@ -378,7 +379,7 @@ class College extends Component { { record.grade } - + ), }, { @@ -389,258 +390,256 @@ class College extends Component { className: "edu-txt-center font-14", render: (text, record) => ( - { - record.experience - } + { + record.experience + } ) }, ], - school: "", - teachers_count: null, - students_count: null, - courses_count: null, - shixuns_count: null, - shixun_report_count: null, - shixun_time: null, - courses: null, - course_count: 0, - pages: 1, - limits: 10, - teachers: null, - teacher_count: 0, - students: null, - student_count: 0, - shixun_chart_data: null, - shixun_chart_datanames: null, - studentionsnames: null, - studentionsvalues: null + school:"", + teachers_count:null, + students_count:null, + courses_count:null, + shixuns_count:null, + shixun_report_count:null, + shixun_time:null, + courses:null, + course_count:0, + pages:1, + limits:10, + teachers:null, + teacher_count:0, + students:null, + student_count:0, + shixun_chart_data:null, + shixun_chart_datanames:null, + studentionsnames:null, + studentionsvalues:null } } - componentDidMount() { + componentDidMount(){ console.log("College"); console.log(this.props.match.params.id); - this.gettop(); - this.Numberofinternshipreports(); - this.Actualcombattimeoftrainees(); - this.Classnumber(1, 10); - this.Teacherranking(1, 10); - this.Studentranking(1, 10); - this.Onlinetraining(); - this.Hottest(); + this.gettop(); + this.Numberofinternshipreports(); + this.Actualcombattimeoftrainees(); + this.Classnumber(1,10); + this.Teacherranking(1,10); + this.Studentranking(1,10); + this.Onlinetraining(); + this.Hottest(); } //头部 - gettop = () => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/statistics.json`; + gettop=()=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/statistics.json`; axios.get(url).then((response) => { - if (response === null || response === undefined) { + if(response===null||response===undefined){ this.setState({ - teachers_count: 0, - students_count: 0, - courses_count: 0, - shixuns_count: 0, - school: "", + teachers_count:0, + students_count:0, + courses_count:0, + shixuns_count:0, + school:"", }) return } - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ - teachers_count: 0, - students_count: 0, - courses_count: 0, - shixuns_count: 0, - school: "", - }) - } else { - this.setState({ - teachers_count: response.data.teachers_count, - students_count: response.data.students_count, - courses_count: response.data.courses_count, - shixuns_count: response.data.shixuns_count, - school: response.data.school, + teachers_count:0, + students_count:0, + courses_count:0, + shixuns_count:0, + school:"", }) + }else{ + this.setState({ + teachers_count:response.data.teachers_count, + students_count:response.data.students_count, + courses_count:response.data.courses_count, + shixuns_count:response.data.shixuns_count, + school:response.data.school, + }) } }).catch((error) => { console.log(error) this.setState({ - teachers_count: 0, - students_count: 0, - courses_count: 0, - shixuns_count: 0, - school: "", + teachers_count:0, + students_count:0, + courses_count:0, + shixuns_count:0, + school:"", }) }); } //获取实训报告数 - Numberofinternshipreports = () => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/shixun_report_count.json`; + Numberofinternshipreports=()=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/shixun_report_count.json`; axios.get(url).then((response) => { - if (response === null || response === undefined) { + if(response===null||response===undefined){ this.setState({ - shixun_report_count: 0, + shixun_report_count:0, }) return } - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ - shixun_report_count: 0, + shixun_report_count:0, }) - } else { - if (response.data.status === -1) { + }else{ + if (response.data.status === -1){ this.setState({ - shixun_report_count: 0, + shixun_report_count:0, }) return } this.setState({ - shixun_report_count: response.data.shixun_report_count, + shixun_report_count:response.data.shixun_report_count, }) } }).catch((error) => { console.log(error) this.setState({ - shixun_report_count: 0, + shixun_report_count:0, }) }); } //学员实战时间 - Actualcombattimeoftrainees = () => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/shixun_time.json`; + Actualcombattimeoftrainees=()=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/shixun_time.json`; axios.get(url).then((response) => { - if (response === null || response === undefined) { + if(response===null||response===undefined){ this.setState({ - shixun_time: 0, + shixun_time:0, }) return } - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ - shixun_time: 0, + shixun_time:0, }) - } else { - if (response.data.status === -1) { + }else{ + if (response.data.status === -1){ this.setState({ - shixun_time: 0, + shixun_time:0, }) return } this.setState({ - shixun_time: response.data.shixun_time, + shixun_time:response.data.shixun_time, }) } }).catch((error) => { console.log(error) this.setState({ - shixun_time: 0, + shixun_time:0, }) }); } //课堂信息 - Classnumber = (page, per_page) => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/course_statistics.json`; + Classnumber=(page,per_page)=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/course_statistics.json`; this.setState({ - coursesloading: true + coursesloading:true }) - axios.get(url, { - params: { - page: page, - per_page: per_page, + axios.get(url,{params:{ + page:page, + per_page:per_page, } }).then((response) => { - if (response === null || response === undefined) { + if(response===null||response===undefined){ this.setState({ - courses: [], - course_count: 0 + courses:[], + course_count:0 }) return } - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ - courses: [], - course_count: 0 + courses:[], + course_count:0 }) - } else { - if (response.data.status === -1) { + }else{ + if (response.data.status === -1){ this.setState({ - courses: [], - course_count: 0 + courses:[], + course_count:0 }) return } this.setState({ - courses: response.data.courses, - course_count: response.data.course_count, - page: page, - limit: per_page + courses:response.data.courses, + course_count:response.data.course_count, + page:page, + limit:per_page }) } this.setState({ - coursesloading: false + coursesloading:false }) }).catch((error) => { this.setState({ - courses: [], - course_count: 0, - coursesloading: false + courses:[], + course_count:0, + coursesloading:false }) }); } - //教师排名 - Teacherranking = (page, per_page) => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/teachers.json`; + //教师排名 + Teacherranking=(page,per_page)=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/teachers.json`; this.setState({ - teachersloading: true + teachersloading:true }) - axios.get(url, { - params: { - page: page, - per_page: per_page, + axios.get(url,{params:{ + page:page, + per_page:per_page, } }).then((response) => { - if (response === null || response === undefined) { + if(response===null||response===undefined){ this.setState({ - teachers: [], - teacher_count: 0 + teachers:[], + teacher_count:0 }) return } - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ - teachers: [], - teacher_count: 0 + teachers:[], + teacher_count:0 }) - } else { - if (response.data.status === -1) { + }else{ + if (response.data.status === -1){ this.setState({ - teachers: [], - teacher_count: 0 + teachers:[], + teacher_count:0 }) return } - let teachers = []; - if (response.data.teachers) { - for (let i = 0; i < response.data.teachers.length; i++) { - let datay = { - id: (i + (page - 1) * 10) + 1, + let teachers=[]; + if(response.data.teachers){ + for(let i=0;i { this.setState({ - teachers: [], - teacher_count: 0, - teachersloading: false + teachers:[], + teacher_count:0, + teachersloading:false }) }); } - //学生排名 + //学生排名 - Studentranking = (page, per_page) => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/student_shixun.json`; + Studentranking=(page,per_page)=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/student_shixun.json`; this.setState({ - studentsloading: true + studentsloading:true }) - axios.get(url, { - params: { - page: page, - per_page: per_page, + axios.get(url,{params:{ + page:page, + per_page:per_page, } }).then((response) => { - if (response === null || response === undefined) { + if(response===null||response===undefined){ this.setState({ - students: [], - student_count: 0, + students:[], + student_count:0, }) return } - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ - students: [], - student_count: 0, + students:[], + student_count:0, }) - } else { - if (response.data.status === -1) { + }else{ + if (response.data.status === -1){ this.setState({ - students: [], - student_count: 0, + students:[], + student_count:0, }) return } - let students = []; - if (response.data.teachers) { - for (let i = 0; i < response.data.teachers.length; i++) { - let datay = { - id: (i + (page - 1) * 10) + 1, + let students=[]; + if(response.data.teachers){ + for(let i=0;i { this.setState({ - students: [], - student_count: 0, - studentsloading: false + students:[], + student_count:0, + studentsloading:false }) }); } - //在线实训情况 - Onlinetraining = () => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/shixun_chart_data.json`; - axios.get(url).then((response) => { - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { - this.setState({ - shixun_chart_data: [], - shixun_chart_datanames: [] - }) - } else { - if (response.data.status === -1) { - this.setState({ - shixun_chart_data: [], - shixun_chart_datanames: [] - }) - return - } - - this.setState({ - shixun_chart_data: response.data.data, - shixun_chart_datanames: response.data.names - }) - } - }).catch((error) => { - this.setState({ - shixun_chart_data: [], - shixun_chart_datanames: [] - }) - }); - } + //在线实训情况 + Onlinetraining=()=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/shixun_chart_data.json`; + axios.get(url).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + this.setState({ + shixun_chart_data:[], + shixun_chart_datanames:[] + }) + }else{ + if (response.data.status === -1){ + this.setState({ + shixun_chart_data:[], + shixun_chart_datanames:[] + }) + return + } + + this.setState({ + shixun_chart_data:response.data.data, + shixun_chart_datanames:response.data.names + }) + } + }).catch((error) => { + this.setState({ + shixun_chart_data:[], + shixun_chart_datanames:[] + }) + }); + } //最热测评 - Hottest = () => { - const id = this.props.match.params.id; - const url = `/colleges/${id}/student_hot_evaluations.json`; + Hottest=()=>{ + const id =this.props.match.params.id; + const url=`/colleges/${id}/student_hot_evaluations.json`; axios.get(url).then((response) => { - if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { this.setState({ studentionsnames: [], studentionsvalues: [] }) - } else { + }else { if (response.data.status === -1) { this.setState({ studentionsnames: [], @@ -799,54 +797,54 @@ class College extends Component { }); } - table1handleChange() { + table1handleChange(){ } //塞选 - paginationonChange = (pageNumber) => { - this.Classnumber(pageNumber, 10); + paginationonChange=(pageNumber)=>{ + this.Classnumber(pageNumber,10); } - paginationonChanges = (pageNumber) => { - this.Teacherranking(pageNumber, 10); + paginationonChanges=(pageNumber)=>{ + this.Teacherranking(pageNumber,10); } - paginationonChangess = (pageNumber) => { - this.Studentranking(pageNumber, 10); + paginationonChangess=(pageNumber)=>{ + this.Studentranking(pageNumber,10); } render() { - let { columns, page, limit, total_users, teacherranking, studentranking, - teachers_count, students_count, courses_count, shixuns_count, shixun_report_count, shixun_time, courses, course_count, school, teachers, - pages, limits, teacher_count, teachersloading, coursesloading, pagess, limitss, studentsloading, students, student_count, shixun_chart_data, - shixun_chart_datanames, studentionsnames, studentionsvalues + let {columns,page,limit,total_users,teacherranking,studentranking, + teachers_count,students_count, courses_count, shixuns_count,shixun_report_count,shixun_time,courses,course_count,school,teachers, + pages,limits, teacher_count,teachersloading,coursesloading,pagess,limitss,studentsloading,students,student_count,shixun_chart_data, + shixun_chart_datanames, studentionsnames,studentionsvalues } = this.state; return ( - - + + {school} - - - {/*//教师1*/} - - 教师 + + + {/*//教师1*/} + + 教师 - - {teachers_count ? teachers_count : 0} - - + + {teachers_count?teachers_count:0} + + 学生 - {students_count ? students_count : 0} + {students_count?students_count:0} @@ -855,7 +853,7 @@ class College extends Component { 课堂 - {courses_count ? courses_count : 0} + {courses_count?courses_count:0} @@ -864,7 +862,7 @@ class College extends Component { 共建实训 - {shixuns_count ? shixuns_count : 0} + {shixuns_count?shixuns_count:0} {/*//教师2*/} @@ -873,33 +871,33 @@ class College extends Component { - - - - - 基本使用情况 + + + + + 基本使用情况 - {/*基本使用情况1*/} - - - 教师 + {/*基本使用情况1*/} + + + 教师 - - 学生 + + 学生 - - 课堂 + + 课堂 - - 共建实训 + + 共建实训 实训报告 - - 学员实战时间 + + 学员实战时间 - + {/*基本使用情况2*/} @@ -953,33 +951,32 @@ class College extends Component { } + {/*基本使用情况3结束*/} - {/*基本使用情况3结束*/} - - + 课堂 { - courses === null ? + courses===null? - + : - JSON.stringify(courses) === "[]" ? - - - - : - - - - - {courses === undefined ? "" : + {courses === undefined ? "" : } - + />} - { - course_count >= 11 ? - - - - - + + { + course_count>=11? + + + - : "" - } - - } + + :"" + } + + + } - + @@ -1045,11 +1042,11 @@ class College extends Component { 教师排名 { - teachers === null ? + teachers===null? - + : @@ -1058,9 +1055,9 @@ class College extends Component { : - - - - {teachers === undefined ? "" : } - - + + {teachers === undefined ? "" : } + + } @@ -1115,37 +1112,37 @@ class College extends Component { - - 在线实训情况 + + 在线实训情况 - { - shixun_chart_data === null ? - - - + { + shixun_chart_data===null? + + + - : - JSON.stringify(shixun_chart_data) === "[]" ? - + : + JSON.stringify(shixun_chart_data) === "[]" ? + - - : - + + : + - - } + + } - + @@ -1157,7 +1154,7 @@ class College extends Component { - + : @@ -1167,7 +1164,7 @@ class College extends Component { : + style={{minHeight: "480px"}}>
- 基本使用情况 +
+ 基本使用情况
- 教师 + {/*基本使用情况1*/} +
+ 教师
- 学生 +
+ 学生
- 课堂 +
+ 课堂
- 共建实训 +
+ 共建实训
实训报告
- 学员实战时间 +
+ 学员实战时间
课堂
- 在线实训情况 +
+ 在线实训情况