ClubAndroidList.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. ctor:function(){
  6. },
  7. onLoad:function(){
  8. },
  9. OnShowView:function(){
  10. if(this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
  11. window.gClubClientKernel.onSendGetAndroidCnt(this,g_ShowClubInfo.dwClubID);
  12. this.ShowPrefabDLG('FilterNode',this.node,function(Js){
  13. this._filter = Js;
  14. this._filter.SetMode(FILTER_MENU_PAGE,function(o){
  15. this._page = o.p;
  16. this.m_bNeedUpdate = true;
  17. }.bind(this),cc.Vec2(420,-280));
  18. }.bind(this));
  19. },
  20. update: function () {
  21. if (this.m_bNeedUpdate) {
  22. this.m_bNeedUpdate = false;
  23. } else {
  24. return;
  25. }
  26. this.m_ListCtrl.InitList(0, 'AndroidItem',this);
  27. var ClubID = g_ShowClubInfo.dwClubID;
  28. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  29. var webUrl = window.PHP_HOME+'/ClubAndroid.php?&GetMark=1&dwUserID='+pGlobalUserData.dwUserID;
  30. webUrl += '&dwClubID='+ClubID;
  31. webUrl += `&start=${(this._page - 1) * window.PAGE_ITEM_CNT + 1}`;
  32. webUrl += `&end=${(this._page) * window.PAGE_ITEM_CNT}`;
  33. WebCenter.GetData(webUrl, null, function (data) {
  34. if(data=='') return;
  35. var AndroidArr = JSON.parse(data);
  36. if (AndroidArr.length == 0) return;
  37. this._totalPage = Math.ceil(AndroidArr[0][3] / window.PAGE_ITEM_CNT);
  38. this._filter.SetPageTotalCnt(this._totalPage,this._page);
  39. this.m_ListCtrl.InsertListInfoArr(0,AndroidArr);
  40. }.bind(this));
  41. },
  42. OnBtCreatAndroid:function(){
  43. this.onShowClubInput(0,this);
  44. },
  45. onShowClubInput:function(type,hook){
  46. this.ShowPrefabDLG('ClubAndroidInput',null,function(Js){
  47. this._InputView = Js;
  48. Js.onSetType(type,hook);
  49. }.bind(this));
  50. },
  51. OnBtAndroidRecord:function(){
  52. this.ShowPrefabDLG('ClubAndroidRecord');
  53. },
  54. OnBtAndroidGroup:function(){
  55. this.ShowPrefabDLG('ClubAndroidGroupList');
  56. },
  57. onCreatAndroid:function(Cnt){
  58. window.gClubClientKernel.onSendCreatAndroid(this,g_ShowClubInfo.dwClubID,Cnt);
  59. },
  60. onSetAndroidScore:function(UserID,Score){
  61. //this.m_Hook.OnGiveScore(UserID,1,Score);
  62. if(Score>0){
  63. var QueryCG = new CMD_GP_C_ClubGive();
  64. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  65. QueryCG.dwUserID = pGlobalUserData.dwUserID;
  66. QueryCG.szPassWord = pGlobalUserData.szPassword;
  67. QueryCG.dwTagUserID = parseInt(UserID);
  68. QueryCG.lScore = parseInt(Score); //金额
  69. QueryCG.byType = parseInt(1); //种类
  70. QueryCG.dwClubID1 = g_ShowClubInfo.dwClubID;
  71. QueryCG.dwClubID2 = g_ShowClubInfo.dwClubID;
  72. QueryCG.szRemark = 1;
  73. window.gClubClientKernel.OnSendGiveScore(this,QueryCG);
  74. }else{
  75. var QueryCG = new CMD_GP_C_ClubGive();
  76. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  77. QueryCG.dwUserID = pGlobalUserData.dwUserID;
  78. QueryCG.szPassWord = pGlobalUserData.szPassword;
  79. QueryCG.dwTagUserID = parseInt(UserID);
  80. QueryCG.lScore = parseInt(-Score); //金额
  81. QueryCG.byType = parseInt(1); //种类
  82. QueryCG.dwClubID1 = g_ShowClubInfo.dwClubID;
  83. QueryCG.dwClubID2 = g_ShowClubInfo.dwClubID;
  84. window.gClubClientKernel.OnSendTakeScore(this,QueryCG);
  85. }
  86. },
  87. onCreatAndroidRes:function(code){
  88. if(code == 1){
  89. g_CurScene.ShowTips('創建失敗!');
  90. }else{
  91. g_CurScene.ShowTips('創建成功!');
  92. }
  93. if(code == 0) this.m_bNeedUpdate = true;
  94. if(this._InputView)this._InputView.node.active = false;
  95. },
  96. onDelAndroidRes:function(code){
  97. if(code == 1){
  98. g_CurScene.ShowTips('權限不足,無法刪除!');
  99. }else if(code == 2){
  100. g_CurScene.ShowTips('正在遊戲中,無法刪除!');
  101. }else if(code == 3){
  102. g_CurScene.ShowTips('資訊有誤,無法刪除!');
  103. }else{
  104. g_CurScene.ShowTips('刪除成功,積分已返還至積分池!');
  105. }
  106. if(code == 0) this.m_bNeedUpdate = true;
  107. },
  108. onAndroidCntInfo:function(CntInfo){
  109. this.$('BG/FreeCnt/LbFreeCnt@Label').string = CntInfo.wFreeCnt;
  110. this.$('BG/PlayCnt/LbPlayCnt@Label').string = CntInfo.wPlayCnt;
  111. },
  112. UpdateScore:function(){
  113. this.m_bNeedUpdate = true;
  114. if(this._InputView)this._InputView.node.active = false;
  115. },
  116. });