LeaseGrantInfo.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. grantName: {
  5. default: null,
  6. type: cc.Label,
  7. serializable: true,
  8. },
  9. amount: {
  10. default: null,
  11. type: cc.Label,
  12. serializable: true,
  13. },
  14. //介绍
  15. describe: {
  16. default: null,
  17. type: cc.Label,
  18. serializable: true,
  19. },
  20. inputInviteValue: {
  21. default: 1,
  22. visible: false
  23. },
  24. },
  25. // LIFE-CYCLE CALLBACKS:
  26. // onLoad () {},
  27. start () {
  28. },
  29. /**
  30. * 赠送
  31. */
  32. onGrant(){
  33. },
  34. setInfo(grantName,amount){
  35. this.grantName.string = grantName;
  36. this.amount.string = amount;
  37. },
  38. inputValue(value, e) {
  39. var numberTemp = new RegExp("^[A-Za-z0-9]+$");
  40. if (numberTemp.test(value)) {
  41. if(Number(value)>=1){
  42. this.inputInviteValue = Number(value);
  43. }else{
  44. this.inputInviteValue = 1;
  45. this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
  46. }
  47. } else {
  48. this.inputInviteValue = 1;
  49. this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
  50. console.log("请输入整数的倍数", this.inputInviteValue);
  51. }
  52. },
  53. onclose(){
  54. this.node.destroy();
  55. }
  56. });