diff --git a/dimensionhub/Views/DetailView.swift b/dimensionhub/Views/DetailView.swift index 2bfb1ed..e732844 100644 --- a/dimensionhub/Views/DetailView.swift +++ b/dimensionhub/Views/DetailView.swift @@ -82,37 +82,57 @@ struct DetailView: View { var body: some View { VStack(alignment: .center) { - VStack(alignment: .leading, spacing: 20) { + VStack(alignment: .leading, spacing: 10) { Text(detailModel.name) - .font(.system(size: 30)) + .font(.system(size: 28)) .fontWeight(.bold) + .foregroundColor(Color(hex: "#333333")) HStack(alignment: .center, spacing: 0) { ForEach(Array(detailModel.voiceActors.enumerated()), id: \.offset) { index, actor in if index > 0 { Text("、") + .font(.system(size: 13)) + .foregroundColor(Color(hex: "#999999")) } Text(actor.name) - .font(.system(size: 16)) + .font(.system(size: 13)) + .foregroundColor(Color(hex: "#999999")) } Text("等") + .font(.system(size: 13)) + .foregroundColor(Color(hex: "#999999")) + Spacer() } } - .background(Color.yellow) + .padding([.top, .leading], 10) + .background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.bottom]) HStack { Spacer() switch detailModel.status { case 0: - Text("补完") + FollowButtonView(title: "补完", bgColor: .black, fontColor: .white) { + + } case 1: - Text("追番") + FollowButtonView(title: "追番", bgColor: .black, fontColor: .white) { + + } case 2: - Text("前排站位") + FollowButtonView(title: "前排站位", bgColor: .black, fontColor: .white) { + + } + case 3: + FollowButtonView(title: "弃番", bgColor: .black, fontColor: .white) { + + } default: - Text("追番") + FollowButtonView(title: "追番", bgColor: .white, fontColor: Color(hex: "#333333")) { + + } } } @@ -120,15 +140,16 @@ struct DetailView: View { HStack(alignment: .center, spacing: 15) { ForEach(Array(detailModel.channels.enumerated()), id: \.offset) { idx, channel in Text(channel.name) - .font(.system(size: 16)) - .foregroundColor(idx == detailModel.selectedChannelIdx ? .blue : .black) + .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) { @@ -141,10 +162,21 @@ struct DetailView: View { } .frame(width: 90, height: 70) .overlay { - Text(episode.numName) + VStack { + HStack { + Text(episode.numName) + .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) @@ -155,20 +187,23 @@ struct DetailView: View { HStack(alignment: .center) { NavigationLink(destination: ListView()) { Rectangle() - .frame(width: 180, height: 50) - .foregroundColor(Color.yellow) - .cornerRadius(10) + .frame(width: 200, height: 25) + .foregroundColor(Color(hex: "#F2F2F2")) + //.cornerRadius(5) .overlay { - RoundedRectangle(cornerRadius: 10) - .stroke(Color.black, lineWidth: 1) +// RoundedRectangle(cornerRadius: 5) +// .stroke(Color.black, lineWidth: 1) + Text("展开全部剧集") + .font(.system(size: 13)) + .foregroundColor(Color(hex: "#999999")) + .fontWeight(.regular) } } } Spacer() } - .border(Color.red) .frame(width: 370, alignment: .center) .task { await detailModel.loadData(dramaId: 124) @@ -178,6 +213,36 @@ struct DetailView: View { } +extension DetailView { + + struct FollowButtonView: View { + let title: String + let bgColor: Color + let fontColor: Color + let onTap: () -> Void + + var body: some View { + Rectangle() + .frame(width: 140, height: 40) + .foregroundColor(bgColor) + .cornerRadius(5) + .overlay { + RoundedRectangle(cornerRadius: 5) + .stroke(Color.black, lineWidth: 1) + + Text(title) + .font(.system(size: 13)) + .foregroundColor(fontColor) + .fontWeight(.regular) + } + .onTapGesture { + onTap() + } + } + } + +} + #Preview { DetailView() }