Merge branches 'dev_aliyun' and 'dev_ec' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_cs
杨树明 5 years ago
commit ab03e70c5c

@ -38,17 +38,13 @@ export function initAxiosInterceptors(props) {
// https://github.com/axios/axios/issues/1497
// TODO 读取到package.json中的配置
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";
// wy
proxy="https://pre-newweb.educoder.net";
proxy="https://test-newweb.educoder.net"
// 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参考来控制

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

@ -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<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);
});
// const url = `/ec_course_supports/edit_require_vs_course?subitem_id=`+id
// axios.get(url)
// .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();
// 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<editcourse.length;p++){
if(editcourse[p].weigths===""){
editcourse[p].weigths=0;
}
if(editcourse[p].ec_course_id===""){
this.setState({
// Supportstype:true,
Supportslist:'保存失败,课程不能为空',
Supportsclass:true
})
return
}
}
// for(var p=0; p<editcourse.length;p++){
// if(editcourse[p].weigths===""){
// editcourse[p].weigths=0;
// }
// if(editcourse[p].ec_course_id===""){
// this.setState({
// // Supportstype:true,
// Supportslist:'保存失败,课程不能为空',
// Supportsclass:true
// })
// 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';
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 {
</p>
<div className="clearfix editorModify">
{Supportsclass===true?<style>
{
`
.showredfont .ant-select-selection{
border: 1px solid #db0505 !important;
}
`
}
</style>:""}
{
editcourse.map((it,key)=>{
return(
<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)=>{
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>
<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">
<span className="column-1"
style={{
@ -569,7 +628,7 @@ class CourseSupports extends Component {
<span className="ml30">合计: <span>{editnum}</span></span>
</div>
<div className="right editglybuttonboxs">
<div className="right editlybuttonbox">
<div className="defalutSubmitbtn fr" onClick={this.SubmitClassData}>保存</div>
<div className="defalutCancelbtn fr mr20" onClick={this.CancelSupports}>取消</div>
</div>

Loading…
Cancel
Save