Commit 5b48154b authored by Steven杜宇's avatar Steven杜宇

// 动态

parent 77eef111
...@@ -392,7 +392,7 @@ class YHCirclePublishViewController: YHBaseViewController { ...@@ -392,7 +392,7 @@ class YHCirclePublishViewController: YHBaseViewController {
// 调用你的发布接口 // 调用你的发布接口
YHHUD.show(.progress(message: "发布中...")) YHHUD.show(.progress(message: "发布中..."))
viewModel.publishCircle(title, content, resources: resources) { [weak self] success, error in viewModel.publishCircle(self.circleId, title, content, resources: resources) { [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
YHHUD.hide() YHHUD.hide()
if let success = success, !success.isEmpty { if let success = success, !success.isEmpty {
......
...@@ -109,7 +109,11 @@ class YHCircleMediaCell: UICollectionViewCell { ...@@ -109,7 +109,11 @@ class YHCircleMediaCell: UICollectionViewCell {
} }
private func configureForImage(_ mediaItem: YHSelectMediaItem) { private func configureForImage(_ mediaItem: YHSelectMediaItem) {
imageView.image = mediaItem.image if let url = mediaItem.imageURL {
imageView.sd_setImage(with: url, placeholderImage: UIImage(named: "global_default_image"), context: nil)
} else {
imageView.image = mediaItem.image
}
playIcon.isHidden = true playIcon.isHidden = true
durationLabel.isHidden = true durationLabel.isHidden = true
} }
......
...@@ -118,10 +118,12 @@ extension YHNameCardDynamicViewController: UITableViewDelegate, UITableViewDataS ...@@ -118,10 +118,12 @@ extension YHNameCardDynamicViewController: UITableViewDelegate, UITableViewDataS
} }
var arr: [YHSelectMediaItem] = [] var arr: [YHSelectMediaItem] = []
for url in model.resource_urls { for model in model.resource_urls {
let item = YHSelectMediaItem() let item = YHSelectMediaItem()
item.type = YHMediaType.image item.type = YHMediaType.image
item.resourceURL = url item.imageURL = URL(string: model.url)
item.uploadState = .success
item.resourceURL = model
arr.append(item) arr.append(item)
} }
let publishVC = YHCirclePublishViewController(currentUser: user, id: model.id, mediaItems: arr, title: model.title, content: model.content) let publishVC = YHCirclePublishViewController(currentUser: user, id: model.id, mediaItems: arr, title: model.title, content: model.content)
......
...@@ -109,8 +109,9 @@ extension YHDynamicViewModel { ...@@ -109,8 +109,9 @@ extension YHDynamicViewModel {
/// - content: 内容 /// - content: 内容
/// - resources:图片/视频数组 /// - resources:图片/视频数组
/// - callBackBlock: 回调 /// - callBackBlock: 回调
func publishCircle(_ title: String, _ content: String, resources: [YHResourceURLs], callBackBlock: @escaping (_ success: String?, _ error: YHErrorModel?) -> Void) { func publishCircle(_ id: String?, _ title: String, _ content: String, resources: [YHResourceURLs], callBackBlock: @escaping (_ success: String?, _ error: YHErrorModel?) -> Void) {
var params: [String: Any] = ["title": title, "content": content] var params: [String: Any] = ["title": title, "content": content]
params["id"] = id
params["resource_urls"] = resources.map { resource in params["resource_urls"] = resources.map { resource in
[ [
"name": resource.name, "name": resource.name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment