Commit 15fb8b14 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:
  服务中心接口调试
  // UI走查
  //  UI走查
parents e00556a3 fc4da478
......@@ -8,6 +8,8 @@
import UIKit
class YHSearchInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHSearchInfoCell"
......@@ -39,7 +41,6 @@ class YHSearchInfoCell: UITableViewCell {
return label
}()
func setupUI() {
contentView.backgroundColor = .white
......@@ -59,4 +60,24 @@ class YHSearchInfoCell: UITableViewCell {
}
}
func highlightText(in text: String, highlightString: String, highlightColor: UIColor) -> NSAttributedString {
let attributedString = NSMutableAttributedString(string: text)
// 创建一个属性字典,用于设置高亮样式
let highlightAttributes: [NSAttributedString.Key: Any] = [
.backgroundColor: highlightColor
]
// 查找并应用高亮样式到指定文字
let range = (text as NSString).range(of: highlightString)
attributedString.addAttributes(highlightAttributes, range: range)
return attributedString
}
func hopeless() {
}
}
......@@ -119,11 +119,11 @@ extension YHHomePageViewModel {
//1. json字符串 转 对象
if json.code == 200 {
let dic = json.data
// guard let result = [YHHomeListModel].deserialize(from: dic as? [Any]) else {
// callBackBlock(false,nil)
// return
// }
// self.lists = result as? [YHHomeListModel]
guard let result = [YHHomeListModel].deserialize(from: dic as? [Any]) else {
callBackBlock(false,nil)
return
}
self.lists = result as? [YHHomeListModel]
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
......
......@@ -10,12 +10,16 @@ import UIKit
import JXSegmentedView
class YHServerHKLifeViewController: YHBaseViewController {
private let serviceCenterMainReqVM : YHServiceCenterMainViewModel = YHServiceCenterMainViewModel()
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var tableHeadView: YHServerTableHeadView!
var tableFootView: YHServiceTableFootView!
var sectionView: YHServiceSectionView!
var dataSouce: [YHHomeListModel] = [] {
didSet {
self.homeTableView.reloadData()
}
}
var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
if #available(iOS 15.0, *) {
......@@ -44,15 +48,24 @@ class YHServerHKLifeViewController: YHBaseViewController {
extension YHServerHKLifeViewController {
func loadData() {
if YHLoginManager.shared.isLogin() == false {
return
}
serviceCenterMainReqVM.getContactList { success, error in
if success == true {
homeViewModel.getHomeBanner(2){[weak self] success, error in
guard let self = self else { return }
self.tableHeadView.bannarView.dataArr = self.homeViewModel.banners ?? []
}
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
homeViewModel.getHomeClassify{[weak self] success, error in
guard let self = self, let classify = self.homeViewModel.classify else { return }
for item in classify {
let model = item as YHHomeClassifyModel
if model.id == 2 {
self.sectionView.items = model.children
let classifyID = model.children.first?.id ?? 0
self.homeViewModel.getList(classifyID) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.homeViewModel.lists ?? []
}
}
}
}
}
......@@ -63,6 +76,13 @@ extension YHServerHKLifeViewController {
sectionView = {
let view = YHServiceSectionView()
view.block = {[weak self] model in
guard let self = self else { return }
self.homeViewModel.getList(model.id) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.homeViewModel.lists ?? []
}
}
return view
}()
......@@ -116,6 +136,7 @@ extension YHServerHKLifeViewController : UITableViewDelegate,UITableViewDataSour
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self)
cell0.tableFootView.items = dataSouce
cell0.selectionStyle = .none
return cell0
}
......@@ -135,12 +156,6 @@ class YHServerHKLifeViewCell: UITableViewCell {
static let cellReuseIdentifier = "YHServerHKLifeViewCell"
var tableFootView: YHServiceTableFootView!
var dataModel : YHContactItemModel? {
didSet {
updateUI()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
......
......@@ -47,7 +47,7 @@ extension YHServiceListViewController {
let classifyID = model.children.first?.id ?? 0
self.homeViewModel.getList(classifyID) {[weak self] success, error in
guard let self = self else { return }
self.normalView.dataSouce = self.homeViewModel.lists ?? []
}
}
}
......@@ -85,6 +85,13 @@ extension YHServiceListViewController {
normalView = {
let view = YHServerNoOrderView()
view.sectionBlock = {[weak self] model in
guard let self = self else { return }
self.homeViewModel.getList(model.id) {[weak self] success, error in
guard let self = self else { return }
self.normalView.dataSouce = self.homeViewModel.lists ?? []
}
}
return view
}()
view.addSubview(normalView)
......
......@@ -36,7 +36,7 @@ class YHCertificateCategoryItem {
class YHCertificateListContainerVC: YHBaseViewController {
static let segmentHeight = 53.0
static let segmentHeight = 49.0
var orderId : Int?
var filterDict : [String: String] = [:]
......@@ -68,6 +68,12 @@ class YHCertificateListContainerVC: YHBaseViewController {
YHCertificateCategoryItem(type: .finish)]
var itemVCs:[YHCertificateListVC] = []
lazy var segmentContainerView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
lazy var segmentedView : JXSegmentedView = {
let segview = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: Self.segmentHeight))
segview.dataSource = segmentedDataSource
......@@ -75,6 +81,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
//配置指示器
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorHeight = 4.0
indicator.indicatorColor = .brandMainColor
segview.indicators = [indicator]
segview.backgroundColor = .clear
......@@ -163,8 +170,9 @@ class YHCertificateListContainerVC: YHBaseViewController {
itemVCs.append(vc)
}
view.addSubview(navBar)
view.addSubview(segmentedView)
view.addSubview(filterBtn)
view.addSubview(segmentContainerView)
segmentContainerView.addSubview(segmentedView)
segmentContainerView.addSubview(filterBtn)
view.addSubview(listContainerView)
navBar.snp.makeConstraints { make in
......@@ -172,21 +180,27 @@ class YHCertificateListContainerVC: YHBaseViewController {
make.top.equalToSuperview().offset(k_Height_statusBar())
make.height.equalTo(k_Height_NavContentBar)
}
segmentContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(Self.segmentHeight+4)
}
segmentedView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.top.left.equalToSuperview()
make.right.equalToSuperview().offset(-21-18)
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(Self.segmentHeight)
}
filterBtn.snp.makeConstraints { make in
make.width.height.equalTo(YHCertificateFilterButton.width)
make.centerY.equalTo(segmentedView.snp.centerY)
make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-18)
}
listContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(segmentedView.snp.bottom)
make.top.equalTo(segmentContainerView.snp.bottom)
make.bottom.equalToSuperview()
}
}
......
......@@ -283,7 +283,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
} else if editType == .delete { // 删除
let msg = "您确定要删除文档\(contentItem.name)吗"
let msg = "您确定要删除文档\(contentItem.name)?"
YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return }
// 删除
......
......@@ -66,7 +66,20 @@ class YHCertificateInfoCell: UITableViewCell {
if !model.nameExtra.applicant.isEmpty {
ownerStr = model.nameExtra.applicant
}
infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)"
infoStr = "类型: \(typeStr) | 所属人: \(ownerStr)"
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize:11),
.foregroundColor: UIColor.labelTextColor2
]
let attrString = NSMutableAttributedString(string: infoStr, attributes: attributes)
if let separatorRange = infoStr.range(of: String("|")) {
let range = NSRange(separatorRange, in: infoStr)
attrString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex: 0xF0F0F0), range: range)
}
infoLabel.attributedText = attrString
var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
......@@ -155,7 +168,7 @@ class YHCertificateInfoCell: UITableViewCell {
nameTextView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(10)
make.top.equalToSuperview().offset(4)
make.right.equalTo(statusLabel.snp.left).offset(-6)
make.right.equalTo(statusLabel.snp.left).offset(-26)
}
infoLabel.snp.makeConstraints { make in
......
......@@ -9,10 +9,16 @@
import UIKit
class YHServerNoOrderView: UIView {
typealias SectionBlock = (YHClassifyModel) -> ()
var sectionBlock: SectionBlock?
var tableHeadView: YHServerTableHeadView!
var tableFootView: YHServiceTableFootView!
var sectionView: YHServiceSectionView!
var dataSouce: [YHHomeListModel] = [] {
didSet {
self.homeTableView.reloadData()
}
}
var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
if #available(iOS 15.0, *) {
......@@ -41,16 +47,19 @@ class YHServerNoOrderView: UIView {
sectionView = {
let view = YHServiceSectionView()
view.block = {[weak self] model in
guard let self = self else { return }
if let block = sectionBlock {
block(model)
}
}
return view
}()
tableHeadView = YHServerTableHeadView()
tableHeadView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 365)
// tableFootView = YHServiceTableFootView()
// tableFootView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)
addSubview(homeTableView)
homeTableView.tableHeaderView = tableHeadView
homeTableView.tableFooterView = tableFootView
homeTableView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.bottom.equalToSuperview()
......@@ -94,6 +103,7 @@ extension YHServerNoOrderView : UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self)
cell0.tableFootView.items = dataSouce
cell0.selectionStyle = .none
return cell0
}
......
......@@ -10,7 +10,8 @@ import UIKit
class YHServiceSectionView: UIView {
typealias Block = (YHClassifyModel) -> ()
var block: Block?
var items: [YHClassifyModel] = [] {
didSet {
......@@ -43,8 +44,6 @@ class YHServiceSectionView: UIView {
super.init(frame: frame)
backgroundColor = .white
setUpView()
// self.items = ["优才","高才","留学","专才"]
// self.myCollectView.reloadData()
}
required init?(coder: NSCoder) {
......@@ -74,18 +73,21 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHServiceSectionCollectionViewCell
cell.dataSource = items[indexPath.row]
if indexPath.row == selectIndex {
cell.isSelected = true
cell.setSelectedStyle()
} else {
cell.isSelected = false
cell.setDeSelectedStyle()
}
return cell
}
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIndex = indexPath.row
collectionView.reloadData()
let model = items[indexPath.row]
if let block = block {
block(model)
}
print("index is \(indexPath.row)")
}
}
......@@ -93,27 +95,12 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo
class YHServiceSectionCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHServiceSectionCollectionViewCell"
private var isSelect: Bool = false
override var isSelected: Bool {
set {
self.isSelect = newValue
if newValue {
self.setSelectedStyle()
} else {
self.setDeSelectedStyle()
}
}
get {
return self.isSelect
}
}
private func setSelectedStyle() {
func setSelectedStyle() {
contentView.backgroundColor = UIColor.brandMainColor
descripeLable.textColor = UIColor.white
}
private func setDeSelectedStyle() {
func setDeSelectedStyle() {
contentView.backgroundColor = UIColor(hex: 0xf4f6fa)
descripeLable.textColor = UIColor(hex: 0x94a3bb)
}
......
......@@ -10,14 +10,11 @@ import UIKit
class YHServiceTableFootView: UIView {
lazy var items = {
return [
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")
]
}()
var items:[YHHomeListModel] = [] {
didSet {
self.myCollectView.reloadData()
}
}
lazy var myCollectView = {
// 设置布局方向
......@@ -36,24 +33,10 @@ class YHServiceTableFootView: UIView {
return collectinoView
}()
var dataSource: YHScemeHeadModel? {
didSet {
updateAllViews()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
self.items = [
AboutAdvantageItem(iconName: "about_match", title: "精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配精准匹配精准匹配精准匹配精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://inews.gtimg.com/om_bt/OjPq2cnMN_-ivDKjxpCZ2kk_ab8YC5VMnL-0pQ21fUvd4AA/1000"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配精准匹配精准匹配精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://img.pconline.com.cn/images/upload/upc/tx/itbbs/2101/25/c1/251135935_1611532823091_mthumb.jpg"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://photo.16pic.com/00/47/86/16pic_4786353_b.jpg"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://inews.gtimg.com/om_bt/OMvPDmiuH_X5Vq1YLNgbFEzD2h_-2dCfWQ7xZFcKFSEsAAA/641")
]
self.myCollectView.reloadData()
}
required init?(coder: NSCoder) {
......@@ -71,27 +54,23 @@ class YHServiceTableFootView: UIView {
// }
}
func updateAllViews() {
guard let model = dataSource else { return }
}
func getImageSize(_ url: String?) -> CGSize {
// guard let urlStr = url, urlStr.count != 0 else {
// return CGSize.zero
// }
// let tempUrl = URL(string: urlStr)
// let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil)
// var width: CGFloat = 0
// var height: CGFloat = 0
// if let imageSRef = imageSourceRef {
// let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil)
// if let imageP = imageProperties {
// let imageDict = imageP as Dictionary
// width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat
// height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat
// }
// }
return CGSize(width: 150, height: 250)
guard let urlStr = url, urlStr.count != 0 else {
return CGSize.zero
}
let tempUrl = URL(string: urlStr)
let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil)
var width: CGFloat = 0
var height: CGFloat = 0
if let imageSRef = imageSourceRef {
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil)
if let imageP = imageProperties {
let imageDict = imageP as Dictionary
width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat
height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat
}
}
return CGSize(width: width, height: height)
}
}
......@@ -103,7 +82,7 @@ extension YHServiceTableFootView: UICollectionViewDelegate, UICollectionViewData
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell
cell.dataSource = items[indexPath.row]
cell.listModel = items[indexPath.row]
return cell
}
......@@ -133,7 +112,7 @@ extension YHServiceTableFootView: CollectionViewWaterfallLayoutDelegate {
if textHeight > 40 {
textHeight = 40
}
let imageSize = getImageSize(model.url)
let imageSize = getImageSize(model.img_url)
var imageHeight = 0.0
if imageSize.width == 0 {
imageHeight = width
......
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