let global = require("Global");
cc.Class({
    extends: cc.Component,

    properties: {
        nextPanel:cc.Node,
        phoneNum:cc.Label,
        code:cc.Label,
    },
    onLoad () {
        this.receiveCode = '';
    },
    onClose () {
        this.node.destroy();
        this.node.parent.destroy();
    },
    onGotoLogin()
    {
        this.node.destroy();
    },
    onNext()
    {
        if(this.phoneNum.string.length!=11)
        {
            global.alert('您输入的电话号码不对',this);
            return;
        }
        let code = this.code.string;
        if(code=!this.receiveCode)
        {
            global.alert('验证码不正确',this);
            return;
        }

        this.onGotoLogin();
    },
    onSendCode()
    {
        if(this.phoneNum.string.length!=11)
        {
            global.alert('您输入的电话号码不对',this);
            return;
        }
        this.receiveCode = '9527';
    },
    activeNext()
    {
        this.nextPanel.active = true;
    },
});
