39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
import { _decorator, Node, ScrollView, Sprite } from 'cc';
|
||
import BaseView from '../../../../../../extensions/app/assets/base/BaseView';
|
||
import { Tools } from 'db://assets/res-native/tools/Tools';
|
||
const { ccclass, property } = _decorator;
|
||
@ccclass('PageRewardhistory')
|
||
export class PageRewardhistory extends BaseView {
|
||
@property(Node)
|
||
rw_item: Node = null!;
|
||
@property(ScrollView)
|
||
rw_list: ScrollView = null!;
|
||
|
||
// 初始化的相关逻辑写在这
|
||
onLoad() {}
|
||
|
||
// 界面打开时的相关逻辑写在这(onShow可被多次调用-它与onHide不成对)
|
||
onShow(params: any) {
|
||
this.initRw()
|
||
}
|
||
|
||
initRw() {
|
||
this.rw_list.content.removeAllChildren()
|
||
Tools.httpReq("draw-records", {}, (res:any)=>{
|
||
for (let i = 0; i < res.length; i++) {
|
||
let d = res[i]
|
||
let item = Tools.AddChild(this.rw_list.content, this.rw_item, "item" + i);
|
||
Tools.SetChildText(item, "lab_num", d.prize_name)
|
||
Tools.SetChildText(item, "lab_time", d.draw_time)
|
||
Tools.remoteLoadSprite(d.prize_pic, Tools.GetChildComp(item, "rehis_bg_rw/icon", Sprite))
|
||
item.active = true;
|
||
}
|
||
})
|
||
}
|
||
|
||
// 界面关闭时的相关逻辑写在这(已经关闭的界面不会触发onHide)
|
||
onHide(result: undefined) {
|
||
// app.manager.ui.show<PageRewardhistory>({name: 'PageRewardhistory', onHide:(result) => { 接收到return的数据,并且有类型提示 }})
|
||
return result;
|
||
}
|
||
} |