ClubPartnerPre.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. InitPre: function () {
  6. if (this.m_UserCtrl == null) this.m_UserCtrl = this.$('@UserCtrl');
  7. this.m_UserCtrl.SetUserByID(0);
  8. this.$('YRevence@Label').string = '0%';
  9. this.$('Y&TDraw@Label').string = '0';
  10. this.$('Rate&TRevence@Label').string = '0';
  11. this.$('T&YRevence@Label').string = '0';
  12. this.$('YWinner@Label').string = '0';
  13. this.$('YScore@Label').string = '0';
  14. //this.$('ScoreZiMo@Label').string = '0';
  15. //删除
  16. this.m_NdDel = this.$('Layout/BtDel');
  17. if (this.m_NdDel) this.m_NdDel.active = false;
  18. //旗下普通玩家
  19. this.m_NdInfo = this.$('Layout/BtInfo');
  20. if (this.m_NdInfo) this.m_NdInfo.active = false;
  21. //旗下
  22. this.m_NdLeadList = this.$('Layout/BtLeadList');
  23. if (this.m_NdLeadList) this.m_NdLeadList.active = false;
  24. this.m_MaxLv = CLUB_LEVEL_OWNER;
  25. this.m_MinLv = CLUB_LEVEL_MEMBER;
  26. this.node.active = false;
  27. this._bChangeRate = false;
  28. },
  29. SetPreInfo: function (ParaArr) {//idArr[i], ShowLv, FindID
  30. this.m_UserID = ParaArr[1][0][0];
  31. this.m_LeaderID = this.m_Hook.m_dwLeaderID;
  32. this.m_ClubID = this.m_Hook.m_SelClubInfo.dwClubID;
  33. this.m_ClubLv = this.m_Hook.m_SelClubInfo.cbClubLevel;
  34. this.m_UserLv = CLUB_LEVEL_MEMBER;
  35. var webUrl = window.PHP_HOME + '/League.php?&GetMark=61&dwUserID=' + this.m_UserID;
  36. webUrl += '&dwClubID=' + this.m_ClubID + '&dwLeaderID=' + this.m_LeaderID;
  37. WebCenter.GetData(webUrl, 1, function (data) {//GameID ClubLv Rate Score
  38. var InfoArr = JSON.parse(data);
  39. this.m_UserLv = InfoArr[1];
  40. //列表筛选等级
  41. if (InfoArr[1] == null || InfoArr[1] > this.m_MaxLv || InfoArr[1] < this.m_MinLv) return
  42. //筛选查找ID
  43. //if(ParaArr[2]!='' && (InfoArr[0]+'').indexOf(ParaArr[2])<0) return
  44. this.node.active = true;
  45. this.m_TagClubLv = InfoArr[1];
  46. if (this.m_UserCtrl) {
  47. this.m_UserCtrl.SetUserByID(this.m_UserID);
  48. }
  49. this.m_UserRate = InfoArr[2]
  50. // this.$('YRevence@Label').string = Score2Str(parseInt(InfoArr[6]));
  51. this.$('Y&TDraw@Label').string = parseInt(InfoArr[7]) + '\n' + parseInt(InfoArr[8]);
  52. this.$('Rate&TRevence@Label').string = InfoArr[2] + '%' //+ '\n' + Score2Str(parseInt(InfoArr[5]));
  53. //this.$('T&YRevence@Label').string = Score2Str(parseInt(InfoArr[4])) + '\n' + Score2Str(parseInt(InfoArr[3]));
  54. this.$('YWinner@Label').string = InfoArr[9];
  55. this.$('YScore@Label').string = Score2Str(parseInt(InfoArr[10]));
  56. //this.$('ScoreInfo@Label').string = Score2Str(parseInt(InfoArr[11])) + '\n' + Score2Str(parseInt(InfoArr[12]));
  57. if (this.m_UserID == ParaArr[1][1]) {
  58. this.m_NdInfo.active = true;
  59. } else {
  60. //解除关系 (部长名下普通成员无删除)
  61. if (this.m_NdDel) this.m_NdDel.active = (InfoArr[1] == CLUB_LEVEL_PARTNER);
  62. //旗下普通玩家
  63. if (this.m_NdInfo && InfoArr[1] > CLUB_LEVEL_MEMBER) this.m_NdInfo.active = true;
  64. //旗下
  65. if (this.m_NdLeadList && InfoArr[1] > CLUB_LEVEL_MEMBER) this.m_NdLeadList.active = true;
  66. }
  67. this._bChangeRate = InfoArr[1] >= CLUB_LEVEL_PARTNER;
  68. var webUrl3 = window.PHP_HOME + '/League.php?&GetMark=63&dwUserID=' + this.m_UserID;
  69. webUrl3 += '&dwClubID=' + this.m_ClubID+"&dwDay="+window.PartnerPage;
  70. WebCenter.GetData(webUrl3, 1, function (data) {//GameID ClubLv Rate Score
  71. var InfoArr = JSON.parse(data);
  72. this.$('YRevence@Label').string = "0"
  73. this.$('ScoreInfo@Label').string = "0"
  74. console.log("自摸算分---", InfoArr, this.m_UserRate, InfoArr[0][0] * this.m_UserRate * 0.01)
  75. if (InfoArr && InfoArr[0] && InfoArr[0][0]) {
  76. // console.log("自摸算分2",InfoArr[0][0])
  77. this.$('YRevence@Label').string = InfoArr[0][0]
  78. this.$('ScoreInfo@Label').string = "" + (InfoArr[0][0] * this.m_UserRate * 0.01).toFixed(2)
  79. }
  80. }.bind(this));
  81. }.bind(this));
  82. },
  83. //详情
  84. OnClick_ShowUserScore: function () {
  85. cc.gSoundRes.PlaySound('Button');
  86. this.m_Hook.OnShowMemberInfo(this.m_UserID, this.m_UserLv);
  87. },
  88. //调整比率
  89. OnClick_ChangeRate: function () {
  90. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  91. if (this.m_UserID == pGlobalUserData.dwUserID) return;
  92. if (this._bChangeRate == false) return;
  93. if (this.m_LeaderID != pGlobalUserData.dwUserID) return;
  94. cc.gSoundRes.PlaySound('Button');
  95. this.m_Hook.SetLeaderRate(this.m_UserID);
  96. },
  97. //旗下
  98. OnClick_ShowUserPartnerInfo: function () {
  99. cc.gSoundRes.PlaySound('Button');
  100. this.m_Hook.OnShowPartnerInfo(this.m_UserID, this.m_TagClubLv);
  101. },
  102. //旗下玩家
  103. OnClick_ShowUserPartnerList: function (_, data) {
  104. cc.gSoundRes.PlaySound('Button');
  105. this.m_Hook.OnShowPartnerList(data, this.m_UserID, this.m_UserCtrl.m_LabID.string);
  106. },
  107. //删除
  108. OnClick_BtDel: function () {
  109. cc.gSoundRes.PlaySound('Button');
  110. if (this.m_TagClubLv == 3) {
  111. this.m_Hook.ShowAlert('是否確認移除玩家? 確認後玩家將成為盟主成員', Alert_YesNo, function (Res) {
  112. if (Res) this.m_Hook.DelFromLeader(this.m_UserID);
  113. }.bind(this));
  114. } else {
  115. var webUrl = window.PHP_HOME + '/League.php?GetMark=103&dwUserID=' + this.m_UserID;
  116. webUrl += '&dwClubID=' + g_ShowClubInfo.dwClubID;
  117. webUrl += `&start=1`;
  118. webUrl += `&end=10`;
  119. webUrl += `&lvl=0`;
  120. WebCenter.GetData(webUrl, null, function (data) {
  121. var Res = JSON.parse(data);
  122. if (Res.length > 1) {
  123. g_Lobby.ShowTips("該玩家有下級玩家,不能删除!");
  124. } else {
  125. this.m_Hook.ShowAlert('是否確認將玩家降為普通成員?', Alert_YesNo, function (Res) {
  126. if (Res) {
  127. this.m_Hook.OnOpClubUserLv(this.m_UserID, CLUB_LEVEL_MEMBER);
  128. }
  129. }.bind(this))
  130. }
  131. }.bind(this));
  132. }
  133. },
  134. });