更新发送邮箱

This commit is contained in:
姜棚 2021-11-30 10:35:02 +08:00
parent 30cd74bea8
commit 440098d0e6
2 changed files with 63 additions and 15 deletions

View File

@ -27,8 +27,8 @@ export default class add extends React.Component{
email_list:[],
phone:"",
email:"",
email_radio:null,
phone_radio:null,
email_radio:-1,
phone_radio:-1,
audit_visible:false,
card_visible:false
}
@ -194,8 +194,8 @@ export default class add extends React.Component{
{
let plan_id = sessionStorage.getItem("plan_id")
let data ={
phone: this.state.phone_radio ? this.state.phone_list[this.state.phone_radio] : this.state.phone ,
email: this.state.email_radio ? this.state.email_list[this.state.email_radio] : this.state.email
phone: this.state.phone_radio > -1 ? this.state.phone_list[this.state.phone_radio] : this.state.phone ,
email: this.state.email_radio > -1 ? this.state.email_list[this.state.email_radio] : this.state.email
}
let phoneReg = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$");
@ -206,7 +206,13 @@ export default class add extends React.Component{
// phone: this.state.phone_radio ? this.state.phone_list[this.state.phone_radio] : this.state.phone ,
// email: this.state.email_radio ? this.state.email_list[this.state.email_radio] : this.state.email
// }
console.log("测试")
console.log(this.state.phone)
console.log(this.state.phone_list)
console.log(this.state.phone_radio)
console.log(this.state.phone_list[this.state.phone_radio] )
console.log(data.phone)
console.log(data.email)
if (!phoneReg.test(data.phone)) {
Notify.error("手机号格式不正确")
@ -391,10 +397,10 @@ export default class add extends React.Component{
</div>
</div>
<div className="input-group">
<Input placeholder="请输入接收手机号" onChange={this.phoneChange} disabled={this.state.phone_radio} ></Input>
<Input placeholder="请输入接收手机号" onChange={this.phoneChange} disabled={this.state.phone_radio > -1} ></Input>
</div>
<div className="input-group">
<Input placeholder="请输入接收邮箱" onChange={this.emailChange} disabled={this.state.email_radio} ></Input>
<Input placeholder="请输入接收邮箱" onChange={this.emailChange} disabled={this.state.email_radio > -1} ></Input>
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.onReturn(e)}}>取消</Button>

View File

@ -1,7 +1,7 @@
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import { Button ,Card,Icon ,Notify,Radio,RadioGroup,smoothScroll,Sweetalert} from 'zent';
import { Button ,Card,Icon ,Notify,Radio,RadioGroup,smoothScroll,Sweetalert,Input} from 'zent';
import "./edit.less"
import Step1 from "./step1.js"
import Step2 from "./step2.js"
@ -25,8 +25,10 @@ export default class add extends React.Component{
],
phone_list:[],
email_list:[],
phone:0,
email:0,
phone:"",
email:"",
email_radio:-1,
phone_radio:-1,
audit_visible:false,
card_visible:false,
step1_data:null,
@ -214,10 +216,11 @@ export default class add extends React.Component{
}
onPhoneChange(e){
this.setState({phone:e.target.value})
console.log("电话",e.target.value)
this.setState({phone_radio:e.target.value})
}
onEmailChange(e){
this.setState({email:e.target.value})
this.setState({email_radio:e.target.value})
}
cancel(e){
this.setState({audit_visible:false})
@ -239,11 +242,30 @@ export default class add extends React.Component{
send(e)
{
let plan_id = sessionStorage.getItem("plan_id")
console.log(this.state.phone_radio > -1)
let data ={
email: this.state.email_list[this.state.email] ,
phone:this.state.phone_list[this.state.phone] ,
phone: this.state.phone_radio > -1 ? this.state.phone_list[this.state.phone_radio] : this.state.phone ,
email: this.state.email_radio > -1 ? this.state.email_list[this.state.email_radio] : this.state.email
}
let phoneReg = new RegExp("^[1][3,4,5,6,7,8,9][0-9]{9}$");
let emailReg = new RegExp( "^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$");
if (!phoneReg.test(data.phone)) {
Notify.error("手机号格式不正确")
return;
}
if(!emailReg.test(data.email)){
Notify.error("邮箱格式不正确")
return;
}
planSend(plan_id,data).then((res)=>{
handelResponse(res,(req,msg)=>{
@ -267,7 +289,18 @@ export default class add extends React.Component{
}
phoneChange=(e)=>
{
this.setState({"phone":e.target.value})
}
emailChange=(e)=>
{
this.setState({"email":e.target.value})
}
@ -365,6 +398,8 @@ export default class add extends React.Component{
{
this.state.audit_visible ? (
<div>
<div className="modal"> </div>
<div className="audit-box" >
<Icon type="close" className="audit-close" onClick={(e)=>{this.cancel(e)}} />
<div className="audit-box-title">审核通过</div>
@ -411,11 +446,18 @@ export default class add extends React.Component{
</RadioGroup>
</div>
</div>
<div className="input-group">
<Input placeholder="请输入接收手机号" onChange={this.phoneChange} disabled={this.state.phone_radio > -1} ></Input>
</div>
<div className="input-group">
<Input placeholder="请输入接收邮箱" onChange={this.emailChange} disabled={this.state.email_radio > -1} ></Input>
</div>
<div className="audit-btn-group">
<Button onClick={(e)=>{this.onReturn(e)}}>取消</Button>
<Button type="primary" onClick={(e)=>{this.send(e)}} >发送</Button>
</div>
</div>
</div>
):null
}