ClubSendScore.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. OnShowView:function () {
  6. this.$('Label@Label').string = '積分數量:'+Score2Str(parseInt(this.m_Hook.m_SelClubInfo.llScore));
  7. this.$('SendTo/InputBG/EditBox@EditBox').string = '';
  8. this.$('SendScore/InputBG/EditBox@EditBox').string = '';
  9. this.$('Remark/InputBG/EditBox@EditBox').string = '';
  10. },
  11. OnClick_BtSend:function(){
  12. var EdGameID = this.$('SendTo/InputBG/EditBox@EditBox');
  13. var EdScore = this.$('SendScore/InputBG/EditBox@EditBox');
  14. var EdRemark = this.$('Remark/InputBG/EditBox@EditBox');
  15. var GameID = parseInt(EdGameID.string);
  16. if( GameID > 0 && GameID < 1000000){
  17. console.log(GameID);
  18. } else { return this.ShowTips('請輸入有效ID') };
  19. var SendScore = Number(EdScore.string);
  20. if(SendScore > 0) { } else { return this.ShowTips('請輸入有效數量') };
  21. var webUrl = window.PHP_HOME+'/UserFunc.php?GetMark=13&dwGameID='+GameID;
  22. WebCenter.GetData(webUrl, null, function (data) {
  23. var UserInfo = JSON.parse(data);
  24. if(UserInfo.UserID == null){
  25. return this.ShowTips('用戶査詢失敗');
  26. }else{
  27. this.OnSureDo(UserInfo.UserID, SendScore, UserInfo.NickName,EdRemark.string);
  28. }
  29. }.bind(this));
  30. },
  31. OnSureDo:function(UserID, Score, Nick,Remark){
  32. this.ShowAlert('確定贈送【'+Nick+'】 '+Score+' 積分?', Alert_YesNo, function(Res) {
  33. if(Res) {
  34. this.m_Hook.OnGiveScore(UserID, 1, Score,Remark);
  35. this.HideView();
  36. }
  37. }.bind(this) )
  38. },
  39. OnSetLeaderID:function(leaderID){
  40. this.$('SendTo/InputBG/EditBox@EditBox').string = leaderID;
  41. },
  42. // update (dt) {},
  43. });