增加初稿问题
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0dd32e2964
commit
6fb7a51311
|
|
@ -10,11 +10,15 @@ import successInform from "./Message";
|
||||||
class NewForm extends React.Component {
|
class NewForm extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = { WishValid:false,firstWish:undefined,secondWish:undefined };
|
this.state = {
|
||||||
|
WishValid: false,
|
||||||
|
firstWish: undefined,
|
||||||
|
secondWish: undefined,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.loadLocalStorage();
|
this.loadLocalStorage();
|
||||||
this.props.form.validateFields(['firstWish'], { force: true });
|
this.props.form.validateFields(["firstWish"], { force: true });
|
||||||
}
|
}
|
||||||
loadLocalStorage = () => {
|
loadLocalStorage = () => {
|
||||||
const values = JSON.parse(localStorage.getItem("formCache") || "{}");
|
const values = JSON.parse(localStorage.getItem("formCache") || "{}");
|
||||||
|
|
@ -41,7 +45,7 @@ class NewForm extends React.Component {
|
||||||
label: "Yes",
|
label: "Yes",
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
validateFieldsAndScroll((err, values) => {
|
validateFieldsAndScroll((err, values) => {
|
||||||
if(err) {
|
if (err) {
|
||||||
message.error("填写不正确,请按照提示修改");
|
message.error("填写不正确,请按照提示修改");
|
||||||
} else {
|
} else {
|
||||||
// console.log(values);
|
// console.log(values);
|
||||||
|
|
@ -94,33 +98,58 @@ class NewForm extends React.Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
validator = (rule, value, callback) => {
|
validator = (rule, value, callback) => {
|
||||||
this.setState({WishValid:true})
|
this.setState({ WishValid: true });
|
||||||
const form = this.props.form
|
const form = this.props.form;
|
||||||
var firstWish = value
|
var firstWish = value;
|
||||||
var secondWish = form.getFieldValue('secondWish')
|
var secondWish = form.getFieldValue("secondWish");
|
||||||
var thirdWish = form.getFieldValue('thirdWish')
|
var thirdWish = form.getFieldValue("thirdWish");
|
||||||
this.setState({firstWish:firstWish,secondWish:secondWish})
|
this.setState({ firstWish: firstWish, secondWish: secondWish });
|
||||||
try{
|
try {
|
||||||
if(firstWish === undefined ||secondWish === undefined ||thirdWish === undefined){
|
if (
|
||||||
throw("请完整填写三个志愿")
|
firstWish === undefined ||
|
||||||
|
secondWish === undefined ||
|
||||||
|
thirdWish === undefined
|
||||||
|
) {
|
||||||
|
throw "请完整填写三个志愿";
|
||||||
}
|
}
|
||||||
if(firstWish === secondWish||firstWish === thirdWish ||secondWish === thirdWish){
|
if (
|
||||||
throw("三个志愿不能重复")
|
firstWish === secondWish ||
|
||||||
|
firstWish === thirdWish ||
|
||||||
|
secondWish === thirdWish
|
||||||
|
) {
|
||||||
|
throw "三个志愿不能重复";
|
||||||
}
|
}
|
||||||
}catch(err){
|
} catch (err) {
|
||||||
this.setState({WishValid:false})
|
this.setState({ WishValid: false });
|
||||||
callback(err)
|
callback(err);
|
||||||
}
|
}
|
||||||
callback()
|
callback();
|
||||||
}
|
};
|
||||||
render() {
|
render() {
|
||||||
const questions = [[],
|
const questions = [
|
||||||
["1","2"],
|
[],
|
||||||
["3","4"],
|
[
|
||||||
["5","6"],
|
"电脑部:说说你跟电脑有关的印象深刻的事情(或者你对电脑最感兴趣的地方,可以是某个组成部分)",
|
||||||
["7","8"],
|
"电脑部:来电脑部之后想学些什么?有什么想学的也可以说呀",
|
||||||
["9","10"]]
|
],
|
||||||
|
[
|
||||||
|
"电器部:你有没有自己拆装简单电器的经历,有的话请简述",
|
||||||
|
"电器部:你希望自己在电器部成为一个怎样的人?定位在劳动者,领导者还是创新者?请简述",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"文宣部:描述一下你构想的以xx为主题的海报or摄影作品,xx可以是你想到的任何事物",
|
||||||
|
"文宣部:你觉得我们是干什么的(正经脸)",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"人资部:请举一个你想出的创新点子(实现过或现实中有一定的可操作性),最好是关于组织某次活动(活动包括但不限于宣传活动,内建活动,特殊的生日祝福等等)",
|
||||||
|
"人资部:你觉得你身上最符合人资部的特点是什么?",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"财外部:在社团全员大会/部门内建/部门事务这三种情况打破了你原来的学习安排的情况下,你如何去平衡社团与学习生活?",
|
||||||
|
"财外部:说说令你印象最深刻的理财经历,可以是任何和理财有关的哦",
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
const tailFormItemLayout = {
|
const tailFormItemLayout = {
|
||||||
wrapperCol: {
|
wrapperCol: {
|
||||||
|
|
@ -150,7 +179,10 @@ class NewForm extends React.Component {
|
||||||
})(<Input />)}
|
})(<Input />)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label="学号(请先填写此项再上传照片)" onChange={this.onStuIdChange}>
|
<Form.Item
|
||||||
|
label="学号(请先填写此项再上传照片)"
|
||||||
|
onChange={this.onStuIdChange}
|
||||||
|
>
|
||||||
{getFieldDecorator("id_student", {
|
{getFieldDecorator("id_student", {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
@ -258,8 +290,8 @@ class NewForm extends React.Component {
|
||||||
message: "请选择第一志愿",
|
message: "请选择第一志愿",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: this.validator
|
validator: this.validator,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
})(
|
})(
|
||||||
<Radio.Group name="firstWish" size="medium">
|
<Radio.Group name="firstWish" size="medium">
|
||||||
|
|
@ -277,17 +309,19 @@ class NewForm extends React.Component {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "请选择第二志愿"
|
message: "请选择第二志愿",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
this.props.form.validateFields(["firstWish"], {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
callback();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{ validator: (rule, value, callback) => {
|
|
||||||
this.props.form.validateFields(['firstWish'], { force: true });
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
})(
|
})(
|
||||||
<Radio.Group name="secondWish" size="medium"
|
<Radio.Group name="secondWish" size="medium">
|
||||||
>
|
|
||||||
<Radio.Button value={1}>电脑部</Radio.Button>
|
<Radio.Button value={1}>电脑部</Radio.Button>
|
||||||
<Radio.Button value={2}>电器部</Radio.Button>
|
<Radio.Button value={2}>电器部</Radio.Button>
|
||||||
<Radio.Button value={3}>文宣部</Radio.Button>
|
<Radio.Button value={3}>文宣部</Radio.Button>
|
||||||
|
|
@ -304,15 +338,17 @@ class NewForm extends React.Component {
|
||||||
required: true,
|
required: true,
|
||||||
message: "请选择第三志愿",
|
message: "请选择第三志愿",
|
||||||
},
|
},
|
||||||
{ validator: (rule, value, callback) => {
|
{
|
||||||
this.props.form.validateFields(['firstWish'], { force: true })
|
validator: (rule, value, callback) => {
|
||||||
callback()
|
this.props.form.validateFields(["firstWish"], {
|
||||||
}
|
force: true,
|
||||||
}
|
});
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
})(
|
})(
|
||||||
<Radio.Group name="thirdWish" size="medium"
|
<Radio.Group name="thirdWish" size="medium">
|
||||||
>
|
|
||||||
<Radio.Button value={1}>电脑部</Radio.Button>
|
<Radio.Button value={1}>电脑部</Radio.Button>
|
||||||
<Radio.Button value={2}>电器部</Radio.Button>
|
<Radio.Button value={2}>电器部</Radio.Button>
|
||||||
<Radio.Button value={3}>文宣部</Radio.Button>
|
<Radio.Button value={3}>文宣部</Radio.Button>
|
||||||
|
|
@ -322,9 +358,15 @@ class NewForm extends React.Component {
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label="是否服从调剂" onChange = {() => {
|
<Form.Item
|
||||||
if(this.props.form.getFieldValue("adjustment") === true)
|
label="是否服从调剂"
|
||||||
message.warning("往届两技术部报名人数较多,选择调剂表示存在您被分配到第二、三志愿的可能,请审慎选择。")}}>
|
onChange={() => {
|
||||||
|
if (this.props.form.getFieldValue("adjustment") === true)
|
||||||
|
message.warning(
|
||||||
|
"往届两技术部报名人数较多,选择调剂表示存在您被分配到第二、三志愿的可能,请审慎选择。"
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
{getFieldDecorator("adjustment", {
|
{getFieldDecorator("adjustment", {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
@ -333,15 +375,17 @@ class NewForm extends React.Component {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})(
|
})(
|
||||||
<Radio.Group >
|
<Radio.Group>
|
||||||
<Radio value={true}>是</Radio>
|
<Radio value={true}>是</Radio>
|
||||||
<Radio value={false}>否</Radio>
|
<Radio value={false}>否</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
)}
|
)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={this.state.firstWish?questions[this.state.firstWish][0]:""}
|
<Form.Item
|
||||||
style={this.state.WishValid?{}:{display:"none"}}>
|
label={this.state.firstWish ? questions[this.state.firstWish][0] : ""}
|
||||||
|
style={this.state.WishValid ? {} : { display: "none" }}
|
||||||
|
>
|
||||||
{getFieldDecorator("firstReason", {
|
{getFieldDecorator("firstReason", {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
@ -352,8 +396,10 @@ class NewForm extends React.Component {
|
||||||
})(<Input.TextArea autosize={{ minRows: 2, maxRows: 8 }} />)}
|
})(<Input.TextArea autosize={{ minRows: 2, maxRows: 8 }} />)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={this.state.firstWish?questions[this.state.firstWish][1]:""}
|
<Form.Item
|
||||||
style={this.state.WishValid?{}:{display:"none"}}>
|
label={this.state.firstWish ? questions[this.state.firstWish][1] : ""}
|
||||||
|
style={this.state.WishValid ? {} : { display: "none" }}
|
||||||
|
>
|
||||||
{getFieldDecorator("secondReason", {
|
{getFieldDecorator("secondReason", {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
@ -364,9 +410,12 @@ class NewForm extends React.Component {
|
||||||
})(<Input.TextArea autosize={{ minRows: 2, maxRows: 8 }} />)}
|
})(<Input.TextArea autosize={{ minRows: 2, maxRows: 8 }} />)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
<Form.Item label={this.state.secondWish?questions[this.state.secondWish][0]:""}
|
label={
|
||||||
style={this.state.WishValid?{}:{display:"none"}}>
|
this.state.secondWish ? questions[this.state.secondWish][0] : ""
|
||||||
|
}
|
||||||
|
style={this.state.WishValid ? {} : { display: "none" }}
|
||||||
|
>
|
||||||
{getFieldDecorator("thirdReason", {
|
{getFieldDecorator("thirdReason", {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
@ -377,7 +426,6 @@ class NewForm extends React.Component {
|
||||||
})(<Input.TextArea autosize={{ minRows: 2, maxRows: 8 }} />)}
|
})(<Input.TextArea autosize={{ minRows: 2, maxRows: 8 }} />)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|
||||||
<Form.Item label="你希望未来能在E志者协会得到什么?又能为E志付出什么?">
|
<Form.Item label="你希望未来能在E志者协会得到什么?又能为E志付出什么?">
|
||||||
{getFieldDecorator("question2", {
|
{getFieldDecorator("question2", {
|
||||||
rules: [
|
rules: [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue