RedPackeWithdrawalViewComp.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-03-20 17:53:50
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-08 14:59:27
  6. * @Description: 红包提现
  7. */
  8. import { _decorator, Node } from "cc";
  9. import { oops } from "db://oops-framework/core/Oops";
  10. import { ecs } from "db://oops-framework/libs/ecs/ECS";
  11. import { CCComp } from "db://oops-framework/module/common/CCComp";
  12. import { UIID } from "../../common/config/GameUIConfig";
  13. import List from "../ui/List";
  14. import { RedPackeItemView } from "./RedPackeItemView";
  15. import { GameComponent } from "db://oops-framework/module/common/GameComponent";
  16. const { ccclass, property } = _decorator;
  17. /** 视图层对象 */
  18. @ccclass('RedPackeWithdrawalViewComp')
  19. export class RedPackeWithdrawalViewComp extends GameComponent {
  20. @property(List)
  21. recordList: List = null!;
  22. data: any[] = [];
  23. onLoad() {
  24. this.setButton();
  25. const data = {
  26. title: `每日消除100次即可领取`,
  27. current: 1,
  28. total: 100,
  29. state: 0,
  30. goods: [
  31. {
  32. type: 1001,
  33. num: 100
  34. }
  35. ]
  36. }
  37. for (let i = 0; i < 10; i++) {
  38. this.data.push(data);
  39. }
  40. oops.log.logView(this.data, "this.data");
  41. this.recordList.numItems = this.data.length;
  42. oops.log.logView(this.recordList.numItems, "this.recordList.numItems");
  43. }
  44. private onListRender(item: Node, idx: number) {
  45. console.log("onListRender", idx);
  46. const itemView: RedPackeItemView | null = item.getComponent(RedPackeItemView);
  47. if (itemView) {
  48. console.log(">>>>>>>>>>>>>>>>>", itemView)
  49. itemView.setItem(this.data[idx], idx);
  50. }
  51. }
  52. private btn_back() {
  53. oops.gui.remove(UIID.RedPacketWithdraw);
  54. }
  55. private btn_record() {
  56. oops.gui.open(UIID.WithdrawRecord);
  57. }
  58. }