MessageDetailViewController.swift 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // MessageDetailViewController.swift
  3. // MTP2_iOS
  4. //
  5. // Created by Handy_Cao 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. var model: MoNotice? {
  20. didSet {
  21. DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+0.5) {
  22. /// 发布日期
  23. self.date.text = DateUtils.getTDateString(self.model?.createtime ?? "", "yyyy-MM-dd HH:mm:ss")
  24. /// 发布标题
  25. self.text.text = self.model?.title
  26. /// 详情
  27. let style: NSMutableParagraphStyle = NSMutableParagraphStyle()
  28. style.lineHeightMultiple = 1.5
  29. let attribute = (self.model?.content ?? "--").withFont(.font_14).withParagraphStyle(style).withTextColor(UIColorFromHex(rgbValue: 0x333333))
  30. self.textView.attributedText = attribute
  31. }
  32. }
  33. }
  34. // MARK: - 生命周期相关
  35. override func viewDidLoad() {
  36. super.viewDidLoad()
  37. // Do any additional setup after loading the view.
  38. /// 设置公告已读
  39. requestNoticeReaded()
  40. }
  41. // MARK: - 接口请求
  42. /// 设置公告已读
  43. fileprivate func requestNoticeReaded() {
  44. guard let noticeManager = MTP2BusinessCore.shared.noticeManager else {
  45. return
  46. }
  47. /// 设置公告已读消息
  48. noticeManager.requestNoticeReaded(model?.autoid ?? 0, callback: { (_, _) in })
  49. }
  50. /*
  51. // MARK: - Navigation
  52. // In a storyboard-based application, you will often want to do a little preparation before navigation
  53. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  54. // Get the new view controller using segue.destination.
  55. // Pass the selected object to the new view controller.
  56. }
  57. */
  58. }