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

    properties: {
        areaCode:cc.Node,
        gameStates:cc.Node,
        phoneNum:cc.Label,
        pwd:cc.Label,
        register: cc.Prefab,
        forgetPWD: cc.Prefab,
        areaCode: cc.Prefab,
        avatar:cc.Sprite,
        dcPoint:cc.Label,
        gcPoint:cc.Label,
        activity:cc.Label,
        logInAvatar:cc.SpriteFrame
    },
    init()
    {
        this.gStatScp = this.gameStates.getComponent('GameStates');
    },
    onClose () {
        this.node.destroy();
    },
    logIn()
    {
        if(this.phoneNum.string.length!=11)
        {
            global.alert('您输入的电话号码不对',this);
            return;
        }
        if(this.pwd.string.length<6)
        {
            global.alert('密码必须大于六位数',this);
            return;
        }
        this.avatar.spriteFrame = this.logInAvatar;
        this.dcPoint.string = '数字公民积分:100';
        this.gcPoint.string = '好市民积分:100';
        this.activity.string = '今日活跃度：10';
        this.gStatScp.bLogin = true;
        this.node.destroy();
    },
    activeCode()
    {
        this.areaCode.active = true;
    },
    goToAreaCode()
    {
        let tPrefab = cc.instantiate(this.areaCode);
        tPrefab.parent = this.node;
        tPrefab.setPosition(0,0);
    },
    goToRegister()
    {
        let tPrefab = cc.instantiate(this.register);
        tPrefab.parent = this.node;
        tPrefab.setPosition(0,0);
    },
    goToForgetPWD()
    {
        let tPrefab = cc.instantiate(this.forgetPWD);
        tPrefab.parent = this.node;
        tPrefab.setPosition(0,0);
    }
});
