ClubRankDataInfo.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. },
  10. OnShowView:function(){
  11. this.ShowPrefabDLG('FilterNode',this.node,function(Js){
  12. this._filter = Js;
  13. this._filter.SetMode(FILTER_MENU_PAGE,function(o){
  14. this._page = o.p;
  15. this.m_bNeedUpdate = true;
  16. }.bind(this),cc.Vec2(510,-330));
  17. }.bind(this));
  18. },
  19. OnToggleClick:function(Tag){
  20. this._page = 1;
  21. this._totalPage = 1;
  22. this.m_bNeedUpdate = true;
  23. },
  24. update:function(){
  25. if( this.m_bNeedUpdate ){
  26. this.m_bNeedUpdate = false;
  27. }else{
  28. return;
  29. }
  30. if(!this._filter) return;
  31. for(var i=0;i<4;i++){
  32. this.$(`${i}`).active = false;
  33. }
  34. var RandType = 0;
  35. for(var i=0;i<4;i++){
  36. if(this.$('BGB/Type/'+i+'@Toggle').isChecked) RandType = i;
  37. }
  38. this.$(`${RandType}`).active = true;
  39. if(this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
  40. this.m_ListCtrl.InitList(RandType, 'ClubRankDataInfoPre');
  41. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  42. var webUrl = '';
  43. //大赢家数据
  44. if(RandType == 0){
  45. webUrl = window.PHP_HOME+ '/League.php?GetMark=113&dwUserID='+pGlobalUserData.dwUserID+'&ClubID='+this.m_Hook.m_Hook.m_SelClubInfo.dwClubID;
  46. }else if(RandType == 1){
  47. webUrl = window.PHP_HOME+ '/League.php?GetMark=114&dwUserID='+pGlobalUserData.dwUserID+'&ClubID='+this.m_Hook.m_Hook.m_SelClubInfo.dwClubID;
  48. }else if(RandType == 2){
  49. webUrl = window.PHP_HOME+ '/League.php?GetMark=115&dwUserID='+pGlobalUserData.dwUserID+'&ClubID='+this.m_Hook.m_Hook.m_SelClubInfo.dwClubID;
  50. }
  51. else if(RandType == 3){
  52. webUrl = window.PHP_HOME+ '/League.php?GetMark=116&dwUserID='+pGlobalUserData.dwUserID+'&ClubID='+this.m_Hook.m_Hook.m_SelClubInfo.dwClubID;
  53. }
  54. webUrl += `&start=${(this._page - 1) * window.PAGE_ITEM_CNT + 1}`;
  55. webUrl += `&end=${(this._page) * window.PAGE_ITEM_CNT}`;
  56. WebCenter.GetData(webUrl, null, function (data) {
  57. var Res = JSON.parse(data);
  58. if (Res.length > 0) {
  59. this._totalPage = Math.ceil(Res[0][3] / window.PAGE_ITEM_CNT);
  60. }else this._totalPage = 1;
  61. this._filter.SetPageTotalCnt(this._totalPage,this._page);
  62. var inforArr = [];
  63. for(var i=0;i<Res.length;i++){
  64. inforArr.push([Res[i], RandType]);
  65. //this.m_ListCtrl.InsertListInfo(RandType, [Res[i], RandType]);
  66. }
  67. this.m_ListCtrl.InsertListInfoArr(RandType,inforArr);
  68. }.bind(this));
  69. },
  70. });