Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
7ccc58bd
Commit
7ccc58bd
authored
Apr 10, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
服务中心接口调试
parent
7a9071ae
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
94 deletions
+92
-94
YHHomePageViewModel.swift
...axy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
+5
-5
YHServerHKLifeViewController.swift
...lligentService(服务中心)/C/YHServerHKLifeViewController.swift
+30
-15
YHServiceListViewController.swift
...elligentService(服务中心)/C/YHServiceListViewController.swift
+8
-1
YHServerNoOrderView.swift
...ules/IntelligentService(服务中心)/V/YHServerNoOrderView.swift
+15
-5
YHServiceSectionView.swift
...les/IntelligentService(服务中心)/V/YHServiceSectionView.swift
+11
-24
YHServiceTableFootView.swift
...s/IntelligentService(服务中心)/V/YHServiceTableFootView.swift
+23
-44
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
View file @
7ccc58bd
...
...
@@ -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
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/C/YHServerHKLifeViewController.swift
View file @
7ccc58bd
...
...
@@ -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
homeViewModel
.
getHomeBanner
(
2
){[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
tableHeadView
.
bannarView
.
dataArr
=
self
.
homeViewModel
.
banners
??
[]
}
serviceCenterMainReqVM
.
getContactList
{
success
,
error
in
if
success
==
true
{
}
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
}
...
...
@@ -134,12 +155,6 @@ extension YHServerHKLifeViewController: JXSegmentedListContainerViewListDelegate
class
YHServerHKLifeViewCell
:
UITableViewCell
{
static
let
cellReuseIdentifier
=
"YHServerHKLifeViewCell"
var
tableFootView
:
YHServiceTableFootView
!
var
dataModel
:
YHContactItemModel
?
{
didSet
{
updateUI
()
}
}
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/C/YHServiceListViewController.swift
View file @
7ccc58bd
...
...
@@ -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
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/V/YHServerNoOrderView.swift
View file @
7ccc58bd
...
...
@@ -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
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/V/YHServiceSectionView.swift
View file @
7ccc58bd
...
...
@@ -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,46 +73,34 @@ 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
:
NS
IndexPath
)
{
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
)
"
)
}
}
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
)
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/V/YHServiceTableFootView.swift
View file @
7ccc58bd
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment