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