fix
This commit is contained in:
parent
283c3ae78a
commit
7255bb3c5a
@ -57,7 +57,7 @@ final class IndexModel {
|
||||
var follow_num: String = "0"
|
||||
|
||||
// 用来显示固定栏目的group_name
|
||||
var fixedGroupName: String = ""
|
||||
var fixedDramaGroup: UpdateDramaGroup? = nil
|
||||
|
||||
@ObservationIgnored
|
||||
private var isLoaded = false
|
||||
@ -78,6 +78,7 @@ final class IndexModel {
|
||||
print("index load data get error_code: \(code), message: \(message)")
|
||||
case .result(let result):
|
||||
self.updateDramaGroups = result.update_dramas
|
||||
self.fixedDramaGroup = result.update_dramas.first
|
||||
self.follow_num = result.follow_num >= 100 ? "99+" : "\(result.follow_num)"
|
||||
}
|
||||
self.isLoaded = true
|
||||
@ -381,11 +382,15 @@ extension IndexView {
|
||||
HStack {
|
||||
Text("🔍")
|
||||
Spacer()
|
||||
Text(indexModel.fixedGroupName)
|
||||
if let fixedDramaGroup = indexModel.fixedDramaGroup {
|
||||
Text(fixedDramaGroup.group_name)
|
||||
.font(.system(size: 18))
|
||||
.fontWeight(.regular)
|
||||
.onTapGesture {
|
||||
print("call me here")
|
||||
selectGroupId = fixedDramaGroup.group_id
|
||||
indexModel.selectedDate = fixedDramaGroup.group_id
|
||||
showDateNavPopover = true
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(8)
|
||||
@ -431,7 +436,7 @@ extension IndexView {
|
||||
geometry in
|
||||
Color.clear.onChange(of: geometry.frame(in: .named("indexScrollView")).minY) {_, y in
|
||||
if abs(y) <= 5 {
|
||||
model.fixedGroupName = group.group_name
|
||||
model.fixedDramaGroup = group
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user