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

dev_unstable^2
杨树林 6 years ago
commit 5d4dd0cc9c

@ -45,10 +45,11 @@ class CoursesNew extends Component {
fetching:false, fetching:false,
boolxinjian:false, boolxinjian:false,
checkboxgroup:undefined, checkboxgroup:undefined,
addonAfteronelenone:0,
addonAfteronelentwo:0,
checkbofrup:[{module_type:"shixun_homework",module_name:"实训作业"},{module_type:"common_homework",module_name:"普通作业"},{module_type:"group_homework",module_name:"分组作业"} checkbofrup:[{module_type:"shixun_homework",module_name:"实训作业"},{module_type:"common_homework",module_name:"普通作业"},{module_type:"group_homework",module_name:"分组作业"}
,{module_type:"exercise",module_name:"试卷"},{module_type:"poll",module_name:"问卷"},{module_type:"graduation",module_name:"毕业设计"} ,{module_type:"exercise",module_name:"试卷"},{module_type:"poll",module_name:"问卷"},{module_type:"graduation",module_name:"毕业设计"}
,{module_type:"board",module_name:"讨论"},{module_type:"attachment",module_name:"资源"},{module_type:"course_group",module_name:"分班"}], ,{module_type:"board",module_name:"讨论"},{module_type:"attachment",module_name:"资源"},{module_type:"course_group",module_name:"分班"}],
checkbofrups:[],
} }
} }
componentDidMount() { componentDidMount() {
@ -66,8 +67,8 @@ class CoursesNew extends Component {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
course: data.course_list_name, course: data.course_list_name,
classroom: data.name, classroom: data.name,
period: data.class_period, period: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period+"",
credit: data.credit, credit: data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit+"",
checkboxgroup: data.course_module_types, checkboxgroup: data.course_module_types,
Realnamecertification: data.authentication, Realnamecertification: data.authentication,
Professionalcertification:data.professional_certification, Professionalcertification:data.professional_certification,
@ -81,7 +82,9 @@ class CoursesNew extends Component {
is_public: data.is_public === 1 ? true : false, is_public: data.is_public === 1 ? true : false,
Realnamecertification: data.authentication, Realnamecertification: data.authentication,
Professionalcertification:data.professional_certification, Professionalcertification:data.professional_certification,
// checkbofrups:data.course_modules, addonAfteronelenone: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period,
addonAfteronelentwo:data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit,
}); });
// try { // try {
// if(data.course_modules===undefined||data.course_modules.length===0){ // if(data.course_modules===undefined||data.course_modules.length===0){
@ -94,6 +97,9 @@ class CoursesNew extends Component {
// checkbofrups:this.state.checkbofrup, // checkbofrups:this.state.checkbofrup,
// }); // });
// } // }
this.handleSearchschool(data.school); this.handleSearchschool(data.school);
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
@ -469,10 +475,20 @@ class CoursesNew extends Component {
const optionschool = this.state.searchlistscholl===undefined?"":this.state.searchlistscholl===null?"":this.state.searchlistscholl==="[]"?"":this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>); const optionschool = this.state.searchlistscholl===undefined?"":this.state.searchlistscholl===null?"":this.state.searchlistscholl==="[]"?"":this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
// console.log(this.props.current_user.user_school) // console.log(this.props.current_user.user_school)
// form合并了 // form合并了
console.log("获取到的数据"); // console.log("获取到的数据");
console.log(this.state); // console.log(this.state);
console.log(this.props); // console.log(this.props);
console.log(this.props.current_user); // console.log(this.props.current_user);
var addonAfterone=this.props.form&&this.props.form.getFieldValue('period');
var addonAfteronelen=0;
if(addonAfterone){
addonAfteronelen=String(addonAfterone).length;
}
var addonAftertwo=this.props.form&&this.props.form.getFieldValue('credit');
var addonAfteronelens=0;
if(addonAftertwo){
addonAfteronelens=String(addonAftertwo).length;
}
return ( return (
<React.Fragment> <React.Fragment>
@ -630,6 +646,23 @@ class CoursesNew extends Component {
} }
`} `}
</style> </style>
<style>{
`
.yslzxueshi .ant-input{
border-right: none !important;
height: 40px !important;
width: 236px !important
}
.yslzxueshi .ant-input-group {
width: 280px !important;
}
.yslzxueshi .ant-input-group-addon{
width: 44px !important;
background-color: #fafafa!important;
}
`
}</style>
<Form.Item <Form.Item
label="总学时" label="总学时"
hasFeedback hasFeedback
@ -637,15 +670,15 @@ class CoursesNew extends Component {
{getFieldDecorator("period", {getFieldDecorator("period",
{ {
rules:[{ rules:[{
required:false, pattern: new RegExp(/^[0-9]+([.]{1}[0-9]+){0,1}$/, "g"),
pattern: new RegExp(/^[0-9]\d*$/, "g"), message: '必须是数值'
message: '' },
}], {
getValueFromEvent: (event) => { max:5,
return event.target.value.replace(/\D/g,'') message: '不能超过5个字符',
}} }]}
)( )(
<Input id="period" className="greyInput " placeholder="例如30"/> <Input id="period" className="yslzxueshi " placeholder="例如30" addonAfter={String(addonAfteronelen)+"/5"} maxLength={5}/>
)} )}
</Form.Item> </Form.Item>
@ -656,15 +689,16 @@ class CoursesNew extends Component {
{getFieldDecorator("credit", {getFieldDecorator("credit",
{ {
rules:[{ rules:[{
required:false, pattern: new RegExp(/^[0-9]+([.]{1}[0-9]+){0,1}$/, "g"),
pattern: new RegExp(/^[0-9]\d*$/, "g"), message: '必须是数值'
message: '' },
}], {
getValueFromEvent: (event) => { max:5,
return event.target.value.replace(/\D/g,'') message: '不能超过5个字符',
}} }
]}
)( )(
<Input id="credit" className={"greyInput "} placeholder="例如3"/> <Input id="credit" className="yslzxueshi" placeholder="例如3" addonAfter={String(addonAfteronelen)+"/5"} maxLength={5}/>
)} )}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -696,7 +730,6 @@ class CoursesNew extends Component {
label="课堂模块" label="课堂模块"
hasFeedback hasFeedback
> >
{getFieldDecorator("checkboxgroup", { {getFieldDecorator("checkboxgroup", {
initialValue: [ initialValue: [
"shixun_homework", "common_homework", "group_homework", "exercise", "attachment", "course_group", "shixun_homework", "common_homework", "group_homework", "exercise", "attachment", "course_group",

@ -27,7 +27,9 @@ function disabledDateTime() {
disabledMinutes: () => range(1, 30).concat(range(31, 60)), disabledMinutes: () => range(1, 30).concat(range(31, 60)),
}; };
} }
function disabledDate(current) {
return current && current < moment().endOf('day').subtract(1, 'days');
}
// function disabledDate(current) { // function disabledDate(current) {
// console.log(current); // console.log(current);
// return current && current < moment().endOf('day').subtract(1, 'days'); // return current && current < moment().endOf('day').subtract(1, 'days');
@ -49,13 +51,15 @@ class Goldsubject extends Component {
fetching:false, fetching:false,
subject_id:"", subject_id:"",
start_date:"", start_date:"",
addonAfteronelenone:"",
addonAfteronelentwo:"",
Whethertocreateanewclassroom:true, Whethertocreateanewclassroom:true,
checkbofrup:[ checkbofrup:[
{module_type:"announcement",module_name:"公告栏"},{module_type:"online_learning",module_name:"在线学习"} {module_type:"announcement",module_name:"公告栏"},{module_type:"online_learning",module_name:"在线学习"}
,{module_type:"shixun_homework",module_name:"实训作业"},{module_type:"common_homework",module_name:"普通作业"} ,{module_type:"shixun_homework",module_name:"实训作业"},{module_type:"common_homework",module_name:"普通作业"}
,{module_type:"exercise",module_name:"试卷"},{module_type:"poll",module_name:"问卷"} ,{module_type:"exercise",module_name:"试卷"},{module_type:"poll",module_name:"问卷"}
,{module_type:"attachment",module_name:"资源"},{module_type:"board",module_name:"讨论"},{module_type:"course_group",module_name:"分班"},], ,{module_type:"attachment",module_name:"资源"},{module_type:"board",module_name:"讨论"},{module_type:"course_group",module_name:"分班"},],
checkbofrups:[],
} }
} }
// disabledEndDate= endValue => { // disabledEndDate= endValue => {
@ -121,8 +125,8 @@ class Goldsubject extends Component {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
course: data.course_list_name, course: data.course_list_name,
classroom: data.name, classroom: data.name,
period: data.class_period, period: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period+"",
credit: data.credit, credit: data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit+"",
checkboxgroup: data.course_module_types, checkboxgroup: data.course_module_types,
Realnamecertification: data.authentication, Realnamecertification: data.authentication,
Professionalcertification:data.professional_certification, Professionalcertification:data.professional_certification,
@ -140,22 +144,13 @@ class Goldsubject extends Component {
Professionalcertification:data.professional_certification, Professionalcertification:data.professional_certification,
name: data.name, name: data.name,
class_period: data.class_period, class_period: data.class_period,
credit: parseFloat(data.credit), addonAfteronelenone: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period,
credit: parseFloat(data.credit),
addonAfteronelentwo:data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit,
course_module_types: data.course_module_types, course_module_types: data.course_module_types,
school:data.school, school:data.school,
Whethertocreateanewclassroom:false, Whethertocreateanewclassroom:false,
}); });
// try {
// if(data.course_modules===undefined||data.course_modules.length===0){
// this.setState({
// checkbofrups:this.state.checkbofrup,
// });
// }
// }catch (e) {
// this.setState({
// checkbofrups:this.state.checkbofrup,
// });
// }
this.handleSearchschool(data.school); this.handleSearchschool(data.school);
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
@ -607,7 +602,7 @@ class Goldsubject extends Component {
this.applyForAddOrgForm.setVisible(true) this.applyForAddOrgForm.setVisible(true)
} }
render() { render() {
let {datatime,datatimetwo,school,searchlistscholl,Whethertocreateanewclassroom} = this.state; let {datatime,datatimetwo,school,searchlistscholl,Whethertocreateanewclassroom,addonAfteronelenone,addonAfteronelentwo} = this.state;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
const propsWithoutForm = Object.assign({}, this.props) const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form delete propsWithoutForm.form
@ -619,6 +614,18 @@ class Goldsubject extends Component {
// console.log(this.state); // console.log(this.state);
// console.log(this.props); // console.log(this.props);
// console.log(this.props.current_user); // console.log(this.props.current_user);
var addonAfterone=this.props.form&&this.props.form.getFieldValue('period');
var addonAfteronelen=0;
if(addonAfterone){
addonAfteronelen=String(addonAfterone).length;
}
var addonAftertwo=this.props.form&&this.props.form.getFieldValue('credit');
var addonAfteronelens=0;
if(addonAftertwo){
addonAfteronelens=String(addonAftertwo).length;
}
console.log(addonAfteronelenone);
console.log(addonAfteronelentwo);
return ( return (
<React.Fragment> <React.Fragment>
@ -786,6 +793,23 @@ class Goldsubject extends Component {
} }
`} `}
</style> </style>
<style>{
`
.yslzxueshi .ant-input{
border-right: none !important;
height: 40px !important;
width: 236px !important
}
.yslzxueshi .ant-input-group {
width: 280px !important;
}
.yslzxueshi .ant-input-group-addon{
width: 44px !important;
background-color: #fafafa!important;
}
`
}</style>
<Form.Item <Form.Item
label="总学时" label="总学时"
hasFeedback hasFeedback
@ -793,18 +817,17 @@ class Goldsubject extends Component {
{getFieldDecorator("period", {getFieldDecorator("period",
{ {
rules:[{ rules:[{
required:false, pattern: new RegExp(/^[0-9]+([.]{1}[0-9]+){0,1}$/, "g"),
pattern: new RegExp(/^[0-9]\d*$/, "g"), message: '必须是数值'
message: '' },
}], {
getValueFromEvent: (event) => { max:5,
return event.target.value.replace(/\D/g,'') message: '不能超过5个字符',
}} }]}
)( )(
<Input id="period" className="greyInput " placeholder="例如30"/> <Input id="period" placeholder="例如30" className="yslzxueshi" addonAfter={String(addonAfteronelen)+"/5"} maxLength={5}/>
)} )}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="学分" label="学分"
hasFeedback hasFeedback
@ -812,15 +835,16 @@ class Goldsubject extends Component {
{getFieldDecorator("credit", {getFieldDecorator("credit",
{ {
rules:[{ rules:[{
required:false, pattern: new RegExp(/^[0-9]+([.]{1}[0-9]+){0,1}$/, "g"),
pattern: new RegExp(/^[0-9]\d*$/, "g"), message: '必须是数值'
message: '' },
}], {
getValueFromEvent: (event) => { max:5,
return event.target.value.replace(/\D/g,'') message: '不能超过5个字符',
}} }
]}
)( )(
<Input id="credit" className={"greyInput "} placeholder="例如3"/> <Input id="credit" placeholder="例如3" className="yslzxueshi" addonAfter={String(addonAfteronelens)+"/5"} maxLength={5}/>
)} )}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -850,7 +874,8 @@ class Goldsubject extends Component {
label="结束时间" label="结束时间"
> >
{getFieldDecorator("endtime", { {getFieldDecorator("endtime", {
rules: [{type: 'object',required: true, message: "结束时间不能为空"}], rules: [{type: 'object',
required: true, message: "结束时间不能为空"}],
})( })(
<span className="fl mt5"> <span className="fl mt5">
<DatePicker <DatePicker

Loading…
Cancel
Save