fix
This commit is contained in:
parent
466ff8e387
commit
085ed309d9
@ -160,6 +160,7 @@ struct DetailView: View {
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
Spacer()
|
||||
}
|
||||
|
||||
if showAllSummary {
|
||||
Text(detailModel.summary)
|
||||
.lineLimit(nil)
|
||||
@ -183,99 +184,72 @@ struct DetailView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding([.top, .leading], 10)
|
||||
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.bottom])
|
||||
.padding(10)
|
||||
.background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.top])
|
||||
|
||||
HStack(alignment: .center, spacing: 10) {
|
||||
Spacer()
|
||||
ForEach(detailModel.statuses, id: \.status) { status in
|
||||
FollowButtonView(dramaStatus: status) { followStatus in
|
||||
Task {
|
||||
let result = await detailModel.onTapFollowButton(userId: self.userId, id: id, status: followStatus)
|
||||
switch result {
|
||||
case .success:
|
||||
()
|
||||
case .error(let title, let message):
|
||||
self.errorInfo = (title, message)
|
||||
self.showAlert = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 渠道列表
|
||||
HStack(alignment: .center, spacing: 15) {
|
||||
ForEach(Array(detailModel.channels.enumerated()), id: \.offset) { idx, channel in
|
||||
Text(channel.name)
|
||||
.font(.system(size: 13))
|
||||
.foregroundColor(idx == detailModel.selectedChannelIdx ? Color(hex: "#169BD5") : Color(hex: "#666666"))
|
||||
.onTapGesture {
|
||||
detailModel.toggleChannel(channelIdx: idx)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding(.leading, 10)
|
||||
|
||||
// 渠道相关的数据列表
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(alignment: .center) {
|
||||
ForEach(detailModel.selectedEpisodes) { episode in
|
||||
VStack(alignment: .center) {
|
||||
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()
|
||||
VStack(alignment: .center) {
|
||||
HStack(alignment: .center, spacing: 10) {
|
||||
Spacer()
|
||||
ForEach(detailModel.statuses, id: \.status) { status in
|
||||
FollowButtonView(dramaStatus: status) { followStatus in
|
||||
Task {
|
||||
let result = await detailModel.onTapFollowButton(userId: self.userId, id: id, status: followStatus)
|
||||
switch result {
|
||||
case .success:
|
||||
()
|
||||
case .error(let title, let message):
|
||||
self.errorInfo = (title, message)
|
||||
self.showAlert = true
|
||||
}
|
||||
.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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if detailModel.selectedEpisodes.count >= 5 {
|
||||
HStack(alignment: .center) {
|
||||
NavigationLink(destination: ListView(id: self.id)) {
|
||||
Rectangle()
|
||||
.frame(width: 200, height: 25)
|
||||
.foregroundColor(Color(hex: "#F2F2F2"))
|
||||
.overlay {
|
||||
Text("展开全部剧集")
|
||||
.font(.system(size: 13))
|
||||
.foregroundColor(Color(hex: "#999999"))
|
||||
.fontWeight(.regular)
|
||||
// 渠道列表
|
||||
HStack(alignment: .center, spacing: 15) {
|
||||
ForEach(Array(detailModel.channels.enumerated()), id: \.offset) { idx, channel in
|
||||
Text(channel.name)
|
||||
.font(.system(size: 13))
|
||||
.foregroundColor(idx == detailModel.selectedChannelIdx ? Color(hex: "#169BD5") : Color(hex: "#666666"))
|
||||
.onTapGesture {
|
||||
detailModel.toggleChannel(channelIdx: idx)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.padding(.leading, 10)
|
||||
|
||||
Spacer()
|
||||
// 渠道相关的数据列表
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
LazyHStack(alignment: .center) {
|
||||
ForEach(detailModel.selectedEpisodes) { episode in
|
||||
EpisodeView(episode: episode)
|
||||
}
|
||||
}
|
||||
.frame(height: 100)
|
||||
}
|
||||
|
||||
if detailModel.selectedEpisodes.count >= 5 {
|
||||
HStack(alignment: .center) {
|
||||
NavigationLink(destination: ListView(id: self.id)) {
|
||||
Rectangle()
|
||||
.frame(width: 200, height: 25)
|
||||
.foregroundColor(Color(hex: "#F2F2F2"))
|
||||
.overlay {
|
||||
Text("展开全部剧集")
|
||||
.font(.system(size: 13))
|
||||
.foregroundColor(Color(hex: "#999999"))
|
||||
.fontWeight(.regular)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(width: 370, alignment: .center)
|
||||
}
|
||||
.frame(width: 370, alignment: .center)
|
||||
.alert(isPresented: $showAlert) {
|
||||
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 {
|
||||
|
||||
@ -276,7 +276,7 @@ extension IndexView {
|
||||
@State private var showDateNavPopover: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
VStack(alignment: .center) {
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Color.clear
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user