工程认证课程体系VS毕业要求

dev_cs
杨树明 5 years ago
parent 1c358a4c6a
commit b10c91c55d

@ -38,14 +38,13 @@ export function initAxiosInterceptors(props) {
// https://github.com/axios/axios/issues/1497 // https://github.com/axios/axios/issues/1497
// TODO 读取到package.json中的配置 // TODO 读取到package.json中的配置
var proxy = "http://localhost:3000" var proxy = "http://localhost:3000"
// proxy = "http://testbdweb.trustie.net"
// proxy="https://pre-newweb.educoder.net" // proxy = "http://testbdweb.educoder.net"
// proxy="https://test-newweb.educoder.net" // proxy = "https://testeduplus2.educoder.net"
proxy="http://192.168.2.63:3001"; //proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net"
// wy proxy="https://test-newweb.educoder.net"
proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制 // 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制

@ -349,4 +349,10 @@ input{
.mt60{ .mt60{
margin-top:60px; margin-top:60px;
}
.editlybuttonbox{
margin-bottom: 30px;
margin-right: 3%;
} }

@ -33,7 +33,8 @@ class CourseSupports extends Component {
Supportstype:false, Supportstype:false,
Supportslist:'', Supportslist:'',
Supportssum:false, Supportssum:false,
Supportsclass:false Supportsclass:false,
Supportsclasskey:undefined
} }
} }
@ -72,6 +73,24 @@ class CourseSupports extends Component {
console.log(error); 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(){ componentDidMount(){
this.setState({ this.setState({
@ -81,58 +100,71 @@ class CourseSupports extends Component {
this.UpdateClassData(); this.UpdateClassData();
} }
EditSupportCourse=(key,e)=>{ EditSupportCourse=(keys,e)=>{
$('#school_major_list').scrollLeft(0); $('#school_major_list').scrollLeft(0);
let id=e.target.id; let id=e.target.id;
id=parseInt(id); id=parseInt(id);
let subindex =e.target.getAttribute("subindex"); 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<neweditcourse.length;j++){
if(neweditcourse[j].weigths===undefined){
newnum=0
}else{
newnum=newnum+neweditcourse[j].weigths;
}
}
newnum= Math.round(newnum*100)/100;
this.setState({
editnum:newnum
})
}
}) // const url = `/ec_course_supports/edit_require_vs_course?subitem_id=`+id
.catch(function (error) { // axios.get(url)
console.log(error); // .then((response) => {
}); //
// 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<neweditcourse.length;j++){
// if(neweditcourse[j].weigths===undefined){
// newnum=0
// }else{
// newnum=newnum+neweditcourse[j].weigths;
// }
// }
// newnum= Math.round(newnum*100)/100;
//
// this.setState({
// editnum:newnum
// })
// }
//
// })
// .catch(function (error) {
// console.log(error);
// });
let {data}=this.state;
data.graduation_subitems.map((item,key)=>{
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(); // $("#school_ListTableLine").show();
// let offsettop=$("#school_ListTableLine").position().top||$("#school_ListTableLine").scrollTop || $("#school_ListTableLine").pageYOffset; // let offsettop=$("#school_ListTableLine").position().top||$("#school_ListTableLine").scrollTop || $("#school_ListTableLine").pageYOffset;
// window.scrollTo(0, offsettop) // window.scrollTo(0, offsettop)
@ -314,19 +346,36 @@ class CourseSupports extends Component {
}) })
return return
} }
for(var p=0; p<editcourse.length;p++){
if(editcourse[p].weigths===""){ // for(var p=0; p<editcourse.length;p++){
editcourse[p].weigths=0; // if(editcourse[p].weigths===""){
} // editcourse[p].weigths=0;
if(editcourse[p].ec_course_id===""){ // }
this.setState({ // if(editcourse[p].ec_course_id===""){
// Supportstype:true, // this.setState({
Supportslist:'保存失败,课程不能为空', // // Supportstype:true,
Supportsclass:true // Supportslist:'保存失败,课程不能为空',
}) // Supportsclass:true
return // })
} // return
} // }
// }
editcourse.map((item,key)=>{
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'; var Url = '/ec_course_supports';
axios.post(Url, { axios.post(Url, {
ec_year_id: ec_year_id, ec_year_id: ec_year_id,
@ -345,6 +394,7 @@ class CourseSupports extends Component {
Supportstype:true, Supportstype:true,
Supportssum:false, Supportssum:false,
Supportsclass:false, Supportsclass:false,
Supportsclasskey:undefined,
}) })
this.UpdateClassData(); this.UpdateClassData();
}else if(response.data.status===-1){ }else if(response.data.status===-1){
@ -353,6 +403,7 @@ class CourseSupports extends Component {
Supportstype:true, Supportstype:true,
Supportssum:false, Supportssum:false,
Supportsclass:false, Supportsclass:false,
Supportsclasskey:undefined,
}) })
} }
}).catch((error) => { }).catch((error) => {
@ -505,18 +556,26 @@ class CourseSupports extends Component {
</p> </p>
<div className="clearfix editorModify"> <div className="clearfix editorModify">
{Supportsclass===true?<style>
{
`
.showredfont .ant-select-selection{
border: 1px solid #db0505 !important;
}
`
}
</style>:""}
{ {
editcourse.map((it,key)=>{ editcourse.map((it,key)=>{
return( return(
<div className="mb15" key={key}> <div className="mb15" key={key}>
<Select className={Supportsclass===true?"bor-red heightimportant":"heightimportant"} showSearch value={it.ec_course_name} onChange={this.handleChange}> <Select className={Supportsclasskey===key?"showredfont heightimportant":"heightimportant"} showSearch value={it.ec_course_name} onChange={this.handleChange}>
{ {
ec_courses_list.map((qva,qk)=>{ ec_courses_list.map((qva,qk)=>{
return( return(
<Option value={[qva.id,key,qva.name]} key={qk}>{qva.name}</Option> <Option value={[qva.id,key,qva.name]} key={[qva.id,key,qva.name]}>{qva.name}</Option>
) )
}) })
@ -557,7 +616,7 @@ class CourseSupports extends Component {
} }
</div> </div>
<span className="c_red none ml35" id="error_tip" style={{display:Supportssum===true||Supportsclass===true?'inline':'none'}}>{Supportslist}</span> <span className="c_red none ml35 color-red" id="error_tip" style={{display:Supportssum===true||Supportsclass===true?'inline':'none'}}>{Supportslist}</span>
<div className="clearfix editorModify"> <div className="clearfix editorModify">
<span className="column-1" <span className="column-1"
style={{ style={{
@ -569,7 +628,7 @@ class CourseSupports extends Component {
<span className="ml30">合计: <span>{editnum}</span></span> <span className="ml30">合计: <span>{editnum}</span></span>
</div> </div>
<div className="right editglybuttonboxs"> <div className="right editlybuttonbox">
<div className="defalutSubmitbtn fr" onClick={this.SubmitClassData}>保存</div> <div className="defalutSubmitbtn fr" onClick={this.SubmitClassData}>保存</div>
<div className="defalutCancelbtn fr mr20" onClick={this.CancelSupports}>取消</div> <div className="defalutCancelbtn fr mr20" onClick={this.CancelSupports}>取消</div>
</div> </div>

Loading…
Cancel
Save