This commit is contained in:
anlicheng 2025-03-03 23:16:29 +08:00
parent e1cc10c399
commit efe9de8b5e
3 changed files with 65 additions and 39 deletions

View File

@ -294,7 +294,7 @@ extension DetailView {
AsyncImage(url: URL(string: episode.thumb)) { image in AsyncImage(url: URL(string: episode.thumb)) { image in
image image
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fill)
.frame(width: 90, height: 70) .frame(width: 90, height: 70)
.clipped() .clipped()
} placeholder: { } placeholder: {

View File

@ -390,8 +390,7 @@ extension IndexView {
AsyncImage(url: URL(string: item.thumb)) { image in AsyncImage(url: URL(string: item.thumb)) { image in
image image
.resizable() .resizable()
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fill)
.frame(width: geometry.frame(in: .local).width, height: 80)
.clipped() .clipped()
} placeholder: { } placeholder: {
ProgressView() ProgressView()
@ -450,23 +449,34 @@ extension IndexView {
ForEach(group.items, id: \.id) { item in ForEach(group.items, id: \.id) { item in
NavigationLink(destination: DetailView(id: item.id)) { NavigationLink(destination: DetailView(id: item.id)) {
AsyncImage(url: URL(string: item.thumb)) { image in AsyncImage(url: URL(string: item.thumb)) { image in
image.resizable() image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 370, height: 180)
.clipped()
} placeholder: { } placeholder: {
ProgressView() ProgressView()
} }
.frame(width: 370, height: 180) .frame(width: 370, height: 180)
.overlay { .overlay {
HStack { HStack {
VStack(alignment: .leading, spacing: 8) { VStack {
Text(item.name) VStack(alignment: .leading, spacing: 8) {
.font(.system(size: 16)) Text(item.name)
.foregroundColor(Color(hex: "#333333")) .font(.system(size: 16))
.lineLimit(1) .foregroundColor(.white)
.lineLimit(1)
Text(item.status)
.font(.system(size: 12)) Text(item.status)
.foregroundColor(Color(hex: "#333333")) .font(.system(size: 12))
.lineLimit(1) .foregroundColor(.white)
.lineLimit(1)
}
.padding(5)
.background(
Color.black.opacity(0.6)
)
.cornerRadius(5)
Spacer() Spacer()
} }

View File

@ -109,31 +109,7 @@ struct ListView: View {
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
LazyVStack(alignment: .center, spacing: 15) { LazyVStack(alignment: .center, spacing: 15) {
ForEach(detailModel.selectedEpisodes) { episode in ForEach(detailModel.selectedEpisodes) { episode in
HStack(alignment: .center) { EpisodeView(episode: episode)
AsyncImage(url: URL(string: episode.thumb)) { image in
image.resizable()
} placeholder: {
ProgressView()
}
.frame(width: 90, height: 60)
VStack(alignment: .leading, spacing: 20) {
Text(episode.num_name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
Text(episode.name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
}
Spacer()
}
.onTapGesture {
if let playUrl = URL(string: episode.play) {
UIApplication.shared.open(playUrl)
}
}
} }
} }
} }
@ -165,6 +141,46 @@ struct ListView: View {
} }
extension ListView {
struct EpisodeView: View {
let episode: ListModel.Episode
var body: some View {
HStack(alignment: .center) {
AsyncImage(url: URL(string: episode.thumb)) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 90, height: 60)
.clipped()
} placeholder: {
ProgressView()
}
.frame(width: 90, height: 60)
VStack(alignment: .leading, spacing: 20) {
Text(episode.num_name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
Text(episode.name)
.font(.system(size: 12))
.foregroundColor(Color(hex: "#333333"))
.lineLimit(1)
}
Spacer()
}
.onTapGesture {
if let playUrl = URL(string: episode.play) {
UIApplication.shared.open(playUrl)
}
}
}
}
}
#Preview { #Preview {
ListView(id: 19625) ListView(id: 19625)
} }