// // MessageDetailViewController.swift // MTP2_iOS // // Created by Handy_Cao on 2020/10/30. // Copyright © 2020 Muchinfo. All rights reserved. // import UIKit import SwiftyAttributes /// 公告详情视图容器控制类 class MessageDetailViewController: BaseViewController { // MARK: - 属性列表 /// 发布日期 @IBOutlet weak var date: UILabel! /// 发布标题 @IBOutlet weak var text: UILabel! /// 详情 @IBOutlet weak var textView: UITextView! var model: MoNotice? { didSet { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+0.5) { /// 发布日期 self.date.text = DateUtils.getTDateString(self.model?.createtime ?? "", "yyyy-MM-dd HH:mm:ss") /// 发布标题 self.text.text = self.model?.title /// 详情 let style: NSMutableParagraphStyle = NSMutableParagraphStyle() style.lineHeightMultiple = 1.5 let attribute = (self.model?.content ?? "--").withFont(.font_14).withParagraphStyle(style).withTextColor(UIColorFromHex(rgbValue: 0x333333)) self.textView.attributedText = attribute } } } // MARK: - 生命周期相关 override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. /// 设置公告已读 requestNoticeReaded() } // MARK: - 接口请求 /// 设置公告已读 fileprivate func requestNoticeReaded() { guard let noticeManager = MTP2BusinessCore.shared.noticeManager else { return } /// 设置公告已读消息 noticeManager.requestNoticeReaded(model?.autoid ?? 0, callback: { (_, _) in }) } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }