Commit 15d3edc3 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  // 消息
  加载更多逻辑
  // 获取未读消息数
  解决bug
parents 31587d24 e718e1d1
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
04174D642BCD52BD000BA46D /* YHTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D632BCD52BD000BA46D /* YHTestViewController.swift */; }; 04174D642BCD52BD000BA46D /* YHTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D632BCD52BD000BA46D /* YHTestViewController.swift */; };
04174D732BCD5B74000BA46D /* YHMsgViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D672BCD5B74000BA46D /* YHMsgViewModel.swift */; }; 04174D732BCD5B74000BA46D /* YHMsgViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D672BCD5B74000BA46D /* YHMsgViewModel.swift */; };
04174D742BCD5B74000BA46D /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D692BCD5B74000BA46D /* IMAppKey.swift */; }; 04174D742BCD5B74000BA46D /* IMAppKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D692BCD5B74000BA46D /* IMAppKey.swift */; };
04174D752BCD5B74000BA46D /* YHMessageListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6B2BCD5B74000BA46D /* YHMessageListModel.swift */; };
04174D762BCD5B74000BA46D /* YHMsgListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6C2BCD5B74000BA46D /* YHMsgListModel.swift */; }; 04174D762BCD5B74000BA46D /* YHMsgListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6C2BCD5B74000BA46D /* YHMsgListModel.swift */; };
04174D772BCD5B74000BA46D /* YHMessageDetailListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */; }; 04174D772BCD5B74000BA46D /* YHMessageDetailListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */; };
04174D782BCD5B74000BA46D /* YHMessageListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */; }; 04174D782BCD5B74000BA46D /* YHMessageListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */; };
...@@ -243,6 +242,8 @@ ...@@ -243,6 +242,8 @@
0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; }; 0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; };
0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; }; 0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; };
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; }; 048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; };
048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048787D02BCE61B20036E221 /* YHServiceNoOrderView.swift */; };
048787D32BCE6B7D0036E221 /* YHServiceOrderAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048787D22BCE6B7D0036E221 /* YHServiceOrderAlertView.swift */; };
048B2A442BC7901900A93BF0 /* YHHomeWebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A432BC7901900A93BF0 /* YHHomeWebViewModel.swift */; }; 048B2A442BC7901900A93BF0 /* YHHomeWebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A432BC7901900A93BF0 /* YHHomeWebViewModel.swift */; };
048B2A462BC7912400A93BF0 /* YHWebModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A452BC7912400A93BF0 /* YHWebModel.swift */; }; 048B2A462BC7912400A93BF0 /* YHWebModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A452BC7912400A93BF0 /* YHWebModel.swift */; };
048B2A482BC7CE4800A93BF0 /* YHFourKingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */; }; 048B2A482BC7CE4800A93BF0 /* YHFourKingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */; };
...@@ -459,7 +460,6 @@ ...@@ -459,7 +460,6 @@
04174D632BCD52BD000BA46D /* YHTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTestViewController.swift; sourceTree = "<group>"; }; 04174D632BCD52BD000BA46D /* YHTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTestViewController.swift; sourceTree = "<group>"; };
04174D672BCD5B74000BA46D /* YHMsgViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMsgViewModel.swift; sourceTree = "<group>"; }; 04174D672BCD5B74000BA46D /* YHMsgViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMsgViewModel.swift; sourceTree = "<group>"; };
04174D692BCD5B74000BA46D /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; }; 04174D692BCD5B74000BA46D /* IMAppKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMAppKey.swift; sourceTree = "<group>"; };
04174D6B2BCD5B74000BA46D /* YHMessageListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageListModel.swift; sourceTree = "<group>"; };
04174D6C2BCD5B74000BA46D /* YHMsgListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMsgListModel.swift; sourceTree = "<group>"; }; 04174D6C2BCD5B74000BA46D /* YHMsgListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMsgListModel.swift; sourceTree = "<group>"; };
04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageDetailListVC.swift; sourceTree = "<group>"; }; 04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageDetailListVC.swift; sourceTree = "<group>"; };
04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageListVC.swift; sourceTree = "<group>"; }; 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageListVC.swift; sourceTree = "<group>"; };
...@@ -688,6 +688,8 @@ ...@@ -688,6 +688,8 @@
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; }; 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; };
0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; }; 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; };
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; }; 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; };
048787D02BCE61B20036E221 /* YHServiceNoOrderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceNoOrderView.swift; sourceTree = "<group>"; };
048787D22BCE6B7D0036E221 /* YHServiceOrderAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHServiceOrderAlertView.swift; sourceTree = "<group>"; };
048B2A432BC7901900A93BF0 /* YHHomeWebViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeWebViewModel.swift; sourceTree = "<group>"; }; 048B2A432BC7901900A93BF0 /* YHHomeWebViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHomeWebViewModel.swift; sourceTree = "<group>"; };
048B2A452BC7912400A93BF0 /* YHWebModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebModel.swift; sourceTree = "<group>"; }; 048B2A452BC7912400A93BF0 /* YHWebModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWebModel.swift; sourceTree = "<group>"; };
048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFourKingViewController.swift; sourceTree = "<group>"; }; 048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFourKingViewController.swift; sourceTree = "<group>"; };
...@@ -942,7 +944,6 @@ ...@@ -942,7 +944,6 @@
04174D6A2BCD5B74000BA46D /* M */ = { 04174D6A2BCD5B74000BA46D /* M */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04174D6B2BCD5B74000BA46D /* YHMessageListModel.swift */,
04174D6C2BCD5B74000BA46D /* YHMsgListModel.swift */, 04174D6C2BCD5B74000BA46D /* YHMsgListModel.swift */,
); );
path = M; path = M;
...@@ -951,8 +952,8 @@ ...@@ -951,8 +952,8 @@
04174D6D2BCD5B74000BA46D /* C */ = { 04174D6D2BCD5B74000BA46D /* C */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */,
04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */, 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */,
04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2128,6 +2129,7 @@ ...@@ -2128,6 +2129,7 @@
04CC2EEF2BC3DDB2000305DD /* YHServiceBannerView.swift */, 04CC2EEF2BC3DDB2000305DD /* YHServiceBannerView.swift */,
049AC4C72BC513AB00F857F4 /* YHOrderListView.swift */, 049AC4C72BC513AB00F857F4 /* YHOrderListView.swift */,
049AC4C92BC5141600F857F4 /* YHServerNoOrderView.swift */, 049AC4C92BC5141600F857F4 /* YHServerNoOrderView.swift */,
048787D02BCE61B20036E221 /* YHServiceNoOrderView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2224,6 +2226,7 @@ ...@@ -2224,6 +2226,7 @@
044414062BC3C54B00784A14 /* YHHomeCollectionViewCell.swift */, 044414062BC3C54B00784A14 /* YHHomeCollectionViewCell.swift */,
044414082BC3CE8500784A14 /* YHHomeCollectionLayout.swift */, 044414082BC3CE8500784A14 /* YHHomeCollectionLayout.swift */,
A50A747D2BC91308003D28D9 /* YHHomeBannerIndicatorView.swift */, A50A747D2BC91308003D28D9 /* YHHomeBannerIndicatorView.swift */,
048787D22BCE6B7D0036E221 /* YHServiceOrderAlertView.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2554,6 +2557,7 @@ ...@@ -2554,6 +2557,7 @@
045EEE812B9F171A0022A143 /* YHPreviewQuestionAndAnswerModel.swift in Sources */, 045EEE812B9F171A0022A143 /* YHPreviewQuestionAndAnswerModel.swift in Sources */,
045EEEB02B9F171A0022A143 /* YHWorkItemView.swift in Sources */, 045EEEB02B9F171A0022A143 /* YHWorkItemView.swift in Sources */,
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */, 0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */,
048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */,
04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */, 04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */,
0468D4362B57752F00CFB916 /* YHUserModel.swift in Sources */, 0468D4362B57752F00CFB916 /* YHUserModel.swift in Sources */,
045EEE992B9F171A0022A143 /* YHPreviewInfoHoldView.swift in Sources */, 045EEE992B9F171A0022A143 /* YHPreviewInfoHoldView.swift in Sources */,
...@@ -2603,6 +2607,7 @@ ...@@ -2603,6 +2607,7 @@
04174D642BCD52BD000BA46D /* YHTestViewController.swift in Sources */, 04174D642BCD52BD000BA46D /* YHTestViewController.swift in Sources */,
A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */, A5ACE92E2B4564F7002C94D2 /* YHValidateCodeInputView.swift in Sources */,
045EEED82B9F171A0022A143 /* YHQuestionInfo.swift in Sources */, 045EEED82B9F171A0022A143 /* YHQuestionInfo.swift in Sources */,
048787D32BCE6B7D0036E221 /* YHServiceOrderAlertView.swift in Sources */,
A5ACE94E2B4564F7002C94D2 /* AlignedCollectionViewFlowLayout.swift in Sources */, A5ACE94E2B4564F7002C94D2 /* AlignedCollectionViewFlowLayout.swift in Sources */,
A592FE932BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift in Sources */, A592FE932BA6CFFC0062FACA /* YHCertificateEntryBottomView.swift in Sources */,
A5ACE93B2B4564F7002C94D2 /* UIFont+Extension.swift in Sources */, A5ACE93B2B4564F7002C94D2 /* UIFont+Extension.swift in Sources */,
...@@ -2764,7 +2769,6 @@ ...@@ -2764,7 +2769,6 @@
045EEEEA2B9F171A0022A143 /* YHFamilyInitialInfo.swift in Sources */, 045EEEEA2B9F171A0022A143 /* YHFamilyInitialInfo.swift in Sources */,
A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */, A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */,
045EEEA52B9F171A0022A143 /* YHImageViewController.swift in Sources */, 045EEEA52B9F171A0022A143 /* YHImageViewController.swift in Sources */,
04174D752BCD5B74000BA46D /* YHMessageListModel.swift in Sources */,
045EEEF32B9F171A0022A143 /* YHFamilyMemberInfoListVC.swift in Sources */, 045EEEF32B9F171A0022A143 /* YHFamilyMemberInfoListVC.swift in Sources */,
04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */, 04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */, A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
......
...@@ -10,9 +10,23 @@ import UIKit ...@@ -10,9 +10,23 @@ import UIKit
import ESTabBarController_swift import ESTabBarController_swift
class YHTabBarViewController: ESTabBarController { class YHTabBarViewController: ESTabBarController {
lazy var viewModel = {
let model = YHMsgViewModel()
return model
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
handleTabBarLine() handleTabBarLine()
addObservers()
}
func addObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(loginSuccess), name: YhConstant.YhNotification.didLoginSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(logoutSuccess), name: YhConstant.YhNotification.didLogoutSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(clearAllUnreadMsg), name: YhConstant.YhNotification.didMarkAllMessagesReadedNotifiction, object: nil)
} }
} }
...@@ -24,6 +38,44 @@ extension YHTabBarViewController { ...@@ -24,6 +38,44 @@ extension YHTabBarViewController {
@objc func showTabBar() -> Void { @objc func showTabBar() -> Void {
self.tabBar.isHidden = false self.tabBar.isHidden = false
} }
@objc func loginSuccess() {
printLog("登录成功,进行相应的 UI刷新操作")
getTotalUnreadMsgCount()
}
@objc func logoutSuccess() {
printLog("登出成功")
}
func getTotalUnreadMsgCount() {
self.viewModel.requestTotalUnreadMsgCount {
[weak self] success, error in
guard let self = self else { return }
DispatchQueue.main.async {
if let vcs = self.viewControllers, let msgListVC = vcs[safe: 2] {
var count = self.viewModel.unreadTotalCount
var unreadText = String(count)
if count > 99 {
unreadText = "99+"
}
msgListVC.tabBarItem.badgeValue = unreadText
UIApplication.shared.applicationIconBadgeNumber = count
}
}
}
}
@objc func clearAllUnreadMsg() {
DispatchQueue.main.async {
if let vcs = self.viewControllers, let msgListVC = vcs[safe: 2] {
msgListVC.tabBarItem.badgeValue = ""
UIApplication.shared.applicationIconBadgeNumber = 0
}
}
}
} }
extension YHTabBarViewController { extension YHTabBarViewController {
......
...@@ -42,6 +42,9 @@ extension YHFourKingViewController { ...@@ -42,6 +42,9 @@ extension YHFourKingViewController {
if self.classId == 0 { if self.classId == 0 {
gk_navTitle = model.name gk_navTitle = model.name
self.sectionView.items = model.children self.sectionView.items = model.children
if model.children.count == 1 {
self.updateAllView()
}
let classifyID = model.children.first?.id ?? 0 let classifyID = model.children.first?.id ?? 0
self.classId = classifyID self.classId = classifyID
self.homeViewModel.getList(true, classifyID) {[weak self] success, error in self.homeViewModel.getList(true, classifyID) {[weak self] success, error in
...@@ -53,6 +56,18 @@ extension YHFourKingViewController { ...@@ -53,6 +56,18 @@ extension YHFourKingViewController {
} }
} }
} }
func updateAllView() {
sectionView.snp.remakeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(0)
}
tableFootView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
}
}
func setupUI() { func setupUI() {
gk_navBarAlpha = 1 gk_navBarAlpha = 1
...@@ -61,6 +76,7 @@ extension YHFourKingViewController { ...@@ -61,6 +76,7 @@ extension YHFourKingViewController {
let view = YHServiceSectionView() let view = YHServiceSectionView()
view.block = {[weak self] model in view.block = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.tableFootView.myCollectView.es.resetNoMoreData()
self.classId = model.id self.classId = model.id
self.homeViewModel.getList(true, model.id) {[weak self] success, error in self.homeViewModel.getList(true, model.id) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
......
//
// YHServiceOrderAlertView.swift
// galaxy
//
// Created by EDY on 2024/4/16.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHServiceOrderAlertView: UIView {
var centerView: UIView!
var titleLabel: UILabel!
var closeButton: UIButton!
var lineView: UIView!
var knowButton: UIButton!
var measageLabel: UILabel!
var subMeasageLabel: UILabel!
static func show() {
let view = YHServiceOrderAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
backgroundColor = UIColor(hex: 0x0000, alpha: 0.5)
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius8
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(401)
}
titleLabel = {
let label = UILabel()
label.text = "原因说明"
label.font = UIFont.PFSC_M(ofSize: 17)
label.textColor = UIColor.mainTextColor
label.textAlignment = .center
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.height.equalTo(21)
make.right.equalTo(-21)
}
closeButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_close"), for: .normal)
button.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
return button
}()
centerView.addSubview(closeButton)
closeButton.snp.makeConstraints { make in
make.right.equalTo(-21)
make.width.height.equalTo(24)
make.top.equalTo(16)
}
lineView = {
let view = UIView()
view.backgroundColor = UIColor.separatorColor
return view
}()
centerView.addSubview(lineView)
lineView.snp.makeConstraints { make in
make.right.equalTo(-21)
make.left.equalTo(21)
make.top.equalTo(52)
make.height.equalTo(1)
}
knowButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
button.contentHorizontalAlignment = .center
button.setTitle("我知道了", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = kCornerRadius6
button.clipsToBounds = true
button.addTarget(self, action: #selector(goNext), for: .touchUpInside)
return button
}()
centerView.addSubview(knowButton)
knowButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.left.equalTo(16)
make.height.equalTo(48)
make.bottom.equalTo(-29)
}
measageLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.numberOfLines = 0
return label
}()
centerView.addSubview(measageLabel)
measageLabel.snp.makeConstraints { make in
make.right.equalTo(-21)
make.left.equalTo(21)
make.top.equalTo(73)
}
subMeasageLabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = UIColor.mainTextColor
label.numberOfLines = 0
return label
}()
centerView.addSubview(subMeasageLabel)
subMeasageLabel.snp.makeConstraints { make in
make.right.equalTo(-21)
make.left.equalTo(21)
make.top.equalTo(157)
}
let a: ASAttributedString = .init("1.当前仅支持查看", .font(UIFont.PFSC_M(ofSize: 15)),.foreground(UIColor(hex: 0x121a26).withAlphaComponent(0.7)))
let aa: ASAttributedString = .init(NSAttributedString(string: "优才订单"), .font(UIFont.PFSC_M(ofSize: 15)),.foreground(UIColor.brandMainColor))
let aaa: ASAttributedString = .init(",如果是签约了其他高才、专才、留学等其他订单,请与您的服务管家或销售顾问企微沟通联系哦\n\n", .font(UIFont.PFSC_M(ofSize: 15)),.foreground(UIColor(hex: 0x121a26).withAlphaComponent(0.7)))
let b: ASAttributedString = .init(NSAttributedString(string: "2.使用其他手机号签约合同/订单,请退出登录"), .font(UIFont.PFSC_M(ofSize: 15)),.foreground(UIColor(hex: 0x121a26).withAlphaComponent(0.7)))
let bb: ASAttributedString = .init("切换账号", .font(UIFont.PFSC_M(ofSize: 15)),.foreground(UIColor.brandMainColor))
let bbb: ASAttributedString = .init("查看", .font(UIFont.PFSC_M(ofSize: 15)),.foreground(UIColor(hex: 0x121a26).withAlphaComponent(0.7)))
measageLabel.attributed.text = a + aa + aaa
subMeasageLabel.attributed.text = b + bb + bbb
knowButton.backgroundColor = .brandMainColor
knowButton.addYinHeGradualLayer()
}
@objc private func handleTap(_ sender: AnyObject?) {
print("处理点击手势")
dismiss()
}
@objc func dismiss() {
removeFromSuperview()
}
@objc func goNext() {
dismiss()
}
}
extension YHServiceOrderAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
...@@ -85,6 +85,7 @@ extension YHServerHKLifeViewController { ...@@ -85,6 +85,7 @@ extension YHServerHKLifeViewController {
let view = YHServiceSectionView() let view = YHServiceSectionView()
view.block = {[weak self] model in view.block = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.homeTableView.es.resetNoMoreData()
self.classId = model.id self.classId = model.id
self.homeViewModel.getList(true, model.id) {[weak self] success, error in self.homeViewModel.getList(true, model.id) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -21,16 +21,8 @@ class YHServiceCenterMainViewController: YHBaseViewController { ...@@ -21,16 +21,8 @@ class YHServiceCenterMainViewController: YHBaseViewController {
}() }()
private let loginTipsView : YHLoginTipsView = { private let noDataView : YHServiceNoOrderView = {
let view = YHLoginTipsView() let view = YHServiceNoOrderView()
view.viewType = 0
view.isHidden = true
return view
}()
private let noDataView : YHLoginTipsView = {
let view = YHLoginTipsView()
view.viewType = 1
view.isHidden = true view.isHidden = true
return view return view
}() }()
...@@ -56,8 +48,25 @@ class YHServiceCenterMainViewController: YHBaseViewController { ...@@ -56,8 +48,25 @@ class YHServiceCenterMainViewController: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
setupUI() setupUI()
handleRightUI() handleRightUI()
noDataView.clickMoreBtnClickkBlock = {[weak self] in
guard let self = self else { return }
let vc = YHServiceViewController()
vc.defaltIndex = 0
self.navigationController?.pushViewController(vc)
}
noDataView.clickBackBtnClickBlock = {[weak self] in
guard let self = self else { return }
if let vc = UIApplication.shared.keyWindow?.rootViewController as? YHTabBarViewController {
vc.selectedIndex = 0
}
}
noDataView.clickShowBtnClickBlock = {[weak self] in
YHServiceOrderAlertView.show()
}
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
...@@ -87,30 +96,19 @@ extension YHServiceCenterMainViewController { ...@@ -87,30 +96,19 @@ extension YHServiceCenterMainViewController {
func setupUI() { func setupUI() {
gk_navTitle = "服务" gk_navTitle = "服务"
gk_navBarAlpha = 1.0 gk_navBarAlpha = 1.0
view.backgroundColor = .white
loginTipsView.clickLoginBtnCallBackBlock = {
self.loginOp()
}
view.addSubview(topBkg) view.addSubview(topBkg)
topBkg.snp.makeConstraints { make in topBkg.snp.makeConstraints { make in
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
make.height.equalTo(216) make.height.equalTo(216)
} }
view.addSubview(loginTipsView)
loginTipsView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.centerY.equalToSuperview()
make.width.equalTo(KScreenWidth)
}
view.addSubview(noDataView) view.addSubview(noDataView)
noDataView.snp.makeConstraints { make in noDataView.snp.makeConstraints { make in
make.centerX.equalToSuperview() make.centerX.equalToSuperview()
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
make.width.equalTo(KScreenWidth) make.width.equalTo(KScreenWidth)
make.height.equalTo(225)
} }
view.addSubview(homeTableView) view.addSubview(homeTableView)
...@@ -206,12 +204,9 @@ extension YHServiceCenterMainViewController { ...@@ -206,12 +204,9 @@ extension YHServiceCenterMainViewController {
private func handleRightUI() { private func handleRightUI() {
if YHLoginManager.shared.isLogin() == false { if YHLoginManager.shared.isLogin() == false {
loginTipsView.isHidden = false
noDataView.isHidden = true noDataView.isHidden = true
homeTableView.isHidden = true homeTableView.isHidden = true
} else { } else {
loginTipsView.isHidden = true
if serviceCenterMainReqVM.arrContactList.isEmpty { if serviceCenterMainReqVM.arrContactList.isEmpty {
homeTableView.isHidden = true homeTableView.isHidden = true
noDataView.isHidden = false noDataView.isHidden = false
......
...@@ -64,6 +64,7 @@ extension YHServiceListViewController { ...@@ -64,6 +64,7 @@ extension YHServiceListViewController {
let view = YHServerNoOrderView() let view = YHServerNoOrderView()
view.sectionBlock = {[weak self] model in view.sectionBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.normalView.homeTableView.es.resetNoMoreData()
self.classId = model.id self.classId = model.id
self.homeViewModel.getList(true, model.id) {[weak self] success, error in self.homeViewModel.getList(true, model.id) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
......
//
// YHServiceNoOrderView.swift
// galaxy
//
// Created by EDY on 2024/4/16.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHServiceNoOrderView: UIView {
public var clickMoreBtnClickkBlock : (()->())?
public var clickBackBtnClickBlock : (()->())?
public var clickShowBtnClickBlock : (()->())?
private lazy var iconImgV : UIImageView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "service_center_no_data")
imagV.contentMode = .scaleAspectFill
return imagV
}()
private lazy var tipsLab : UILabel = {
let lable = UILabel()
lable.textColor = UIColor.labelTextColor2
lable.font = UIFont.PFSC_R(ofSize: 14)
lable.textAlignment = .center
lable.text = "您还没有相关订单"
return lable
}()
private lazy var noFindLab : UILabel = {
let lable = UILabel()
lable.textColor = UIColor.labelTextColor2
lable.font = UIFont.PFSC_R(ofSize: 12)
lable.textAlignment = .center
lable.text = "找不到订单"
return lable
}()
private lazy var showBtn : UIButton = {
let btn = UIButton(type: .custom)
btn.setBackgroundImage(UIImage(named: "service_no_order_alert"), for: .normal)
return btn
}()
private lazy var moreBtn : UIButton = {
let btn = UIButton(type: .custom)
btn.setTitle("更多资讯", for: .normal)
btn.layer.cornerRadius = kCornerRadius6
btn.clipsToBounds = true
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
btn.setTitleColor(UIColor.mainTextColor, for: .normal)
btn.backgroundColor = UIColor.contentBkgColor
return btn
}()
private lazy var backBtn : UIButton = {
let btn = UIButton(type: .custom)
btn.setTitle("返回首页", for: .normal)
btn.layer.cornerRadius = kCornerRadius6
btn.clipsToBounds = true
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 12)
btn.setTitleColor(.white, for: .normal)
return btn
}()
public override init(frame: CGRect) {
super.init(frame:frame)
initView()
}
private func initView() {
addSubview(iconImgV)
iconImgV.snp.makeConstraints { make in
make.top.equalToSuperview()
make.centerX.equalToSuperview()
make.height.equalTo(93)
make.width.equalTo(93)
}
addSubview(tipsLab)
tipsLab.snp.makeConstraints { make in
make.top.equalTo(iconImgV.snp.bottom).offset(12)
make.centerX.equalToSuperview()
make.left.right.equalToSuperview()
}
addSubview(noFindLab)
noFindLab.snp.makeConstraints { make in
make.top.equalTo(tipsLab.snp.bottom).offset(8.5)
make.centerX.equalToSuperview().offset(-8)
}
addSubview(showBtn)
showBtn.snp.makeConstraints { make in
make.left.equalTo(noFindLab.snp.right).offset(2)
make.centerY.equalTo(noFindLab.snp.centerY)
make.width.height.equalTo(16)
}
addSubview(moreBtn)
moreBtn.snp.makeConstraints { make in
make.top.equalTo(noFindLab.snp.bottom).offset(22.5)
make.right.equalTo(self.snp.centerX).offset(-8.5)
make.height.equalTo(38)
make.width.equalTo(84)
}
addSubview(backBtn)
backBtn.snp.makeConstraints { make in
make.top.equalTo(noFindLab.snp.bottom).offset(22.5)
make.left.equalTo(self.snp.centerX).offset(8.5)
make.height.equalTo(38)
make.width.equalTo(84)
}
showBtn.addTarget(self, action: #selector(showBtnClick), for: .touchUpInside)
backBtn.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
moreBtn.addTarget(self, action: #selector(moreBtnClick), for: .touchUpInside)
showBtn.YH_clickEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
layoutIfNeeded()
backBtn.backgroundColor = .brandMainColor
backBtn.addYinHeGradualLayer()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func moreBtnClick() {
self.clickMoreBtnClickkBlock?()
}
@objc func backBtnClick() {
self.clickBackBtnClickBlock?()
}
@objc func showBtnClick() {
self.clickShowBtnClickBlock?()
}
}
...@@ -29,7 +29,7 @@ class YHServiceTableFootView: UIView { ...@@ -29,7 +29,7 @@ class YHServiceTableFootView: UIView {
collectinoView.register(YHHomeCollectionViewCell.self, forCellWithReuseIdentifier:YHHomeCollectionViewCell.cellReuseIdentifier) collectinoView.register(YHHomeCollectionViewCell.self, forCellWithReuseIdentifier:YHHomeCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self collectinoView.delegate = self
collectinoView.dataSource = self collectinoView.dataSource = self
collectinoView.bounces = false // collectinoView.bounces = false
collectinoView.translatesAutoresizingMaskIntoConstraints = false collectinoView.translatesAutoresizingMaskIntoConstraints = false
collectinoView.alwaysBounceVertical = true collectinoView.alwaysBounceVertical = true
return collectinoView return collectinoView
......
...@@ -21,7 +21,9 @@ class YHMessageDetailListVC: YHBaseViewController { ...@@ -21,7 +21,9 @@ class YHMessageDetailListVC: YHBaseViewController {
lazy var navBar: YHCustomNavigationBar = { lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar() let bar = YHCustomNavigationBar.navBar()
bar.backgroundColor = .white bar.backgroundColor = .white
bar.title = "资料填写".local if let title = self.title, !title.isEmpty {
bar.title = title
}
bar.showRightButtonType(.clean) bar.showRightButtonType(.clean)
bar.backBlock = { bar.backBlock = {
[weak self] in [weak self] in
...@@ -47,10 +49,37 @@ class YHMessageDetailListVC: YHBaseViewController { ...@@ -47,10 +49,37 @@ class YHMessageDetailListVC: YHBaseViewController {
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
tableView.backgroundColor = UIColor(hex:0xF8F8F8) tableView.backgroundColor = UIColor(hex:0xF8F8F8)
tableView.backgroundView = emptyDataTipsView
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHInformationFillCell.self, forCellReuseIdentifier: YHInformationFillCell.cellReuseIdentifier) tableView.register(YHInformationFillCell.self, forCellReuseIdentifier: YHInformationFillCell.cellReuseIdentifier)
return tableView return tableView
}() }()
lazy var emptyDataTipsView:UIView = {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 124))
view.isHidden = true
let imgView = UIImageView(image: UIImage(named: "msg_no_data"))
view.addSubview(imgView)
let label = UILabel()
label.textColor = UIColor(hex: 0x94A3B8)
label.font = UIFont.PFSC_R(ofSize: 14)
label.textAlignment = .center
label.text = "暂无新消息".local
view.addSubview(label)
imgView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(204)
make.width.height.equalTo(92)
make.centerX.equalTo(view)
}
label.snp.makeConstraints { make in
make.top.equalTo(imgView.snp.bottom).offset(12)
make.centerX.equalTo(view)
}
return view
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -88,6 +117,7 @@ class YHMessageDetailListVC: YHBaseViewController { ...@@ -88,6 +117,7 @@ class YHMessageDetailListVC: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
msgArr.removeAll() msgArr.removeAll()
msgArr.append(contentsOf: self.viewModel.msgDetailList) msgArr.append(contentsOf: self.viewModel.msgDetailList)
emptyDataTipsView.isHidden = msgArr.count > 0
self.tableView.reloadData() self.tableView.reloadData()
} }
} }
......
...@@ -109,6 +109,19 @@ class YHMessageListVC: YHBaseViewController { ...@@ -109,6 +109,19 @@ class YHMessageListVC: YHBaseViewController {
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar) make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-k_Height_TabBar) make.bottom.equalToSuperview().offset(-k_Height_TabBar)
} }
NotificationCenter.default.addObserver(self, selector: #selector(loginSuccess), name: YhConstant.YhNotification.didLoginSuccessNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(logoutSuccess), name: YhConstant.YhNotification.didLogoutSuccessNotifiction, object: nil)
}
@objc func loginSuccess() {
printLog("登录成功,进行相应的 UI刷新操作")
}
@objc func logoutSuccess() {
} }
func getUnreadMsgList() { func getUnreadMsgList() {
...@@ -139,6 +152,7 @@ class YHMessageListVC: YHBaseViewController { ...@@ -139,6 +152,7 @@ class YHMessageListVC: YHBaseViewController {
signMsg.customType = .fileSign signMsg.customType = .fileSign
msgArr.append(signMsg) msgArr.append(signMsg)
} }
emptyDataTipsView.isHidden = msgArr.count > 0
self.tableView.reloadData() self.tableView.reloadData()
} }
} }
...@@ -156,6 +170,8 @@ class YHMessageListVC: YHBaseViewController { ...@@ -156,6 +170,8 @@ class YHMessageListVC: YHBaseViewController {
item.unreadCount = 0 item.unreadCount = 0
} }
self.tableView.reloadData() self.tableView.reloadData()
// 发送清空所有未读消息通知
NotificationCenter.default.post(name: YhConstant.YhNotification.didMarkAllMessagesReadedNotifiction, object: nil)
return return
} }
...@@ -213,6 +229,7 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource { ...@@ -213,6 +229,7 @@ extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource {
let msgItem = msgArr[indexPath.row] let msgItem = msgArr[indexPath.row]
let vc = YHMessageDetailListVC() let vc = YHMessageDetailListVC()
vc.type = msgItem.type vc.type = msgItem.type
vc.title = msgItem.getTitle()
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
} }
......
//
// YHMessageListModel.swift
// galaxy
//
// Created by edy on 2024/4/15.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMessageListModel: NSObject {
}
...@@ -35,6 +35,22 @@ class YHMessageInfoModel: SmartCodable { ...@@ -35,6 +35,22 @@ class YHMessageInfoModel: SmartCodable {
case lastMessageTime = "last_message_time" case lastMessageTime = "last_message_time"
case type case type
} }
func getTitle() -> String {
if customType == .infoFill {
return "资料填写"
} else if customType == .cerUpload {
return "证件上传"
} else if customType == .draft {
return "文书定稿"
} else if customType == .fileSign {
return "文件签字"
}
return ""
}
} }
class YHMsgListModel: SmartCodable { class YHMsgListModel: SmartCodable {
......
...@@ -32,25 +32,21 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -32,25 +32,21 @@ class YHMessageSessionCell: UITableViewCell {
func updateModel(_ model: YHMessageInfoModel) { func updateModel(_ model: YHMessageInfoModel) {
self.nameLabel.text = model.getTitle()
if model.customType == .infoFill { if model.customType == .infoFill {
self.nameLabel.text = "资料填写"
self.iconImgView.image = UIImage(named: "msg_icon_info_fill") self.iconImgView.image = UIImage(named: "msg_icon_info_fill")
} else if model.customType == .cerUpload { } else if model.customType == .cerUpload {
self.nameLabel.text = "证件上传"
self.iconImgView.image = UIImage(named: "msg_icon_cer_upload") self.iconImgView.image = UIImage(named: "msg_icon_cer_upload")
} else if model.customType == .draft { } else if model.customType == .draft {
self.nameLabel.text = "文书定稿"
self.iconImgView.image = UIImage(named: "msg_icon_draft") self.iconImgView.image = UIImage(named: "msg_icon_draft")
} else if model.customType == .fileSign { } else if model.customType == .fileSign {
self.nameLabel.text = "文件签字"
self.iconImgView.image = UIImage(named: "msg_icon_file_sign") self.iconImgView.image = UIImage(named: "msg_icon_file_sign")
} else {
self.nameLabel.text = ""
} }
self.badgeLabel.isHidden = model.unreadCount <= 0 self.badgeLabel.isHidden = model.unreadCount <= 0
let unreadCountText = (model.unreadCount < 100 ? String(model.unreadCount) : "99+") let unreadCountText = (model.unreadCount < 100 ? String(model.unreadCount) : "99+")
self.badgeLabel.text = unreadCountText self.badgeLabel.text = unreadCountText
......
...@@ -13,10 +13,11 @@ class YHMsgViewModel: NSObject { ...@@ -13,10 +13,11 @@ class YHMsgViewModel: NSObject {
var msgList: YHMsgListModel? var msgList: YHMsgListModel?
var msgDetailList : [YHDetailMessageModel] = [] var msgDetailList : [YHDetailMessageModel] = []
var unreadTotalCount: Int = 0
func getUnreadMsgList(_ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) { func getUnreadMsgList(_ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.unreadMsgList let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.unreadMsgListApi
let _ = YHNetRequest.getRequest(url: strUrl) { json, code in let _ = YHNetRequest.getRequest(url: strUrl) { json, code in
var dic = json.data var dic = json.data
...@@ -74,7 +75,7 @@ class YHMsgViewModel: NSObject { ...@@ -74,7 +75,7 @@ class YHMsgViewModel: NSObject {
} }
func getMsgDetailList(type:Int, _ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) { func getMsgDetailList(type:Int, _ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.msgDetaiList let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.msgDetaiListApi
let params = ["type": type] let params = ["type": type]
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, code in let _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, code in
...@@ -110,7 +111,7 @@ class YHMsgViewModel: NSObject { ...@@ -110,7 +111,7 @@ class YHMsgViewModel: NSObject {
func readMessages(type:Int?, msgIds:[Int]?, isAllRead:Bool?, _ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) { func readMessages(type:Int?, msgIds:[Int]?, isAllRead:Bool?, _ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.readMsg let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.readMsgApi
var params:[String : Any] = [:] var params:[String : Any] = [:]
if let type = type { if let type = type {
...@@ -138,9 +139,35 @@ class YHMsgViewModel: NSObject { ...@@ -138,9 +139,35 @@ class YHMsgViewModel: NSObject {
} }
} failBlock: { error in } failBlock: { error in
self.msgList = nil
callBackBlock(false, error) callBackBlock(false, error)
} }
}
func requestTotalUnreadMsgCount(_ callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Message.unreadTotalCountApi
let _ = YHNetRequest.postRequest(url: strUrl) {
json, code in
let dic = json.data as? [String : Any]
printLog("model 是 ==> \(json)")
if json.code == 200 {
if let dic = dic, let total = dic["total"] as? Int {
self.unreadTotalCount = total
callBackBlock(true, nil)
} else {
self.unreadTotalCount = 0
callBackBlock(false, nil)
}
} else {
self.unreadTotalCount = 0
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { error in
self.unreadTotalCount = 0
callBackBlock(false, error)
}
} }
} }
...@@ -196,5 +196,8 @@ extension YhConstant { ...@@ -196,5 +196,8 @@ extension YhConstant {
//首页刷新通知 //首页刷新通知
public static let refreshHomePageNotifiction = Notification.Name(rawValue: "com.yinhe.homePage.refresh") public static let refreshHomePageNotifiction = Notification.Name(rawValue: "com.yinhe.homePage.refresh")
//清空所有未读消息数
public static let didMarkAllMessagesReadedNotifiction = Notification.Name(rawValue: "com.yinhe.msgPage.readAll")
} }
} }
...@@ -260,10 +260,12 @@ class YHAllApiName { ...@@ -260,10 +260,12 @@ class YHAllApiName {
// 消息 // 消息
struct Message { struct Message {
// 获取未读消息列表 // 获取未读消息列表
static let unreadMsgList = "infoflow/unread-message" static let unreadMsgListApi = "infoflow/unread-message"
// 具体业务消息列表 // 具体业务消息列表
static let msgDetaiList = "infoflow/message/list" static let msgDetaiListApi = "infoflow/message/list"
// 标记消息已读 // 标记消息已读
static let readMsg = "infoflow/read-push" static let readMsgApi = "infoflow/read-push"
// 获取未读消息总数
static let unreadTotalCountApi = "infoflow/unread-total"
} }
} }
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_no_order_alert@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_no_order_alert@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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