This commit is contained in:
anlicheng 2025-04-14 17:20:26 +08:00
parent 98265c72d6
commit 8517c5afc3
3 changed files with 7 additions and 33 deletions

View File

@ -113,6 +113,7 @@ struct IndexMainView: View {
}
Spacer()
if let fixedDramaGroup = indexModel.fixedDramaGroup {
Text(fixedDramaGroup.group_name)
.font(.system(size: 18))

View File

@ -87,17 +87,17 @@ final class IndexModel {
var scrollIDPublisher = PassthroughSubject<(String, Int), Never>()
@ObservationIgnored
private var bag = Set<AnyCancellable>()
private var cancel: AnyCancellable?
init() {
self.selectedDate = ""
self.scrollIDPublisher
self.cancel = self.scrollIDPublisher
.sink { userId, scrollID in
self.dramaGroupElements.forEach { element in
switch element {
case .label(let groupId, let groupName):
case .label(_, _):
()
case .item(let groupId, let item):
if item.id == scrollID {
@ -108,16 +108,8 @@ final class IndexModel {
}
}
let ids = self.dramaGroupElements.suffix(6).compactMap { element -> Int? in
switch element {
case .label(_, _):
return nil
case .item(groupId: _, item: let item):
return item.id
}
}
//
let ids = self.getDramaIds(self.updateDramaGroups).suffix(6)
let timeDistance = self.updateInterval.distance(to: Date())
//
if timeDistance > 1.0 && ids.contains(scrollID) {
@ -127,7 +119,6 @@ final class IndexModel {
self.updateInterval = Date()
}
}
.store(in: &bag)
}
func loadData(userId: String) async {

View File

@ -62,25 +62,7 @@ extension ListView {
var body: some View {
HStack(alignment: .center) {
AsyncImage(url: URL(string: episode.thumb)) { phase in
switch phase {
case .empty:
ProgressView()
case .success(let image):
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 90, height: 60)
.clipped()
default:
Image("ph_img_medium")
.resizable()
.aspectRatio(contentMode: .fill)
.clipped()
}
}
FlexImage(urlString: episode.thumb, width: 90, height: 60, placeholder: "ph_img_medium")
.frame(width: 90, height: 60)
VStack(alignment: .leading, spacing: 20) {