Files
18xchat/.svn/pristine/54/5412b2a3b73b927f22e12faf46d5440bd64b47b1.svn-base
T
2025-07-17 17:18:21 +08:00

84 lines
2.5 KiB
Plaintext

import { _decorator, Component, instantiate, isValid, Label, Material, Node, Prefab, Sprite, tween, UIOpacity, v3 } from 'cc';
import Utils from '../../Main/Common/Utils';
import HXZ_ScrollViewList from '../../Main/Common/ScrollViewList';
import GameManager from '../../Main/Manager/GameManager';
import { I_HuiyiInfo } from '../../Main/Config/CommonConfig';
import ResManager from '../../Main/Manager/ResManager';
import { GButton } from '../../Main/Common/GButton';
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
import SubManager from '../SubManager';
import HttpUnit from '../../Main/Common/HttpUnit';
const { ccclass, property } = _decorator;
/**图鉴 - 私房珍藏 */
@ccclass('tj_zhencang')
export class tj_zhencang extends Component {
private itemClone!: any;
@property(HXZ_ScrollViewList)
Item_List: HXZ_ScrollViewList = null!; // 回忆列表
@property(Prefab)
Item_Temp: Prefab = null!;//被克隆的模板
private _nodeTab:any = {}
private huiyiDataList: any[] = []
private nextPage = 1 // 当前页数,每10个记录为一页
protected onLoad(): void {
Utils.parseNode(this.node, this._nodeTab)
this.itemClone = instantiate(this.Item_Temp);
this.Item_List.setTemplateItem(this.itemClone);
}
start() {
this._nodeTab.EmptyNode.active = false;
this.getNextPage()
}
update(deltaTime: number) {
}
//刷新列表
getNextPage() {
HttpUnit.ins.sendZhencangId({limit:10, page:this.nextPage, type:1}, (data) => {
if (data) {
if (data && data.length > 0) {
this.nextPage++
this.huiyiDataList = this.huiyiDataList.concat(data)
let len = this.huiyiDataList.length;
this.Item_List.numItems = len
} else {
if (this.nextPage == 1) {
this._nodeTab.EmptyNode.active = true
}
}
}
})
}
//region 列表渲染
onRenderItemList(node: any, idx: number) {
if(!isValid(node)) {return}
if (!node.inited) {
node.inited = true;
Utils.parseNode(node);
}
//翻到底部加载下一页
if (idx >= this.huiyiDataList.length-1) {
this.getNextPage()
}
}
//刷新单个节点
private refreshHuiyiCell(hyItem:any, idx:number) {
}
}