|
@@ -1,33 +1,17 @@
|
|
|
import React from 'react';
|
|
|
-import { Input, Button, Form, Select, Upload, Icon, Spin, message } from 'antd';
|
|
|
+import { Input, Button, Form, Select, Upload, Icon, Spin, message, Cascader } from 'antd';
|
|
|
import './edu.less';
|
|
|
import { edulvlArr } from '../../dataDic.js';
|
|
|
import ajax from 'jquery/src/ajax/xhr.js'
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
|
|
|
-import EduPfsSelect from './eduPfsSelect.jsx';
|
|
|
+import { techFieldList } from '../../DicTechFieldList';
|
|
|
+import { getBase64, beforeUpload } from '../../tools'
|
|
|
import YearSelect from '../../yearSelect.jsx';
|
|
|
|
|
|
const FormItem = Form.Item;
|
|
|
const Option = Select.Option;
|
|
|
|
|
|
-function getBase64(img, callback) {
|
|
|
- const reader = new FileReader();
|
|
|
- reader.addEventListener('load', () => callback(reader.result));
|
|
|
- reader.readAsDataURL(img);
|
|
|
-};
|
|
|
-
|
|
|
-function beforeUpload(file) {
|
|
|
- const isJPG = file.type === 'image/jpeg';
|
|
|
- if (!isJPG) {
|
|
|
- message.error('You can only upload JPG file!');
|
|
|
- }
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
- if (!isLt2M) {
|
|
|
- message.error('Image must smaller than 2MB!');
|
|
|
- }
|
|
|
- return isJPG && isLt2M;
|
|
|
-};
|
|
|
|
|
|
class Avatar extends React.Component {
|
|
|
constructor(props) {
|
|
@@ -80,11 +64,13 @@ const EduFrom = Form.create()(React.createClass({
|
|
|
dataType: "json",
|
|
|
url: globalConfig.context + "/api/user/educate",
|
|
|
success: function (data) {
|
|
|
- if (data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ } else {
|
|
|
this.setState({
|
|
|
- id:data.data.id,
|
|
|
+ id: data.data.id,
|
|
|
edulvl: data.data.education,
|
|
|
- eduPfs: [parseInt(data.data.majorCategory), parseInt(data.data.majorName)],
|
|
|
+ eduPfs: data.data.majorCategory ? data.data.majorCategory.split(',') : [],
|
|
|
schoolname: data.data.graduateSchool,
|
|
|
graduationTimeYear: data.data.graduationTimeYear,
|
|
|
edunum: data.data.diplomaCode,
|
|
@@ -102,7 +88,8 @@ const EduFrom = Form.create()(React.createClass({
|
|
|
return {
|
|
|
loading: false,
|
|
|
xueweiPicUrl: '',
|
|
|
- xueliPicUrl: ''
|
|
|
+ xueliPicUrl: '',
|
|
|
+ eduPfs: []
|
|
|
};
|
|
|
},
|
|
|
componentDidMount() {
|
|
@@ -119,10 +106,9 @@ const EduFrom = Form.create()(React.createClass({
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + "/api/user/userEdu",
|
|
|
data: {
|
|
|
- "id":this.state.id,
|
|
|
+ "id": this.state.id,
|
|
|
"education": values.edulvl,
|
|
|
- "majorCategory": this.state.eduPfsA,
|
|
|
- "majorName": this.state.eduPfsB,
|
|
|
+ "majorCategory": values.eduPfs.join(','),
|
|
|
"graduateSchool": values.schoolname,
|
|
|
"graduationTimeYear": this.state.graduationTimeYear,
|
|
|
"diplomaUrl": this.state.xueliPicUrl,
|
|
@@ -153,13 +139,8 @@ const EduFrom = Form.create()(React.createClass({
|
|
|
this.state.xueliPicUrl = e;
|
|
|
},
|
|
|
xueweiPicUrl(e) {
|
|
|
-
|
|
|
this.state.xueweiPicUrl = e;
|
|
|
},
|
|
|
- professional(e1, e2) {
|
|
|
- this.state.eduPfsA = e1;
|
|
|
- this.state.eduPfsB = e2;
|
|
|
- },
|
|
|
render() {
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
const formItemLayout = {
|
|
@@ -188,11 +169,13 @@ const EduFrom = Form.create()(React.createClass({
|
|
|
</FormItem>
|
|
|
<FormItem
|
|
|
{...formItemLayout}
|
|
|
- label="专业"
|
|
|
+ label="专业领域"
|
|
|
>
|
|
|
- {getFieldDecorator('edupfs')(
|
|
|
- <EduPfsSelect defValue={this.state.eduPfs} Professional={this.professional} />
|
|
|
- )}
|
|
|
+ {getFieldDecorator('eduPfs', {
|
|
|
+ initialValue: this.state.eduPfs || []
|
|
|
+ })(
|
|
|
+ <Cascader placeholder="请选择专业领域" options={techFieldList} style={{ width: 300 }} />
|
|
|
+ )}
|
|
|
</FormItem>
|
|
|
<FormItem
|
|
|
{...formItemLayout}
|