ClubAndroidRecord.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. ctor:function(){
  6. this._Time = 0;
  7. },
  8. onLoad:function(){
  9. },
  10. OnShowView:function(){
  11. if(this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
  12. this.m_ListCtrl.InitList(0, 'AndroidRecordItem',this);
  13. this.onGetRecordInfo();
  14. },
  15. OnBtShowTime:function(){
  16. this.$('Time').x = 0;
  17. },
  18. OnBtHideTime:function(){
  19. this.$('Time').x = 2000;
  20. },
  21. OnClick_Tag:function(_,data){
  22. this.OnBtHideTime();
  23. var str = '今天';
  24. if(data == 0 ){
  25. str = '今天';
  26. }else if(data == 2 ){
  27. str = '2天';
  28. }else if(data == 3){
  29. str = '3天';
  30. }else if(data == 5){
  31. str = '5天';
  32. }else if(data == 7){
  33. str = '7天';
  34. }else if(data == 30){
  35. str = '1個月';
  36. }else{
  37. str = '全部';
  38. }
  39. this.$('Sub/BtTime/Background/Label@Label').string = str;
  40. if(data<7){
  41. this._Time = parseInt(data);
  42. }else if(data == 7){
  43. this._Time = 10;
  44. }else if(data == 30){
  45. this._Time = 100;
  46. }else{
  47. this._Time = 1000;
  48. }
  49. this.onGetRecordInfo();
  50. },
  51. onGetRecordInfo:function(){
  52. this.m_ListCtrl.InitList(0, 'AndroidRecordItem',this);
  53. var ClubID = g_ShowClubInfo.dwClubID;
  54. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  55. var webUrl = window.PHP_HOME+'/ClubAndroid.php?&GetMark=3&dwUserID='+pGlobalUserData.dwUserID;
  56. webUrl += '&dwClubID='+ClubID;
  57. webUrl += '&dwTime='+this._Time;
  58. WebCenter.GetData(webUrl, null, function (data) {
  59. var RecordArr = JSON.parse(data);
  60. this.m_ListCtrl.InsertListInfoArr(0,RecordArr);
  61. var AllWin = 0;
  62. var AllDraw = 0;
  63. var AllScore1 = 0;
  64. var AllScore2 = 0;
  65. var AllScore3 = 0;
  66. for (const i in RecordArr) {
  67. AllWin += RecordArr[i][1];
  68. AllDraw += RecordArr[i][2];
  69. AllScore1 += RecordArr[i][3];
  70. AllScore2 += RecordArr[i][4];
  71. AllScore3 += parseInt(RecordArr[i][5]);
  72. }
  73. this.onSetAllInfo(AllWin,AllDraw,AllScore1,AllScore2,AllScore3);
  74. }.bind(this));
  75. },
  76. onSetAllInfo:function(AllWin,AllDraw,AllScore1,AllScore2,AllScore3){
  77. this.$('Sub/AllLab/AllWin@Label').string = AllWin;
  78. this.$('Sub/AllLab/AllDraw@Label').string = AllDraw;
  79. this.$('Sub/AllLab/AllScore1@Label').string = Score2Str(parseInt(AllScore1));
  80. this.$('Sub/AllLab/AllScore2@Label').string = Score2Str(parseInt(AllScore2));
  81. this.$('Sub/AllLab/AllScore3@Label').string = Score2Str(parseInt(AllScore3));
  82. }
  83. });