1234567891011121314151617181920212223242526272829303132333435363738394041 |
- const DrawApi = require("../net/DrawApi");
- cc.Class({
- extends: cc.Component,
- properties: {
- item: cc.Node,
- moneyTileRichText: cc.RichText,
- content: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- /// 获取红包记录数据
- this.moneyTileRichText.string = `<b><color=#613f16>余额:¥9.12</c></b>`;
-
- DrawApi.getDrawHbs((respondData) => {
- let reds = respondData.list;
- /// 如果有红包记录
- if (reds != undefined || reds.length > 0) {
- for (let i = 0; i < reds.length; ++ i) {
- let contentItem = cc.instantiate(this.item);
- this.content.addChild(contentItem);
- contentItem.getComponent('DrawRedRecordItem').init(reds[i]);
- }
- }
- }, (err, code) => {
- console.log(err, code);
- })
- },
- start () {
- },
- // update (dt) {},
- });
|