From b10c91c55d29af390e06c8c4b7467f65d3cccbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 19 Sep 2019 16:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E8=AE=A4=E8=AF=81=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=93=E7=B3=BBVS=E6=AF=95=E4=B8=9A=E8=A6=81?= =?UTF-8?q?=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 15 +- .../CourseSupports/ecCourseSupports.css | 6 + .../ecs/EcSetting/CourseSupports/index.js | 187 ++++++++++++------ 3 files changed, 136 insertions(+), 72 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 5f30a26a8..025db7f5c 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -38,14 +38,13 @@ export function initAxiosInterceptors(props) { // https://github.com/axios/axios/issues/1497 // TODO 读取到package.json中的配置? - var proxy = "http://localhost:3000" - - // proxy="https://pre-newweb.educoder.net" - // proxy="https://test-newweb.educoder.net" - proxy="http://192.168.2.63:3001"; - - // wy - proxy="http://192.168.2.63:3001" + var proxy = "http://localhost:3000" + // proxy = "http://testbdweb.trustie.net" + // proxy = "http://testbdweb.educoder.net" + // proxy = "https://testeduplus2.educoder.net" + //proxy="http://47.96.87.25:48080" + proxy="https://pre-newweb.educoder.net" + proxy="https://test-newweb.educoder.net" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css b/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css index 3f1dc000a..7f497b28e 100644 --- a/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css +++ b/public/react/src/modules/ecs/EcSetting/CourseSupports/ecCourseSupports.css @@ -349,4 +349,10 @@ input{ .mt60{ margin-top:60px; +} + + +.editlybuttonbox{ + margin-bottom: 30px; + margin-right: 3%; } \ No newline at end of file diff --git a/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js b/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js index e5d413601..0d6771e79 100644 --- a/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js +++ b/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js @@ -33,7 +33,8 @@ class CourseSupports extends Component { Supportstype:false, Supportslist:'', Supportssum:false, - Supportsclass:false + Supportsclass:false, + Supportsclasskey:undefined } } @@ -72,6 +73,24 @@ class CourseSupports extends Component { console.log(error); }); + const zrl = `/ec_years/${ec_year_id}/ec_courses/search.json`; + axios.get(zrl,{params:{ + per_page:10000, + } + }) + .then((response) => { + + if(response.status===200){ + this.setState({ + ec_courses_list:response.data.ec_courses + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } componentDidMount(){ this.setState({ @@ -81,58 +100,71 @@ class CourseSupports extends Component { this.UpdateClassData(); } - EditSupportCourse=(key,e)=>{ + EditSupportCourse=(keys,e)=>{ $('#school_major_list').scrollLeft(0); let id=e.target.id; id=parseInt(id); let subindex =e.target.getAttribute("subindex"); - const url = `/ec_course_supports/edit_require_vs_course?subitem_id=`+id - axios.get(url) - .then((response) => { - - if(response.status===200){ - var support_data; - if(response.data.edit_support_data.length>0){ - support_data=response.data.edit_support_data; - }else if(response.data.edit_support_data.length===0){ - support_data=[{weights: 0,top_relation: false,ec_course_name:'',ec_course_id:''}]; - } - - this.setState({ - ec_courses_list:response.data.ec_courses_list, - editcourse:support_data, - index:subindex, - ec_graduation_subitem_id:id, - Supportssum:false, - Supportsclass:false, - }) - - let {editcourse} =this.state; - let neweditcourse=editcourse; - let newnum=0; - for(var j=0;j { + // + // if(response.status===200){ + + // + // this.setState({ + // ec_courses_list:response.data.ec_courses_list, + // editcourse:support_data, + // index:subindex, + // ec_graduation_subitem_id:id, + // Supportssum:false, + // Supportsclass:false, + // }) + // + // let {editcourse} =this.state; + // let neweditcourse=editcourse; + // let newnum=0; + // for(var j=0;j{ + if(keys===key){ + + if(item.course_supports.length>0){ + this.setState({ + editcourse:item.course_supports, + Editkey:key + }) + }else if(item.course_supports.length===0){ + this.setState({ + editcourse:[{weights: 0,top_relation: false,ec_course_name:'',ec_course_id:''}], + Editkey:key + }) + } + + } + }) - this.setState({ - Editkey:key - }) // $("#school_ListTableLine").show(); // let offsettop=$("#school_ListTableLine").position().top||$("#school_ListTableLine").scrollTop || $("#school_ListTableLine").pageYOffset; // window.scrollTo(0, offsettop) @@ -314,19 +346,36 @@ class CourseSupports extends Component { }) return } - for(var p=0; p{ + if(item.weigths===""){ + item.weigths=0; + } + if(item.ec_course_id===""){ + this.setState({ + // Supportstype:true, + Supportslist:'保存失败,课程不能为空', + Supportsclass:true, + Supportsclasskey:key + }) + return + } + }) + var Url = '/ec_course_supports'; axios.post(Url, { ec_year_id: ec_year_id, @@ -345,6 +394,7 @@ class CourseSupports extends Component { Supportstype:true, Supportssum:false, Supportsclass:false, + Supportsclasskey:undefined, }) this.UpdateClassData(); }else if(response.data.status===-1){ @@ -353,6 +403,7 @@ class CourseSupports extends Component { Supportstype:true, Supportssum:false, Supportsclass:false, + Supportsclasskey:undefined, }) } }).catch((error) => { @@ -505,18 +556,26 @@ class CourseSupports extends Component {

- + {Supportsclass===true?:""} { editcourse.map((it,key)=>{ return(
- { ec_courses_list.map((qva,qk)=>{ return( - + ) }) @@ -557,7 +616,7 @@ class CourseSupports extends Component { }
- {Supportslist} + {Supportslist}
合计: {editnum}
-
+
保存
取消