Commit 58a5ab04 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit 'a3925866' into xiezhaolin

parents 04a7055a a3925866
This diff is collapsed.
......@@ -156,7 +156,7 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa
guard let model = self.viewModel.arrHomeNewsData?[indexPath.row] else { return }
if model.type == 2 {
let vc = YHHomeWebViewController()
vc.url = YHConfigManager.shared.h5Url + "?id=\(model.id)"
vc.url = YHConfigManager.shared.h5Url + "/articleDetail.html" + "?id=\(model.id)"
vc.id = model.id
vc.block = { item in
if let arr = self.viewModel.arrHomeNewsData {
......
......@@ -40,7 +40,7 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
label.textColor = UIColor(hex: 0x121A26, alpha: 1.0)
label.font = UIFont.PFSC_R(ofSize: 14)
label.numberOfLines = 2
label.lineBreakMode = .byWordWrapping
label.lineBreakMode = .byTruncatingTail
return label
}()
......@@ -178,7 +178,8 @@ extension YHHomeCollectionViewCell {
make.top.equalToSuperview().offset(10)
make.left.equalToSuperview().offset(8)
make.right.equalToSuperview().offset(-8)
make.bottom.equalTo(-36)
make.height.equalTo(listModel.textH)
// make.bottom.equalTo(-36)
}
numLable.text = listModel.like_count.string
heartImageViewBtn.isSelected = listModel.is_like
......
......@@ -82,7 +82,7 @@ extension YHServiceTableFootView: UICollectionViewDelegate, UICollectionViewData
guard let model = items[indexPath.row] else { return }
if model.type == 2 {
let vc = YHHomeWebViewController()
vc.url = YHConfigManager.shared.h5Url + "?id=\(model.id)"
vc.url = YHConfigManager.shared.h5Url + "/articleDetail.html" + "?id=\(model.id)"
vc.id = model.id
vc.block = {[weak self] model in
guard let self = self else { return }
......
......@@ -10,7 +10,12 @@ import UIKit
class YHMsgViewController: YHBaseViewController {
var msgArr:[String] = ["","",""]
var msgArr:[YHMessageInfoModel] = []
lazy var viewModel = {
let model = YHMsgViewModel()
return model
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
......@@ -79,6 +84,11 @@ class YHMsgViewController: YHBaseViewController {
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
getUnreadMsgList()
}
func setupUI() {
gk_navigationBar.isHidden = true
......@@ -96,6 +106,35 @@ class YHMsgViewController: YHBaseViewController {
make.bottom.equalToSuperview().offset(-k_Height_TabBar)
}
}
func getUnreadMsgList() {
YHHUD.show(.progress(message: "加载中..."))
self.viewModel.getUnreadMsgList {
[weak self] success, error in
guard let self = self else { return }
YHHUD.hide()
if success, let msgList = viewModel.msgList {
msgArr.removeAll()
// 资料填写
if let infoMsg = msgList.information {
msgArr.append(infoMsg)
}
// 证件上传
if let cerMsg = msgList.certificate {
msgArr.append(cerMsg)
}
// 文书定稿
if let dratMsg = msgList.draft {
msgArr.append(dratMsg)
}
// 文件签字
if let signMsg = msgList.signature {
msgArr.append(signMsg)
}
self.tableView.reloadData()
}
}
}
}
extension YHMsgViewController {
......@@ -118,6 +157,10 @@ extension YHMsgViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMessageSessionCell.cellReuseIdentifier, for: indexPath) as! YHMessageSessionCell
if 0 <= indexPath.row && indexPath.row < msgArr.count {
let model = msgArr[indexPath.row]
cell.updateModel(model)
}
return cell
}
......
......@@ -30,6 +30,37 @@ class YHMessageSessionCell: UITableViewCell {
setupUI()
}
func updateModel(_ model: YHMessageInfoModel) {
self.badgeLabel.text = (model.unreadCount < 100 ? String(model.unreadCount) : "99+")
self.detailLabel.text = model.lastMessage
self.timeLabel.text = formatTimestamp(Double(model.lastMessageTime))
}
func formatTimestamp(_ timestamp: TimeInterval) -> String {
let currentDate = Date()
let calendar = Calendar.current
let currentYear = calendar.component(.year, from: currentDate)
let currentDay = calendar.component(.day, from: currentDate)
let date = Date(timeIntervalSince1970: timestamp)
let year = calendar.component(.year, from: date)
let day = calendar.component(.day, from: date)
let dateFormatter = DateFormatter()
if year == currentYear {
if day == currentDay {
dateFormatter.dateFormat = "HH:mm"
} else {
dateFormatter.dateFormat = "MM-dd"
}
} else {
dateFormatter.dateFormat = "yyyy-MM-dd"
}
return dateFormatter.string(from: date)
}
func setupUI() {
self.selectionStyle = .none
......
......@@ -60,17 +60,23 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
}()
lazy var items: [PersonalModuleItem] = {
let version = "app版本号:" + UIDevice.appVersion() + "_" + UIDevice.appBuild()
var arrData = [
PersonalModuleItem(icon: "mine_item_msg", title: "我的消息".local, type:.myMessage),
PersonalModuleItem(icon: "mine_item_scoreCenter", title: "积分中心".local, type:.scoreCenter),
PersonalModuleItem(icon: "mine_item_code", title: "我的测评码".local, type:.myTestCode),
PersonalModuleItem(icon: "mine_item_appoint", title: "预约银河湾".local, type:.appointGalaxyBay),
PersonalModuleItem(icon: "mine_item_appoint", title: version, type:.appointGalaxyBay),
PersonalModuleItem(icon: "mine_item_appoint", title: "预约银河湾".local, type:.appointGalaxyBay)
]
#if DEBUG
let version = "app版本号:" + UIDevice.appVersion() + "_" + UIDevice.appBuild()
arrData.append(PersonalModuleItem(icon: "mine_item_appoint", title: version, type:.none))
#elseif TESTENV
let version = "app版本号:" + UIDevice.appVersion() + "_" + UIDevice.appBuild()
arrData.append(PersonalModuleItem(icon: "mine_item_appoint", title: version, type:.none))
#else
#endif
return arrData
......@@ -225,12 +231,19 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
var url = "https:www.baidu.com"
var addtionString = randomAlphanumericString(6)//随机6个字母或者数字
let indexToInsert = token.index(token.startIndex, offsetBy: 6) //插入位置,这里以第六个字符后面为例
// token.insert(addtionString, at: indexToInsert) //for test hjl
token.insert(contentsOf: addtionString, at: indexToInsert)
url = url + "?param=" + token
YHHUD.flash(message: "还需要H5同学给URL")
let vc = YHHomeWebViewController()
vc.url = url
self.navigationController?.pushViewController(vc)
}
case .myTestCode://我的测评码
printLog("我的测评码")
YHHUD.flash(message: "还需要产品给图片链接")
let vc = YHHomeWebViewController()
vc.url = "https://upload.cdn.galaxy-immi.com/sell/product/images/page-1686138671996.png"
self.navigationController?.pushViewController(vc)
......
......@@ -254,4 +254,10 @@ class YHAllApiName {
//方案计划
static let applyPlanApi = "infoflow/assessment/apply_plan"
}
// 消息
struct Message {
// 获取未读消息列表
static let unreadMsgList = "infoflow/unread-message"
}
}
......@@ -90,6 +90,7 @@ class YHNetRequest: NSObject {
requestHeader.add(name:"sign",value:sign)
requestHeader.add(name: "token", value: YHLoginManager.shared.userModel?.token ?? "-")
requestHeader.add(name: "device-id", value: YHLoginManager.shared.userModel?.registerId ?? "")
// requestHeader.add(name: "token", value: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTI0NjA1NzQsImkiOjk4OTcwNDI5NjA3NzI0OSwidSI6IumTtuays-mbhuWboiIsInIiOiJzdXBlcl9hcHAifQ.jyBpXSii6nlRIITdOya3GQa5eb5G42Jh9nj39Cncwl8")
......
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