fix index
This commit is contained in:
parent
33eecfcfcb
commit
d785eef3df
@ -212,7 +212,6 @@ struct IndexView: View {
|
||||
}
|
||||
|
||||
// 基于日期的更新列表
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack(alignment: .center, spacing: 10) {
|
||||
ForEach(indexModel.showUpdateDramas, id: \.id) { drama in
|
||||
@ -230,30 +229,32 @@ struct IndexView: View {
|
||||
}
|
||||
}
|
||||
case .item(let item):
|
||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||
image.resizable()
|
||||
} placeholder: {
|
||||
ProgressView()
|
||||
}
|
||||
.frame(width: 370, height: 180)
|
||||
.overlay {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(item.name)
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
NavigationLink(destination: DetailView(id: item.id)) {
|
||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||
image.resizable()
|
||||
} placeholder: {
|
||||
ProgressView()
|
||||
}
|
||||
.frame(width: 370, height: 180)
|
||||
.overlay {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(item.name)
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
|
||||
Text(item.status)
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
Text(item.status)
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.lineLimit(1)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
.padding([.top, .leading], 10)
|
||||
}
|
||||
.padding([.top, .leading], 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,22 +312,6 @@ struct IndexView: View {
|
||||
//print(userModel)
|
||||
}
|
||||
}
|
||||
|
||||
private func addItem() {
|
||||
// withAnimation {
|
||||
// let newItem = Item(timestamp: Date())
|
||||
// modelContext.insert(newItem)
|
||||
// }
|
||||
}
|
||||
|
||||
private func deleteItems(offsets: IndexSet) {
|
||||
// withAnimation {
|
||||
// for index in offsets {
|
||||
// modelContext.delete(items[index])
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension IndexView {
|
||||
@ -385,44 +370,6 @@ extension IndexView {
|
||||
|
||||
}
|
||||
|
||||
extension IndexView {
|
||||
|
||||
struct UpdateDramaCellView: View {
|
||||
let showItem: IndexModel.UpdateDramaShowItem
|
||||
@Binding var showDateNavPopover: Bool
|
||||
|
||||
var body: some View {
|
||||
switch showItem.element {
|
||||
case .group(let group):
|
||||
Text(group.group_name)
|
||||
.onTapGesture {
|
||||
showDateNavPopover = true
|
||||
}
|
||||
case .item(let item):
|
||||
VStack(alignment: .center) {
|
||||
AsyncImage(url: URL(string: item.thumb)) { image in
|
||||
image.resizable()
|
||||
} placeholder: {
|
||||
ProgressView()
|
||||
}
|
||||
.frame(width: 80, height: 80)
|
||||
.overlay {
|
||||
VStack(alignment: .leading) {
|
||||
Text(item.name)
|
||||
.lineLimit(1)
|
||||
|
||||
Text(item.status)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: 100, height: 120)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#Preview {
|
||||
IndexView()
|
||||
.modelContainer(for: Item.self, inMemory: true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user