From 855a148f87e95dc3ebac218733bd0e15f64295eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 2 Nov 2019 16:13:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bankcardnumberverification.js | 178 +++++++++ .../CompetitionContentspdfpeopledata.js | 350 +----------------- .../Mailboxvalidation.js | 270 ++++++++++++++ .../Phonenumberverification.js | 262 +++++++++++++ 4 files changed, 724 insertions(+), 336 deletions(-) create mode 100644 public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js create mode 100644 public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js create mode 100644 public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js new file mode 100644 index 000000000..174256373 --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -0,0 +1,178 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' + +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class Bankcardnumberverification extends Component { + constructor(props) { + super(props) + this.state = { + basicInfo: {}, + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1 + } + } + + componentDidMount() { + window.document.title = '竞赛'; + console.log("3获取用户信息"); + console.log(this.props); + } + + + render() { + const {getFieldDecorator} = this.props.form; + const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + return ( +
+
+

签/领/开户行及银行卡号

+

为保障奖金的及时发放,请队长如实填写你名下的银行卡信息

+
+
+ +
+ +
+ + {getFieldDecorator('openingbank', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入开户行', + }], + })( + + )} + + + + {getFieldDecorator('subbranch', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入支行', + }], + })( + + )} + + + + {getFieldDecorator('subbranchs', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入账号', + }], + })( + + )} + + +
+

+
+ {/*
this.yhBanksfalse()}>

取消

*/} + +
+
+ +
+
+
+ +
+
+ ) + } +} + +const Bankcardnumberverifications = Form.create({name: 'Bankcardnumberverification'})(Bankcardnumberverification); + +export default Bankcardnumberverifications; + diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index 3585f5b81..9cc4cd19e 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -6,7 +6,9 @@ import mycompetotionchild from './mycompetotionchild.css'; import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; import '../../../../courses/css/Courses.css' import RealNameCertificationModal from "../../../../user/modal/RealNameCertificationModal"; - +import Phonenumberverifications from './Phonenumberverification'; +import Mailboxvalidations from './Mailboxvalidation' +import Bankcardnumberverifications from './Bankcardnumberverification' export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} class CompetitionContentspdfpeopledata extends Component { @@ -118,7 +120,7 @@ class CompetitionContentspdfpeopledata extends Component { if (result) { this.props.showNotification("邮箱地址绑定成功!"); this.setState({ - updating: '' + emailbool: false }) this.getdata(); } @@ -327,9 +329,7 @@ class CompetitionContentspdfpeopledata extends Component { render() { - const {getFieldDecorator} = this.props.form; const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state - console.log(emailbool); return (
{this.state.certification === 1 ? @@ -455,106 +455,9 @@ class CompetitionContentspdfpeopledata extends Component { {/*手机号绑定*/} { phonebool === true ? -
- -
- - - {getFieldDecorator('phone', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: `请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`, - }], - })( - - )} - - - - {getFieldDecorator('phoneValidateCode', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: '请输入手机获取的验证码', - }], - })( - - )} - - - -
- - -
-
-
-
+ this.hideUpdating(i)} + getdata={() => this.getdata()}> : "" } @@ -567,241 +470,18 @@ class CompetitionContentspdfpeopledata extends Component {
{ emailbool === false ? "" : -
- -
- - - {getFieldDecorator('email', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: basicInfo && basicInfo.mail ? '请输入要更换的新邮箱地址' : '请输入邮箱地址', - }], - })( - - )} - - - - {getFieldDecorator('emailValidateCode', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: '请输入邮箱收到的验证码', - }], - })( - - )} - - - -
- - -
-
-
-
+ this.hideUpdating(i)} + getdata={() => this.getdata()}> } { leader === true ?
{ bank_account_editable === true ? -
-
-

签/领/开户行及银行卡号

-

为保障奖金的及时发放,请队长如实填写你名下的银行卡信息

-
-
- -
- - - {getFieldDecorator('openingbank', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: '请输入开户行', - }], - })( - - )} - - - - {getFieldDecorator('subbranch', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: '请输入支行', - }], - })( - - )} - - - - {getFieldDecorator('subbranchs', { - rules: [{ - // initialValue: this.state.cityDefaultValue, - required: true, - message: '请输入账号', - }], - })( - - )} - - -
-

-
- {/*
this.yhBanksfalse()}>

取消

*/} - -
-
-
-
- -
-
+ this.hideUpdating(i)} + getdata={() => this.getdata()}> :
@@ -842,7 +522,5 @@ class CompetitionContentspdfpeopledata extends Component { } } -const CompetitionContentspdfpeopledatas = Form.create({name: 'CompetitionContentspdfpeopledata'})(CompetitionContentspdfpeopledata); - -export default CompetitionContentspdfpeopledatas; +export default CompetitionContentspdfpeopledata; diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js new file mode 100644 index 000000000..1ac61bd3f --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Mailboxvalidation.js @@ -0,0 +1,270 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' + +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class Mailboxvalidation extends Component { + constructor(props) { + super(props) + this.state = { + basicInfo: {}, + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1 + } + } + + componentDidMount() { + window.document.title = '竞赛'; + console.log("3获取用户信息"); + console.log(this.props); + } + + + // 绑定邮箱 + onEmailSubmit = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let {login} = this.props.current_user; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(values.email)) { + let url = `/users/accounts/${login}/email_bind.json` + axios.post((url), { + email: values.email, + code: values.emailValidateCode + }).then((result) => { + if (result) { + this.props.showNotification("邮箱地址绑定成功!"); + this.hideUpdating(2); + this.props.getdata(); + } + }).catch((error) => { + console.log(error); + }) + } else { + this.props.showNotification("请输入正确的邮箱地址"); + } + } + }) + } + //取消编辑 + hideUpdating = (i) => { + if (i === 1) { + this.props.hideUpdating(1); + } else if (i === 2) { + this.props.hideUpdating(2); + + + } else if (i === 3) { + + } + + } + + // 获取验证码 + getCode = (index) => { + let url = `/accounts/get_verification_code.json` + let login = ''; + let values = this.props.form.getFieldsValue(); + if (index == 3) { + //绑定手机号码 + login = values.phone; + let reg = /^1\d{10}$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的手机号码`); + return; + } + } else if (index == 4) { + // 绑定邮箱 + login = values.email; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的邮箱地址`); + return; + } + } + let type = index; + if (!login) { + this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`); + return; + } + axios.get((url), { + params: { + login, type + } + }).then((result) => { + if (result) { + // 倒计时 + this.setState({ + secondsFlag: true + }) + this.remainTime(); + } + }).catch((error) => { + console.log(error); + }) + } + + // 获取验证码倒计时 + remainTime = () => { + this.setState({ + seconds: 60 + }) + this.timer = setInterval(() => { + let {seconds} = this.state; + let s = parseInt(seconds) - 1; + if (s > -1) { + this.setState({ + seconds: s + }) + } else { + this.setState({ + secondsFlag: false + }) + clearInterval(this.timer); + } + }, 1000) + } + + phonebools = () => { + this.setState({ + phonebool: true + }) + } + + emailbools = () => { + console.log("点击了邮箱"); + this.setState({ + emailbool: true + }) + } + + + render() { + const {getFieldDecorator} = this.props.form; + const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + console.log(emailbool); + return ( +
+ +
+ +
+ + {getFieldDecorator('email', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: basicInfo && basicInfo.mail ? '请输入要更换的新邮箱地址' : '请输入邮箱地址', + }], + })( + + )} + + + + {getFieldDecorator('emailValidateCode', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入邮箱收到的验证码', + }], + })( + + )} + + + +
+ + +
+
+
+
+
+ ) + } +} + +const Mailboxvalidations = Form.create({name: 'Mailboxvalidation'})(Mailboxvalidation); + +export default Mailboxvalidations; + diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js new file mode 100644 index 000000000..c14030e46 --- /dev/null +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Phonenumberverification.js @@ -0,0 +1,262 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import mycompetotionchild from './mycompetotionchild.css'; +import {getHiddenName} from "../../../../user/account/AccountBasicEdit"; +import '../../../../courses/css/Courses.css' +import RealNameCertificationModal from "../../../../user/modal/RealNameCertificationModal"; + +export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"} + +class Phonenumberverification extends Component { + constructor(props) { + super(props) + this.state = { + updating: '', + secondsFlag: false, + seconds: 60, + phonebool: false, + emailbool: false, + formationdata: [], + bank_account_editable: false, + leader: false, + bank_account: undefined, + certification: 1 + } + } + + componentDidMount() { + window.document.title = '竞赛'; + console.log("获取用户信息"); + console.log(this.props); + } + + + // 绑定手机 + onPhoneSubmit = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let {login} = this.props.current_user; + let reg = /^1\d{10}$/; + if (reg.test(values.phone)) { + let url = `/users/accounts/${login}/phone_bind.json` + axios.post((url), { + phone: values.phone, + code: values.phoneValidateCode + }).then((result) => { + if (result) { + this.props.showNotification("手机号码绑定成功!"); + this.props.hideUpdating() + this.props.getdata(); + } + }).catch((error) => { + console.log(error); + }) + } else { + this.props.showNotification("请输入有效的11位手机号码"); + } + } + }) + } + //取消编辑 + hideUpdating = (i) => { + if (i === 1) { + this.props.hideUpdating(1); + } else if (i === 2) { + this.props.hideUpdating(2); + + } else if (i === 3) { + + } + + } + + // 获取验证码 + getCode = (index) => { + let url = `/accounts/get_verification_code.json` + let login = ''; + let values = this.props.form.getFieldsValue(); + if (index == 3) { + //绑定手机号码 + login = values.phone; + let reg = /^1\d{10}$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的手机号码`); + return; + } + } else if (index == 4) { + // 绑定邮箱 + login = values.email; + let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; + if (reg.test(login) == false) { + this.props.showNotification(`请先输入正确的邮箱地址`); + return; + } + } + let type = index; + if (!login) { + this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`); + return; + } + axios.get((url), { + params: { + login, type + } + }).then((result) => { + if (result) { + // 倒计时 + this.setState({ + secondsFlag: true + }) + this.remainTime(); + } + }).catch((error) => { + console.log(error); + }) + } + + // 获取验证码倒计时 + remainTime = () => { + this.setState({ + seconds: 60 + }) + this.timer = setInterval(() => { + let {seconds} = this.state; + let s = parseInt(seconds) - 1; + if (s > -1) { + this.setState({ + seconds: s + }) + } else { + this.setState({ + secondsFlag: false + }) + clearInterval(this.timer); + } + }, 1000) + } + + phonebools = () => { + this.setState({ + phonebool: true + }) + } + + + render() { + const {getFieldDecorator} = this.props.form; + const {updating, seconds, secondsFlag, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state + const {basicInfo} = this.props + console.log(emailbool); + return ( +
+ +
+ +
+ + {getFieldDecorator('phone', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: `请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`, + }], + })( + + )} + + + + {getFieldDecorator('phoneValidateCode', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入手机获取的验证码', + }], + })( + + )} + + + +
+ + +
+
+
+
+
+ ) + } +} + +const Phonenumberverifications = Form.create({name: 'Phonenumberverification'})(Phonenumberverification); + +export default Phonenumberverifications; + From ccb72936eb4d8307265e373c23cd81f920e4f37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 2 Nov 2019 16:31:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bankcardnumberverification.js | 30 ++++++++++++++++++- .../CompetitionContentspdfpeopledata.js | 4 ++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js index 174256373..3aa1ee742 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/Bankcardnumberverification.js @@ -32,6 +32,34 @@ class Bankcardnumberverification extends Component { console.log(this.props); } + yhBankstrue = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`; + axios.patch(url, { + bank: values.openingbank, + second_bank: values.subbranchs, + card_no: values.subbranch + }) + .then((result) => { + try { + if (result.data.status == 0) { + // console.log(JSON.stringify(result)); + this.props.showNotification(`提交成功成功`); + this.props.getdata(); + this.props.GetawardinformationAPI(); + } + } catch (e) { + + } + + }).catch((error) => { + console.log(error); + }) + } + }) + + } render() { const {getFieldDecorator} = this.props.form; @@ -158,7 +186,7 @@ class Bankcardnumberverification extends Component {

{/*
this.yhBanksfalse()}>

取消

*/} - +
diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index 9cc4cd19e..fbdf3e28a 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -481,7 +481,9 @@ class CompetitionContentspdfpeopledata extends Component { bank_account_editable === true ? this.hideUpdating(i)} - getdata={() => this.getdata()}> + getdata={() => this.getdata()} + GetawardinformationAPI={() => this.GetawardinformationAPI()} + > :