OOMeetingAcceptCell.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // OOMeetingAcceptCell.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2018/1/22.
  6. // Copyright © 2018年 zone. All rights reserved.
  7. //
  8. import UIKit
  9. class OOMeetingAcceptCell: UITableViewCell,Configurable {
  10. @IBOutlet weak var timeInternal: UILabel!
  11. @IBOutlet weak var titleLabel: UILabel!
  12. @IBOutlet weak var roomNameLabel: UILabel!
  13. @IBOutlet weak var personsLabel: UILabel!
  14. @IBOutlet weak var editButton: UIButton!
  15. var viewModel:OOMeetingAcceptViewModel?
  16. override func awakeFromNib() {
  17. super.awakeFromNib()
  18. // Initialization code
  19. }
  20. override func setSelected(_ selected: Bool, animated: Bool) {
  21. super.setSelected(selected, animated: animated)
  22. // Configure the view for the selected state
  23. }
  24. func config(withItem item: Any?) {
  25. guard let model = item as? OOMeetingInfo else {
  26. return
  27. }
  28. //时间段
  29. let startTime = Date.date(model.startTime ?? "", formatter: "yyyy-MM-dd HH:mm:ss")
  30. let endTime = Date.date(model.completedTime ?? "", formatter: "yyyy-MM-dd HH:mm:ss")
  31. if startTime != nil && endTime != nil {
  32. let formatter = DateFormatter()
  33. formatter.dateFormat = "HH:mm"
  34. let sDate = startTime!.formatterDate(formatter: "yyyy-MM-dd")
  35. let sTime = formatter.string(from: startTime!)
  36. let eTime = formatter.string(from: endTime!)
  37. timeInternal.text = "\(sDate) (\(sTime) 至 \(eTime))"
  38. if startTime!.timeIntervalSince1970 < Date().timeIntervalSince1970 {
  39. self.timeInternal.textColor = UIColor(hex: "#999999")
  40. }else{
  41. self.timeInternal.theme_textColor = ThemeColorPicker(keyPath: "Base.base_color")
  42. }
  43. }
  44. titleLabel.text = model.subject
  45. viewModel?.loadMeetingRoomById(model.room!, completed: { (roomResult) in
  46. guard let itemRoom = roomResult else{
  47. self.roomNameLabel.text = "未知会议室"
  48. return
  49. }
  50. self.roomNameLabel.text = itemRoom.name
  51. })
  52. let persons = model.invitePersonList?.map({ (p) -> String in
  53. return String(p.split(separator: "@")[0])
  54. }).joined(separator: ",")
  55. personsLabel.text = persons
  56. }
  57. }