ClubPeopleCard.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. ctor: function () {
  6. this.m_ScoreCnt = 0;
  7. this.m_PoolCnt = 0;
  8. this.m_LeaderID = 0;
  9. },
  10. OnShowView: function () {
  11. this.m_userCtrl = this.$('@UserCtrl')
  12. this.m_userCtrl.SetUserByID(0);
  13. this.m_SelClubInfo = this.m_Hook.m_SelClubInfo;
  14. },
  15. OnSetParam: function (type) {
  16. cc.gPreLoader.LoadRes('Image_ClubPeopleCard_' + (type == 0 ? 'TSeniorCard' : 'T-shezhiwodemingpian'), 'Club', function (sprFrame) {
  17. this.$('BGM/TPsw@Sprite').spriteFrame = sprFrame;
  18. }.bind(this));
  19. this.$('BGM/PersonalBG/LabNode').active = type == 0;
  20. this.$('BGM/PersonalBG/InputNode').active = type == 1;
  21. this.$('BtShare').active = type == 1;
  22. this.$('BtGiveScore').active = type == 0;
  23. this.$('BGM/AllienceBG/t2@Label').string = this.m_SelClubInfo.wKindID == CLUB_KIND_2?'聯盟專屬碼':'俱樂部專屬碼';
  24. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  25. var webUrl = window.PHP_HOME + '/League.php?GetMark=121&dwUserID=' + pGlobalUserData.dwUserID;
  26. webUrl += '&ClubID=' + this.m_Hook.m_SelClubInfo.dwClubID;
  27. webUrl += '&type=' + type;
  28. WebCenter.GetData(webUrl, null, function (data) {
  29. var Res = JSON.parse(data);
  30. if (type == 0) {
  31. this.$('BGM/PersonalBG/LabNode/LWeChat@Label').string = Res['WeChat'];
  32. this.$('BGM/PersonalBG/LabNode/LQQ@Label').string = Res['QQ'];
  33. } else {
  34. if (Res['WeChat'][0] != '') this.$('BGM/PersonalBG/InputNode/EdWeChat@EditBox').string = Res['WeChat'];
  35. if (Res['QQ'][0] != '') this.$('BGM/PersonalBG/InputNode/EdQQ@EditBox').string = Res['QQ'];
  36. cc.share.InitShareInfo_H5_WX(this.GetShareInfo.bind(this));
  37. }
  38. this.$('BGM/AllienceBG/AllienceID@Label').string = Res['AllianceID'];
  39. if(!Res['UserID']){
  40. this.m_LeaderID = pGlobalUserData.dwUserID;
  41. this.m_userCtrl.SetUserByID(pGlobalUserData.dwUserID);
  42. }else{
  43. this.m_userCtrl.SetUserByID(Res['UserID']);
  44. this.m_LeaderID = Res['UserID'];
  45. }
  46. }.bind(this));
  47. },
  48. //
  49. OnBtSave: function () {
  50. cc.gSoundRes.PlaySound('Button');
  51. var WeChat = this.$('BGM/PersonalBG/InputNode/EdWeChat@EditBox').string;
  52. var QQ = this.$('BGM/PersonalBG/InputNode/EdQQ@EditBox').string;
  53. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  54. var webUrl = window.PHP_HOME + '/League.php?GetMark=120&dwUserID=' + pGlobalUserData.dwUserID;
  55. webUrl += '&ClubID=' + this.m_Hook.m_SelClubInfo.dwClubID;
  56. webUrl += '&WeChat=' + WeChat;
  57. webUrl += '&QQ=' + QQ;
  58. WebCenter.GetData(webUrl, null, function (data) {
  59. var res = JSON.parse(data);
  60. this.ShowTips(res['Describe']);
  61. }.bind(this));
  62. },
  63. OnBtShare: function () {
  64. cc.gSoundRes.PlaySound('Button');
  65. var filePath = saveImage(this.node);
  66. //this.ShowAlert(filePath);
  67. if(filePath!='') {
  68. ThirdPartyShareImg(filePath);
  69. }else{
  70. this.ShowTips('截圖保存失敗');
  71. }
  72. },
  73. GetShareInfo:function(){
  74. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  75. var ShareInfo = new Object();
  76. ShareInfo.title = `玩遊戲看這裡!`;
  77. ShareInfo.desc = `我和我身邊的朋友都在玩的競技平臺,快來一展身手!`;
  78. ShareInfo.imgUrl = `${window.PHP_HOME}/share.jpg`;
  79. // if (cc.sys.isNative) {
  80. // ShareInfo.link = window.SHARE_URL
  81. // } else {
  82. // }
  83. ShareInfo.link = cc.share.MakeLink_InviteClub(this.m_Hook.m_SelClubInfo.wKindID, this._dwAllianceID, cc.share.Mode.ToH5);
  84. return ShareInfo;
  85. },
  86. OnBtSaveImg: function () {
  87. cc.gSoundRes.PlaySound('Button');
  88. var bg = this.$('BGM')
  89. this.ShowTips(saveImage(bg)!=''?'保存成功!':'保存失敗');
  90. },
  91. OnBtGiveScore:function(){
  92. var webUrl = window.PHP_HOME+'/UserFunc.php?GetMark=12&dwUserID='+this.m_LeaderID;
  93. WebCenter.GetData(webUrl, null, function (data) {
  94. var UserInfo = JSON.parse(data);
  95. if(UserInfo.UserID == null){
  96. return this.m_Hook.ShowTips('未查找到該玩家');
  97. }else{
  98. this.ShowPrefabDLG('ClubSendScore',null,function(Js){
  99. Js.OnSetLeaderID(UserInfo.GameID);
  100. }.bind(this));
  101. }
  102. }.bind(this));
  103. },
  104. OnGiveScore:function(UserID, Type, Score,Remark){
  105. this.m_Hook.OnGiveScore(UserID, Type, Score,Remark);
  106. },
  107. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  108. });