diff --git a/dimensionhub/Core/API.swift b/dimensionhub/Core/API.swift index ea60dd1..28cad0d 100644 --- a/dimensionhub/Core/API.swift +++ b/dimensionhub/Core/API.swift @@ -77,11 +77,13 @@ struct API { do { let (data, response) = try await URLSession.shared.data(for: request) guard let response = response as? HTTPURLResponse, response.statusCode == 200 else { + print("url: \(request.url!.absoluteString)") + // print(String(data: data, encoding: .utf8)!) return .error(-1, "http status error") } - let x = String(data: data, encoding: .utf8)! - print("url: \(request.url!.path()), data is: \(x)") +// let x = String(data: data, encoding: .utf8)! +// print("url: \(request.url!.path()), data is: \(x)") do { let result = try JSONDecoder().decode(APISuccessResponse.self, from: data) return .result(result.result) diff --git a/dimensionhub/Views/DetailView.swift b/dimensionhub/Views/DetailView.swift index 23ce14c..4045c74 100644 --- a/dimensionhub/Views/DetailView.swift +++ b/dimensionhub/Views/DetailView.swift @@ -90,6 +90,8 @@ final class DetailModel { print(message) case .result(let detail): self.name = detail.name + self.summary = detail.summary + self.thumb = detail.thumb self.statuses = detail.status.flatMap({ s in if let status = DramaStatus(s) { return [status] @@ -123,18 +125,24 @@ struct DetailView: View { .font(.system(size: 28)) .fontWeight(.bold) .foregroundColor(Color(hex: "#333333")) + + Text(detailModel.summary) + .lineLimit(3) + .multilineTextAlignment(.leading) + .padding() + //.frame(maxWidth: .infinity, alignment: .leading) } .padding([.top, .leading], 10) .background(Color(hex: "#F2F2F2"), ignoresSafeAreaEdges: [.bottom]) -// HStack(alignment: .center, spacing: 10) { -// Spacer() -// ForEach(detailModel.statuses, id: \.status) { status in -// FollowButtonView(title: status.config.name, bgColor: status.config.bgColor, fontColor: status.config.fontColor) { -// print("call me follow button clicked") -// } -// } -// } + HStack(alignment: .center, spacing: 10) { + Spacer() + ForEach(detailModel.statuses, id: \.status) { status in + FollowButtonView(title: status.config.name, bgColor: status.config.bgColor, fontColor: status.config.fontColor) { + print("call me follow button clicked") + } + } + } // 渠道列表 HStack(alignment: .center, spacing: 15) { @@ -203,6 +211,7 @@ struct DetailView: View { .frame(width: 370, alignment: .center) .task { await detailModel.loadData(userId: 1, id: self.id) + print(detailModel.summary) } } diff --git a/dimensionhub/Views/ListView.swift b/dimensionhub/Views/ListView.swift index c2cdbd6..346d3dc 100644 --- a/dimensionhub/Views/ListView.swift +++ b/dimensionhub/Views/ListView.swift @@ -54,6 +54,8 @@ final class ListModel { print(message) case .result(let detail): self.name = detail.name + self.summary = detail.summary + self.thumb = detail.thumb self.channels = detail.channels self.selectedChannelIdx = 0