提交 2a2410a2 authored 作者: 何守志's avatar 何守志

heshouzhi倒计时

上级 bbe5ca9c
...@@ -33,6 +33,7 @@ export default { ...@@ -33,6 +33,7 @@ export default {
YanZhengMa:null, YanZhengMa:null,
errormsg: null, errormsg: null,
showToptips: false, showToptips: false,
MyTimes:null
}, },
subscriptions: { subscriptions: {
...@@ -71,6 +72,9 @@ export default { ...@@ -71,6 +72,9 @@ export default {
}, },
setYanZhengMa(state,{payload}){ setYanZhengMa(state,{payload}){
return {...state,YanZhengMa:payload.YanZhengMa}; return {...state,YanZhengMa:payload.YanZhengMa};
},
setTime(state,{payload}){
return {...state,MyTimes:payload.MyTimes}
} }
}, },
......
...@@ -21,7 +21,6 @@ function RouterConfig({ history, app }) { ...@@ -21,7 +21,6 @@ function RouterConfig({ history, app }) {
return ( return (
<Router history={history}> <Router history={history}>
<Switch> <Switch>
<IndexRoute component={HomePage}/>
<Route path="/" exact component={MiddleSelectPage} /> <Route path="/" exact component={MiddleSelectPage} />
<Route path="/Home" component={HomePage} /> <Route path="/Home" component={HomePage} />
<Route path="/Login" component={IndexPage} /> <Route path="/Login" component={IndexPage} />
......
...@@ -15,7 +15,7 @@ class HomePage extends React.Component{ ...@@ -15,7 +15,7 @@ class HomePage extends React.Component{
componentWillMount() { componentWillMount() {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ type: 'home/getSummaryData',payload: { pNumber:'浦东新区' }}); dispatch({ type: 'home/getSummaryData',payload: { pNumber:'浦东新区' }});
// dispatch({ type: 'home/getSummary',payload: { pNumber:'浦东新区' }}); dispatch({ type: 'home/getSummary',payload: { pNumber:'浦东新区' }});
} }
onChange=(value)=>{ onChange=(value)=>{
console.info("改变了"); console.info("改变了");
......
...@@ -21,7 +21,13 @@ import { ...@@ -21,7 +21,13 @@ import {
import 'weui'; import 'weui';
import 'react-weui/build/packages/react-weui.css'; import 'react-weui/build/packages/react-weui.css';
import styles from './IndexPage.css'; import styles from './IndexPage.css';
class IndexPage extends React.Component{ class IndexPage extends React.Component{
constructor(props) {
super(props);
this.ti = this.ti.bind(this);
}
//手机号判断 //手机号判断
telCheck=(event)=>{ telCheck=(event)=>{
const tel=event.target.value; const tel=event.target.value;
...@@ -44,18 +50,38 @@ class IndexPage extends React.Component{ ...@@ -44,18 +50,38 @@ class IndexPage extends React.Component{
this.props.dispatch({ type: 'login/setYanZhengMa', payload: { YanZhengMa:tel } }); this.props.dispatch({ type: 'login/setYanZhengMa', payload: { YanZhengMa:tel } });
} }
}; };
//一秒减一
ti = function(number){
let t = setInterval(function () {
number--;
if(number<1){
clearInterval(t);
}
this.props.dispatch({type:'login/setTime',payload:{MyTimes:number}});
}.bind(this),1000);
}
//发送验证码 //发送验证码
sendCheckNum = () => { sendCheckNum = () => {
this.ti(10);
// 1.检验改手机号是否存在系统中,如果不存在,无法注册 // 1.检验改手机号是否存在系统中,如果不存在,无法注册
this.props.dispatch({type:'login/checkNumber',payload:{}}) this.props.dispatch({type:'login/checkNumber',payload:{}})
}; };
// 注册 // 注册
registerClick=()=>{ registerClick=()=>{
this.props.dispatch({ type: 'login/checkYanZhengMa', payload: {} }); this.props.dispatch({ type: 'login/checkYanZhengMa', payload: {} });
}; };
render(){ render(){
let time = this.props.login.MyTimes;
let button = (<CellFooter>
<Button type="vcode" onClick={this.sendCheckNum} style={{height:"25px",lineHeight:"25px"}}>发送</Button>
</CellFooter>);
if(time>0 && time<10){
button = (<CellFooter>
<Button type="vcode" style={{height:"25px",lineHeight:"25px"}}>{time}</Button>
</CellFooter>);
}
return ( return (
<Page className={styles.bodyBackground}> <Page className={styles.bodyBackground}>
<h1 className={styles.myTitle}>上海征地房屋补偿</h1> <h1 className={styles.myTitle}>上海征地房屋补偿</h1>
<Form className={styles.formWrapStyle}> <Form className={styles.formWrapStyle}>
...@@ -75,9 +101,7 @@ class IndexPage extends React.Component{ ...@@ -75,9 +101,7 @@ class IndexPage extends React.Component{
<CellBody> <CellBody>
<Input type="tel" placeholder="验证码" onBlur={(event)=>this.telYanZhengMa(event)} style={{color:"#fff"}}/> <Input type="tel" placeholder="验证码" onBlur={(event)=>this.telYanZhengMa(event)} style={{color:"#fff"}}/>
</CellBody> </CellBody>
<CellFooter> {button}
<Button type="vcode" onClick={this.sendCheckNum} style={{height:"25px",lineHeight:"25px"}}>发送</Button>
</CellFooter>
</FormCell> </FormCell>
</Form> </Form>
<ButtonArea className={styles.buttonWrapStyle}> <ButtonArea className={styles.buttonWrapStyle}>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论