diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js index 85fc4bee..fe222c66 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js @@ -14,7 +14,9 @@ class PackageIndexNEIBannerConcent extends Component { super(props) this.contentMdRef = React.createRef(); this.state = { - modalCancel:false + modalCancel:false, + getverificationcodes:true, + seconds:35, } } @@ -22,7 +24,76 @@ class PackageIndexNEIBannerConcent extends Component { } + //获取验证码; + getverificationcode =()=>{ + // if (this.state.logins&&this.state.logins.length === 0) { + // // 判断没有输入手机号 + // return + // } + if(this.state.getverificationcodes === undefined){ + console.log("undefined"); + return; + } + if (this.state.getverificationcodes === true) { + this.setState({ + getverificationcodes: undefined, + }) + let timer = setInterval(() => { + this.setState((preState) => ({ + seconds: preState.seconds - 1, + }), () => { + if (this.state.seconds == 0) { + clearInterval(timer); + this.setState({ + getverificationcodes: false, + seconds: 35, + }) + } + }); + }, 1000) + //其他的网络请求也可以 + this.SMSverification(); + } else { + this.setState({ + getverificationcodes: undefined, + }) + let timer = setInterval(() => { + this.setState((preState) => ({ + seconds: preState.seconds - 1, + }), () => { + if (this.state.seconds == 0) { + clearInterval(timer); + this.setState({ + getverificationcodes: false, + seconds: 35, + }) + } + }); + }, 1000) + //其他的网络请求也可以 + this.SMSverification(); + } + } + //短信验证 + SMSverification = () => { + // var url = `/accounts/get_verification_code.json`; + // axios.get((url), { + // params: { + // login: this.state.logins, + // type: 1, + // } + // }).then((result) => { + // //验证有问题{"status":1,"message":"success"} + // // console.log(result); + // this.openNotification("验证码已发送,请注意查收!",2); + // + // + // }).catch((error) => { + // console.log(error); + // + // }) + } setclick=()=>{ const mdContnet = this.contentMdRef.current.getValue().trim(); console.log(mdContnet) @@ -52,7 +123,7 @@ class PackageIndexNEIBannerConcent extends Component { render() { - let {modalCancel}=this.state; + let {modalCancel,seconds,getverificationcodes}=this.state; return (
获取验证码} + enterButton={ + getverificationcodes === undefined ? 重新发送 ({seconds}s): getverificationcodes === true ?获取验证码 :重新发送} + onSearch={()=>this.getverificationcode()} /> diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PhoneModel.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PhoneModel.js index b51a7f2d..99d63e7c 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PhoneModel.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PhoneModel.js @@ -1,14 +1,86 @@ import React, { Component } from 'react'; import { Spin, Icon , Modal,Input,Button} from 'antd'; class PhoneModel extends Component { + //getverificationcodes 是否是重新发送或者是获取验证码 + //多少秒 constructor(props) { super(props); this.state = { funmodalsType:false, - istype:false + istype:false, + getverificationcodes:true, + seconds:35, } } + //获取验证码 + getverificationcode =()=>{ + // if (this.state.logins&&this.state.logins.length === 0) { + // 判断没有输入手机号 + // return + // } + + if (this.state.getverificationcodes === true) { + this.setState({ + getverificationcodes: undefined, + }) + let timer = setInterval(() => { + this.setState((preState) => ({ + seconds: preState.seconds - 1, + }), () => { + if (this.state.seconds == 0) { + clearInterval(timer); + this.setState({ + getverificationcodes: false, + seconds: 35, + }) + } + }); + }, 1000) + //其他的网络请求也可以 + this.SMSverification(); + } else { + this.setState({ + getverificationcodes: undefined, + }) + let timer = setInterval(() => { + this.setState((preState) => ({ + seconds: preState.seconds - 1, + }), () => { + if (this.state.seconds == 0) { + clearInterval(timer); + this.setState({ + getverificationcodes: false, + seconds: 35, + + }) + } + }); + }, 1000) + //其他的网络请求也可以 + this.SMSverification(); + } + } + //短信验证 + SMSverification = () => { + // var url = `/accounts/get_verification_code.json`; + // axios.get((url), { + // params: { + // login: this.state.logins, + // type: 1, + // } + // }).then((result) => { + // //验证有问题{"status":1,"message":"success"} + // // console.log(result); + // this.openNotification("验证码已发送,请注意查收!",2); + // + // + // }).catch((error) => { + // console.log(error); + // + // }) + } render() { + let{getverificationcodes,seconds} =this.state; const antIcons = return( - + { + getverificationcodes === undefined ? + + : getverificationcodes === true ? + + : + + + } {/**/}