Commit 0d1db5c4 authored by Steven杜宇's avatar Steven杜宇

// 消息新增类型和点击事件

parent d4df3171
......@@ -7,6 +7,7 @@
//
import UIKit
import SafariServices
class YHMessageDetailListVC: YHBaseViewController {
......@@ -196,8 +197,7 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDetailMessageCell.cellReuseIdentifier, for: indexPath) as! YHDetailMessageCell
if 0 <= indexPath.row && indexPath.row < msgArr.count {
let item = msgArr[indexPath.row]
cell.updateModel(item)
cell.updateBottomBtn(type: self.type)
cell.updateModel(item, type:self.type)
}
return cell
}
......@@ -252,6 +252,17 @@ extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
}
} else if self.type == YHMessageType.infoSubmit.rawValue { // 资料递交
if !item.url.isEmpty {
if let url = URL(string: item.url) {
let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close
safariViewController.modalPresentationStyle = .fullScreen
present(safariViewController, animated: true, completion: nil)
} else {
YHHUD.flash(message: "url无效")
}
return
}
self.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .service)
}
......
......@@ -84,13 +84,14 @@ class YHDetailMessageModel: SmartCodable {
var time: Int = 0
var isRead: Bool = false
var orderId: String = ""
var url: String = ""
required init() {
}
enum CodingKeys: String, CodingKey {
case id, title, content, time
case id, title, content, time, url
case isRead = "is_read"
case orderId = "order_id"
}
......
......@@ -32,15 +32,13 @@ class YHDetailMessageCell: UITableViewCell {
setupUI()
}
func updateModel(_ model: YHDetailMessageModel) {
func updateModel(_ model: YHDetailMessageModel, type:Int) {
self.model = model
titleLabel.text = model.title
detailLabel.text = model.content
unreadPointView.isHidden = model.isRead
timeLabel.text = formatTimestamp(Double(model.time))
}
func updateBottomBtn(type:Int) {
if type == YHMessageType.infoFill.rawValue {
bottomBtn.setTitle("去填写".local, for: .normal)
......@@ -55,8 +53,12 @@ class YHDetailMessageCell: UITableViewCell {
} else if type == YHMessageType.infoSubmit.rawValue {
bottomBtn.setTitle("去查看".local, for: .normal)
if !model.url.isEmpty {
bottomBtn.setTitle("去签字".local, for: .normal)
}
}
}
func formatTimestamp(_ timestamp: TimeInterval) -> String {
let currentDate = Date()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment