LoginPanel.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. cc.Class({
  2. editor: {
  3. menu: 'Login/LoginPanel'
  4. },
  5. extends: cc.Component,
  6. properties: {
  7. gotoLogin: {
  8. default: undefined,
  9. type: cc.Button,
  10. },
  11. gotoRegister: {
  12. default: undefined,
  13. type: cc.Button,
  14. },
  15. getCode: {
  16. default: undefined,
  17. type: cc.Button,
  18. },
  19. phoneEditor: {
  20. default: undefined,
  21. type: cc.EditBox,
  22. },
  23. codeEditor: {
  24. default: undefined,
  25. type: cc.EditBox,
  26. },
  27. passwordEditor: {
  28. default: undefined,
  29. type: cc.EditBox,
  30. },
  31. },
  32. onLoad () {
  33. },
  34. reloadData (cb) {
  35. this._cb = cb;
  36. },
  37. gotoLoginOnClicked () {
  38. var phoneNum = this.phoneEditor.string;
  39. if (phoneNum.length == 0 && !G.FuncUtils.isMobile(phoneNum)) {
  40. G.AppUtils.getSceneCtrl().addToast("手机号码格式不正确");
  41. return;
  42. }
  43. var password = this.passwordEditor.string;
  44. if (password.length == 0) {
  45. G.AppUtils.getSceneCtrl().addToast("密码不能不填");
  46. return;
  47. }
  48. if (password.length > 16) {
  49. G.AppUtils.getSceneCtrl().addToast("密码过长");
  50. return;
  51. }
  52. G.LoginMgr.requestLoginByPhone(phoneNum, password);
  53. },
  54. gotoRegisterOnClicked () {
  55. if (this._cb) {
  56. this._cb();
  57. }
  58. },
  59. getCodeOnClicked () {
  60. }
  61. });