DrawRedRecord.js 998 B

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