MessageDetailViewController.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // MessageDetailViewController.swift
  3. // MTP2_iOS
  4. //
  5. // Created by Muchinfo on 2020/10/30.
  6. // Copyright © 2020 Muchinfo. All rights reserved.
  7. //
  8. import UIKit
  9. import SwiftyAttributes
  10. /// 公告详情视图容器控制类
  11. class MessageDetailViewController: BaseViewController {
  12. // MARK: - 属性列表
  13. /// 发布日期
  14. @IBOutlet weak var date: UILabel!
  15. /// 发布标题
  16. @IBOutlet weak var text: UILabel!
  17. /// 详情
  18. @IBOutlet weak var textView: UITextView!
  19. // MARK: - 生命周期相关
  20. override func viewDidLoad() {
  21. super.viewDidLoad()
  22. // Do any additional setup after loading the view.
  23. /// 异常
  24. guard let obj = takeInfo as? MoNotice else { return }
  25. /// 发布日期
  26. self.date.text = obj.createtime.getTDateString()
  27. /// 发布标题
  28. self.text.text = obj.title
  29. /// 详情
  30. let style: NSMutableParagraphStyle = NSMutableParagraphStyle()
  31. style.lineHeightMultiple = 1.5
  32. let attribute = obj.content.withFont(.font_14).withParagraphStyle(style).withTextColor(.hex333())
  33. self.textView.attributedText = attribute
  34. /// 设置公告已读
  35. requestNoticeReaded()
  36. }
  37. // MARK: - 接口请求
  38. /// 设置公告已读
  39. fileprivate func requestNoticeReaded() {
  40. /// 异常
  41. guard let commonManager = MTP2BusinessCore.shared.commonManager, let obj = takeInfo as? MoNotice else { return }
  42. /// 设置公告已读消息
  43. commonManager.requestNoticeReaded(noticeID: obj.autoid, callback: { (_, _) in })
  44. }
  45. }