dev_forum
杨树明 5 years ago
parent 91bcb7bba4
commit 42c2cc50cb

@ -46,7 +46,8 @@ class CoursesNew extends Component {
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;
this.getschool("")
this.Searchvalue("")
if (coursesId != undefined) { if (coursesId != undefined) {
let url = "/courses/" + coursesId + "/settings.json" let url = "/courses/" + coursesId + "/settings.json"
axios.get(url).then((result) => { axios.get(url).then((result) => {
@ -85,8 +86,7 @@ class CoursesNew extends Component {
}) })
} }
this.getschool("")
this.Searchvalue("")
} }
componentDidUpdate(prevProps){ componentDidUpdate(prevProps){
@ -292,7 +292,8 @@ class CoursesNew extends Component {
search:value search:value
}).then((result)=>{ }).then((result)=>{
// console.log(result.data) // console.log(result.data)
if (result.data.status===0) { if (result.data.message===undefined) {
this.setState({ this.setState({
searchlist: result.data.course_lists, searchlist: result.data.course_lists,
// course:value, // course:value,
@ -357,7 +358,9 @@ class CoursesNew extends Component {
}; };
getschool=(value)=>{ getschool=(value)=>{
this.props.form.setFieldsValue({
school: value
})
let url="/schools/school_list.json"; let url="/schools/school_list.json";
axios.get(url,{ axios.get(url,{
params: { params: {
@ -369,9 +372,7 @@ class CoursesNew extends Component {
searchlistscholl: result.data.school_names, searchlistscholl: result.data.school_names,
school: value school: value
}) })
this.props.form.setFieldsValue({
school: value
})
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
@ -389,7 +390,7 @@ class CoursesNew extends Component {
const optionschool = this.state.searchlistscholl&&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) // console.log(this.props.current_user.user_school)
// form合并了 // form合并了
// console.log(optionschool) console.log(options)
return ( return (
<React.Fragment> <React.Fragment>

Loading…
Cancel
Save