fix
This commit is contained in:
parent
eecee74af2
commit
46bf943d4c
@ -62,7 +62,7 @@ struct IndexMainView: View {
|
|||||||
|
|
||||||
ScrollView(.vertical, showsIndicators: false) {
|
ScrollView(.vertical, showsIndicators: false) {
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.frame(width: 0, height: 10)
|
.frame(width: 0, height: 38)
|
||||||
|
|
||||||
// 基于日期的更新列表
|
// 基于日期的更新列表
|
||||||
LazyVStack(alignment: .center, spacing: 10) {
|
LazyVStack(alignment: .center, spacing: 10) {
|
||||||
@ -130,6 +130,14 @@ struct IndexMainView: View {
|
|||||||
}
|
}
|
||||||
.padding([.top, .bottom], 8)
|
.padding([.top, .bottom], 8)
|
||||||
.background(.white)
|
.background(.white)
|
||||||
|
.background(
|
||||||
|
GeometryReader { geometry in
|
||||||
|
Color.clear
|
||||||
|
.onAppear {
|
||||||
|
print("hstack height is: \(geometry.size.height)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.ignoresSafeArea(edges: .bottom)
|
.ignoresSafeArea(edges: .bottom)
|
||||||
|
|||||||
@ -62,6 +62,7 @@ final class IndexModel {
|
|||||||
// 保存原始的更新数据
|
// 保存原始的更新数据
|
||||||
var updateDramaGroups: [UpdateDramaGroup] = []
|
var updateDramaGroups: [UpdateDramaGroup] = []
|
||||||
|
|
||||||
|
// 转换后的数据, 方便在一次循环中展示数据
|
||||||
var dramaGroupElements: [GroupElement] = []
|
var dramaGroupElements: [GroupElement] = []
|
||||||
|
|
||||||
var follow_num: String = "0"
|
var follow_num: String = "0"
|
||||||
@ -100,17 +101,16 @@ final class IndexModel {
|
|||||||
switch self.dramaGroupElements[scrollID] {
|
switch self.dramaGroupElements[scrollID] {
|
||||||
case .label(_, _):
|
case .label(_, _):
|
||||||
()
|
()
|
||||||
case .item(let groupId, let item):
|
case .item(let groupId, _):
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.setFixedDrameGroup(groupId: groupId)
|
self.setFixedDrameGroup(groupId: groupId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断更新周期
|
// 判断更新周期
|
||||||
let ids = self.getDramaIds(self.updateDramaGroups).suffix(6)
|
|
||||||
let timeDistance = self.updateInterval.distance(to: Date())
|
let timeDistance = self.updateInterval.distance(to: Date())
|
||||||
// 滑动停止的时候,检测是否到达了底部
|
// 滑动停止的时候,检测是否到达了底部
|
||||||
if timeDistance > 1.0 && ids.contains(scrollID) {
|
if timeDistance > 1.0 && self.dramaGroupElements.count - scrollID < 6 {
|
||||||
Task {
|
Task {
|
||||||
await self.loadMoreUpdateDramasTask(userId: userId, mode: .next)
|
await self.loadMoreUpdateDramasTask(userId: userId, mode: .next)
|
||||||
}
|
}
|
||||||
@ -223,6 +223,12 @@ final class IndexModel {
|
|||||||
groupElements.append(.item(group.group_id, item))
|
groupElements.append(.item(group.group_id, item))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 第一元素不显示
|
||||||
|
if groupElements.count > 0 {
|
||||||
|
groupElements.removeFirst()
|
||||||
|
}
|
||||||
|
|
||||||
return groupElements
|
return groupElements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user