dev_unstable^2
杨树林 5 years ago
parent 6217e80adb
commit f89b10ca39

@ -48,7 +48,6 @@ class CoursesNew extends Component {
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:"board",module_name:"讨论"},{module_type:"attachment",module_name:"资源"},{module_type:"course_group",module_name:"分班"}],
checkbofrups:[],
}
}
componentDidMount() {
@ -81,19 +80,18 @@ class CoursesNew extends Component {
is_public: data.is_public === 1 ? true : false,
Realnamecertification: data.authentication,
Professionalcertification:data.professional_certification,
checkbofrups:data.course_modules,
});
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,
});
}
// 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,
// });
// }
@ -464,7 +462,7 @@ class CoursesNew extends Component {
this.applyForAddOrgForm.setVisible(true)
}
render() {
let {datatime,school,searchlistscholl,checkbofrups} = this.state;
let {datatime,school,searchlistscholl} = this.state;
const {getFieldDecorator} = this.props.form;
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
@ -472,10 +470,10 @@ 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>);
// console.log(this.props.current_user.user_school)
// form合并了
console.log("获取到的数据");
console.log(this.state);
console.log(this.props);
console.log(this.props.current_user);
// console.log("获取到的数据");
// console.log(this.state);
// console.log(this.props);
// console.log(this.props.current_user);
return (
<React.Fragment>
@ -699,29 +697,11 @@ class CoursesNew extends Component {
label="课堂模块"
hasFeedback
>
{getFieldDecorator("checkboxgroup", {
initialValue: [
"shixun_homework", "common_homework", "group_homework", "exercise", "attachment", "course_group",
],
})(
this.props.match.params.coursesId != undefined?
<Checkbox.Group style={{width: "800px", marginTop: "10px"}}>
{
checkbofrups===undefined?"":checkbofrups.length===0?"":checkbofrups.map((item,key)=>{
return(
item.module_type==="announcement"?
""
:
item.module_type==="online_learning"?
""
:
<Checkbox key={key} value={item.module_type} className="fl">{item.module_name}</Checkbox>
)
})
}
</Checkbox.Group>
:
<Checkbox.Group style={{width: "800px", marginTop: "10px"}}>
<Checkbox value={"shixun_homework"} className="fl">实训作业</Checkbox>
<Checkbox value={"common_homework"} className="fl">普通作业</Checkbox>

@ -55,7 +55,7 @@ class Goldsubject extends Component {
,{module_type:"shixun_homework",module_name:"实训作业"},{module_type:"common_homework",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:"分班"},],
checkbofrups:[],
}
}
// disabledEndDate= endValue => {
@ -144,20 +144,7 @@ class Goldsubject extends Component {
course_module_types: data.course_module_types,
school:data.school,
Whethertocreateanewclassroom:false,
checkbofrups:data.course_modules,
});
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);
}).catch((error) => {
console.log(error);
@ -609,7 +596,7 @@ class Goldsubject extends Component {
this.applyForAddOrgForm.setVisible(true)
}
render() {
let {datatime,datatimetwo,school,searchlistscholl,Whethertocreateanewclassroom,checkbofrups} = this.state;
let {datatime,datatimetwo,school,searchlistscholl,Whethertocreateanewclassroom} = this.state;
const {getFieldDecorator} = this.props.form;
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
@ -621,6 +608,18 @@ class Goldsubject extends Component {
// console.log(this.state);
// console.log(this.props);
// 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(addonAfterone);
console.log(addonAfteronelen);
return (
<React.Fragment>
@ -788,6 +787,14 @@ class Goldsubject extends Component {
}
`}
</style>
<style>{
`
.yslzxueshi .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}</style>
<Form.Item
label="总学时"
hasFeedback
@ -795,18 +802,25 @@ class Goldsubject extends Component {
{getFieldDecorator("period",
{
rules:[{
required:false,
pattern: new RegExp(/^[0-9]\d*$/, "g"),
message: ''
}],
getValueFromEvent: (event) => {
return event.target.value.replace(/\D/g,'')
}}
pattern: new RegExp(/^[1-9]\d*$/, "g"),
message: '必须是数值'
},
{
max:4,
message: '不能超过5个字符',
}]}
)(
<Input id="period" className="greyInput " placeholder="例如30"/>
<Input id="period" placeholder="例如30" className="yslzxueshi" addonAfter={String(addonAfteronelen)+"/5"} />
)}
</Form.Item>
<style>{
`
.yslzxuefen .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}</style>
<Form.Item
label="学分"
hasFeedback
@ -814,15 +828,16 @@ class Goldsubject extends Component {
{getFieldDecorator("credit",
{
rules:[{
required:false,
pattern: new RegExp(/^[0-9]\d*$/, "g"),
message: ''
}],
getValueFromEvent: (event) => {
return event.target.value.replace(/\D/g,'')
}}
pattern: new RegExp(/^[1-9]\d*$/, "g"),
message: '必须是数值'
},
{
max:4,
message: '不能超过5个字符',
}
]}
)(
<Input id="credit" className={"greyInput "} placeholder="例如3"/>
<Input id="credit" placeholder="例如3" className="yslzxuefen" addonAfter={String(addonAfteronelens)+"/5"} />
)}
</Form.Item>
<Form.Item
@ -884,25 +899,6 @@ class Goldsubject extends Component {
"announcement","online_learning","shixun_homework","common_homework",
],
})(
this.props.match.params.coursesId != undefined?
<Checkbox.Group style={{width: "800px", marginTop: "10px"}}>
{
checkbofrups===undefined?"":checkbofrups.length===0?"":checkbofrups.map((item,key)=>{
return(
item.module_type==="announcement"?
<Checkbox value={"announcement"} className="fl" defaultChecked disabled>公告栏</Checkbox>
:
item.module_type==="online_learning"?
<Checkbox value={"online_learning"} className="fl" defaultChecked disabled>在线学习</Checkbox>
:
item.module_type==="graduation"?"":
item.module_type==="group_homework"?"":
<Checkbox key={key} value={item.module_type} className="fl">{item.module_name}</Checkbox>
)
})
}
</Checkbox.Group>
:
<Checkbox.Group style={{width: "800px", marginTop: "10px"}}>
<Checkbox value={"announcement"} className="fl" defaultChecked disabled>公告栏</Checkbox>
<Checkbox value={"online_learning"} className="fl" defaultChecked disabled>在线学习</Checkbox>

Loading…
Cancel
Save