This commit is contained in:
anlicheng 2025-03-31 17:33:54 +08:00
parent 283c3ae78a
commit 7255bb3c5a

View File

@ -57,7 +57,7 @@ final class IndexModel {
var follow_num: String = "0" var follow_num: String = "0"
// group_name // group_name
var fixedGroupName: String = "" var fixedDramaGroup: UpdateDramaGroup? = nil
@ObservationIgnored @ObservationIgnored
private var isLoaded = false private var isLoaded = false
@ -78,6 +78,7 @@ final class IndexModel {
print("index load data get error_code: \(code), message: \(message)") print("index load data get error_code: \(code), message: \(message)")
case .result(let result): case .result(let result):
self.updateDramaGroups = result.update_dramas self.updateDramaGroups = result.update_dramas
self.fixedDramaGroup = result.update_dramas.first
self.follow_num = result.follow_num >= 100 ? "99+" : "\(result.follow_num)" self.follow_num = result.follow_num >= 100 ? "99+" : "\(result.follow_num)"
} }
self.isLoaded = true self.isLoaded = true
@ -381,11 +382,15 @@ extension IndexView {
HStack { HStack {
Text("🔍") Text("🔍")
Spacer() Spacer()
Text(indexModel.fixedGroupName) if let fixedDramaGroup = indexModel.fixedDramaGroup {
Text(fixedDramaGroup.group_name)
.font(.system(size: 18)) .font(.system(size: 18))
.fontWeight(.regular) .fontWeight(.regular)
.onTapGesture { .onTapGesture {
print("call me here") selectGroupId = fixedDramaGroup.group_id
indexModel.selectedDate = fixedDramaGroup.group_id
showDateNavPopover = true
}
} }
} }
.padding(8) .padding(8)
@ -431,7 +436,7 @@ extension IndexView {
geometry in geometry in
Color.clear.onChange(of: geometry.frame(in: .named("indexScrollView")).minY) {_, y in Color.clear.onChange(of: geometry.frame(in: .named("indexScrollView")).minY) {_, y in
if abs(y) <= 5 { if abs(y) <= 5 {
model.fixedGroupName = group.group_name model.fixedDramaGroup = group
} }
} }
}) })