ClubGroupItem.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {},
  4. onLoad: function () {
  5. },
  6. start: function () {
  7. },
  8. InitPre: function () {
  9. this.node.active = false;
  10. if (!this.m_UserCtrl) {
  11. this.m_UserCtrl = new Array();
  12. this.m_BtAddUser = new Array();
  13. for (var i = 0; i < 9; ++i) {
  14. this.m_UserCtrl[i] = this.$(`UserNode/${i}/User@UserCtrl`);
  15. this.m_UserCtrl[i].m_Hook = this;
  16. this.m_BtAddUser[i] = this.$(`UserNode/${i}/BtAdd@Button`);
  17. }
  18. this.m_LabRemark = this.$('bg/LabRemark@Label');
  19. }
  20. },
  21. SetPreInfo: function (Param) {
  22. this.node.active = true;
  23. this.m_Index = Param.Index;
  24. this.m_Info = Param.Info;
  25. this.Refresh(this.m_Info.Remark);
  26. },
  27. Refresh: function (Remark) {
  28. for (var i = 0; i < 9; ++i) {
  29. this.m_UserCtrl[i].node.active = false;
  30. this.m_BtAddUser[i].node.active = false;
  31. }
  32. this.m_LabRemark.string = '';
  33. if (this.m_LabRemark) this.m_LabRemark.string = Remark ? Remark : this.m_Info.Remark;
  34. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  35. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=123&dwClubID=${this.m_Info.ClubID}&dwUserID=${pGlobalUserData.dwUserID}&dwGroupID=${this.m_Info.GroupID}`;
  36. console.log("url:",webUrl);
  37. WebCenter.GetData(webUrl, 0, function (data) {
  38. var GroupMember = JSON.parse(data);
  39. for (var i = 0; i < GroupMember.length; i++) {
  40. this.m_UserCtrl[i].node.active = true;
  41. this.m_UserCtrl[i].SetUserByID(GroupMember[i].UserID);
  42. }
  43. this.UpdateView_AddButton();
  44. }.bind(this));
  45. },
  46. UpdateView_AddButton: function () {
  47. for (var i in this.m_UserCtrl) {
  48. this.m_BtAddUser[i].node.active = !this.m_UserCtrl[i].node.active;
  49. }
  50. },
  51. OnClicked_Remark: function () {
  52. cc.gSoundRes.PlaySound('Button');
  53. if (this.m_Hook && this.m_Hook.OnShowPopui) this.m_Hook.OnShowPopui(this.m_Info, 0, function (Remark) {
  54. this.Refresh(Remark)
  55. }.bind(this));
  56. },
  57. OnClicked_AddMember: function () {
  58. cc.gSoundRes.PlaySound('Button');
  59. if (this.m_Hook && this.m_Hook.OnShowPopui) this.m_Hook.OnShowPopui(this.m_Info, 1, function () {
  60. this.Refresh()
  61. }.bind(this));
  62. },
  63. OnUserCtrlCallback_Kick: function (UserCtrl) {
  64. if (!UserCtrl) return;
  65. if (this.m_Hook && this.m_Hook.OnDelMember) this.m_Hook.OnDelMember(this.m_Info, UserCtrl.GetUserID(), function () {
  66. this.Refresh()
  67. }.bind(this));
  68. },
  69. OnClicked_Clear: function () {
  70. cc.gSoundRes.PlaySound('Button');
  71. if (this.m_Hook && this.m_Hook.OnClearMember) this.m_Hook.OnClearMember(this.m_Info, function () {
  72. this.Refresh();
  73. }.bind(this));
  74. },
  75. // update (dt) {},
  76. });