Commit b61d7014 authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '66f23646' into xiezhaolin

parents 4dc91787 66f23646
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
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 */; }; 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 /* YHInformationFillVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6E2BCD5B74000BA46D /* YHInformationFillVC.swift */; }; 04174D772BCD5B74000BA46D /* YHMessageDetailListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */; };
04174D782BCD5B74000BA46D /* YHMsgViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6F2BCD5B74000BA46D /* YHMsgViewController.swift */; }; 04174D782BCD5B74000BA46D /* YHMessageListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */; };
04174D792BCD5B74000BA46D /* YHMessageSessionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D712BCD5B74000BA46D /* YHMessageSessionCell.swift */; }; 04174D792BCD5B74000BA46D /* YHMessageSessionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D712BCD5B74000BA46D /* YHMessageSessionCell.swift */; };
04174D7A2BCD5B74000BA46D /* YHInformationFillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D722BCD5B74000BA46D /* YHInformationFillCell.swift */; }; 04174D7A2BCD5B74000BA46D /* YHInformationFillCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04174D722BCD5B74000BA46D /* YHInformationFillCell.swift */; };
0425E63D2BA9345200A5E763 /* YHSchemeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0425E63C2BA9345200A5E763 /* YHSchemeTableViewCell.swift */; }; 0425E63D2BA9345200A5E763 /* YHSchemeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0425E63C2BA9345200A5E763 /* YHSchemeTableViewCell.swift */; };
...@@ -463,8 +463,8 @@ ...@@ -463,8 +463,8 @@
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>"; }; 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 /* YHInformationFillVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHInformationFillVC.swift; sourceTree = "<group>"; }; 04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageDetailListVC.swift; sourceTree = "<group>"; };
04174D6F2BCD5B74000BA46D /* YHMsgViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMsgViewController.swift; sourceTree = "<group>"; }; 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageListVC.swift; sourceTree = "<group>"; };
04174D712BCD5B74000BA46D /* YHMessageSessionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageSessionCell.swift; sourceTree = "<group>"; }; 04174D712BCD5B74000BA46D /* YHMessageSessionCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHMessageSessionCell.swift; sourceTree = "<group>"; };
04174D722BCD5B74000BA46D /* YHInformationFillCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHInformationFillCell.swift; sourceTree = "<group>"; }; 04174D722BCD5B74000BA46D /* YHInformationFillCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHInformationFillCell.swift; sourceTree = "<group>"; };
0425E63C2BA9345200A5E763 /* YHSchemeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeTableViewCell.swift; sourceTree = "<group>"; }; 0425E63C2BA9345200A5E763 /* YHSchemeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeTableViewCell.swift; sourceTree = "<group>"; };
...@@ -955,8 +955,8 @@ ...@@ -955,8 +955,8 @@
04174D6D2BCD5B74000BA46D /* C */ = { 04174D6D2BCD5B74000BA46D /* C */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04174D6E2BCD5B74000BA46D /* YHInformationFillVC.swift */, 04174D6E2BCD5B74000BA46D /* YHMessageDetailListVC.swift */,
04174D6F2BCD5B74000BA46D /* YHMsgViewController.swift */, 04174D6F2BCD5B74000BA46D /* YHMessageListVC.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2765,7 +2765,7 @@ ...@@ -2765,7 +2765,7 @@
A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */, A5ACE93C2B4564F7002C94D2 /* UIColor+Extension.swift in Sources */,
045EEEC02B9F171A0022A143 /* YHOtherInfoFillViewModel.swift in Sources */, 045EEEC02B9F171A0022A143 /* YHOtherInfoFillViewModel.swift in Sources */,
045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */, 045EEEF22B9F171A0022A143 /* YHChildBasicInfoVC.swift in Sources */,
04174D772BCD5B74000BA46D /* YHInformationFillVC.swift in Sources */, 04174D772BCD5B74000BA46D /* YHMessageDetailListVC.swift in Sources */,
A592BFEF2B9AB720004C04A9 /* YHWholeScreenTipsView.swift in Sources */, A592BFEF2B9AB720004C04A9 /* YHWholeScreenTipsView.swift in Sources */,
045EEEF42B9F171A0022A143 /* YHSpouseBasicInfoVC.swift in Sources */, 045EEEF42B9F171A0022A143 /* YHSpouseBasicInfoVC.swift in Sources */,
A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */, A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */,
...@@ -2811,7 +2811,7 @@ ...@@ -2811,7 +2811,7 @@
044413F92BC279D200784A14 /* YHHomeWebBottomView.swift in Sources */, 044413F92BC279D200784A14 /* YHHomeWebBottomView.swift in Sources */,
045EEEC32B9F171A0022A143 /* YHOtherResidenceFillView.swift in Sources */, 045EEEC32B9F171A0022A143 /* YHOtherResidenceFillView.swift in Sources */,
045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */, 045EEE792B9F171A0022A143 /* YHPreviewViewModel.swift in Sources */,
04174D782BCD5B74000BA46D /* YHMsgViewController.swift in Sources */, 04174D782BCD5B74000BA46D /* YHMessageListVC.swift in Sources */,
A517A4E12BB573EB000DEECD /* YHDocListCell.swift in Sources */, A517A4E12BB573EB000DEECD /* YHDocListCell.swift in Sources */,
A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */, A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */,
0493B3DE2BA80C2300AF9393 /* YHCertificateFilterButton.swift in Sources */, 0493B3DE2BA80C2300AF9393 /* YHCertificateFilterButton.swift in Sources */,
......
...@@ -123,30 +123,10 @@ extension AppDelegate { ...@@ -123,30 +123,10 @@ extension AppDelegate {
//1.设置主窗口 //1.设置主窗口
private func setupRootVC() { private func setupRootVC() {
let tabBarController = YHTabBarViewController() let nav = YHNavigationController(rootVC:YHStartPageViewController())
let homeVC = YHHomePageViewController()
tabBarController.delegate = homeVC
let v0 = YHNavigationController(rootVC:homeVC)
let v1 = YHNavigationController(rootVC:YHServiceCenterMainViewController())
let v2 = YHNavigationController(rootVC:YHMsgViewController())
let v3 = YHNavigationController(rootVC:YHMyViewController())
v0.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "首页", image: UIImage(named: "home"), selectedImage: UIImage(named: "home_1"))
v1.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "服务", image: UIImage(named: "service"), selectedImage: UIImage(named: "service_1"))
v2.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "消息", image: UIImage(named: "msg"), selectedImage: UIImage(named: "msg_1"))
v3.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "我的", image: UIImage(named: "me"), selectedImage: UIImage(named: "me_1"))
tabBarController.viewControllers = [v0,v1,v2,v3]
tabBarController.tabBar.backgroundColor = .white
window = UIWindow(frame: UIScreen.main.bounds) window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = YHStartPageViewController() window?.rootViewController = nav
window?.makeKeyAndVisible() window?.makeKeyAndVisible()
} }
} }
......
...@@ -105,6 +105,10 @@ private extension YHHomePageViewController { ...@@ -105,6 +105,10 @@ private extension YHHomePageViewController {
gk_navigationBar.isHidden = true gk_navigationBar.isHidden = true
view.backgroundColor = .white view.backgroundColor = .white
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)
view.addSubview(searchView) view.addSubview(searchView)
searchView.snp.makeConstraints { make in searchView.snp.makeConstraints { make in
make.top.equalTo(k_Height_safeAreaInsetsTop() + 6) make.top.equalTo(k_Height_safeAreaInsetsTop() + 6)
...@@ -140,6 +144,15 @@ private extension YHHomePageViewController { ...@@ -140,6 +144,15 @@ private extension YHHomePageViewController {
@objc func homepageRefresh() { @objc func homepageRefresh() {
loadFirstData() loadFirstData()
} }
@objc func loginSuccess() {
getData()
}
@objc func logoutSuccess() {
getData()
}
} }
extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDataSource { extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDataSource {
......
...@@ -123,7 +123,6 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD ...@@ -123,7 +123,6 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
make.bottom.left.right.equalToSuperview() make.bottom.left.right.equalToSuperview()
make.height.equalTo(59 + k_Height_safeAreaInsetsBottom()) make.height.equalTo(59 + k_Height_safeAreaInsetsBottom())
} }
getData()
if id == 0 { if id == 0 {
if self.url.contains("?id=") { if self.url.contains("?id=") {
...@@ -131,6 +130,7 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD ...@@ -131,6 +130,7 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
if list.count == 2 { if list.count == 2 {
if let iddd = list[1].int { if let iddd = list[1].int {
id = iddd id = iddd
getData()
return return
} }
} }
...@@ -138,6 +138,10 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD ...@@ -138,6 +138,10 @@ class YHHomeWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationD
bottomView.isHidden = true bottomView.isHidden = true
webview.frame = CGRect(x: 0, y: statusHeight + navHeight!, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight!) webview.frame = CGRect(x: 0, y: statusHeight + navHeight!, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight!)
} }
getData()
} }
deinit { deinit {
......
...@@ -202,11 +202,17 @@ class YHSearchInfomationVC: YHBaseViewController { ...@@ -202,11 +202,17 @@ class YHSearchInfomationVC: YHBaseViewController {
searchHistoryView.isHidden = true searchHistoryView.isHidden = true
self.tableView.reloadData() self.tableView.reloadData()
tableView.es.stopPullToRefresh() tableView.es.stopPullToRefresh()
// 只有一页的时候不展示没有更多数据了
if self.viewModel.totalCount < self.viewModel.searchPageSize { // 不足一页
tableView.footer?.isHidden = true
} else {
tableView.footer?.isHidden = false
if self.viewModel.hasMoreForHomeNews == false { if self.viewModel.hasMoreForHomeNews == false {
tableView.es.noticeNoMoreData() tableView.es.noticeNoMoreData()
} }
} }
} }
}
func loadMoreData() { func loadMoreData() {
viewModel.searchArticleList(self.searchStr, isFirstPage : false) { viewModel.searchArticleList(self.searchStr, isFirstPage : false) {
...@@ -221,11 +227,17 @@ class YHSearchInfomationVC: YHBaseViewController { ...@@ -221,11 +227,17 @@ class YHSearchInfomationVC: YHBaseViewController {
searchHistoryView.isHidden = true searchHistoryView.isHidden = true
self.tableView.reloadData() self.tableView.reloadData()
tableView.es.stopLoadingMore() tableView.es.stopLoadingMore()
// 只有一页的时候不展示没有更多数据了
if self.viewModel.totalCount < self.viewModel.searchPageSize { // 不足一页
tableView.footer?.isHidden = true
} else {
tableView.footer?.isHidden = false
if self.viewModel.hasMoreForHomeNews == false { if self.viewModel.hasMoreForHomeNews == false {
tableView.es.noticeNoMoreData() tableView.es.noticeNoMoreData()
} }
} }
} }
}
func loadFirstData() { func loadFirstData() {
...@@ -241,11 +253,17 @@ class YHSearchInfomationVC: YHBaseViewController { ...@@ -241,11 +253,17 @@ class YHSearchInfomationVC: YHBaseViewController {
searchHistoryView.isHidden = true searchHistoryView.isHidden = true
self.tableView.reloadData() self.tableView.reloadData()
tableView.es.stopPullToRefresh() tableView.es.stopPullToRefresh()
// 只有一页的时候不展示没有更多数据了
if self.viewModel.totalCount < self.viewModel.searchPageSize { // 不足一页
tableView.footer?.isHidden = true
} else {
tableView.footer?.isHidden = false
if self.viewModel.hasMoreForHomeNews == false { if self.viewModel.hasMoreForHomeNews == false {
tableView.es.noticeNoMoreData() tableView.es.noticeNoMoreData()
} }
} }
} }
}
func getSearchHistoryList() -> [String] { func getSearchHistoryList() -> [String] {
if let arr = UserDefaults.standard.array(forKey: Self.searchInfoHistoryKey) as? [String] { if let arr = UserDefaults.standard.array(forKey: Self.searchInfoHistoryKey) as? [String] {
......
...@@ -102,7 +102,7 @@ private extension YHStartPageViewController { ...@@ -102,7 +102,7 @@ private extension YHStartPageViewController {
tabBarController.delegate = homeVC tabBarController.delegate = homeVC
let v0 = YHNavigationController(rootVC:homeVC) let v0 = YHNavigationController(rootVC:homeVC)
let v1 = YHNavigationController(rootVC:YHServiceCenterMainViewController()) let v1 = YHNavigationController(rootVC:YHServiceCenterMainViewController())
let v2 = YHNavigationController(rootVC:YHMsgViewController()) let v2 = YHNavigationController(rootVC:YHMessageListVC())
let v3 = YHNavigationController(rootVC:YHMyViewController()) let v3 = YHNavigationController(rootVC:YHMyViewController())
v0.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "首页", image: UIImage(named: "home"), selectedImage: UIImage(named: "home_1")) v0.tabBarItem = ESTabBarItem.init(YHBasicContentView(),title: "首页", image: UIImage(named: "home"), selectedImage: UIImage(named: "home_1"))
......
...@@ -50,7 +50,7 @@ class YHHomeWebBottomView: UIView { ...@@ -50,7 +50,7 @@ class YHHomeWebBottomView: UIView {
likeButton = { likeButton = {
let button = YHHomeWebBottomButton() let button = YHHomeWebBottomButton()
button.setContent("home_web_like", "652") button.setContent("home_web_like", "0")
button.addTarget(self, action: #selector(likeBtnClick), for: .touchUpInside) button.addTarget(self, action: #selector(likeBtnClick), for: .touchUpInside)
return button return button
}() }()
...@@ -64,7 +64,7 @@ class YHHomeWebBottomView: UIView { ...@@ -64,7 +64,7 @@ class YHHomeWebBottomView: UIView {
starButton = { starButton = {
let button = YHHomeWebBottomButton() let button = YHHomeWebBottomButton()
button.setContent("home_web_star", "34") button.setContent("home_web_star", "0")
button.addTarget(self, action: #selector(starBtnClick), for: .touchUpInside) button.addTarget(self, action: #selector(starBtnClick), for: .touchUpInside)
return button return button
}() }()
...@@ -78,6 +78,12 @@ class YHHomeWebBottomView: UIView { ...@@ -78,6 +78,12 @@ class YHHomeWebBottomView: UIView {
} }
@objc private func likeBtnClick() { @objc private func likeBtnClick() {
if YHLoginManager.shared.isLogin() == false {
if let block = likeBlock {
block(isLike)
}
return
}
isLike = !isLike isLike = !isLike
if let block = likeBlock { if let block = likeBlock {
block(isLike) block(isLike)
...@@ -85,6 +91,13 @@ class YHHomeWebBottomView: UIView { ...@@ -85,6 +91,13 @@ class YHHomeWebBottomView: UIView {
} }
@objc private func starBtnClick() { @objc private func starBtnClick() {
if YHLoginManager.shared.isLogin() == false {
if let block = starBlock {
block(isStar)
}
return
}
isStar = !isStar isStar = !isStar
if let block = starBlock { if let block = starBlock {
block(isStar) block(isStar)
......
...@@ -81,8 +81,8 @@ class YHSearchInfoHistoryView: UIView { ...@@ -81,8 +81,8 @@ class YHSearchInfoHistoryView: UIView {
func getwith(font: UIFont, height: CGFloat, string: String) -> CGSize { func getwith(font: UIFont, height: CGFloat, string: String) -> CGSize {
let size = CGSize.init(width: CGFloat(MAXFLOAT), height: height) let size = CGSize.init(width: CGFloat(MAXFLOAT), height: height)
let dic = [NSAttributedString.Key.font: font] // swift 4.2 let dic = [NSAttributedString.Key.font: font] // swift 4.2
let strSize = string.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size var strSize = string.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return strSize return CGSizeMake(ceil(strSize.width), strSize.height)
} }
} }
...@@ -99,8 +99,8 @@ extension YHSearchInfoHistoryView: UICollectionViewDelegate, UICollectionViewDat ...@@ -99,8 +99,8 @@ extension YHSearchInfoHistoryView: UICollectionViewDelegate, UICollectionViewDat
let size = self.getwith(font: UIFont.systemFont(ofSize: 12), height: 24, string: historyItems[indexPath.item]) let size = self.getwith(font: UIFont.systemFont(ofSize: 12), height: 24, string: historyItems[indexPath.item])
var width = size.width + gap*2.0 var width = size.width + gap*2.0
if width > collectionView.width { if width > 226.0 {
width = collectionView.width width = 226.0
} }
return CGSize(width: width, height: cellHeight) return CGSize(width: width, height: cellHeight)
} }
......
...@@ -18,8 +18,10 @@ class YHHomePageViewModel : YHBaseViewModel { ...@@ -18,8 +18,10 @@ class YHHomePageViewModel : YHBaseViewModel {
//首页相关参数 //首页相关参数
private var curPageIndex : Int = 1 private var curPageIndex : Int = 1
private var page_Size : Int = 6 private var page_Size : Int = 6
private var totalCount : Int = 0 var totalCount : Int = 0
var hasMoreForHomeNews : Bool = true var hasMoreForHomeNews : Bool = true
// 搜索
let searchPageSize: Int = 10
} }
//接口 //接口
...@@ -261,11 +263,11 @@ extension YHHomePageViewModel { ...@@ -261,11 +263,11 @@ extension YHHomePageViewModel {
if isFirstPage { if isFirstPage {
params = ["page": 1, params = ["page": 1,
"page_size": 10, "page_size": searchPageSize,
"title": title] "title": title]
} else { } else {
params = ["page": curPageIndex + 1, params = ["page": curPageIndex + 1,
"page_size": 10, "page_size": searchPageSize,
"title": title] "title": title]
} }
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.article let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.article
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import UIKit import UIKit
class YHInformationFillVC: YHBaseViewController { class YHMessageDetailListVC: YHBaseViewController {
var type:Int = -1 var type:Int = -1
var msgArr:[YHDetailMessageModel] = [] var msgArr:[YHDetailMessageModel] = []
...@@ -32,7 +32,7 @@ class YHInformationFillVC: YHBaseViewController { ...@@ -32,7 +32,7 @@ class YHInformationFillVC: YHBaseViewController {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") { YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") {
self.markAllMsgsRead()
} }
} }
return bar return bar
...@@ -40,7 +40,7 @@ class YHInformationFillVC: YHBaseViewController { ...@@ -40,7 +40,7 @@ class YHInformationFillVC: YHBaseViewController {
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.sectionHeaderHeight = 46.0 tableView.estimatedSectionHeaderHeight = 1.0
tableView.estimatedSectionFooterHeight = 1.0 tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none tableView.separatorStyle = .none
...@@ -92,16 +92,37 @@ class YHInformationFillVC: YHBaseViewController { ...@@ -92,16 +92,37 @@ class YHInformationFillVC: YHBaseViewController {
} }
} }
} func markAllMsgsRead() {
YHHUD.show(.progress(message: "清除中..."))
extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource { self.viewModel.readMessages(type:self.type, msgIds:nil, isAllRead:true) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if success {
YHHUD.flash(message: "清除成功")
for item in self.msgArr {
item.isRead = true
}
self.tableView.reloadData()
return
}
func numberOfSections(in tableView: UITableView) -> Int { if let error = error {
return msgArr.count var msg = "清除失败"
if error.errorMsg.count > 0 {
msg = error.errorMsg
}
YHHUD.flash(message: msg)
return
}
} }
}
}
extension YHMessageDetailListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1 return msgArr.count
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...@@ -119,7 +140,7 @@ extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource { ...@@ -119,7 +140,7 @@ extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource {
} }
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 46.0 return 1.0
} }
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
...@@ -133,17 +154,7 @@ extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource { ...@@ -133,17 +154,7 @@ extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView() return UIView()
let label = UILabel()
label.textColor = UIColor(hex: 0x121A26, alpha: 0.3)
label.textAlignment = .center
label.font = UIFont.PFSC_R(ofSize:12)
label.text = "2023-09-13"
view.addSubview(label)
label.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
return view
} }
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import UIKit import UIKit
class YHMsgViewController: YHBaseViewController { class YHMessageListVC: YHBaseViewController {
var msgArr:[YHMessageInfoModel] = [] var msgArr:[YHMessageInfoModel] = []
lazy var viewModel = { lazy var viewModel = {
...@@ -43,13 +43,15 @@ class YHMsgViewController: YHBaseViewController { ...@@ -43,13 +43,15 @@ class YHMsgViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
bar.rightBtnClick = {
[weak self] in
guard let self = self else { return }
bar.rightBtnClick = { bar.rightBtnClick = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") { YHCommonAlertView.show("清除未读", "确定要清除所有未读提示吗?", "取消", "确认") {
let vc = YHInformationFillVC() self.markAllMsgsRead()
vc.type = 1 }
self.navigationController?.pushViewController(vc)
} }
} }
return bar return bar
...@@ -141,20 +143,51 @@ class YHMsgViewController: YHBaseViewController { ...@@ -141,20 +143,51 @@ class YHMsgViewController: YHBaseViewController {
} }
} }
} }
}
extension YHMsgViewController { func markAllMsgsRead() {
YHHUD.show(.progress(message: "清除中..."))
@objc func clean() { self.viewModel.readMessages(type:nil, msgIds:nil, isAllRead:true) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if success {
YHHUD.flash(message: "清除成功")
for item in self.msgArr {
item.unreadCount = 0
}
self.tableView.reloadData()
return
}
if let error = error {
var msg = "清除失败"
if error.errorMsg.count > 0 {
msg = error.errorMsg
}
YHHUD.flash(message: msg)
return
}
}
} }
}
extension YHMessageListVC {
@objc func didEnableNotifyBtnClicked() { @objc func didEnableNotifyBtnClicked() {
self.goToSettingPage()
}
func goToSettingPage() {
let url = URL(string: UIApplication.openSettingsURLString)
if let url = url, UIApplication .shared.canOpenURL(url) {
UIApplication .shared.open(url, options: [:], completionHandler: {
(success) in
})
}
} }
} }
extension YHMsgViewController: UITableViewDelegate, UITableViewDataSource { extension YHMessageListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return msgArr.count return msgArr.count
...@@ -176,9 +209,9 @@ extension YHMsgViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -176,9 +209,9 @@ extension YHMsgViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 < indexPath.row && indexPath.row < msgArr.count { if 0 <= indexPath.row && indexPath.row < msgArr.count {
let msgItem = msgArr[indexPath.row] let msgItem = msgArr[indexPath.row]
let vc = YHInformationFillVC() let vc = YHMessageDetailListVC()
vc.type = msgItem.type vc.type = msgItem.type
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} }
......
...@@ -20,6 +20,7 @@ class YHInformationFillCell: UITableViewCell { ...@@ -20,6 +20,7 @@ class YHInformationFillCell: UITableViewCell {
var unreadPointView:UIView! var unreadPointView:UIView!
var bottomBtn:UIButton! var bottomBtn:UIButton!
var lineView:UIView! var lineView:UIView!
var timeLabel:UILabel!
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
...@@ -30,11 +31,50 @@ class YHInformationFillCell: UITableViewCell { ...@@ -30,11 +31,50 @@ class YHInformationFillCell: UITableViewCell {
setupUI() setupUI()
} }
func updateModel(_ model: YHDetailMessageModel) {
titleLabel.text = model.title
detailLabel.text = model.content
unreadPointView.isHidden = model.isRead
timeLabel.text = formatTimestamp(Double(model.time))
}
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() { func setupUI() {
self.selectionStyle = .none self.selectionStyle = .none
contentView.backgroundColor = UIColor(hex:0xF8F8F8) contentView.backgroundColor = UIColor(hex:0xF8F8F8)
timeLabel = UILabel()
timeLabel.textColor = UIColor(hex: 0x121A26, alpha: 0.3)
timeLabel.textAlignment = .center
timeLabel.font = UIFont.PFSC_R(ofSize:12)
timeLabel.text = "2023-09-13"
contentView.addSubview(timeLabel)
whiteView = UIView() whiteView = UIView()
whiteView.backgroundColor = .white whiteView.backgroundColor = .white
whiteView.layer.cornerRadius = 6.0 whiteView.layer.cornerRadius = 6.0
...@@ -71,10 +111,16 @@ class YHInformationFillCell: UITableViewCell { ...@@ -71,10 +111,16 @@ class YHInformationFillCell: UITableViewCell {
bottomBtn.addTarget(self, action: #selector(didBottomBtnClicked), for: .touchUpInside) bottomBtn.addTarget(self, action: #selector(didBottomBtnClicked), for: .touchUpInside)
whiteView.addSubview(bottomBtn) whiteView.addSubview(bottomBtn)
timeLabel.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(46.0)
}
whiteView.snp.makeConstraints { make in whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16) make.right.equalToSuperview().offset(-16)
make.top.bottom.equalToSuperview() make.top.equalTo(timeLabel.snp.bottom)
make.bottom.equalToSuperview()
} }
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
......
...@@ -34,15 +34,19 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -34,15 +34,19 @@ class YHMessageSessionCell: UITableViewCell {
if model.customType == .infoFill { if model.customType == .infoFill {
self.nameLabel.text = "资料填写" self.nameLabel.text = "资料填写"
self.iconImgView.image = UIImage(named: "msg_icon_info_fill")
} else if model.customType == .cerUpload { } else if model.customType == .cerUpload {
self.nameLabel.text = "证件上传" self.nameLabel.text = "证件上传"
self.iconImgView.image = UIImage(named: "msg_icon_cer_upload")
} else if model.customType == .draft { } else if model.customType == .draft {
self.nameLabel.text = "文书定稿" self.nameLabel.text = "文书定稿"
self.iconImgView.image = UIImage(named: "msg_icon_draft")
} else if model.customType == .fileSign { } else if model.customType == .fileSign {
self.nameLabel.text = "文件签字" self.nameLabel.text = "文件签字"
self.iconImgView.image = UIImage(named: "msg_icon_file_sign")
} else { } else {
self.nameLabel.text = "" self.nameLabel.text = ""
...@@ -103,7 +107,6 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -103,7 +107,6 @@ class YHMessageSessionCell: UITableViewCell {
contentView.addSubview(iconContentView) contentView.addSubview(iconContentView)
iconImgView = UIImageView() iconImgView = UIImageView()
iconImgView.backgroundColor = .red
iconContentView.addSubview(iconImgView) iconContentView.addSubview(iconImgView)
badgeLabel = UILabel() badgeLabel = UILabel()
...@@ -183,5 +186,4 @@ class YHMessageSessionCell: UITableViewCell { ...@@ -183,5 +186,4 @@ class YHMessageSessionCell: UITableViewCell {
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
} }
} }
...@@ -21,34 +21,34 @@ class YHMsgViewModel: NSObject { ...@@ -21,34 +21,34 @@ class YHMsgViewModel: NSObject {
var dic = json.data var dic = json.data
var json = json // var json = json
json.code = 200 // json.code = 200
dic = [ // dic = [
"information": [ // "information": [
"unread_count": 0, // "unread_count": 0,
"last_message": "阿法守法所发生的法师打发", // "last_message": "阿法守法所发生的法师打发",
"last_message_time": 1586507545, // "last_message_time": 1586507545,
"type": 0 // "type": 0
], // ],
"certificate": [ // "certificate": [
"unread_count": 3, // "unread_count": 3,
"last_message": "发生发顺丰大声道发生大发萨法沙发沙发沙发沙发阿斯顿发生发顺丰阿凡达放大第三方", // "last_message": "发生发顺丰大声道发生大发萨法沙发沙发沙发沙发阿斯顿发生发顺丰阿凡达放大第三方",
"last_message_time": 1586507545, // "last_message_time": 1586507545,
"type": 0 // "type": 0
], // ],
"draft": [ // "draft": [
"unread_count": 100, // "unread_count": 100,
"last_message": "发生发顺丰大声道发生大发", // "last_message": "发生发顺丰大声道发生大发",
"last_message_time": 1712737945, // "last_message_time": 1712737945,
"type": 0 // "type": 0
], // ],
"signature": [ // "signature": [
"unread_count": 87, // "unread_count": 87,
"last_message": "发生发", // "last_message": "发生发",
"last_message_time": 1713236425, // "last_message_time": 1713236425,
"type": 0 // "type": 0
] // ]
] // ]
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 { if json.code == 200 {
...@@ -108,12 +108,23 @@ class YHMsgViewModel: NSObject { ...@@ -108,12 +108,23 @@ class YHMsgViewModel: NSObject {
} }
} }
func readMessages(type:Int, msgIds:[Int], _ 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.readMsg
let params:[String : Any] = ["type": type, var params:[String : Any] = [:]
"ids": msgIds] if let type = type {
params["type"] = type
}
if let msgIds = msgIds, msgIds.count > 0 {
params["ids"] = msgIds
}
if let isAllRead = isAllRead {
params["all_read"] = isAllRead
}
printLog("params 是 ==> \(params)")
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, code in let _ = YHNetRequest.postRequest(url: strUrl, params: params) { json, code in
let dic = json.data let dic = json.data
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "Frame 1@2x.png", "filename" : "Group 2033194158@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "Frame 1@3x.png", "filename" : "Group 2033194158@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Message_zhengjian@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Message_zhengjian@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon-wenshuqingdan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon-wenshuqingdan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon-wenshuqingdan@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon-wenshuqingdan@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 2033194489@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 2033194489@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{ {
"images" : [ "images" : [
{ {
"filename" : "超级app启动页占位图.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "启动页@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "启动页@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
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