ClubPartner.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. ctor:function(){
  6. this.m_bNeedUpdate = false;
  7. this._page = 1;
  8. this._totalPage = 1;
  9. this._searchID = 0;
  10. },
  11. onLoad:function(){
  12. this.$('BtBack').active = false;
  13. },
  14. OnShowSubData:function (type,UserID,GameID, ClubLv, DlgLv) {
  15. if(UserID){
  16. this.m_SelClubInfo = this.m_Hook.m_SelClubInfo;
  17. this.m_DlgLevel = DlgLv;
  18. this.m_dwClubID = this.m_SelClubInfo.dwClubID;
  19. this.m_dwLeaderID = UserID;
  20. this.m_dwLeaderGameID = GameID;
  21. this.m_ClubLv = ClubLv;
  22. this.$('EditBox@EditBox').string = '';
  23. this.m_Type = type;
  24. }
  25. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  26. //this.$('BtGet').active = ( this.m_dwLeaderID == pGlobalUserData.dwUserID);
  27. if(this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
  28. this.m_ListCtrl.InitList(0, 'ClubPartnerPre', this);
  29. //自己旗下合伙人
  30. this.$('LeaderID@Label').string = GameID;
  31. this.$('BtInvite').active = pGlobalUserData.dwGameID == GameID;
  32. this.$('BtSetLeader').active = pGlobalUserData.dwGameID != GameID;
  33. if(type == 0){
  34. cc.gPreLoader.LoadRes('Image_ClubPartner_T-xiashuhehuoren','Club',function (spriteFrame) {
  35. this.$('BGB/TBillList@Sprite').spriteFrame = spriteFrame;
  36. }.bind(this));
  37. this.$('ScrollView/view/content/ClubUserPre/YWinner').active = false;
  38. this.$('ScrollView/view/content/ClubUserPre/YScore').active = false;
  39. this.$('ScrollView/BGTitle2/t6').active = true;
  40. this.$('ScrollView/BGTitle2/t7').active = false;
  41. this.$('ScrollView/BGTitle2/t8').active = false;
  42. }
  43. else{
  44. this.$('ScrollView/view/content/ClubUserPre/Layout').active = false;
  45. this.$('ScrollView/view/content/ClubUserPre/YWinner').active = true;
  46. this.$('ScrollView/view/content/ClubUserPre/YScore').active = true;
  47. this.$('ScrollView/BGTitle2/t6').active = false;
  48. this.$('ScrollView/BGTitle2/t7').active = true;
  49. this.$('ScrollView/BGTitle2/t8').active = true;
  50. cc.gPreLoader.LoadRes('Image_ClubPartner_T-xiashuwanjia','Club',function (spriteFrame) {
  51. this.$('BGB/TBillList@Sprite').spriteFrame = spriteFrame;
  52. }.bind(this));
  53. }
  54. this.ShowPrefabDLG('FilterNode',this.node,function(Js){
  55. this._filter = Js;
  56. this._filter.SetMode(FILTER_MENU_PAGE,function(o){
  57. this._page = o.p;
  58. this.m_bNeedUpdate = true;
  59. }.bind(this),cc.Vec2(450,-330));
  60. }.bind(this));
  61. },
  62. OnShowInfor:function(type,UserID){
  63. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  64. var webUrl = window.PHP_HOME+'/League.php?GetMark=67&dwUserID='+this.m_dwLeaderID+'&dwClubID='+this.m_dwClubID;
  65. webUrl += `&start=${(this._page - 1) * window.PAGE_ITEM_CNT + 1}`;
  66. webUrl += `&end=${(this._page) * window.PAGE_ITEM_CNT}`;
  67. webUrl += `&searchID=${this._searchID}`;
  68. webUrl += `&type=${type}`;
  69. WebCenter.GetData(webUrl, 1, function (data) {
  70. this.m_ListCtrl.InitList(0, 'ClubPartnerPre', this);
  71. var idArr = JSON.parse(data);
  72. this._inforArr = [];
  73. for(var i = 0; i<idArr.length; i++ ){
  74. if (idArr.length > 0) this._totalPage = Math.ceil(idArr[0][5] / window.PAGE_ITEM_CNT);
  75. else this._totalPage = 1;
  76. this._filter.SetPageTotalCnt(this._totalPage,this._page);
  77. this._inforArr = [];
  78. for(var i = 0; i<idArr.length; i++ ){
  79. this._inforArr.push([idArr[i],UserID]);
  80. }
  81. //this.m_ListCtrl.InsertListInfo(0, [idArr[i],UserID]);
  82. }
  83. this.m_ListCtrl.InsertListInfoArr(0,this._inforArr);
  84. }.bind(this));
  85. },
  86. //显示玩家信息
  87. OnShowMemberInfo: function(UserID, ClubLv){
  88. this.ShowPrefabDLG('ClubUserScore', this.node, function(Js){
  89. Js.OnShowClubUser(UserID, this.m_dwClubID, ClubLv);
  90. }.bind(this));
  91. },
  92. //显示玩家合伙人详情
  93. OnShowPartnerInfo: function(UserID, Lv){
  94. if(Lv < CLUB_LEVEL_PARTNER) return
  95. this.ShowPrefabDLG('ClubPartner', this.node, function(Js){
  96. Js.OnShowSubData(UserID, Lv, this.m_DlgLevel+1);
  97. }.bind(this));
  98. },
  99. //调配成员
  100. OnClick_BtSetLeader: function(){
  101. this.ShowPrefabDLG('ClubInput',this.node,function(Js){
  102. Js.OnSetRetunIndex(6,'成員ID', function(ID){
  103. this.ReSetUserLeader(ID, this.m_dwLeaderID);
  104. }.bind(this));
  105. }.bind(this));
  106. },
  107. OnShowPartnerList:function(type,UserID,GameID){
  108. this.ShowPrefabDLG('ClubPartner', this.node, function(Js){
  109. Js.OnShowSubData(type,UserID,GameID);
  110. }.bind(this));
  111. },
  112. //邀请玩家
  113. OnClick_BtInvate:function(){
  114. cc.gSoundRes.PlaySound('Button');
  115. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  116. var Self=this;
  117. this.ShowPrefabDLG('ClubInput',this.node,function(Js){
  118. Js.OnSetRetunIndex(3,'邀請玩家ID',function(ID){
  119. var webUrl = window.PHP_HOME+'/UserFunc.php?GetMark=13&dwGameID='+ID;
  120. WebCenter.GetData(webUrl, null, function (data) {
  121. var Res = JSON.parse(data)
  122. window.gClubClientKernel.onSendSetClubUserLvL(Res['UserID'],Self.m_Hook.m_SelClubInfo.dwClubID,CLUB_LEVEL_MEMBER);
  123. });
  124. });
  125. });
  126. },
  127. //搜索
  128. OnBtSearch: function(){
  129. cc.gSoundRes.PlaySound('Button');
  130. var strGameID = this.$('EditBox@EditBox').string;
  131. if(strGameID==''){
  132. this.ShowTips('ID不能為空!');
  133. return ;
  134. }
  135. this.$('BtBack').active = !this.$('BtBack').active;
  136. this.$('BtFind').active = !this.$('BtFind').active;
  137. this._searchID = parseInt(strGameID);
  138. this._page = 1;
  139. this.m_bNeedUpdate = true;
  140. },
  141. //返回
  142. OnBtBack: function(){
  143. cc.gSoundRes.PlaySound('Button');
  144. this.$('EditBox@EditBox').string = '';
  145. this.$('BtBack').active = !this.$('BtBack').active;
  146. this.$('BtFind').active = !this.$('BtFind').active;
  147. this._searchID = 0;
  148. this.m_bNeedUpdate = true;
  149. },
  150. //添加合伙人
  151. OnClick_BtAddLeader: function(){
  152. var LeaderLv = 6;
  153. var self = this;
  154. this.ShowPrefabDLG('ClubInput',this.node,function(Js){
  155. Js.OnSetRetunIndex(4,'玩家ID',function(ID){
  156. self.OnGameIDSetClubLv(ID, LeaderLv);
  157. });
  158. }.bind(this));
  159. },
  160. ReSetUserLeader:function (ID, LeaderID) {
  161. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  162. var webUrl = window.PHP_HOME+'/League.php?GetMark=33&dwUserID='+pGlobalUserData.dwUserID;
  163. webUrl+='&dwGameID='+ID+'&ClubID='+this.m_dwClubID+'&LeaderID='+LeaderID;
  164. WebCenter.GetData(webUrl, null, function (data) {
  165. this.ShowAlert(data);
  166. WebCenter.SetDataOutTime('League.php?GetMark=60');
  167. this.m_bNeedUpdate = true;
  168. }.bind(this));
  169. },
  170. DelFromLeader:function (UserID) {
  171. //this.ShowAlert('是否确认移除玩家?确认后玩家将成为盟主成员',Alert_YesNo,function(Res){
  172. // if(Res){
  173. var GameID = g_GlobalUserInfo.m_UserInfoMap[UserID].GameID;
  174. this.ReSetUserLeader(GameID, this.m_SelClubInfo.CreaterID);
  175. //}
  176. //}.bind(this))
  177. },
  178. OnGameIDSetClubLv:function (GameID, Lv) {
  179. var webUrl = window.PHP_HOME+'/UserFunc.php?GetMark=13&dwGameID='+GameID;
  180. WebCenter.GetData(webUrl, null, function (data) {
  181. if(data == '') return this.ShowTips('查不到該玩家!')
  182. var UserInfo = JSON.parse(data);
  183. this.OnOpClubUserLv(UserInfo.UserID, Lv,OPERATE_CODE_SET,function(){
  184. this.m_bNeedUpdate = true;
  185. }.bind(this));
  186. }.bind(this));
  187. },
  188. //设置合伙人比率
  189. SetLeaderRate:function(UserID){
  190. // this.$('ClubReta').active = true;
  191. // this.m_RetaUserID = UserID;
  192. // this.$('ClubReta/BGM/EditBox@EditBox').string = '';
  193. // this.$('ClubReta/BGM/InputNum@Label').string = '';
  194. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  195. this.ShowPrefabDLG('ClubInput',this.node,function(Js){
  196. Js.OnSetRetunIndex(1,'1-100之間的有效比率', function(Res){
  197. if(Res >= 0 && Res <= 100){
  198. var webUrl = window.PHP_HOME+'/League.php?GetMark=35&dwUserID='+pGlobalUserData.dwUserID+'&ClubID='+this.m_dwClubID;
  199. webUrl += '&LeaderID='+UserID+'&Rate='+Res;
  200. WebCenter.GetData(webUrl, null, function (data) {
  201. this.ShowAlert(data);
  202. WebCenter.SetDataOutTime('GetMark=61');
  203. this.m_bNeedUpdate = true;
  204. }.bind(this));
  205. }else{
  206. return this.ShowAlert('請輸入1-100之間的有效數字');
  207. }
  208. }.bind(this));
  209. }.bind(this));
  210. },
  211. OnClick_GetScore:function(){
  212. this.m_Hook.OnBtShowDlg(null, 'ClubGetScore');
  213. },
  214. OnClick_ChangeRateList:function(){
  215. cc.gSoundRes.PlaySound('Button');
  216. this.ShowPrefabDLG('ClubRateList',this.node,function(Js){
  217. Js.OnLoadData(this.m_dwLeaderID);
  218. }.bind(this));
  219. },
  220. OnClick_ShowUserRevenueList:function () {
  221. this.m_Hook.OnShowRevenueList(this.m_dwLeaderID);
  222. },
  223. OnShowRevenueList:function (LeaderID) {
  224. this.m_Hook.OnShowRevenueList(LeaderID);
  225. },
  226. //////////////////////////////////////////////////////////中转
  227. //成员等级调整
  228. OnOpClubUserLv:function (UserID, Lv,Code,CallBack) {
  229. this.m_Hook.OnOpClubUserLv(UserID, Lv,Code, CallBack);
  230. },
  231. //俱乐部赠送
  232. OnGiveScore:function(UserID, Type, Score) {
  233. this.m_Hook.OnGiveScore(UserID, Type, Score);
  234. },
  235. //俱乐部下分
  236. OnTakeScore:function(UserID, Type, Score) {
  237. this.m_Hook.OnTakeScore(UserID, Type, Score);
  238. },
  239. OnBtClickRetaNum:function(Tag, Data){
  240. cc.gSoundRes.PlaySound('Button');
  241. if(Data == 'Reset'){ //重置
  242. this.$('ClubReta/BGM/EditBox@EditBox').string = '';
  243. this.$('ClubReta/BGM/InputNum@Label').string = '';
  244. }else{
  245. if(this.$('ClubReta/BGM/InputNum@Label').string.length >= 3) return //0-9
  246. this.$('ClubReta/BGM/InputNum@Label').string += Data;
  247. }
  248. //this.$('ClubReta/BGM/EditBox@EditBox').string = this.$('ClubReta/BGM/InputNum@Label').string;
  249. },
  250. OnBtClickCloseRetaNode:function(Tag, Data){
  251. cc.gSoundRes.PlaySound('Button');
  252. this.$('ClubReta/BGM/InputNum@Label').string = '';
  253. this.$('ClubReta').active = false;
  254. },
  255. OnBtClickRetaSure:function(){
  256. cc.gSoundRes.PlaySound('Button');
  257. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  258. if(parseInt(this.$('ClubReta/BGM/InputNum@Label').string) >= 0 && parseInt(this.$('ClubReta/BGM/InputNum@Label').string) <= 100){
  259. var webUrl = window.PHP_HOME+'/League.php?GetMark=35&dwUserID='+pGlobalUserData.dwUserID+'&ClubID='+this.m_dwClubID;
  260. webUrl += '&LeaderID='+this.m_RetaUserID+'&Rate='+parseInt(this.$('ClubReta/BGM/InputNum@Label').string);
  261. WebCenter.GetData(webUrl, null, function (data) {
  262. this.ShowAlert(data);
  263. WebCenter.SetDataOutTime('GetMark=61');
  264. this.m_bNeedUpdate = true;
  265. this.$('ClubReta').active = false;
  266. }.bind(this));
  267. }else{
  268. return this.ShowAlert('請輸入1-100之間的有效數字');
  269. }
  270. },
  271. update:function(){
  272. if(this.m_bNeedUpdate == false) return;
  273. this.m_bNeedUpdate = false;
  274. this.OnShowInfor(this.m_Type, this.m_dwLeaderID,this.m_dwLeaderGameID);
  275. },
  276. });