OOMeetingPersonCell.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // OOMeetingPersonCell.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2018/1/29.
  6. // Copyright © 2018年 zone. All rights reserved.
  7. //
  8. import UIKit
  9. class OOMeetingPersonCell: UICollectionViewCell,Configurable {
  10. @IBOutlet weak var iconImageView: UIImageView!
  11. @IBOutlet weak var nameLabel: UILabel!
  12. @IBOutlet weak var activityContainerView: UIVisualEffectView!
  13. @IBOutlet weak var deleteButton: UIButton!
  14. var viewModel:OOMeetingCreateViewModel?
  15. private var model:OOPersonModel?
  16. override func awakeFromNib() {
  17. super.awakeFromNib()
  18. // Initialization code
  19. }
  20. // @IBAction func delectPersonAction(_ sender: UIButton) {
  21. // print("delectPersonAction")
  22. // //发送需要删除的p
  23. //
  24. // }
  25. func config(withItem item: Any?) {
  26. guard let p = item as? OOPersonModel else {
  27. return
  28. }
  29. self.setupModel(p: p)
  30. }
  31. func setupModel(p: OOPersonModel, ishiddenDelBtn: Bool = false) {
  32. deleteButton.isHidden = ishiddenDelBtn
  33. nameLabel.text = p.name
  34. viewModel?.getIconOfPerson(p, compeletionBlock: { (iconImage, errMSg) in
  35. self.activityContainerView.alpha = 0
  36. if let errMSG = errMSg {
  37. if p.genderType == "f" {
  38. self.iconImageView.image = #imageLiteral(resourceName: "icon_men")
  39. }else {
  40. self.iconImageView.image = #imageLiteral(resourceName: "icon_women")
  41. }
  42. print(errMSG)
  43. }else{
  44. self.iconImageView.image = iconImage
  45. }
  46. })
  47. }
  48. }