SelfInfo.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_IPLabel: cc.Label,
  5. },
  6. ctor: function () {
  7. this.m_BindPhone = null;
  8. },
  9. onLoad: function () {
  10. },
  11. start: function () {
  12. },
  13. OnShowView: function () {
  14. if (!this.m_LbBindPhone) this.m_LbBindPhone = this.$('UserNode/BindPhone/LbPhone@Label');
  15. if (!this.m_BtBind) this.m_BtBind = this.$('BtBind@Button');
  16. if (!this.m_BtRebind) this.m_BtRebind = this.$('BtRebind@Button');
  17. if (!this.m_BtRealName) this.m_BtRealName = this.$('Layout/BtRealName@Button');
  18. if (!this.m_BtResetPsw) this.m_BtResetPsw = this.$('Layout/BtResetPsw@Button');
  19. if (!this.m_BtUpload) this.m_BtUpload = this.$('Layout/BtUpload@Button');
  20. this.m_LbBindPhone.string = '';
  21. this.m_BtBind.node.active = false;
  22. this.m_BtRebind.node.active = false;
  23. this.m_BtRealName.node.active = false;
  24. this.m_BtResetPsw.node.active = false;
  25. var platform = cc.sys.localStorage.getItem(window.Key_LoginPlatform);
  26. //先关闭头像上传按钮(未启用)
  27. //this.m_BtUpload.node.active = (platform != window.PLATFORM_WX);
  28. this.m_BindPhone = null;
  29. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  30. // 检查绑定手机
  31. var webUrl = window.PHP_HOME + '/UserFunc.php?GetMark=19&dwUserID=' + pGlobalUserData.dwUserID;
  32. g_CurScene.ShowLoading();
  33. WebCenter.GetData(webUrl, 3, function (data) {
  34. g_CurScene.StopLoading();
  35. if (data == "") {
  36. this.m_LbBindPhone.string = '未綁定';
  37. //绑定手机功能未开放,先隐藏
  38. // this.m_BtBind.node.active = true;
  39. } else {
  40. this.m_LbBindPhone.string = cutPhone(data);
  41. this.m_BindPhone = data;
  42. // 重新绑定手机功能未开放,先隐藏
  43. //this.m_BtRebind.node.active = true;
  44. }
  45. //实名认证功能未开放 ,先隐藏
  46. //this.m_BtRealName.node.active = true;
  47. //修改密码功能未开放,先隐藏
  48. // this.m_BtResetPsw.node.active = (platform != window.PLATFORM_WX);
  49. }.bind(this));
  50. },
  51. SetInfo: function (userid, IP,Gold) {
  52. // if(userid==15){ //todo
  53. // this.m_BtUpload.node.active = true;
  54. // }
  55. this.$("UserNode@UserCtrl").SetUserByID(userid);
  56. this.m_IPLabel.string = IP;
  57. this.$("UserNode/Gold/gold@Label").string = Gold;
  58. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  59. var Addr1 = g_GlobalUserInfo.GetUserAddress(pGlobalUserData.dwUserID);
  60. this.$('UserNode/Adress/adress@Label').string = Addr1.string;
  61. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  62. var webUrl2 = window.PHP_HOME + '/UserFunc.php?&GetMark=18&dwUserID=' + pGlobalUserData.dwUserID;
  63. WebCenter.GetData(webUrl2, 10, function (data) {
  64. var res = JSON.parse(data);
  65. this.$('UserNode/JuShu/juShu@Label').string = res.GameCnt;
  66. this.$('UserNode/Time/Time@Label').string = res.Time;
  67. //this.OnChangeTex(res.GameCnt);
  68. }.bind(this));
  69. },
  70. OnClicked_Bind: function () {
  71. cc.gSoundRes.PlaySound('Button');
  72. this.ShowPrefabDLG("BindPhone", this.node, function (Js) {
  73. Js.SetBindMode(true);
  74. }.bind(this));
  75. },
  76. OnClicked_BtSetNick: function () {
  77. cc.gSoundRes.PlaySound('Button');
  78. this.ShowPrefabDLG('SetNick', this.node);
  79. },
  80. OnClicked_BtSetSex: function () {
  81. cc.gSoundRes.PlaySound('Button');
  82. this.ShowPrefabDLG('SetSex', this.node);
  83. },
  84. OnClicked_Rebind: function () {
  85. cc.gSoundRes.PlaySound('Button');
  86. this.ShowPrefabDLG("BindPhone", this.node, function (Js) {
  87. Js.SetBindMode(false);
  88. }.bind(this));
  89. },
  90. OnBindSuccess: function (NewPhone) {
  91. this.m_LbBindPhone.string = cutPhone(NewPhone);
  92. this.m_BindPhone = NewPhone;
  93. },
  94. OnClicked_RealName: function () {
  95. cc.gSoundRes.PlaySound('Button');
  96. // this.ShowPrefabDLG('RealAuth', this.node);
  97. },
  98. OnClicked_ResetPsw: function () {
  99. cc.gSoundRes.PlaySound('Button');
  100. if (!this.CheckBindPhone()) return;
  101. this.ShowPrefabDLG('ChangePsw', this.node, function (Js) {
  102. Js.OnShowView(1);
  103. }.bind(this));
  104. },
  105. OnClicked_UpLoad: function() {
  106. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  107. ThirdPartyPickImg({
  108. Mark: 1,
  109. Type: 1,
  110. UserID: pGlobalUserData.dwUserID,
  111. }, '0');
  112. },
  113. CheckBindPhone: function () {
  114. if (!this.m_BindPhone) {
  115. this.ShowAlert('請先綁定手機號!', Alert_YesNo, function (Res) {
  116. if (Res) {
  117. this.ShowPrefabDLG("BindPhone", this.node, function (Js) {
  118. Js.SetBindMode(true);
  119. }.bind(this));
  120. }
  121. }.bind(this));
  122. return false;
  123. }
  124. return true;
  125. },
  126. OnUpload_Finish: function(){
  127. var pGlobalUserData=g_GlobalUserInfo.GetGlobalUserData();
  128. this.$("UserNode@UserCtrl").SetUserByID(pGlobalUserData.dwUserID, true);
  129. },
  130. OnBtShowDlg:function(Tag, Data) {
  131. if(!cc.gPreLoader.Exist_Prefab(Data, Data)) return;
  132. this.ShowPrefabDLG(Data,this.node);
  133. },
  134. onNickNameChange() {
  135. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  136. this.m_Hook.m_MeUserCtrl.SetUserByID(pGlobalUserData.dwUserID);
  137. },
  138. });