ClubUserSet.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_LabGold:cc.Label,
  5. m_UserNode:cc.Node,
  6. m_BtSetLv8:cc.Node,
  7. m_BtDelLv8:cc.Node,
  8. //m_BtSetLv7:cc.Node,
  9. //m_BtDelLv7:cc.Node,
  10. m_BtLvDel:cc.Node,
  11. m_LbSelfScore:cc.Label,
  12. m_EdOpScore:cc.EditBox,
  13. m_NdBtGive:cc.Node,
  14. m_NdBtTake:cc.Node,
  15. },
  16. ctor:function () {
  17. this.m_UserArr = new Array();
  18. this.m_UserCnt = 0;
  19. },
  20. onLoad:function(){
  21. this.m_UserCtrl = this.m_UserNode.getComponent("UserCtrl");
  22. },
  23. OnShowClubUser:function(UserID, Lv, ClubID){
  24. this.m_UserID = UserID;
  25. this.m_UserCtrl.SetUserByID(UserID);
  26. this.m_UserLv = Lv;
  27. this.m_LabGold.string = 0;
  28. var SelfLv = this.m_Hook.m_SelClubInfo.ClubLevel;
  29. //管理员权限
  30. this.m_BtSetLv8.active = SelfLv >= 9 && Lv < 7;
  31. this.m_BtDelLv8.active = SelfLv >= 9 && Lv == 8;
  32. //合伙人权限
  33. //this.m_BtSetLv7.active = SelfLv >= 8 && Lv < 7;
  34. //this.m_BtDelLv7.active = SelfLv >= 8 && Lv == 7;
  35. //移出俱乐部
  36. this.m_BtLvDel.active = SelfLv >= 8 && Lv<SelfLv;
  37. //下分
  38. this.m_NdBtTake.active = SelfLv >= 7;
  39. this.m_EdOpScore.string = '0';
  40. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  41. var webUrl = window.PHP_HOME+'/League.php?&GetMark=27&dwUserID='+UserID;
  42. webUrl += '&dwUserID2='+pGlobalUserData.dwUserID+'&dwClubID='+ClubID
  43. WebCenter.GetData(webUrl, null, function (data) {
  44. var res = JSON.parse(data);
  45. if(res.dwUserID == null || res.dwUserID != this.m_UserID) return
  46. this.m_LabGold.string = res.Gold;
  47. this.m_LbSelfScore.string = res.Gold1;
  48. }.bind(this));
  49. },
  50. OnBtSetLv0:function(){
  51. this.m_Hook.OnOpClubUserLv(this.m_UserID,0,OPERATE_CODE_SET);
  52. this.HideView();
  53. },
  54. OnBtSetLv8:function(){
  55. this.m_Hook.OnOpClubUserLv(this.m_UserID,8,OPERATE_CODE_SET);
  56. this.HideView();
  57. },
  58. OnBtSetLv7:function(){
  59. this.m_Hook.OnOpClubUserLv(this.m_UserID,7,OPERATE_CODE_SET);
  60. this.HideView();
  61. },
  62. OnBtSetLv3:function(){
  63. this.m_Hook.OnOpClubUserLv(this.m_UserID,3,OPERATE_CODE_SET);
  64. this.HideView();
  65. },
  66. OnBtSetLvUp:function(){
  67. this.m_Hook.OnOpClubUserLv(this.m_UserID,this.m_UserLv+1,OPERATE_CODE_SET);
  68. this.HideView();
  69. },
  70. OnBtSetLvDown:function(){
  71. if(this.m_UserLv <= 3){
  72. this.m_Hook.ShowAlert('該用戶為普通成員,無法再降級!');
  73. }else{
  74. this.m_Hook.OnOpClubUserLv(this.m_UserID,this.m_UserLv-1,OPERATE_CODE_SET);
  75. }
  76. this.HideView();
  77. },
  78. OnClickGive:function(){//0金币 1积分
  79. //ClubGive
  80. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  81. //if(pGlobalUserData.dwUserID == this.m_UserID) return this.m_Hook.ShowTips('不要闹!');
  82. var Score = parseInt(this.m_EdOpScore.string);
  83. if(Score>0) {
  84. this.m_Hook.OnGiveScore(this.m_UserID, 1, Score);
  85. this.HideView();
  86. }else{
  87. return this.m_Hook.ShowTips('金額輸入錯誤!');
  88. }
  89. },
  90. OnClickTake:function(){//0金币 1积分
  91. //ClubGive
  92. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  93. //if(pGlobalUserData.dwUserID == this.m_UserID) return this.m_Hook.ShowTips('不要闹!');
  94. var Score = parseInt(this.m_EdOpScore.string);
  95. if(Score>0) {
  96. this.m_Hook.OnTakeScore(this.m_UserID, 1, Score);
  97. this.HideView();
  98. }else{
  99. return this.m_Hook.ShowTips('输入金额错误!');
  100. }
  101. },
  102. });