diff --git a/public/react/src/modules/user/modal/ApplyForAddOrgModal.js b/public/react/src/modules/user/modal/ApplyForAddOrgModal.js index 72ae542c6..afa613f9d 100644 --- a/public/react/src/modules/user/modal/ApplyForAddOrgModal.js +++ b/public/react/src/modules/user/modal/ApplyForAddOrgModal.js @@ -1,176 +1,177 @@ -import React, { Component } from "react"; -import { Modal, Button, Input, Form, } from "antd"; -import axios from 'axios' -import ModalWrapper from "../../courses/common/ModalWrapper" -import { City } from 'educoder' -import '../account/common.css' - -const { TextArea } = Input; -const Search = Input.Search -class ApplyForAddOrgModal extends Component{ - constructor(props){ - super(props); - this.state={ - - } - } - - componentDidUpdate=(prevState)=>{ - if(this.props.schoolName && prevState.schoolName != this.props.schoolName){ - this.props.form.setFieldsValue({ - schoolName:this.props.schoolName - }) - } - } - componentDidMount=()=>{ - if(this.props.schoolName){ - this.props.form.setFieldsValue({ - schoolName:this.props.schoolName - }) - } - } - - setVisible = (visible) => { - this.refs.modalWrapper.setVisible(visible) - } - - onSendOk = () => { - this.props.form.validateFieldsAndScroll((err, values) => { - console.log(values); - if(!err){ - let url=`/add_school_applies.json`; - axios.post(url,{ - name:values.schoolName, - province:values.city && values.city[0], - city:values.city && values.city[1], - address:values.address, - remarks:values.remarks - }).then((result)=>{ - if(result){ - this.props.showNotification("新增学校/单位成功!"); - this.props.addOrgSuccess(values.schoolName) - this.setVisible(false); - } - }).catch((error)=>{ - console.log(error); - }) - } - }) - } - - onOk = () => { - this.onSendOk() - } - - render(){ - const { course_lists, checkBoxValues, searchValue, loading, hasMore } = this.state - const { moduleName } = this.props - const { getFieldDecorator } = this.props.form; - return( - - -
- - {getFieldDecorator('schoolName', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: '请输入学校或工作单位', - }], - })( - - )} -
-
  • 示例:
  • -
      -
    • - - 国防科学技术大学 -
    • -
    • - - 国防科学技术大学开福校区 -
    • -
    -
    -
    - - - {getFieldDecorator('city', { - rules: [], - })( - - )} - - - - {getFieldDecorator('address', { - rules: [], - })( - - )} - - - - {getFieldDecorator('remarks', { - })( - - )} - - -
    - - -
    - ) - } -} -const WrappedApplyForAddOrgModal = Form.create({ name: 'ApplyForAddOrgModal' })(ApplyForAddOrgModal); - -export default WrappedApplyForAddOrgModal; - - +import React, { Component } from "react"; +import { Modal, Button, Input, Form, } from "antd"; +import axios from 'axios' +import ModalWrapper from "../../courses/common/ModalWrapper" +import { City } from 'educoder' +import '../account/common.css' + +const { TextArea } = Input; +const Search = Input.Search +class ApplyForAddOrgModal extends Component{ + constructor(props){ + super(props); + this.state={ + + } + } + + componentDidUpdate=(prevState)=>{ + if(this.props.schoolName && prevState.schoolName != this.props.schoolName){ + this.props.form.setFieldsValue({ + schoolName:this.props.schoolName + }) + } + } + componentDidMount=()=>{ + if(this.props.schoolName){ + this.props.form.setFieldsValue({ + schoolName:this.props.schoolName + }) + } + } + + setVisible = (visible) => { + this.refs.modalWrapper.setVisible(visible) + } + + onSendOk = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + console.log(values); + if(!err){ + let url=`/add_school_applies.json`; + axios.post(url,{ + name:values.schoolName, + province:values.city && values.city[0], + city:values.city && values.city[1], + address:values.address, + remarks:values.remarks + }).then((result)=>{ + if(result){ + this.props.showNotification("新增学校/单位成功!"); + this.setVisible(false); + this.props.addOrgSuccess(values.schoolName) + + } + }).catch((error)=>{ + console.log(error); + }) + } + }) + } + + onOk = () => { + this.onSendOk() + } + + render(){ + const { course_lists, checkBoxValues, searchValue, loading, hasMore } = this.state + const { moduleName } = this.props + const { getFieldDecorator } = this.props.form; + return( + + +
    + + {getFieldDecorator('schoolName', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入学校或工作单位', + }], + })( + + )} +
    +
  • 示例:
  • +
      +
    • + + 国防科学技术大学 +
    • +
    • + + 国防科学技术大学开福校区 +
    • +
    +
    +
    + + + {getFieldDecorator('city', { + rules: [], + })( + + )} + + + + {getFieldDecorator('address', { + rules: [], + })( + + )} + + + + {getFieldDecorator('remarks', { + })( + + )} + + +
    + + +
    + ) + } +} +const WrappedApplyForAddOrgModal = Form.create({ name: 'ApplyForAddOrgModal' })(ApplyForAddOrgModal); + +export default WrappedApplyForAddOrgModal; + +