RedBagCodeItem.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import JsbSystem from "../../../mk/system/JsbSystem";
  2. import { TCashList } from "../../data/module/CashNormalData";
  3. const { ccclass, property } = cc._decorator;
  4. /**
  5. * 红包码条目
  6. * @author 薛鸿潇
  7. */
  8. @ccclass
  9. export default class RedBagCodeItem extends cc.Component {
  10. @property({ displayName: 'lbl红包码', type: cc.Label })
  11. private lbl_code: cc.Label = null;
  12. @property({ displayName: 'lbl时间', type: cc.Label })
  13. private lbl_time: cc.Label = null;
  14. @property({ displayName: 'lbl毛币', type: cc.Label })
  15. private lbl_rmb: cc.Label = null;
  16. /**
  17. * 初始化数据
  18. */
  19. public async setItemData(item_data) {
  20. await this.initItem(item_data);
  21. }
  22. /**
  23. * 初始化样式
  24. */
  25. private initItem(item_data: TCashList) {
  26. this.lbl_rmb.string = item_data.amount + '元';
  27. this.lbl_time.string = mk.time.getNowDayString(item_data.applyTime * 1000);
  28. this.lbl_code.string = item_data.withdrawalCode ? '红包码:' + item_data.withdrawalCode : '';
  29. }
  30. /**
  31. * 复制按钮
  32. */
  33. private clickCopy() {
  34. JsbSystem.setClipboard('AABBAA')
  35. }
  36. // update (dt) {}
  37. }