ClubPartner.js 13 KB

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