fix
This commit is contained in:
parent
283c3ae78a
commit
7255bb3c5a
@ -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,12 +382,16 @@ extension IndexView {
|
|||||||
HStack {
|
HStack {
|
||||||
Text("🔍")
|
Text("🔍")
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(indexModel.fixedGroupName)
|
if let fixedDramaGroup = indexModel.fixedDramaGroup {
|
||||||
.font(.system(size: 18))
|
Text(fixedDramaGroup.group_name)
|
||||||
.fontWeight(.regular)
|
.font(.system(size: 18))
|
||||||
.onTapGesture {
|
.fontWeight(.regular)
|
||||||
print("call me here")
|
.onTapGesture {
|
||||||
}
|
selectGroupId = fixedDramaGroup.group_id
|
||||||
|
indexModel.selectedDate = fixedDramaGroup.group_id
|
||||||
|
showDateNavPopover = true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.padding(8)
|
.padding(8)
|
||||||
.background(.white)
|
.background(.white)
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user