|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import React, {Component} from "React";
|
|
|
|
|
import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon} from "antd";
|
|
|
|
|
import ApplyForAddOrgModal from '../../user/modal/ApplyForAddOrgModal';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import "../css/Courses.css";
|
|
|
|
|
import locale from 'antd/lib/date-picker/locale/zh_CN';
|
|
|
|
@ -7,6 +8,7 @@ import moment from 'moment';
|
|
|
|
|
import Modals from '../../modals/Modals';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { Option } = Select;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +136,6 @@ class CoursesNew extends Component {
|
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
|
let {is_public,datatime} = this.state
|
|
|
|
|
// console.log(is_public)
|
|
|
|
|
|
|
|
|
|
if (coursesId != undefined) {
|
|
|
|
|
// 编辑
|
|
|
|
|
|
|
|
|
@ -180,7 +181,7 @@ class CoursesNew extends Component {
|
|
|
|
|
name: values.classroom,
|
|
|
|
|
class_period: values.period,
|
|
|
|
|
credit: parseFloat(values.credit),
|
|
|
|
|
end_date: datatime,
|
|
|
|
|
end_date: datatime===undefined?"":datatime,
|
|
|
|
|
is_public: is_public === true || is_public === 1 ? 1 : 0,
|
|
|
|
|
course_module_types: values.checkboxgroup,
|
|
|
|
|
authentication: this.state.Realnamecertification,
|
|
|
|
@ -234,7 +235,7 @@ class CoursesNew extends Component {
|
|
|
|
|
name: values.classroom,
|
|
|
|
|
class_period: values.period,
|
|
|
|
|
credit: parseFloat(values.credit),
|
|
|
|
|
end_date: datatime,
|
|
|
|
|
end_date: datatime===undefined?"":datatime,
|
|
|
|
|
is_public: is_public === true || is_public === 1 ? 1 : 0,
|
|
|
|
|
course_module_types: values.checkboxgroup,
|
|
|
|
|
authentication: this.state.Realnamecertification,
|
|
|
|
@ -285,12 +286,13 @@ class CoursesNew extends Component {
|
|
|
|
|
// console.log(e.target.checked);
|
|
|
|
|
}
|
|
|
|
|
Searchvalue=(value)=>{
|
|
|
|
|
|
|
|
|
|
let url="/courses/search_course_list.json";
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
search:value
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
// console.log(result.data)
|
|
|
|
|
if (result.data.message===undefined) {
|
|
|
|
|
if (result.data.status===0) {
|
|
|
|
|
this.setState({
|
|
|
|
|
searchlist: result.data.course_lists,
|
|
|
|
|
// course:value,
|
|
|
|
@ -305,14 +307,19 @@ class CoursesNew extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
handleSearch=(value)=>{
|
|
|
|
|
|
|
|
|
|
if(value!=""){
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
classroom:value,
|
|
|
|
|
course:value
|
|
|
|
|
});
|
|
|
|
|
this.Searchvalue(value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleChange=(value)=>{
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
course:value,
|
|
|
|
|
classroom:value
|
|
|
|
@ -321,13 +328,24 @@ class CoursesNew extends Component {
|
|
|
|
|
|
|
|
|
|
handleSearchschool=(value)=>{
|
|
|
|
|
|
|
|
|
|
if(value!="") {
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
school: value,
|
|
|
|
|
fetching: true,
|
|
|
|
|
});
|
|
|
|
|
this.Searchvalue(value)
|
|
|
|
|
|
|
|
|
|
this.getschool(value)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleChangeschools=(value)=>{
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
school: value,
|
|
|
|
|
fetching: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleChangeschool=(value)=>{
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
@ -339,35 +357,56 @@ class CoursesNew extends Component {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getschool=(value)=>{
|
|
|
|
|
|
|
|
|
|
let url="/schools/school_list.json";
|
|
|
|
|
axios.get(url,{
|
|
|
|
|
params: {
|
|
|
|
|
search: value
|
|
|
|
|
}
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if (result.data.message===undefined) {
|
|
|
|
|
if (result.data.status===0) {
|
|
|
|
|
this.setState({
|
|
|
|
|
searchlistscholl: result.data.school_names,
|
|
|
|
|
scholl: value
|
|
|
|
|
school: value
|
|
|
|
|
})
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
scholl: value
|
|
|
|
|
school: value
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
showApplyForAddOrgModal = () => {
|
|
|
|
|
this.applyForAddOrgForm.setVisible(true)
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
let {datatime} = this.state;
|
|
|
|
|
let {datatime,school,searchlistscholl} = this.state;
|
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
const propsWithoutForm = Object.assign({}, this.props)
|
|
|
|
|
delete propsWithoutForm.form
|
|
|
|
|
const options = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
|
|
|
|
|
const optionschool = this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
|
|
|
|
|
const optionschool = 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(optionschool)
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<style>
|
|
|
|
|
{
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
.color-green-light {
|
|
|
|
|
color: #45E660!important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
|
|
|
|
|
{...propsWithoutForm}></ApplyForAddOrgModal>
|
|
|
|
|
{/*提示*/}
|
|
|
|
|
<Modals
|
|
|
|
|
modalsType={this.state.Modalstype}
|
|
|
|
@ -412,31 +451,9 @@ class CoursesNew extends Component {
|
|
|
|
|
}
|
|
|
|
|
`}
|
|
|
|
|
</style>
|
|
|
|
|
<div className="stud-class-set bor-bottom-greyE padding10200">
|
|
|
|
|
<Form.Item label="课堂所属单位">
|
|
|
|
|
{getFieldDecorator('school', {
|
|
|
|
|
rules: [{required: true, message: "不能为空"}],
|
|
|
|
|
})(
|
|
|
|
|
<Select
|
|
|
|
|
showSearch
|
|
|
|
|
className={"fl construction mr10 "}
|
|
|
|
|
placeholder="请输入并选择课本堂的所属单位"
|
|
|
|
|
// value={this.state.school}
|
|
|
|
|
onSearch={this.handleSearchschool}
|
|
|
|
|
// notFoundContent={this.state.fetching ? <Spin size="small" /> : null}
|
|
|
|
|
onChange={this.handleChangeschool}
|
|
|
|
|
onFocus={()=>this.getschool("")}
|
|
|
|
|
allowClear={true}
|
|
|
|
|
>
|
|
|
|
|
{optionschool}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
<span className={"newcoursestitle fl"}>
|
|
|
|
|
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
|
|
|
|
|
</span>
|
|
|
|
|
<div id='isschool'></div>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</div>
|
|
|
|
|
{/*<div className="stud-class-set bor-bottom-greyE padding10200">*/}
|
|
|
|
|
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
|
|
|
|
|
<div className="stud-class-set bor-bottom-greyE padding10200 ">
|
|
|
|
|
<div className={"TabsWarpcourse"}>
|
|
|
|
@ -456,7 +473,6 @@ class CoursesNew extends Component {
|
|
|
|
|
>
|
|
|
|
|
{options}
|
|
|
|
|
</Select>
|
|
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
<span className={"newcoursestitle fl"}>
|
|
|
|
|
{/*(错误示例:数据结构2017本部;数据结构2017秋季;数据结构2017电子商务1班)*/}
|
|
|
|
@ -606,7 +622,7 @@ class CoursesNew extends Component {
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stud-class-set padding10200 coursenavbox">
|
|
|
|
|
<div className="stud-class-set padding10200 coursenavbox bor-bottom-greyE">
|
|
|
|
|
<Form.Item
|
|
|
|
|
label="公开设置"
|
|
|
|
|
hasFeedback
|
|
|
|
@ -620,9 +636,45 @@ class CoursesNew extends Component {
|
|
|
|
|
<span className={"coursesselect"}>(选中后本课堂对所有用户可见,否则仅本课堂成员可见)</span>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="stud-class-set padding10200 coursenavbox mb20">
|
|
|
|
|
<Form.Item label="课堂所属单位">
|
|
|
|
|
{getFieldDecorator('school', {
|
|
|
|
|
rules: [{required: true, message: "不能为空"}],
|
|
|
|
|
})(
|
|
|
|
|
<Select
|
|
|
|
|
showSearch
|
|
|
|
|
className={"fl construction mr10 "}
|
|
|
|
|
placeholder="请输入并选择课本堂的所属单位"
|
|
|
|
|
// value={this.state.school}
|
|
|
|
|
onSearch={this.handleSearchschool}
|
|
|
|
|
// notFoundContent={this.state.fetching ? <Spin size="small" /> : null}
|
|
|
|
|
onChange={this.handleChangeschools}
|
|
|
|
|
allowClear={true}
|
|
|
|
|
>
|
|
|
|
|
{optionschool}
|
|
|
|
|
</Select>
|
|
|
|
|
)}
|
|
|
|
|
<span className={"newcoursestitle fl"}>
|
|
|
|
|
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
|
|
|
|
|
</span>
|
|
|
|
|
<div id='isschool'></div>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
{searchlistscholl.length===0?<div style={{height:"20px",lineHeight:"20px"}} className="ml20">
|
|
|
|
|
<span>
|
|
|
|
|
<span style={{color: '#CDCDCD'}}>未找到包含“{school}”的高校,</span>
|
|
|
|
|
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>:""}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className={"FAFAFA"}>
|
|
|
|
|
<Form.Item wrapperCol={{span: 12, offset: 5}}>
|
|
|
|
|
<div className="clearfix mt80 mb30">
|
|
|
|
|
<Form.Item >
|
|
|
|
|
<div className="clearfix mt40 mb30">
|
|
|
|
|
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">
|
|
|
|
|
提交
|
|
|
|
|
</Button>
|
|
|
|
|