dev_oauth
杨树林 6 years ago
parent da0b6771bb
commit d87f339143

@ -833,18 +833,19 @@ class CoursesIndex extends Component{
(props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} />) (props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/*修改课堂*/} {/*修改金品课堂*/}
<Route path="/courses/:coursesId/settings" <Route path="/courses/:coursesId/newgolds/settings/:id"
render={ render={
(props) => (<WrappedCoursesNewApp {...this.props} {...props} {...this.state} />) (props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/*修改金品课堂*/} {/*修改课堂*/}
<Route path="/courses/:coursesId/newgold/settings/:id" <Route path="/courses/:coursesId/settings"
render={ render={
(props) => (<WrappedCoursesNewAppGoldclass {...this.props} {...props} {...this.state} />) (props) => (<WrappedCoursesNewApp {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 实训作业子页面*/} {/* 实训作业子页面*/}
<Route path="/courses/:coursesId/shixun_homework/:category_id" <Route path="/courses/:coursesId/shixun_homework/:category_id"
render={ render={

@ -353,19 +353,17 @@ class CoursesBanner extends Component {
window.location.href = "/courses/" + this.props.match.params.coursesId + "/settings"; window.location.href = "/courses/" + this.props.match.params.coursesId + "/settings";
}; };
postsettingstwo=()=>{ postsettingstwo=()=>{
var id =1; var ids =1;
try { try {
if(this.state.coursedata.is_public){ if(this.state.coursedata.is_public){
id=1; ids=1;
}else { }else {
id=0; ids=0;
} }
}catch (e) { }catch (e) {
} }
window.location.href = `/courses/${this.props.match.params.coursesId}/newgolds/settings/${ids}`;
window.location.href = " /courses/" + this.props.match.params.coursesId + "/newgold/settings"+id;
}; };

@ -29,8 +29,13 @@ function disabledDateTime() {
} }
function disabledDate(current) { function disabledDate(current) {
console.log(current);
return current && current < moment().endOf('day').subtract(1, 'days'); return current && current < moment().endOf('day').subtract(1, 'days');
} }
function disabledDateysl(current) {
console.log(current);
return current && current < moment().endOf('day').add(1, 'days');
}
class Goldsubject extends Component { class Goldsubject extends Component {
@ -46,9 +51,56 @@ class Goldsubject extends Component {
start_date:"", start_date:"",
} }
} }
// disabledEndDate= endValue => {
// const { datatimetwo } = this.state;
// var startValue =datatimetwo
// if (!endValue || !startValue) {
// return false;
// }
// return endValue.valueOf() < startValue.valueOf();
// };
componentDidMount() { isabledStartDate = (startValue) => {
const { datatime } = this.state;
var datatimes="";
if(datatime!==undefined){
datatimes=datatime;
datatimes=moment(datatimes, dateFormat).subtract(0, 'days');;
}else {
datatimes=datatime;
}
if (!startValue || !datatimes) {
return false;
}
return startValue.valueOf() > datatimes.valueOf();
};
disabledEndDate = (endValue) => {
// console.log("---------------------------------")
// console.log(moment(new Date(), dateFormat).add(1, 'days'));
// console.log(moment(new Date(), dateFormat).add(2, 'days'));
const { datatimetwo } = this.state;
var startvalue="";
if(datatimetwo!==undefined){
startvalue=datatimetwo;
startvalue=moment(startvalue, dateFormat).add(1, 'days');
}else {
startvalue=datatimetwo;
}
// console.log("结束时间");
// console.log(endValue);
// console.log(startvalue);
// console.log(datatimetwo);
if (!endValue || !startvalue) {
return false;
}
return endValue.valueOf() < startvalue.valueOf();
};
componentDidMount() {
console.log("新建金品课堂的数据");
console.log(this.props);
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let user_school=this.props.current_user&&this.props.current_user.user_school; let user_school=this.props.current_user&&this.props.current_user.user_school;
@ -74,16 +126,16 @@ class Goldsubject extends Component {
}); });
// starttime // starttime
this.setState({ this.setState({
datatimetwo: data.start_date, datatimetwo: data.start_date === undefined ? "" : moment(data.start_date, dateFormat),
datatime: data.end_date, datatime: data.end_date === undefined ? "" : moment(data.end_date, dateFormat),
is_public: 1, is_public: this.props.match.params.id,
Realnamecertification: data.authentication, Realnamecertification: data.authentication,
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), credit: parseFloat(data.credit),
course_module_types: data.course_module_types, course_module_types: data.course_module_types,
school:data.school school:data.school,
}); });
this.handleSearchschool(data.school); this.handleSearchschool(data.school);
}).catch((error) => { }).catch((error) => {
@ -125,25 +177,42 @@ class Goldsubject extends Component {
} }
} }
onChangeTimepublishs = (date, dateString) => { onChangeTimepublishs = (date, dateString) => {
console.log("结束时间11111111111");
console.log(dateString);
if(dateString===""){ if(dateString===""){
this.setState({ this.setState({
datatime: undefined, datatime: undefined,
}) })
this.props.form.setFieldsValue({
endtime: "",
});
}else{ }else{
this.setState({ this.setState({
datatime: dateString, datatime: dateString,
}) });
this.props.form.setFieldsValue({
endtime:dateString,
});
} }
}; };
onChangeTimepublishstwo = (date, dateString) => { onChangeTimepublishstwo = (date, dateString) => {
console.log("结束时间22222222222");
console.log(dateString);
if(dateString===""){ if(dateString===""){
this.setState({ this.setState({
datatimetwo: undefined, datatimetwo: undefined,
}) })
this.props.form.setFieldsValue({
starttime: "",
});
}else{ }else{
this.setState({ this.setState({
datatimetwo: dateString, datatimetwo: dateString,
}) })
this.props.form.setFieldsValue({
starttime: dateString,
});
} }
}; };
cancelmodel = () => { cancelmodel = () => {
@ -171,30 +240,34 @@ class Goldsubject extends Component {
handleSubmit = (e) => { handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
let first_category_url=this.props.current_user.first_category_url; let first_category_url=this.props.current_user.first_category_url;
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let {is_public,datatime,datatimetwo} = this.state var is_public =this.props.match.params.id;
let {datatime,datatimetwo} = this.state
// console.log(is_public) // console.log(is_public)
if (coursesId != undefined) { if (coursesId != undefined) {
// 编辑 // 编辑
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (err) {
return;
}
// if(values.course===""||values.course===undefined){ // if(values.course===""||values.course===undefined){
// this.scrollToAnchor("iscourse") // this.scrollToAnchor("iscourse")
// return // return
// //
// } // }
if(values.classroom===""||values.classroom===undefined){ // if(values.classroom===""||values.classroom===undefined){
this.scrollToAnchor("isclassroom") // this.scrollToAnchor("isclassroom")
return // return
} // }
//
if(values.school===""||values.school===undefined){ // if(values.school===""||values.school===undefined){
// this.scrollToAnchor("isschool") // // this.scrollToAnchor("isschool")
return // return
//
} // }
if(values.checkboxgroup.length===0){ if(values.checkboxgroup.length===0){
this.setState({ this.setState({
@ -220,9 +293,9 @@ class Goldsubject extends Component {
name: values.classroom, name: values.classroom,
class_period: values.period, class_period: values.period,
credit: parseFloat(values.credit), credit: parseFloat(values.credit),
start_date:datatimetwo===undefined?"":datatimetwo, start_date:values.starttime,
end_date: datatime===undefined?"":datatime, end_date: values.endtime,
is_public: 1, //这是也是带过来的值 is_public: is_public, //这是也是带过来的值
course_module_types: values.checkboxgroup, course_module_types: values.checkboxgroup,
school:values.school school:values.school
} }
@ -251,6 +324,9 @@ class Goldsubject extends Component {
console.log(error) console.log(error)
}) })
} }
console.log("错误信息信息信息");
console.log(err);
}); });
} else { } else {
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
@ -279,9 +355,9 @@ class Goldsubject extends Component {
name: values.classroom, name: values.classroom,
class_period: values.period, class_period: values.period,
credit: parseFloat(values.credit), credit: parseFloat(values.credit),
start_date:datatimetwo===undefined?"":datatimetwo, start_date:values.starttime,
end_date: datatime===undefined?"":datatime, end_date: values.endtime,
is_public: 1, //这是也是带过来的值 is_public: is_public, //这是也是带过来的值
course_module_types: values.checkboxgroup, course_module_types: values.checkboxgroup,
school:values.school school:values.school
} }
@ -430,6 +506,7 @@ class Goldsubject extends Component {
search: value search: value
} }
}).then((result)=>{ }).then((result)=>{
if(result){
if (result.data.status===0) { if (result.data.status===0) {
this.setState({ this.setState({
searchlistscholl: result.data.school_names, searchlistscholl: result.data.school_names,
@ -441,6 +518,7 @@ class Goldsubject extends Component {
}) })
} }
} }
}
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
@ -653,9 +731,10 @@ class Goldsubject extends Component {
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="开始时间" label="开始时间"
hasFeedback
> >
{getFieldDecorator("starttime")( {getFieldDecorator("starttime", {
rules: [{type: 'object',required: true, message: "开始时间不能为空"}],
})(
<span className="fl mt5"> <span className="fl mt5">
<DatePicker <DatePicker
showToday={false} showToday={false}
@ -666,7 +745,7 @@ class Goldsubject extends Component {
width={"210px"} width={"210px"}
value={datatimetwo === undefined ? "" :datatimetwo === null ? "" : moment(datatimetwo, dateFormat)} value={datatimetwo === undefined ? "" :datatimetwo === null ? "" : moment(datatimetwo, dateFormat)}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabledDate={disabledDate} disabledDate={this.isabledStartDate}
dropdownClassName="hideDisable" dropdownClassName="hideDisable"
onChange={this.onChangeTimepublishstwo} onChange={this.onChangeTimepublishstwo}
/> />
@ -675,9 +754,10 @@ class Goldsubject extends Component {
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="结束时间" label="结束时间"
hasFeedback
> >
{getFieldDecorator("endtime")( {getFieldDecorator("endtime", {
rules: [{type: 'object',required: true, message: "结束时间不能为空"}],
})(
<span className="fl mt5"> <span className="fl mt5">
<DatePicker <DatePicker
showToday={false} showToday={false}
@ -688,7 +768,7 @@ class Goldsubject extends Component {
width={"210px"} width={"210px"}
value={datatime === undefined ? "" :datatime === null ? "" : moment(datatime, dateFormat)} value={datatime === undefined ? "" :datatime === null ? "" : moment(datatime, dateFormat)}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabledDate={disabledDate} disabledDate={this.disabledEndDate}
dropdownClassName="hideDisable" dropdownClassName="hideDisable"
onChange={this.onChangeTimepublishs} onChange={this.onChangeTimepublishs}
/> />
@ -815,6 +895,8 @@ class Goldsubject extends Component {
) )
} }
} }
const WrappedCoursesNewAppGoldclass = Form.create({name: 'goldsubject'})(Goldsubject); const WrappedCoursesNewAppGoldclass = Form.create({name: 'goldsubject'})(Goldsubject);
export default WrappedCoursesNewAppGoldclass; export default WrappedCoursesNewAppGoldclass;

Loading…
Cancel
Save