| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { _decorator, Component, Node, Prefab, instantiate, RichText } from 'cc';
- import { Http, HttpResponseCode } from '../core/net/Http';
- import List from '../core/ui/virtualList/List';
- import { WindowSystem } from '../core/ui/window/WindowSystem';
- import { WithdrawalItem } from '../myWallet/WithdrawalItem';
- import { WithdrawaGTlItem } from './WithdrawaGTlItem';
- const { ccclass, property, requireComponent } = _decorator;
- /**
- * 贡献提现记录
- */
- @ccclass('WithdrawalList')
- @requireComponent(Http)
- export class WithdrawalList extends Component {
- @property({ tooltip: "任务列表", type: List }) list: List;
- @property({ tooltip: "提现总金额", type: Node }) totalMoney: Node;
- private listData = [];
- start() {
- }
- private async onOpenHandler() {
- let result = await this.getComponent(Http).send("/api/fission/GetContributionLogs");
- let num = 0;
- if (result && result.code == HttpResponseCode.Success) {
- this.listData = result.data.logs;
- this.listData.sort((a: any, b: any): number => {
- if (a.createTime > b.createTime) {
- return -1;
- }
- });
- for (let i = 0; i < this.listData.length; i++) {
- num += this.listData[i].value;
- }
- this.list.numItems = this.listData.length;
- } else {
- WindowSystem.showTips('获取记录失败');
- }
- this.totalMoney.getComponent(RichText).string = "<color=#000000>累计提现:</color><color=#ff7f00>" + (num / 10000) + "元</color>";//TODO 获取提现金额
- // this.addItems();
- }
- /**
- * TODO 缺少数据
- * @param data 体现记录array
- */
- // public async addItems() {
- // for (let i = 0; i < 30; i++) {
- // this.listData.push({ value: 1000, createTime: 1624952208 });
- // }
- // this.list.numItems = this.listData.length;
- // }
- /**
- * 当列表项渲染
- */
- public onListRender(item: Node, index: number) {
- item.getComponent(WithdrawaGTlItem).onDataChange(this.listData[index]);
- }
- }
|