From 46bf943d4ce24afa30e846f6b369a21758257c43 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Tue, 10 Jun 2025 17:55:05 +0800 Subject: [PATCH] fix --- dimensionhub/Views/Index/IndexMainView.swift | 10 +++++++++- dimensionhub/Views/Index/IndexModel.swift | 12 +++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dimensionhub/Views/Index/IndexMainView.swift b/dimensionhub/Views/Index/IndexMainView.swift index 7f82536..6e5c180 100644 --- a/dimensionhub/Views/Index/IndexMainView.swift +++ b/dimensionhub/Views/Index/IndexMainView.swift @@ -62,7 +62,7 @@ struct IndexMainView: View { ScrollView(.vertical, showsIndicators: false) { Rectangle() - .frame(width: 0, height: 10) + .frame(width: 0, height: 38) // 基于日期的更新列表 LazyVStack(alignment: .center, spacing: 10) { @@ -130,6 +130,14 @@ struct IndexMainView: View { } .padding([.top, .bottom], 8) .background(.white) + .background( + GeometryReader { geometry in + Color.clear + .onAppear { + print("hstack height is: \(geometry.size.height)") + } + } + ) } } .ignoresSafeArea(edges: .bottom) diff --git a/dimensionhub/Views/Index/IndexModel.swift b/dimensionhub/Views/Index/IndexModel.swift index 6905a53..f17cd64 100644 --- a/dimensionhub/Views/Index/IndexModel.swift +++ b/dimensionhub/Views/Index/IndexModel.swift @@ -62,6 +62,7 @@ final class IndexModel { // 保存原始的更新数据 var updateDramaGroups: [UpdateDramaGroup] = [] + // 转换后的数据, 方便在一次循环中展示数据 var dramaGroupElements: [GroupElement] = [] var follow_num: String = "0" @@ -100,17 +101,16 @@ final class IndexModel { switch self.dramaGroupElements[scrollID] { case .label(_, _): () - case .item(let groupId, let item): + case .item(let groupId, _): DispatchQueue.main.async { self.setFixedDrameGroup(groupId: groupId) } } // 判断更新周期 - let ids = self.getDramaIds(self.updateDramaGroups).suffix(6) let timeDistance = self.updateInterval.distance(to: Date()) // 滑动停止的时候,检测是否到达了底部 - if timeDistance > 1.0 && ids.contains(scrollID) { + if timeDistance > 1.0 && self.dramaGroupElements.count - scrollID < 6 { Task { await self.loadMoreUpdateDramasTask(userId: userId, mode: .next) } @@ -223,6 +223,12 @@ final class IndexModel { groupElements.append(.item(group.group_id, item)) } } + + // 第一元素不显示 + if groupElements.count > 0 { + groupElements.removeFirst() + } + return groupElements }