fix some ui
continuous-integration/drone/push Build is passing Details

master
cxz66666 2020-08-19 23:15:53 +08:00
parent cfc15c6863
commit 5b0ad75041
7 changed files with 332 additions and 203 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

View File

@ -1,33 +1,44 @@
import React from 'react'; import React from "react";
import Sheet from './components/Sheet'; import Sheet from "./components/Sheet";
import { BackTop,Layout} from 'antd'; import { BackTop, Layout } from "antd";
import Background from './background2.jpg'; import Background from "./background2.jpg";
import UploadToOSS from './components/UploadToOSS' import UploadToOSS from "./components/UploadToOSS";
class Entry extends React.Component { class Entry extends React.Component {
state = { state = {
stuid : null, stuid: null,
} };
setID = (value) =>{ setID = (value) => {
this.setState({stuid:value}) this.setState({ stuid: value });
} };
render() { render() {
return ( return (
<Layout style={{backgroundImage: `url(${Background})`}}> <Layout style={{ backgroundImage: `url(${Background})` }}>
<div style={{background:'#fff',borderRadius:20, <div
paddingTop:48, paddingLeft:24, paddingRight:24, marginTop: 24, marginLeft: 24, marginRight: 24,marginBottom:24,opacity:0.75 }} > style={{
<h2 class="ant-typography" style={{ textAlign: 'center' }}> background: "rgba(255,255,255,0.85)",
borderRadius: 20,
paddingTop: 48,
paddingLeft: 24,
paddingRight: 24,
marginTop: 24,
marginLeft: 24,
marginRight: 24,
marginBottom: 24,
}}
>
<h2 class="ant-typography" style={{ textAlign: "center" }}>
浙江大学学生E志者协会2020年纳新报名表 浙江大学学生E志者协会2020年纳新报名表
</h2> </h2>
<center> <center>
<UploadToOSS stuid={this.state.stuid} /> <UploadToOSS stuid={this.state.stuid} />
</center> </center>
<Sheet setID = {this.setID} /> <Sheet setID={this.setID} />
<BackTop visibilityHeight={200} /> <BackTop visibilityHeight={200} />
<p style={{textAlign: 'center'}}> <p style={{ textAlign: "center" }}>
浙江大学学生E志者协会©2020 Created by EVATech 浙江大学学生E志者协会©2020 Created by EVATech
</p> </p>
</ div> </div>
</Layout> </Layout>
); );
} }

View File

@ -934,7 +934,7 @@ export const Feature80DataSource = {
children: ( children: (
<a href="https://mp.weixin.qq.com/s/xGDr9QoajBd83RHuZPIZKg"> <a href="https://mp.weixin.qq.com/s/xGDr9QoajBd83RHuZPIZKg">
<p> <p>
&nbsp; &nbsp; 积极追求参与竞赛等创新实践活动 积极追求参与竞赛等创新实践活动
<br /> <br />
</p> </p>
</a> </a>

View File

@ -1,24 +1,33 @@
import React from "react"; import React from "react";
import axios from "axios"; import axios from "axios";
import { Button, Form, Spin, message,Checkbox,Alert,BackTop,Layout,Card } from "antd"; import {
Button,
Form,
Spin,
message,
Checkbox,
Alert,
BackTop,
Layout,
Card,
} from "antd";
import "antd/dist/antd.css"; import "antd/dist/antd.css";
import { confirmAlert } from "react-confirm-alert"; import { confirmAlert } from "react-confirm-alert";
import "react-confirm-alert/src/react-confirm-alert.css"; import "react-confirm-alert/src/react-confirm-alert.css";
import qs from "qs"; import qs from "qs";
import Background from '../background2.jpg'; import Background from "../background2.jpg";
import { withRouter } from 'react-router-dom' import { withRouter } from "react-router-dom";
const Wishes = ["电脑部", "电器部", "文宣部", "人资部", "财外部"];
const Wishes = ["电脑部","电器部","文宣部","人资部","财外部"]
class TimePicker extends React.Component { class TimePicker extends React.Component {
constructor(){ constructor() {
super() super();
this.state = {confirmed:false} this.state = { confirmed: false };
} }
componentDidMount(){ componentDidMount() {
this.queryInfo() this.queryInfo();
this.queryTime() this.queryTime();
} }
handleSubmit = (e) => { handleSubmit = (e) => {
@ -26,8 +35,7 @@ class TimePicker extends React.Component {
const validateFieldsAndScroll = this.props.form.validateFieldsAndScroll; const validateFieldsAndScroll = this.props.form.validateFieldsAndScroll;
confirmAlert({ confirmAlert({
title: "提交面试时间", title: "提交面试时间",
message: message: "点击 Yes 进行提交。",
"点击 Yes 进行提交。",
buttons: [ buttons: [
{ {
label: "Yes", label: "Yes",
@ -36,10 +44,10 @@ class TimePicker extends React.Component {
if (err) { if (err) {
message.error("填写不正确,请按照提示修改"); message.error("填写不正确,请按照提示修改");
} else { } else {
var Times = [] var Times = [];
for(var i in values){ for (var i in values) {
for(var j = 0;j < values[i].length;j++) for (var j = 0; j < values[i].length; j++)
Times = Times.concat(values[i][j]) Times = Times.concat(values[i][j]);
} }
let addForm = async () => { let addForm = async () => {
let result = await axios("api/posttime", { let result = await axios("api/posttime", {
@ -47,20 +55,25 @@ class TimePicker extends React.Component {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
}, },
method: "POST", method: "POST",
data: qs.stringify({ dto:JSON.stringify({Times:Times}),guid:this.props.match.params.guid}), data: qs.stringify({
dto: JSON.stringify({ Times: Times }),
guid: this.props.match.params.guid,
}),
}); });
if (result.data.status === "success") { if (result.data.status === "success") {
message.success( message.success("提交成功!期待你的精彩面试表现!");
"提交成功!期待你的精彩面试表现!" } else if (
); result.data.data.errorMsg === "TIME_ALREAY_CONFIRM"
) {
message.error("我们已经为您分配了场次,请留意短信通知");
} else { } else {
message.error("提交失败!可能是网络问题。"); message.error("提交失败!可能是网络问题。");
} }
}; };
if(Times.length !== 0){ if (Times.length !== 0) {
addForm() addForm();
}else{ } else {
message.error("请至少选择一个场次!"); message.error("请至少选择一个场次!");
} }
} }
@ -75,66 +88,62 @@ class TimePicker extends React.Component {
}); });
}; };
queryTime = async () => { queryTime = async () => {
let result = await axios( let result = await axios("api/gettime", {
'api/gettime', method: "GET",
{ });
method: 'GET', if (result.data.status === "success") {
} var timetable = [];
) for (var time of result.data.data) {
if(result.data.status === "success") { for (var index = 0; index < timetable.length; index++) {
var timetable = [] if (timetable[index].day === time.day) {
for(var time of result.data.data){ for (var i = 0; i < timetable[index].time.length; i++) {
for(var index = 0;index < timetable.length;index++){ if (time.beginTime === timetable[index].time[i].label) {
if(timetable[index].day === time.day){ timetable[index].time[i].value.push(time.id);
for(var i = 0 ; i < timetable[index].time.length;i++){ break;
if(time.beginTime === timetable[index].time[i].label){
timetable[index].time[i].value.push(time.id)
break
}
} }
if(i === timetable[index].time.length){
timetable[index].time.push({label:time.beginTime,value:[time.id]})
}
break
} }
} if (i === timetable[index].time.length) {
if(index === timetable.length){ timetable[index].time.push({
timetable.push({ day:time.day,time:[{label:time.beginTime,value:[time.id]}]}) label: time.beginTime,
value: [time.id],
});
}
break;
} }
} }
this.setState( if (index === timetable.length) {
{ timetable.push({
option_list: timetable, day: time.day,
option_number: timetable.length time: [{ label: time.beginTime, value: [time.id] }],
} });
)
}else{
message.error("获取面试场次失败,请稍后重试")
this.props.history.push('/')
}
}
queryInfo = async () => {
let result = await axios(
'api/getinfo/'+this.props.match.params.guid,
{
method: 'GET',
} }
)
if(result.data.status === "success") {
result.data.data.firstWish = Wishes[result.data.data.firstWish-1]
result.data.data.secondWish = Wishes[result.data.data.secondWish-1]
this.setState(
{
info: result.data.data,
} }
) this.setState({
}else{ option_list: timetable,
message.error("获取个人信息失败,请稍后重试") option_number: timetable.length,
this.props.history.push('/') });
} else {
message.error("获取面试场次失败,请稍后重试");
this.props.history.push("/");
} }
} };
render(){ queryInfo = async () => {
let result = await axios("api/getinfo/" + this.props.match.params.guid, {
method: "GET",
});
if (result.data.status === "success") {
result.data.data.firstWish = Wishes[result.data.data.firstWish - 1];
result.data.data.secondWish = Wishes[result.data.data.secondWish - 1];
this.setState({
info: result.data.data,
});
} else {
message.error("获取个人信息失败,请稍后重试");
this.props.history.push("/");
}
};
render() {
const formItemLayout = { const formItemLayout = {
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@ -160,121 +169,209 @@ class TimePicker extends React.Component {
}; };
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
if(this.state.confirmed){ if (this.state.confirmed) {
return( return this.state.option_list ? (
this.state.option_list ? <Form {...formItemLayout} onSubmit={this.handleSubmit}>
<Form {...formItemLayout} onSubmit={this.handleSubmit}> <h4 class="ant-typography" style={{ textAlign: "center" }}>
<h4 class="ant-typography" style={{ textAlign: 'center' }}> 请尽量多选
请尽量多选
</h4> </h4>
<Form.Item label= {this.state.option_number > 0 ? this.state.option_list[0].day:0}> <Form.Item
{getFieldDecorator("time1", { label={
initialValue: [], this.state.option_number > 0 ? this.state.option_list[0].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 0 ? this.state.option_list[0].time:0} />)} >
</Form.Item> {getFieldDecorator("time1", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 0
? this.state.option_list[0].time
: 0
}
/>
)}
</Form.Item>
<Form.Item label={this.state.option_number > 1 ? this.state.option_list[1].day:0}> <Form.Item
{getFieldDecorator("time2", { label={
initialValue: [], this.state.option_number > 1 ? this.state.option_list[1].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 1 ? this.state.option_list[1].time:0} />)} >
</Form.Item> {getFieldDecorator("time2", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 1
? this.state.option_list[1].time
: 0
}
/>
)}
</Form.Item>
<Form.Item label={this.state.option_number > 2 ? this.state.option_list[2].day:0}> <Form.Item
{getFieldDecorator("time3", { label={
initialValue: [], this.state.option_number > 2 ? this.state.option_list[2].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 2 ? this.state.option_list[2].time:0} />)} >
</Form.Item> {getFieldDecorator("time3", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 2
? this.state.option_list[2].time
: 0
}
/>
)}
</Form.Item>
<Form.Item label={this.state.option_number > 3 ? this.state.option_list[3].day:0}> <Form.Item
{getFieldDecorator("time4", { label={
initialValue: [], this.state.option_number > 3 ? this.state.option_list[3].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 3 ? this.state.option_list[3].time:0} />)} >
</Form.Item> {getFieldDecorator("time4", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 3
? this.state.option_list[3].time
: 0
}
/>
)}
</Form.Item>
<Form.Item label={this.state.option_number > 4 ? this.state.option_list[4].day:0}> <Form.Item
{getFieldDecorator("time5", { label={
initialValue: [], this.state.option_number > 4 ? this.state.option_list[4].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 4 ?this.state.option_list[4].time:0} />)} >
</Form.Item> {getFieldDecorator("time5", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 4
? this.state.option_list[4].time
: 0
}
/>
)}
</Form.Item>
<Form.Item label={this.state.option_number > 5 ?this.state.option_list[5].day:0}> <Form.Item
{getFieldDecorator("time6", { label={
initialValue: [], this.state.option_number > 5 ? this.state.option_list[5].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 5 ?this.state.option_list[5].time:0} />)} >
</Form.Item> {getFieldDecorator("time6", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 5
? this.state.option_list[5].time
: 0
}
/>
)}
</Form.Item>
<Form.Item label={this.state.option_number > 6 ? this.state.option_list[6].day:0}> <Form.Item
{getFieldDecorator("time7", { label={
initialValue: [], this.state.option_number > 6 ? this.state.option_list[6].day : 0
rules: [{ required: false }], }
})( <Checkbox.Group options={this.state.option_number > 6 ? this.state.option_list[6].time:0} />)} >
</Form.Item> {getFieldDecorator("time7", {
initialValue: [],
rules: [{ required: false }],
})(
<Checkbox.Group
options={
this.state.option_number > 6
? this.state.option_list[6].time
: 0
}
/>
)}
</Form.Item>
<Button <Button
icon="copy" icon="copy"
style={{display:"block",margin:"0 auto" }} style={{ display: "block", margin: "0 auto" }}
type="primary" type="primary"
htmlType="submit" htmlType="submit"
> >
提交 提交
</Button> </Button>
</Form>: </Form>
<div> ) : (
<Spin size="large" tip="Loading..."> <div>
<Alert <Spin size="large" tip="Loading...">
message="正在打开页面" <Alert
description="请耐心等待,长时间未加载请请尝试刷新页面" message="正在打开页面"
style={{height:"700px",textAlign:"center"}} description="请耐心等待,长时间未加载请请尝试刷新页面"
type="info" style={{ height: "700px", textAlign: "center" }}
/> type="info"
</Spin> />
</div> </Spin>
)}else{ </div>
return(this.state.info? );
<div> } else {
<Card title="个人信息" > return this.state.info ? (
<Card type="inner" title="姓名" > <div>
<Card title="个人信息">
<Card type="inner" title="姓名">
<h3>{this.state.info.name}</h3> <h3>{this.state.info.name}</h3>
</Card> </Card>
<Card type="inner" title="学号"> <Card type="inner" title="学号">
<h3>{this.state.info.id_student}</h3> <h3>{this.state.info.id_student}</h3>
</Card> </Card>
<Card type="inner" title="第一志愿" > <Card type="inner" title="第一志愿">
<h3>{this.state.info.firstWish}</h3> <h3>{this.state.info.firstWish}</h3>
</Card> </Card>
<Card type="inner" title="第二志愿" > <Card type="inner" title="第二志愿">
<h3>{this.state.info.secondWish}</h3> <h3>{this.state.info.secondWish}</h3>
</Card> </Card>
</Card> </Card>
<p></p> <p></p>
<Button <Button
style={{display:"block",margin:"0 auto" }} style={{ display: "block", margin: "0 auto" }}
type="primary" type="primary"
onClick= {(e) => {this.setState({confirmed:true}) onClick={(e) => {
if(!this.state.option_list){this.queryTime()} this.setState({ confirmed: true });
}} if (!this.state.option_list) {
this.queryTime();
}
}}
> >
确认个人信息 确认个人信息
</Button> </Button>
</div>
:
<div>
<Spin size="large" tip="Loading...">
<Alert
message="正在打开页面"
description="请耐心等待,长时间未加载请请尝试刷新页面"
type="info"
style={{height:"700px",textAlign:"center"}}
/>
</Spin>
</div> </div>
) ) : (
<div>
<Spin size="large" tip="Loading...">
<Alert
message="正在打开页面"
description="请耐心等待,长时间未加载请请尝试刷新页面"
type="info"
style={{ height: "700px", textAlign: "center" }}
/>
</Spin>
</div>
);
} }
} }
} }
@ -283,20 +380,32 @@ const Chooser = withRouter(Form.create({})(TimePicker));
class ChooseTime extends React.Component { class ChooseTime extends React.Component {
render() { render() {
return ( return (
<Layout style={{backgroundImage: `url(${Background})`}}> <Layout style={{ backgroundImage: `url(${Background})` }}>
<div style={{background:'#fff',borderRadius:20, <div
paddingTop:48, paddingLeft:24, paddingRight:24, marginTop: 24, marginLeft: 24, marginRight: 24,marginBottom:24,opacity:0.92 }} > style={{
<h2 class="ant-typography" style={{ textAlign: 'center' }}> background: "#fff",
borderRadius: 20,
paddingTop: 48,
paddingLeft: 24,
paddingRight: 24,
marginTop: 24,
marginLeft: 24,
marginRight: 24,
marginBottom: 24,
opacity: 0.92,
}}
>
<h2 class="ant-typography" style={{ textAlign: "center" }}>
浙江大学学生E志者协会2020年面试时间 浙江大学学生E志者协会2020年面试时间
</h2> </h2>
<Chooser/> <Chooser />
<BackTop visibilityHeight={200} /> <BackTop visibilityHeight={200} />
<p style={{textAlign: 'center'}}> <p style={{ textAlign: "center" }}>
浙江大学学生E志者协会©2020 Created by EVATech 浙江大学学生E志者协会©2020 Created by EVATech
</p> </p>
</ div> </div>
</Layout> </Layout>
); );
} }
} }
export default ChooseTime export default ChooseTime;

View File

@ -51,18 +51,26 @@ class NewForm extends React.Component {
message.success( message.success(
"提交成功!后续的面试时间会以短信形式通知,期待你的加入!" "提交成功!后续的面试时间会以短信形式通知,期待你的加入!"
); );
successInform(values.phone, values.name, values.id_student, values.firstWish, values.secondWish); successInform(
}else { values.phone,
if(result.data.errorMsg === "TICKET_NOT_LEGEAL"){ values.name,
values.id_student,
values.firstWish,
values.secondWish
);
} else {
if (result.data.errorMsg === "TICKET_NOT_LEGEAL") {
message.error("提交失败!请检查报名表填写是否正确。"); message.error("提交失败!请检查报名表填写是否正确。");
}else if(result.data.errorMsg === "TICKET_INFO_INCOMPLETE"){ } else if (
result.data.errorMsg === "TICKET_INFO_INCOMPLETE"
) {
message.error("提交失败!请检查报名表填写是否完整。"); message.error("提交失败!请检查报名表填写是否完整。");
}else{ } else {
message.error("提交失败!可能是网络问题。"); message.error("提交失败!可能是网络问题。");
} }
} }
} };
addForm() addForm();
} }
}); });
}, },

View File

@ -22,12 +22,12 @@ class UploadToOSS extends React.Component {
if (!isJpgOrPng) { if (!isJpgOrPng) {
message.error("只能上传JPG/PNG格式的图片哦"); message.error("只能上传JPG/PNG格式的图片哦");
} }
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 5;
if (!isLt2M) { if (!isLt2M) {
message.error("图像文件要小于2MB哦"); message.error("图像文件要小于5MB哦");
} }
if (!this.props.stuid) { if (!this.props.stuid) {
message.error("请先填写学号"); message.error("请先填写学号");
} }
if (isJpgOrPng && isLt2M && this.props.stuid) { if (isJpgOrPng && isLt2M && this.props.stuid) {
if (file.type === "image/png") { if (file.type === "image/png") {
@ -97,6 +97,7 @@ class UploadToOSS extends React.Component {
const { imageUrl } = this.state; const { imageUrl } = this.state;
return ( return (
<Upload <Upload
accept=".jpg,.png"
showUploadList={false} showUploadList={false}
beforeUpload={this.beforeUpload} beforeUpload={this.beforeUpload}
onChange={this.handleChange} onChange={this.handleChange}