This commit is contained in:
anlicheng 2025-03-03 22:20:59 +08:00
parent 466ff8e387
commit 085ed309d9
2 changed files with 98 additions and 83 deletions

View File

@ -160,6 +160,7 @@ struct DetailView: View {
.foregroundColor(Color(hex: "#333333")) .foregroundColor(Color(hex: "#333333"))
Spacer() Spacer()
} }
if showAllSummary { if showAllSummary {
Text(detailModel.summary) Text(detailModel.summary)
.lineLimit(nil) .lineLimit(nil)
@ -183,9 +184,10 @@ struct DetailView: View {
} }
} }
} }
.padding([.top, .leading], 10) .padding(10)
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.bottom]) .background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.top])
VStack(alignment: .center) {
HStack(alignment: .center, spacing: 10) { HStack(alignment: .center, spacing: 10) {
Spacer() Spacer()
ForEach(detailModel.statuses, id: \.status) { status in ForEach(detailModel.statuses, id: \.status) { status in
@ -220,41 +222,12 @@ struct DetailView: View {
// //
ScrollView(.horizontal, showsIndicators: false) { ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center) { LazyHStack(alignment: .center) {
ForEach(detailModel.selectedEpisodes) { episode in ForEach(detailModel.selectedEpisodes) { episode in
VStack(alignment: .center) { EpisodeView(episode: episode)
AsyncImage(url: URL(string: episode.thumb)) { image in
image.resizable()
} placeholder: {
ProgressView()
}
.frame(width: 90, height: 70)
.overlay {
VStack {
HStack {
Text(episode.num_name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
Spacer()
}
Spacer()
}
.padding([.top, .leading], 8)
}
Text(episode.name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
}
.frame(width: 90, height: 120)
.onTapGesture {
if let playUrl = URL(string: episode.play) {
UIApplication.shared.open(playUrl)
}
}
} }
} }
.frame(height: 100)
} }
if detailModel.selectedEpisodes.count >= 5 { if detailModel.selectedEpisodes.count >= 5 {
@ -276,6 +249,7 @@ struct DetailView: View {
Spacer() Spacer()
} }
.frame(width: 370, alignment: .center) .frame(width: 370, alignment: .center)
}
.alert(isPresented: $showAlert) { .alert(isPresented: $showAlert) {
Alert(title: Text(self.errorInfo.0), message: Text(self.errorInfo.1), dismissButton: .default(Text("OK"))) Alert(title: Text(self.errorInfo.0), message: Text(self.errorInfo.1), dismissButton: .default(Text("OK")))
} }
@ -312,6 +286,47 @@ extension DetailView {
} }
} }
struct EpisodeView: View {
let episode: DetailModel.Episode
var body: some View {
VStack(alignment: .center) {
AsyncImage(url: URL(string: episode.thumb)) { image in
image
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 90, height: 70)
.clipped()
} placeholder: {
ProgressView()
}
.overlay {
VStack {
HStack {
Text(episode.num_name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
Spacer()
}
Spacer()
}
.padding([.top, .leading], 8)
}
Text(episode.name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
}
.frame(width: 90)
.onTapGesture {
if let playUrl = URL(string: episode.play) {
UIApplication.shared.open(playUrl)
}
}
}
}
} }
#Preview { #Preview {

View File

@ -276,7 +276,7 @@ extension IndexView {
@State private var showDateNavPopover: Bool = false @State private var showDateNavPopover: Bool = false
var body: some View { var body: some View {
VStack { VStack(alignment: .center) {
HStack(alignment: .center) { HStack(alignment: .center) {
Color.clear Color.clear