DrawRedRecord.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const DrawApi = require("../net/DrawApi");
  2. const WeChat = require('../net/WeChat');
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. item: cc.Node,
  7. moneyTileRichText: cc.RichText,
  8. content: cc.Node,
  9. },
  10. // LIFE-CYCLE CALLBACKS:
  11. onLoad () {
  12. /// 获取红包记录数据
  13. this.moneyTileRichText.string = `<b><color=#613f16>余额:¥${(GameGlobal.userData.hb / 100).toFixed(2)}</c></b>`;
  14. DrawApi.getDrawHbs((respondData) => {
  15. let reds = respondData.list;
  16. /// 如果有红包记录
  17. if (reds != undefined || reds.length > 0) {
  18. for (let i = 0; i < reds.length; ++ i) {
  19. let contentItem = cc.instantiate(this.item);
  20. this.content.addChild(contentItem);
  21. contentItem.getComponent('DrawRedRecordItem').init(reds[i]);
  22. }
  23. }
  24. }, (err, code) => {
  25. console.log(err, code);
  26. })
  27. },
  28. start () {
  29. },
  30. /// 点我提现
  31. drawAction() {
  32. WeChat.jumpCustomerServices(true);
  33. },
  34. closeAction() {
  35. this.node.destroy();
  36. },
  37. // update (dt) {},
  38. });