Commit ad0c0604 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:
  // 消息
  我的点赞和我的收藏和我的浏览
  // 消息
parents ba9cfe93 de83d6e8
This diff is collapsed.
//
// YHInformationFillCell.swift
// galaxy
//
// Created by edy on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHInformationFillCell: UITableViewCell {
static let cellReuseIdentifier = "YHInformationFillCell"
static let unreadPointWidth = 6.0
var whiteView:UIView!
var titleLabel:UILabel!
var detailLabel:UILabel!
var unreadPointView:UIView!
var bottomBtn:UIButton!
var lineView:UIView!
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
contentView.backgroundColor = UIColor(hex:0xF8F8F8)
whiteView = UIView()
whiteView.backgroundColor = .white
whiteView.layer.cornerRadius = 6.0
whiteView.clipsToBounds = true
contentView.addSubview(whiteView)
titleLabel = UILabel()
titleLabel.textColor = UIColor(hex: 0x222222)
titleLabel.textAlignment = .left
titleLabel.font = UIFont.PFSC_M(ofSize:17)
titleLabel.text = "资料填写提醒".local
whiteView.addSubview(titleLabel)
unreadPointView = UIView()
unreadPointView.backgroundColor = UIColor(hex:0xF81D22)
unreadPointView.layer.cornerRadius = Self.unreadPointWidth/2.0
unreadPointView.clipsToBounds = true
whiteView.addSubview(unreadPointView)
detailLabel = UILabel()
detailLabel.textAlignment = .left
detailLabel.numberOfLines = 0
whiteView.addSubview(detailLabel)
lineView = UIView()
lineView.backgroundColor = UIColor(hex:0xF8F8F8)
whiteView.addSubview(lineView)
bottomBtn = UIButton()
bottomBtn.setTitle("去填写".local, for: .normal)
bottomBtn.setTitleColor(UIColor(hex: 0x3570DC), for: .normal)
bottomBtn.titleLabel?.font = .PFSC_R(ofSize: 14)
bottomBtn.addTarget(self, action: #selector(didBottomBtnClicked), for: .touchUpInside)
whiteView.addSubview(bottomBtn)
whiteView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.top.bottom.equalToSuperview()
}
titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.top.equalToSuperview().offset(16)
make.height.equalTo(24.0)
}
unreadPointView.snp.makeConstraints { make in
make.width.height.equalTo(Self.unreadPointWidth)
make.left.equalTo(titleLabel.snp.right).offset(4)
make.centerY.equalTo(titleLabel)
make.right.lessThanOrEqualToSuperview().offset(-16)
}
detailLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
}
lineView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(detailLabel.snp.bottom).offset(16)
make.height.equalTo(1)
}
bottomBtn.snp.makeConstraints { make in
make.top.equalTo(lineView.snp.bottom)
make.left.right.bottom.equalToSuperview()
make.height.equalTo(52)
}
updateModel()
}
@objc func didBottomBtnClicked() {
}
func updateModel() {
let text1: ASAttributedString = .init("林先生,您好,您尚有20%内容未填写,请到", .font(UIFont.PFSC_R(ofSize: 14)), .foreground(UIColor(hex: 0x121A26, alpha: 0.7)))
let text2: ASAttributedString = .init("服务中心-资料上传", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor(hex: 0x3570DC)), .action {
})
let text3: ASAttributedString = .init("去填写,请您尽快完成~", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor(hex: 0x121A26, alpha: 0.7)))
detailLabel.attributed.text = text1 + text2 + text3
}
}
//
// YHInformationFillVC.swift
// galaxy
//
// Created by edy on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHInformationFillVC: YHBaseViewController {
var msgArr:[String] = ["","","",""]
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
bar.backgroundColor = .white
bar.title = "资料填写".local
bar.showRightButtonType(.clean)
bar.backBlock = {
[weak self] in
guard let self = self else { return }
self.navigationController?.popViewController(animated: true)
}
bar.rightBtnClick = {
[weak self] in
guard let self = self else { return }
}
return bar
}()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.sectionHeaderHeight = 46.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor(hex:0xF8F8F8)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHInformationFillCell.self, forCellReuseIdentifier: YHInformationFillCell.cellReuseIdentifier)
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
func setupUI() {
gk_navigationBar.isHidden = true
view.backgroundColor = .white
view.addSubview(tableView)
view.addSubview(navBar)
navBar.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_statusBar())
make.height.equalTo(k_Height_NavContentBar)
}
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview()
}
}
}
extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return msgArr.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHInformationFillCell.cellReuseIdentifier, for: indexPath) as! YHInformationFillCell
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 46.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = 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
}
}
......@@ -96,6 +96,8 @@ extension YHMsgViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHInformationFillVC()
self.navigationController?.pushViewController(vc)
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
......
//
// YHMyLikeViewController.swift
// galaxy
//
// Created by EDY on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyLikeViewController: YHBaseViewController {
let viewModel: YHMyLikeViewModel = YHMyLikeViewModel()
var tableFootView: YHServiceTableFootView!
var id = 1
var dataSouce: [YHHomeListModel?] = [] {
didSet {
self.tableFootView.items = dataSouce
}
}
override func viewDidLoad() {
super.viewDidLoad()
var title = "我的收藏"
if id == 1 {
title = "我的点赞"
} else if id == 2{
title = "我的收藏"
} else {
title = "我的浏览"
}
gk_navTitle = title
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
}
extension YHMyLikeViewController {
func loadData() {
if id == 1 || id == 2 {
self.viewModel.getList(id) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.viewModel.arrHomeNewsData ?? []
}
} else {
self.viewModel.getList(callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.viewModel.arrHomeNewsData ?? []
})
}
}
func setupUI() {
gk_navBarAlpha = 1
tableFootView = {
let view = YHServiceTableFootView()
return view
}()
view.addSubview(tableFootView)
tableFootView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
}
}
}
......@@ -96,6 +96,33 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
guard let self = self else { return }
if !checkLogin() { return }
}
view.likeClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
let vc = YHMyLikeViewController()
vc.id = 1
self.navigationController?.pushViewController(vc)
print("点赞")
}
view.collectClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
let vc = YHMyLikeViewController()
vc.id = 2
self.navigationController?.pushViewController(vc)
print("收藏")
}
view.recentScanClick = {
[weak self] in
guard let self = self else { return }
if !checkLogin() { return }
let vc = YHMyLikeViewController()
vc.id = 3
self.navigationController?.pushViewController(vc)
print("最近浏览")
}
return view
}()
......
......@@ -7,6 +7,7 @@
//
import UIKit
import AttributedString
class YHUserInfoHeaderView: UIView {
......@@ -14,7 +15,10 @@ class YHUserInfoHeaderView: UIView {
var evaluateBlock:(()->Void)?
var avatarClickBlock:(()->Void)?
var nickNameClickBlock:(()->Void)?
var likeClick:(()->Void)?
var collectClick:(()->Void)?
var recentScanClick:(()->Void)?
var nickName:String? {
didSet {
userNameLabel.text = nickName
......@@ -52,6 +56,18 @@ class YHUserInfoHeaderView: UIView {
label.textColor = UIColor(hexString:"#949DB5")
label.textAlignment = NSTextAlignment.left
label.font = UIFont.PFSC_R(ofSize: 13)
let text1: ASAttributedString = .init("点赞 0 ", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hex: 0x949DB5)), .action {
self.likeClick?()
})
let text2: ASAttributedString = .init("收藏 0 ", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hex: 0x949DB5)), .action {
self.collectClick?()
})
let text3: ASAttributedString = .init("最近浏览 0 ", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hex: 0x949DB5)), .action {
self.recentScanClick?()
})
label.attributed.text = text1 + text2 + text3
return label
}()
......
//
// YHMyLikeViewModel.swift
// galaxy
//
// Created by EDY on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHMyLikeViewModel: YHBaseViewModel {
var arrHomeNewsData: [YHHomeListModel]?
}
extension YHMyLikeViewModel {
// 1点赞 2收藏
func getList(_ type: Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params: [String : Any] = ["page": 1,
"page_size": 10,
"operate_type": type]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.user
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
if json.code == 200 {
let dic = json.data
guard let result = YHHomeListTotalModel.deserialize(from: dic as? Dictionary) else {
self.arrHomeNewsData = []
callBackBlock(false,nil)
return
}
for item in result.data {
item.calHeightParam()
}
self.arrHomeNewsData = result.data
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
//最近浏览
func getList(callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params: [String : Any] = ["page": 1,
"page_size": 10]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.userLook
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
if json.code == 200 {
let dic = json.data
guard let result = YHHomeListTotalModel.deserialize(from: dic as? Dictionary) else {
self.arrHomeNewsData = []
callBackBlock(false,nil)
return
}
for item in result.data {
item.calHeightParam()
}
self.arrHomeNewsData = result.data
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
......@@ -26,6 +26,10 @@ class YHAllApiName {
static let star = "infoflow/article/collect"
//资讯点赞
static let like = "infoflow/article/like"
//我的点赞和收藏
static let user = "infoflow/user/consult"
//我的浏览
static let userLook = "infoflow/user/view"
}
//order 模块
......
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