From 5ef85cde10e99e78e1a2353835eae78c407cf70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 9 Oct 2019 08:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/ecs/curriculum/Curriculumtwo.js | 277 +++++++++++++++++- 1 file changed, 269 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/ecs/curriculum/Curriculumtwo.js b/public/react/src/modules/ecs/curriculum/Curriculumtwo.js index 221b2afb5..8d457f6cd 100644 --- a/public/react/src/modules/ecs/curriculum/Curriculumtwo.js +++ b/public/react/src/modules/ecs/curriculum/Curriculumtwo.js @@ -1,28 +1,289 @@ import React, { Component } from 'react'; - +import { Select,InputNumber,message,Modal,Input,Radio,Spin,Icon,Tooltip,Popconfirm,Upload,Button} from 'antd'; +import axios from 'axios'; class Curriculumtwo extends Component { //测试用 constructor(props) { super(props) // console.log(props); + this.state={ + params:[], + deletelist:[], + ec_course_id:0, + ec_course_name:undefined, + ec_course_evaluation_lists:undefined, + course_evaluation_lists:undefined, + course_name: undefined, + deletetype:"end", + savetype:'', + schooldata:{}, + course_url:undefined, + Evaluationsparamstype:true, + idkey:null, + listid:null, + Modallist:"", + Modallisttype:false, + titlemessage:"提示", + savetypes:false, + levels:undefined, + editecGradetype:false, + editlevels:undefined, + listvaluey:null, + Modallisttypes:false, + ismanager:false + } } componentWillMount(){ + window.document.title ="成绩等级设置"; } + componentDidMount(){ - // console.log(this.props); - console.log("Curriculumtwo"); - console.log(this.props.match.params.type); - this.props.Ontitine(this.props.match.params.type); + console.log(this.props.match.params); + this.props.Ontitine(this.props.match.params.type); + let ec_course_id=706; + let Url = `/ec_courses/`+ec_course_id+`/score_levels.json`; + axios.get(Url).then((response) => { + if(response.status===200){ + this.setState({ + levels:response.data.levels, + ismanager:response.data.ismanager, + editlevels:response.data.levels + }) + } + }).catch((error) => { + console.log(error) + }) + + const jol =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; + axios.get(jol, { + withCredentials: true, + }) + .then((response) => { + if(response.status===200){ + // if(response.data.allow_visit===false){ + // window.location.href="/403" + // } + this.setState({ + schooldata:response.data + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + + updalevels=()=>{ + let ec_course_id=this.props.match.params.ec_course_id; + let Url = `/ec_courses/`+ec_course_id+`/score_level_data`; + axios.get(Url, { + withCredentials: true, + } + ).then((response) => { + if(response.status===200){ + this.setState({ + levels:response.data.levels, + ismanager:response.data.ismanager, + editlevels:response.data.levels + }) + } + }).catch((error) => { + console.log(error) + }) + + } + editecGrade=()=>{ + this.setState({ + editecGradetype:true + }) + } + + CancelecCourseEvaluationstop=()=>{ + this.updalevels(); + this.setState({ + editecGradetype:false + }) + + } + + SaveecCourseEvaluationstop=()=>{ + let {editlevels}=this.state; + let levels=editlevels; + let ec_course_id=this.props.match.params.ec_course_id; + for(var i=0; i { + if(response.status===200){ + // this.setState({ + // editecGradetype:false + // }) + this.updalevels(); + } + }).catch((error) => { + console.log(error) + }) + + } + + deleteditecGrade=(key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + // console.log(key) + neweditlevels.splice(key, 1); + this.setState({ + editlevels:neweditlevels + }) + } + + additecGrade=(key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + let list={score: 0, level: ""} + neweditlevels.push(list) + // console.log(key) + this.setState({ + editlevels:neweditlevels + }) + } + + editlevelslist=(e,key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + neweditlevels[key].level=e.target.value; + this.setState({ + editlevels:neweditlevels + }) } + editlevelslists=(e,key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + let sum=parseInt(e.target.value); + if(isNaN(sum)){ + sum=0 + } + neweditlevels[key].score=sum; + this.setState({ + editlevels:neweditlevels + }) + } + + hidemodeldelete=()=>{ + this.setState({ + Modallisttype:false + }) + } render() { - // console.log("Curriculumtwo"); - // console.log(this.props); + const RadioGroup = Radio.Group; + let {listvaluey,params,ec_course_evaluation_lists,ec_course_id,schooldata,course_name,course_url,idkey,modeldelet,listid,titlemessage,Modallisttype,Modallist,savetypes,levels,editlevels,editecGradetype,Modallisttypes,ismanager} = this.state; + console.log(ismanager) return (
- 测试 +
+ +

+ 等级名称 + 规则 + + + {/* 操作 */} + + {/**/} + + + + +

+ +
    + { + levels===undefined?"":levels.map((item,key)=>{ + return( +
  • + {item.level} + 分数 + {key>2?'<':'>= '} + {item.score} +
  • + ) + }) + } + +
+ + +
+
+ +
+
+

+ 等级名称 + 规则 + 分值 + (请按照分数的降序方式进行等级的划分设置) +

+
+ + + + +
+
提交
+
取消
+
+ +
+ + + +
+
+
) }