fix
This commit is contained in:
parent
953b4a5a36
commit
283c3ae78a
@ -54,55 +54,39 @@ final class FollowListModel {
|
||||
|
||||
struct FollowListView: View {
|
||||
@AppStorage("userId") private var userId: String = Utils.defaultUserId()
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@State var followModel = FollowListModel()
|
||||
@State var isMoreLoading: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center) {
|
||||
Rectangle()
|
||||
.frame(height: 0)
|
||||
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: .top)
|
||||
.border(.red)
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Color.clear
|
||||
.overlay(alignment: .leading) {
|
||||
HStack(alignment: .center, spacing: 3) {
|
||||
Button(action: {
|
||||
dismiss()
|
||||
}) {
|
||||
|
||||
Image(systemName: "chevron.left")
|
||||
.font(.system(size: 20, weight: .medium))
|
||||
|
||||
Text("番剧补完计划")
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
Group {
|
||||
if followModel.dramas.count > 0 {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack(alignment: .center) {
|
||||
ForEach(followModel.dramas, id: \.id) { drama in
|
||||
DramaCellView(dramaItem: drama)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(height: 50)
|
||||
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: .top)
|
||||
|
||||
if followModel.dramas.count > 0 {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack(alignment: .center) {
|
||||
ForEach(followModel.dramas, id: \.id) { drama in
|
||||
DramaCellView(dramaItem: drama)
|
||||
}
|
||||
} else {
|
||||
VStack {
|
||||
Spacer()
|
||||
Text("这里什么都没有")
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(.black)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VStack {
|
||||
Spacer()
|
||||
Text("这里什么都没有")
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(.black)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.frame(width: 370)
|
||||
}
|
||||
.frame(width: 370)
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
.navigationTitle("番剧补完计划")
|
||||
.task {
|
||||
await self.followModel.loadData(userId: self.userId)
|
||||
}
|
||||
|
||||
@ -56,6 +56,9 @@ final class IndexModel {
|
||||
var updateDramaGroups: [UpdateDramaGroup] = []
|
||||
var follow_num: String = "0"
|
||||
|
||||
// 用来显示固定栏目的group_name
|
||||
var fixedGroupName: String = ""
|
||||
|
||||
@ObservationIgnored
|
||||
private var isLoaded = false
|
||||
|
||||
@ -326,10 +329,11 @@ extension IndexView {
|
||||
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: .top)
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
|
||||
// 基于日期的更新列表
|
||||
LazyVStack(alignment: .center, spacing: 10) {
|
||||
ForEach(indexModel.updateDramaGroups, id: \.group_id) { group in
|
||||
DramaGroupView(group: group) {
|
||||
DramaGroupView(group: group, model: indexModel) {
|
||||
selectGroupId = group.group_id
|
||||
indexModel.selectedDate = group.group_id
|
||||
showDateNavPopover = true
|
||||
@ -373,6 +377,20 @@ extension IndexView {
|
||||
await self.indexModel.loadMoreUpdateDramas(userId: self.userId, mode: .prev)
|
||||
self.isPrevLoading = false
|
||||
}
|
||||
.overlay(alignment: .topTrailing) {
|
||||
HStack {
|
||||
Text("🔍")
|
||||
Spacer()
|
||||
Text(indexModel.fixedGroupName)
|
||||
.font(.system(size: 18))
|
||||
.fontWeight(.regular)
|
||||
.onTapGesture {
|
||||
print("call me here")
|
||||
}
|
||||
}
|
||||
.padding(8)
|
||||
.background(.white)
|
||||
}
|
||||
}
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
.popover(isPresented: $showDateNavPopover) {
|
||||
@ -394,6 +412,8 @@ extension IndexView {
|
||||
// 显示分组信息
|
||||
struct DramaGroupView: View {
|
||||
let group: IndexModel.UpdateDramaGroup
|
||||
let model: IndexModel
|
||||
|
||||
var onTap: () -> Void
|
||||
|
||||
var body: some View {
|
||||
@ -407,6 +427,14 @@ extension IndexView {
|
||||
onTap()
|
||||
}
|
||||
}
|
||||
.background(GeometryReader {
|
||||
geometry in
|
||||
Color.clear.onChange(of: geometry.frame(in: .named("indexScrollView")).minY) {_, y in
|
||||
if abs(y) <= 5 {
|
||||
model.fixedGroupName = group.group_name
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
ForEach(group.items, id: \.id) { item in
|
||||
NavigationLink(destination: DetailView(id: item.id)) {
|
||||
@ -453,6 +481,7 @@ extension IndexView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user