12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- cc.Class({
- editor: {
- menu: 'Login/LoginPanel'
- },
- extends: cc.Component,
- properties: {
- gotoLogin: {
- default: undefined,
- type: cc.Button,
- },
- gotoRegister: {
- default: undefined,
- type: cc.Button,
- },
- getCode: {
- default: undefined,
- type: cc.Button,
- },
- phoneEditor: {
- default: undefined,
- type: cc.EditBox,
- },
- codeEditor: {
- default: undefined,
- type: cc.EditBox,
- },
- passwordEditor: {
- default: undefined,
- type: cc.EditBox,
- },
- },
- onLoad () {
- let phoneNum = cc.sys.localStorage.getItem("user_phone_num", "")
- let password = cc.sys.localStorage.getItem("user_password", "")
-
- this.phoneEditor.string = phoneNum;
- this.passwordEditor.string = password;
- },
- reloadData (cb) {
- this._cb = cb;
- },
- gotoLoginOnClicked () {
- var phoneNum = this.phoneEditor.string;
- if (phoneNum.length == 0 && !G.FuncUtils.isMobile(phoneNum)) {
- G.AppUtils.getSceneCtrl().addToast("手机号码格式不正确");
- return;
- }
- var password = this.passwordEditor.string;
- if (password.length == 0) {
- G.AppUtils.getSceneCtrl().addToast("密码不能不填");
- return;
- }
- if (password.length > 16) {
- G.AppUtils.getSceneCtrl().addToast("密码过长");
- return;
- }
- G.LogiMngr.requestLoginByPhone(phoneNum, password);
- cc.sys.localStorage.setItem("user_phone_num", phoneNum)
- cc.sys.localStorage.setItem("user_password", password)
- },
- gotoRegisterOnClicked () {
- if (this._cb) {
- this._cb();
- }
- },
- getCodeOnClicked () {
- }
- });
|