ClubUserPre.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. InitPre:function(){
  6. if(this.m_UserCtrl == null){
  7. this.m_UserCtrl = this.$('@UserCtrl');
  8. this.m_LbIndex = this.$('LbRank@Label');
  9. this.m_LbScore = this.$('Score@Label');
  10. this.m_LbLv1 = this.$('level1');
  11. this.m_LbLv2 = this.$('level2');
  12. this.m_LbLv3 = this.$('level3');
  13. this.m_LbLv4 = this.$('level4');
  14. this.m_BtKickOut = this.$('BtKickOut');
  15. this.m_State = this.$('State@Label');
  16. this.m_LbLeaderID = this.$('LeaderID@Label');
  17. }
  18. },
  19. SetPreInfo:function(Info){
  20. //this.SetUserInfo(Info[0],Info[1],Info[2],Info[3],Info[4]);
  21. this.m_Hook = Info[1];
  22. if(Info[0] == 0){
  23. this.ShowUserList(Info[2]);
  24. }else if(Info[0] == 1){
  25. this.ShowApplyInfor(Info[2])
  26. }else{
  27. this.ShowAdminInfor(Info[2])
  28. }
  29. },
  30. ShowUserList:function(Arr){
  31. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  32. this.m_UserID = Arr[0];
  33. this.m_UserCtrl.SetUserByID(Arr[0]);
  34. this.m_LbLeaderID.string = Arr[1]== null? 0:Arr[1];
  35. this.m_Level = Arr[3];
  36. var str = '';
  37. if(Arr[10]==-1){
  38. str = Arr[2].replace(/ /,'\n');
  39. }else{
  40. str = Arr[10]>=US_SIT?'遊戲中':'線上';
  41. }
  42. this.m_State.string = str;
  43. if(Arr[3] == CLUB_LEVEL_OWNER){
  44. this.m_LbLv1.active = true;
  45. this.m_LbLv2.active = false;
  46. this.m_LbLv3.active = false;
  47. this.m_LbLv4.active = false;
  48. }else if(Arr[3]==CLUB_LEVEL_MANAGER){
  49. this.m_LbLv1.active = false;
  50. this.m_LbLv2.active = false;
  51. this.m_LbLv3.active = true;
  52. this.m_LbLv4.active = false;
  53. }else if(Arr[3]==CLUB_LEVEL_PARTNER){
  54. this.m_LbLv1.active = false;
  55. this.m_LbLv2.active = true;
  56. this.m_LbLv3.active = false;
  57. this.m_LbLv4.active = false;
  58. }else{
  59. this.m_LbLv1.active = false;
  60. this.m_LbLv2.active = false;
  61. this.m_LbLv3.active = false;
  62. this.m_LbLv4.active = true;
  63. }
  64. //this.m_LbLv.string = Arr[3]==CLUB_LEVEL_OWNER ?'老板':(Arr[3]==CLUB_LEVEL_MANAGER ?'管理员':(Arr[3]==CLUB_LEVEL_PARTNER ?'合伙人':"会员"));
  65. this.node.active = true;
  66. if(this.m_BtKickOut){
  67. this.m_BtKickOut.active = g_ShowClubInfo.cbClubLevel>=CLUB_LEVEL_MANAGER && g_ShowClubInfo.cbClubLevel > this.m_Level;
  68. }
  69. },
  70. ShowApplyInfor:function(userID){
  71. this.m_UserID = userID;
  72. this.m_UserCtrl.SetUserByID(userID);
  73. this.node.active = true;
  74. },
  75. ShowAdminInfor:function(userID){
  76. this.m_UserID = userID;
  77. this.m_UserCtrl.SetUserByID(userID);
  78. this.node.active = true;
  79. if(this.m_BtKickOut){
  80. this.m_BtKickOut.active = g_ShowClubInfo.cbClubLevel==CLUB_LEVEL_OWNER;
  81. }
  82. },
  83. SetUserInfo:function(UIndex, UserID, Level, Score , bShowFull){
  84. this.m_UserID = UserID;
  85. this.m_Level = Level;
  86. this.m_Score = Score;
  87. this.m_UserCtrl.SetUserByID(this.m_UserID);
  88. if(bShowFull == null) bShowFull = true;
  89. this.m_UserCtrl.SetShowFullID(bShowFull);
  90. if(this.m_LbIndex) this.m_LbIndex.string = parseInt(UIndex) + 1;
  91. if(this.m_LbScore) this.m_LbScore.string = Score;//'金币:'+
  92. //俱乐部权限等级
  93. // if(this.m_LbLv) {
  94. // this.m_LbLv.string = window.ClubLvStr[Level];
  95. // if(this.m_Level >= CLUB_LEVEL_OWNER) this.m_LbLv.node.color = cc.color(255, 98, 0);
  96. // else if(this.m_Level == CLUB_LEVEL_MANAGER) this.m_LbLv.node.color = cc.color(0, 168, 255);
  97. // else if(this.m_Level >= CLUB_LEVEL_PARTNER) this.m_LbLv.node.color = cc.color(35, 222, 30);
  98. // else this.m_LbLv.node.color = cc.color(170, 57, 40);
  99. // }
  100. if(this.m_BtKickOut){
  101. this.m_BtKickOut.active = g_ShowClubInfo.cbClubLevel>=CLUB_LEVEL_MANAGER && g_ShowClubInfo.cbClubLevel > this.m_Level;
  102. }
  103. },
  104. OnBtShowUserInfo:function(){
  105. this.m_Hook.ShowUserInfo(this.m_UserID,this.m_Level, this.m_Hook.m_ClubID)
  106. },
  107. OnClick_BtTakeAll:function(){
  108. this.m_Hook.OnTakeUserAllScore(this.m_UserID, this.m_Score);
  109. },
  110. OnClick_BtShowUserScoreInfo:function(Tag, View){
  111. this.m_Hook.ShowUserScoreInfo(this.m_UserID, View)
  112. },
  113. //检查信息
  114. CheckUser:function(){
  115. if ( g_GlobalUserInfo.m_UserInfoMap[this.m_UserID] == null ) {
  116. g_Lobby.ShowTips("用戶資訊异常!");
  117. return false;
  118. }
  119. if ( g_GlobalUserInfo.m_UserInfoMap[this.m_UserID] == 'Loading' ) {
  120. g_Lobby.ShowTips("用戶資訊加載中! 請稍候......");
  121. return false;
  122. }
  123. return true;
  124. },
  125. //俱乐部成员删除/拒绝加入
  126. OnBtDelUser:function(){
  127. if(!this.CheckUser()) return
  128. this.m_Hook.OnOpClubUserLv(this.m_UserID,CLUB_LEVEL_NONE);
  129. },
  130. //俱乐部成员 同意加入
  131. OnBtAgree:function(){
  132. if(!this.CheckUser()) return
  133. this.m_Hook.OnOpClubUserLv(this.m_UserID,CLUB_LEVEL_MEMBER);
  134. },
  135. //俱乐部成员 黑名单
  136. OnBtNotShow:function(){
  137. if(!this.CheckUser()) return
  138. this.m_Hook.OnOpClubUserLv(this.m_UserID,CLUB_LEVEL_BAN);
  139. },
  140. //俱乐部成员删除
  141. OnClick_DelUser:function(){
  142. if(!this.CheckUser()) return;
  143. //权限判断
  144. this.m_MeLevel = this.m_Hook.m_Hook.m_SelClubInfo.cbClubLevel;
  145. if(this.m_MeLevel<CLUB_LEVEL_MANAGER || this.m_Level>=this.m_MeLevel) return g_Lobby.ShowTips("权限不足!");
  146. var webUrl = window.PHP_HOME+ '/League.php?GetMark=103&dwUserID='+this.m_UserID;
  147. webUrl += '&dwClubID='+this.m_Hook.m_Hook.m_SelClubInfo.dwClubID;
  148. webUrl += `&start=1`;
  149. webUrl += `&end=10`;
  150. webUrl += `&lvl=0`;
  151. WebCenter.GetData(webUrl, null, function (data) {
  152. var Res = JSON.parse(data);
  153. if(Res.length>1){
  154. g_Lobby.ShowTips("該玩家有下級玩家,不能删除!");
  155. }else{
  156. this.m_Hook.ShowAlert('確認踢出該成員?',Alert_YesNo, function(Res) {
  157. if(Res) this.m_Hook.OnOpClubUserLv(this.m_UserID,CLUB_LEVEL_NONE);
  158. }.bind(this));
  159. }
  160. }.bind(this));
  161. },
  162. //显示详情
  163. OnBtDetails:function(){
  164. },
  165. OnBtDelAdminLv:function(){
  166. this.m_Hook.OnOpClubUserLv(this.m_UserID,CLUB_LEVEL_MEMBER);
  167. },
  168. });