const SceneCtrlBase = require('SceneCtrlBase'); const JMLoadProgressBar = require('JMLoadProgressBar'); const JMNetImage = require('JMNetImage'); const LoginPanel = require('../view/login/LoginPanel'); const RegisterPanel = require('../view/login/RegisterPanel'); const TagType = { LOGIN: 0, REGISTER: 1 }; cc.Class({ extends: SceneCtrlBase, editor: { menu: 'Ctrl/LoginCtrl' }, properties: { loginPanel: { default: undefined, type: LoginPanel, }, registerPanel: { default: undefined, type: RegisterPanel, }, }, onLoad () { this._super(); this._tagType = TagType.LOGIN; // 进行授权、登录、注册等操作 this.initAuth(); this.initUI(); }, initAuth () { }, initUI () { this.showpanel(TagType.LOGIN); this.loginPanel.reloadData(()=> { this.showpanel(TagType.REGISTER); }); this.registerPanel.reloadData(()=> { this.showpanel(TagType.LOGIN); }); }, showpanel (tagType) { this._tagType = tagType; this.loginPanel.node.active = tagType == TagType.LOGIN; this.registerPanel.node.active = tagType == TagType.REGISTER; } });