BlockedUser.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. onLoad: function () {
  6. },
  7. start: function () {
  8. },
  9. OnShowView: function() {
  10. },
  11. Refresh: function() {
  12. if(!this.m_ListCtrl) this.m_ListCtrl = this.node.getComponent('CustomListCtrl');
  13. this.m_ListCtrl.InitList(0, 'BlockedUserItem', this);
  14. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  15. var webUrl =`${window.PHP_HOME}/League.php?&GetMark=118&dwClubID=${this.m_Hook.m_SelClubInfo.dwClubID}`;
  16. WebCenter.GetData(webUrl, 0, function (data) {
  17. var UserMap = JSON.parse(data);
  18. for(var i = 0; i < UserMap.length;i++){
  19. this.m_ListCtrl.InsertListInfo(0, {Index: i,Info: UserMap[i]});
  20. }
  21. }.bind(this));
  22. },
  23. OnClicked_AddUser: function() {
  24. cc.gSoundRes.PlaySound('Button');
  25. var pEdit = this.$('EditBox@EditBox');
  26. if(!pEdit) return;
  27. if(pEdit.string.length == 0) return this.ShowTips('請輸入玩家ID!');
  28. this.OnSetBlocked({ClubID:this.m_Hook.m_SelClubInfo.dwClubID, UserID: pEdit.string}, 1);
  29. },
  30. OnSetBlocked: function(Info, Blocked) {
  31. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  32. var webUrl =`${window.PHP_HOME}/League.php?&GetMark=119&dwClubID=${Info.ClubID}`;
  33. webUrl += `&dwUserID=${pGlobalUserData.dwUserID}&dwTarID=${Info.UserID}&Blocked=${Blocked ? 1 : 0}`
  34. WebCenter.GetData(webUrl, 0, function (data) {
  35. var Res = JSON.parse(data);
  36. if(Res.Res == 0) {
  37. this.ShowAlert(Res.Describe,Alert_Yes, function(Res) {
  38. this.Refresh();
  39. }.bind(this));
  40. } else {
  41. this.ShowAlert(Res.Describe,Alert_Yes, function(Res) {
  42. }.bind(this));
  43. }
  44. }.bind(this));
  45. },
  46. });