From 01f19b9bcfdcf0e4ac05a1aed0b9fdb7c8b1d1c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Wed, 24 Jul 2019 20:34:19 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/user/modal/ApplyForAddOrgModal.js | 353 +++++++++---------
1 file changed, 177 insertions(+), 176 deletions(-)
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;
+
+