ClubGroup.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_AddGroup: cc.Node,
  5. m_Popui: cc.Node,
  6. m_Title: [cc.Node],
  7. m_EditBox: [cc.EditBox],
  8. },
  9. onLoad: function () {
  10. this.m_Popui.active = false;
  11. this.m_GroupList = new Array();
  12. },
  13. start: function () {
  14. },
  15. OnShowView: function () {
  16. },
  17. Refresh: function () {
  18. if (!this.m_ListCtrl) this.m_ListCtrl = this.node.getComponent('CustomListCtrl');
  19. this.m_ListCtrl.InitList(0, 'ClubGroupItem', this);
  20. this.m_AddGroup.zIndex = 1000;
  21. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  22. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=122&dwClubID=${this.m_Hook.m_SelClubInfo.dwClubID}&dwUserID=${pGlobalUserData.dwUserID}`;
  23. WebCenter.GetData(webUrl, 0, function (data) {
  24. var GroupList = JSON.parse(data);
  25. this.m_GroupList = new Array();
  26. for (var i = 0; i < GroupList.length; i++) {
  27. this.m_ListCtrl.InsertListInfo(0, {
  28. Index: i,
  29. Info: GroupList[i]
  30. });
  31. this.m_GroupList[i] = clone(GroupList[i]);
  32. }
  33. }.bind(this));
  34. },
  35. OnClicked_ClearEmptyGroup: function(){
  36. cc.gSoundRes.PlaySound('Button');
  37. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  38. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=130&dwClubID=${this.m_Hook.m_SelClubInfo.dwClubID}&dwUserID=${pGlobalUserData.dwUserID}`;
  39. WebCenter.GetData(webUrl, 0, function (data) {
  40. var Res = JSON.parse(data);
  41. if (Res.Res == 0) {
  42. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {
  43. this.Refresh();
  44. }.bind(this));
  45. } else {
  46. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {}.bind(this));
  47. }
  48. }.bind(this));
  49. },
  50. OnClicked_AddGroup: function () {
  51. cc.gSoundRes.PlaySound('Button');
  52. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  53. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=127&dwClubID=${this.m_Hook.m_SelClubInfo.dwClubID}&dwUserID=${pGlobalUserData.dwUserID}`;
  54. WebCenter.GetData(webUrl, 0, function (data) {
  55. var GroupInfo = JSON.parse(data);
  56. this.m_ListCtrl.InsertListInfo(0, {
  57. Index: this.m_GroupList.length,
  58. Info: GroupInfo
  59. });
  60. this.m_GroupList[this.m_GroupList.length] = clone(GroupInfo);
  61. }.bind(this));
  62. },
  63. OnClicked_PopuiHide: function () {
  64. cc.gSoundRes.PlaySound('Button');
  65. this.m_Popui.active = false;
  66. },
  67. OnClicked_PopuiSure: function () {
  68. cc.gSoundRes.PlaySound('Button');
  69. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  70. if (this.m_PopType == 0) { // 修改备注
  71. var str = this.m_EditBox[0].string;
  72. if (str.length == 0) return this.ShowTips('請輸入備註!');
  73. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=126&dwClubID=${this.m_PopInfo.ClubID}`;
  74. webUrl += `&dwGroupID=${this.m_PopInfo.GroupID}&dwUserID=${pGlobalUserData.dwUserID}&szRemark=${str}`
  75. WebCenter.GetData(webUrl, 0, function (data) {
  76. var Res = JSON.parse(data);
  77. if (Res.Res == 0) {
  78. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {
  79. if (this.m_PopCallback) this.m_PopCallback(str);
  80. }.bind(this));
  81. } else {
  82. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {}.bind(this));
  83. }
  84. }.bind(this));
  85. } else if (this.m_PopType == 1) { // 添加成员
  86. var str = this.m_EditBox[1].string;
  87. if (str.length == 0) return this.ShowTips('請輸入玩家ID!');
  88. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=124&dwClubID=${this.m_PopInfo.ClubID}`;
  89. webUrl += `&dwGroupID=${this.m_PopInfo.GroupID}&dwUserID=${pGlobalUserData.dwUserID}&dwTarID=${str}`
  90. WebCenter.GetData(webUrl, 0, function (data) {
  91. var Res = JSON.parse(data);
  92. if (Res.Res == 0) {
  93. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {
  94. if (this.m_PopCallback) this.m_PopCallback();
  95. }.bind(this));
  96. } else {
  97. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {}.bind(this));
  98. }
  99. }.bind(this));
  100. }
  101. this.m_Popui.active = false;
  102. },
  103. OnShowPopui: function (Info, Type, Callback) {
  104. this.m_PopInfo = Info;
  105. this.m_PopType = Type;
  106. this.m_PopCallback = Callback;
  107. for (var i in this.m_Title) {
  108. this.m_Title[i].active = i == Type;
  109. this.m_EditBox[i].node.active = i == Type;
  110. this.m_EditBox[i].string = '';
  111. }
  112. this.m_Popui.x = 0;
  113. this.m_Popui.y = 0;
  114. this.m_Popui.active = true;
  115. },
  116. OnDelMember: function (Info, TarID, Callback) {
  117. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  118. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=125&dwClubID=${Info.ClubID}`;
  119. webUrl += `&dwGroupID=${Info.GroupID}&dwUserID=${pGlobalUserData.dwUserID}&dwTarID=${TarID}`
  120. WebCenter.GetData(webUrl, 0, function (data) {
  121. var Res = JSON.parse(data);
  122. if (Res.Res == 0) {
  123. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {
  124. if (Callback) Callback();
  125. }.bind(this));
  126. } else {
  127. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {}.bind(this));
  128. }
  129. }.bind(this));
  130. },
  131. OnClearMember: function (Info, Callback) {
  132. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  133. var webUrl = `${window.PHP_HOME}/League.php?&GetMark=128&dwClubID=${Info.ClubID}`;
  134. webUrl += `&dwGroupID=${Info.GroupID}&dwUserID=${pGlobalUserData.dwUserID}`
  135. WebCenter.GetData(webUrl, 0, function (data) {
  136. var Res = JSON.parse(data);
  137. if (Res.Res == 0) {
  138. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {
  139. if (Callback) Callback();
  140. }.bind(this));
  141. } else {
  142. this.ShowAlert(Res.Describe, Alert_Yes, function (Res) {}.bind(this));
  143. }
  144. }.bind(this));
  145. }
  146. });