12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { GameViewType } from "../main/ViewManage";
- import ViewObject from "../main/ViewObject";
- import { HttpStateType, ReveData } from "../util/CHttp";
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class Login extends ViewObject {
- @property(cc.EditBox)
- mUserName: cc.EditBox = null;
- @property(cc.EditBox)
- mPassWord: cc.EditBox = null;
-
- public onclickLogin(){
- let http = this.main.loginHttp;
- let msg = {
- 'userName':this.mUserName.string,
- 'passWord':this.mPassWord.string
- }
- this.main.startLoad();
- http.sendForm('/login',msg,(state,reve:ReveData)=>{
- this.main.stopLoad();
- if(state == HttpStateType.SUCCESS){
- if(reve.retCode == 0){
- this.main.userData = reve.data;
- this.openArea();
- }else{
- this.main.showTips(reve.message);
- }
- }else{
- this.main.showTips('网络异常');
- }
- })
- }
- /**
- * 打开选区界面
- */
- public openArea(){
- //载入测试的登陆界面
- this.main.viewManage.loadFunc(GameViewType.area,(viewObject:ViewObject)=>{
- viewObject.show(this);
- });
- }
- public onclickTest(){
- this.main.userData = {
- id:2,
- token:'edbeb6d9b01bfd41eff12efb7def330f',
- zone:null,
- };
- this.openArea();
- }
- }
|