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
4aa501ba
Commit
4aa501ba
authored
Apr 10, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页资讯列表UI调整
parent
94cb1c0a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
14 deletions
+152
-14
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHHomePageViewController.swift
...Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
+73
-14
YHHomeListModel.swift
...y/galaxy/Classes/Modules/Home(首页)/M/YHHomeListModel.swift
+18
-0
YHHomePageViewModel.swift
...axy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
+26
-0
YHHomeCollectionViewCell.swift
...IntelligentService(服务中心)/V/YHHomeCollectionViewCell.swift
+29
-0
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+2
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
4aa501ba
...
@@ -240,6 +240,7 @@
...
@@ -240,6 +240,7 @@
049AC4C62BC3E55300F857F4
/* YHServiceSectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
;
};
049AC4C62BC3E55300F857F4
/* YHServiceSectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
;
};
049AC4C82BC513AB00F857F4
/* YHOrderListView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C72BC513AB00F857F4
/* YHOrderListView.swift */
;
};
049AC4C82BC513AB00F857F4
/* YHOrderListView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C72BC513AB00F857F4
/* YHOrderListView.swift */
;
};
049AC4CA2BC5141600F857F4
/* YHServerNoOrderView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C92BC5141600F857F4
/* YHServerNoOrderView.swift */
;
};
049AC4CA2BC5141600F857F4
/* YHServerNoOrderView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C92BC5141600F857F4
/* YHServerNoOrderView.swift */
;
};
049AC4CC2BC6615500F857F4
/* YHHomeListModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4CB2BC6615500F857F4
/* YHHomeListModel.swift */
;
};
04A271232BABFF3200652B1B
/* YHCertificateUploadTypeCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04A271222BABFF3200652B1B
/* YHCertificateUploadTypeCell.swift */
;
};
04A271232BABFF3200652B1B
/* YHCertificateUploadTypeCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04A271222BABFF3200652B1B
/* YHCertificateUploadTypeCell.swift */
;
};
04A271252BAC33BB00652B1B
/* YHFilePreviewTool.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04A271242BAC33BB00652B1B
/* YHFilePreviewTool.swift */
;
};
04A271252BAC33BB00652B1B
/* YHFilePreviewTool.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04A271242BAC33BB00652B1B
/* YHFilePreviewTool.swift */
;
};
04A671592B9F18C800C1FB91
/* YHCertificateUploadSheetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04A671582B9F18C800C1FB91
/* YHCertificateUploadSheetView.swift */
;
};
04A671592B9F18C800C1FB91
/* YHCertificateUploadSheetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04A671582B9F18C800C1FB91
/* YHCertificateUploadSheetView.swift */
;
};
...
@@ -674,6 +675,7 @@
...
@@ -674,6 +675,7 @@
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServiceSectionView.swift
;
sourceTree
=
"<group>"
;
};
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServiceSectionView.swift
;
sourceTree
=
"<group>"
;
};
049AC4C72BC513AB00F857F4
/* YHOrderListView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHOrderListView.swift
;
sourceTree
=
"<group>"
;
};
049AC4C72BC513AB00F857F4
/* YHOrderListView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHOrderListView.swift
;
sourceTree
=
"<group>"
;
};
049AC4C92BC5141600F857F4
/* YHServerNoOrderView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServerNoOrderView.swift
;
sourceTree
=
"<group>"
;
};
049AC4C92BC5141600F857F4
/* YHServerNoOrderView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServerNoOrderView.swift
;
sourceTree
=
"<group>"
;
};
049AC4CB2BC6615500F857F4
/* YHHomeListModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeListModel.swift
;
sourceTree
=
"<group>"
;
};
04A271222BABFF3200652B1B
/* YHCertificateUploadTypeCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateUploadTypeCell.swift
;
sourceTree
=
"<group>"
;
};
04A271222BABFF3200652B1B
/* YHCertificateUploadTypeCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateUploadTypeCell.swift
;
sourceTree
=
"<group>"
;
};
04A271242BAC33BB00652B1B
/* YHFilePreviewTool.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHFilePreviewTool.swift
;
sourceTree
=
"<group>"
;
};
04A271242BAC33BB00652B1B
/* YHFilePreviewTool.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHFilePreviewTool.swift
;
sourceTree
=
"<group>"
;
};
04A671582B9F18C800C1FB91
/* YHCertificateUploadSheetView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateUploadSheetView.swift
;
sourceTree
=
"<group>"
;
};
04A671582B9F18C800C1FB91
/* YHCertificateUploadSheetView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateUploadSheetView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -2153,6 +2155,7 @@
...
@@ -2153,6 +2155,7 @@
A5D6AB1A2B46A1CC001C10A5
/* YHHomeModel.swift */
,
A5D6AB1A2B46A1CC001C10A5
/* YHHomeModel.swift */
,
A5C5B2E92B4ECA4D00A7C5D1
/* YHDavidModel0.swift */
,
A5C5B2E92B4ECA4D00A7C5D1
/* YHDavidModel0.swift */
,
A53F42B82BC3DCA9009CAC70
/* YHHomeKingKongBlockModel.swift */
,
A53F42B82BC3DCA9009CAC70
/* YHHomeKingKongBlockModel.swift */
,
049AC4CB2BC6615500F857F4
/* YHHomeListModel.swift */
,
);
);
path
=
M
;
path
=
M
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -2486,6 +2489,7 @@
...
@@ -2486,6 +2489,7 @@
045EEEB32B9F171A0022A143
/* YHWorkFileSyncTableViewCell.swift in Sources */
,
045EEEB32B9F171A0022A143
/* YHWorkFileSyncTableViewCell.swift in Sources */
,
045EEEF12B9F171A0022A143
/* YHChildInfoContainerVC.swift in Sources */
,
045EEEF12B9F171A0022A143
/* YHChildInfoContainerVC.swift in Sources */
,
049AC4C82BC513AB00F857F4
/* YHOrderListView.swift in Sources */
,
049AC4C82BC513AB00F857F4
/* YHOrderListView.swift in Sources */
,
049AC4CC2BC6615500F857F4
/* YHHomeListModel.swift in Sources */
,
045EEF0B2B9F171A0022A143
/* YHBasicInfoFillViewController.swift in Sources */
,
045EEF0B2B9F171A0022A143
/* YHBasicInfoFillViewController.swift in Sources */
,
A582B2452BBA4CF9009D098C
/* YHHKPlanDocModel.swift in Sources */
,
A582B2452BBA4CF9009D098C
/* YHHKPlanDocModel.swift in Sources */
,
045EEF142B9F171A0022A143
/* YHItemModel.swift in Sources */
,
045EEF142B9F171A0022A143
/* YHItemModel.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomePageViewController.swift
View file @
4aa501ba
...
@@ -11,6 +11,8 @@ import ESPullToRefresh
...
@@ -11,6 +11,8 @@ import ESPullToRefresh
import
GKNavigationBarSwift
import
GKNavigationBarSwift
class
YHHomePageViewController
:
YHBaseViewController
{
class
YHHomePageViewController
:
YHBaseViewController
{
var
viewModel
:
YHHomePageViewModel
!
lazy
var
items
=
{
lazy
var
items
=
{
return
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
,
url
:
""
)]
return
[
AboutAdvantageItem
(
iconName
:
"about_match"
,
title
:
"精准匹配"
,
detail
:
"大数据精准匹配,专属方案获批率更高"
,
url
:
""
)]
}()
}()
...
@@ -41,7 +43,7 @@ class YHHomePageViewController: YHBaseViewController {
...
@@ -41,7 +43,7 @@ class YHHomePageViewController: YHBaseViewController {
let
flowLayout
=
YHHomeCollectionLayout
()
let
flowLayout
=
YHHomeCollectionLayout
()
flowLayout
.
minimumInteritemSpacing
=
7.0
flowLayout
.
minimumInteritemSpacing
=
7.0
flowLayout
.
minimumColumnSpacing
=
10.0
flowLayout
.
minimumColumnSpacing
=
10.0
flowLayout
.
sectionInset
=
UIEdgeInsets
(
top
:
0
,
left
:
0
,
bottom
:
0
,
right
:
0
)
flowLayout
.
sectionInset
=
UIEdgeInsets
(
top
:
0
,
left
:
20
,
bottom
:
0
,
right
:
2
0
)
let
collectinoView
=
YHGestureCollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
flowLayout
)
let
collectinoView
=
YHGestureCollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
flowLayout
)
// collectinoView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
// collectinoView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
...
@@ -57,7 +59,9 @@ class YHHomePageViewController: YHBaseViewController {
...
@@ -57,7 +59,9 @@ class YHHomePageViewController: YHBaseViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
viewModel
=
YHHomePageViewModel
()
setupUI
()
setupUI
()
getData
()
}
}
lazy
var
searchView
:
YHHomeSearchView
=
{
lazy
var
searchView
:
YHHomeSearchView
=
{
...
@@ -76,6 +80,13 @@ class YHHomePageViewController: YHBaseViewController {
...
@@ -76,6 +80,13 @@ class YHHomePageViewController: YHBaseViewController {
let
vc
=
YHSearchInfomationVC
()
let
vc
=
YHSearchInfomationVC
()
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
func
getData
()
{
viewModel
.
getHomeList
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
homeCollectView
.
reloadData
()
}
}
}
}
private
extension
YHHomePageViewController
{
private
extension
YHHomePageViewController
{
...
@@ -99,13 +110,15 @@ private extension YHHomePageViewController {
...
@@ -99,13 +110,15 @@ private extension YHHomePageViewController {
homeHeaderView
.
frame
=
CGRect
(
x
:
0
,
y
:
-
YHHomeHeadView
.
viewH
,
width
:
KScreenWidth
-
40
,
height
:
YHHomeHeadView
.
viewH
)
homeHeaderView
.
frame
=
CGRect
(
x
:
0
,
y
:
-
YHHomeHeadView
.
viewH
,
width
:
KScreenWidth
-
40
,
height
:
YHHomeHeadView
.
viewH
)
homeCollectView
.
addSubview
(
homeHeaderView
)
homeCollectView
.
addSubview
(
homeHeaderView
)
homeCollectView
.
contentInset
=
UIEdgeInsets
(
top
:
YHHomeHeadView
.
viewH
,
left
:
20
,
bottom
:
20
,
right
:
20
)
//
homeCollectView.contentInset = UIEdgeInsets(top: YHHomeHeadView.viewH, left: 20, bottom: 20, right: 20)
homeCollectView
.
es
.
addInfiniteScrolling
{
// homeCollectView.es.addInfiniteScrolling {
self
.
loadFakeData
()
// self.loadFakeData()
}
// }
homeCollectView
.
reloadData
()
// loadFirstItem()
// homeCollectView.reloadData()
}
}
func
loadFirstItem
()
{
func
loadFirstItem
()
{
...
@@ -130,6 +143,25 @@ private extension YHHomePageViewController {
...
@@ -130,6 +143,25 @@ private extension YHHomePageViewController {
self
.
homeCollectView
.
reloadData
()
self
.
homeCollectView
.
reloadData
()
}
}
}
}
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
:
width
,
height
:
height
)
}
}
}
...
@@ -137,11 +169,12 @@ private extension YHHomePageViewController {
...
@@ -137,11 +169,12 @@ private extension YHHomePageViewController {
extension
YHHomePageViewController
:
UICollectionViewDelegate
,
UICollectionViewDataSource
{
extension
YHHomePageViewController
:
UICollectionViewDelegate
,
UICollectionViewDataSource
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
items
.
count
return
self
.
viewModel
.
lists
?
.
count
??
0
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHHomeCollectionViewCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHHomeCollectionViewCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHHomeCollectionViewCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHHomeCollectionViewCell
cell
.
listModel
=
self
.
viewModel
.
lists
?[
indexPath
.
row
]
return
cell
return
cell
}
}
...
@@ -154,13 +187,39 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa
...
@@ -154,13 +187,39 @@ extension YHHomePageViewController: UICollectionViewDelegate, UICollectionViewDa
extension
YHHomePageViewController
:
CollectionViewWaterfallLayoutDelegate
{
extension
YHHomePageViewController
:
CollectionViewWaterfallLayoutDelegate
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
:
UICollectionViewLayout
,
sizeForItemAtIndexPath
indexPath
:
NSIndexPath
)
->
CGSize
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
:
UICollectionViewLayout
,
sizeForItemAtIndexPath
indexPath
:
NSIndexPath
)
->
CGSize
{
guard
let
model
=
self
.
viewModel
.
lists
?[
indexPath
.
row
]
else
{
return
CGSize
(
width
:
0
,
height
:
0
)
}
let
text
=
model
.
title
let
width
=
(
KScreenWidth
-
47
)
/
2
let
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
// 字体大小
let
maxWidth
=
width
-
16
// 最大宽度限制
// 创建NSAttributedString对象并设置属性
let
attributes
=
[
NSAttributedString
.
Key
.
font
:
font
]
as
[
NSAttributedString
.
Key
:
Any
]
_
=
NSMutableAttributedString
(
string
:
text
,
attributes
:
attributes
)
// 根据指定的最大宽度和字体大小计算文本的高度
let
size
=
(
text
as
NSString
)
.
boundingRect
(
with
:
CGSize
(
width
:
maxWidth
,
height
:
.
greatestFiniteMagnitude
),
options
:
.
usesLineFragmentOrigin
,
attributes
:
attributes
,
context
:
nil
)
.
size
var
textHeight
=
size
.
height
if
textHeight
>
40
{
textHeight
=
40
}
let
imageSize
=
getImageSize
(
model
.
img_url
)
var
imageHeight
=
0.0
if
imageSize
.
width
==
0
{
imageHeight
=
width
}
else
{
imageHeight
=
width
*
imageSize
.
height
/
imageSize
.
width
if
imageHeight
>
280
{
imageHeight
=
280
}
}
let
totalHeight
=
imageHeight
+
textHeight
+
46
return
CGSize
(
width
:
width
,
height
:
totalHeight
)
let
margin
=
20.0
//
let margin = 20.0
let
gap
=
7.0
//
let gap = 7.0
let
itemWidth
=
70.0
//
ceil((KScreenWidth - 2*margin - gap)/2.0)
// let itemWidth =
ceil((KScreenWidth - 2*margin - gap)/2.0)
let
arrItemH
:
[
CGFloat
]
=
[
100
,
150
,
200
,
250
,
300
,
350
,
400
]
//
let arrItemH : [CGFloat] = [100,150,200,250,300,350,400]
//
let
HHH
=
arrItemH
[
Int
.
random
(
in
:
0
...
6
)]
//
let HHH = arrItemH[Int.random(in: 0...6)]
return
CGSize
(
width
:
itemWidth
,
height
:
HHH
)
//
return CGSize(width: itemWidth, height: HHH)
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHHomeListModel.swift
0 → 100644
View file @
4aa501ba
//
// YHHomeListModel.swift
// galaxy
//
// Created by EDY on 2024/4/10.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHHomeListModel
:
YHBaseModel
{
var
collect_count
:
Int
=
0
var
id
:
Int
=
0
var
title
:
String
=
""
var
content
:
String
=
""
var
view_count
:
Int
=
0
var
img_url
:
String
=
""
}
galaxy/galaxy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
View file @
4aa501ba
...
@@ -11,6 +11,7 @@ import UIKit
...
@@ -11,6 +11,7 @@ import UIKit
class
YHHomePageViewModel
:
YHBaseViewModel
{
class
YHHomePageViewModel
:
YHBaseViewModel
{
//数据源
//数据源
var
configModel
:
YHHomeCofigMode
?
var
configModel
:
YHHomeCofigMode
?
var
lists
:
[
YHHomeListModel
]?
}
}
//接口
//接口
...
@@ -34,4 +35,29 @@ extension YHHomePageViewModel {
...
@@ -34,4 +35,29 @@ extension YHHomePageViewModel {
callBackBlock
(
false
,
err
)
callBackBlock
(
false
,
err
)
}
}
}
}
func
getHomeList
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
params
:
[
String
:
Any
]
=
[
"page"
:
1
,
"page_size"
:
10
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Common
.
consult
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
=
[
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
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/V/YHHomeCollectionViewCell.swift
View file @
4aa501ba
...
@@ -18,6 +18,12 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
...
@@ -18,6 +18,12 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
}
}
}
}
var
listModel
:
YHHomeListModel
?
{
didSet
{
updataSubViews
()
}
}
lazy
var
titleImageView
:
UIImageView
=
{
lazy
var
titleImageView
:
UIImageView
=
{
let
imageV
=
UIImageView
(
image
:
UIImage
(
named
:
"home_title_image"
))
let
imageV
=
UIImageView
(
image
:
UIImage
(
named
:
"home_title_image"
))
imageV
.
contentMode
=
.
scaleAspectFill
imageV
.
contentMode
=
.
scaleAspectFill
...
@@ -154,6 +160,29 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
...
@@ -154,6 +160,29 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
descripeLable
.
text
=
dataSource
.
title
descripeLable
.
text
=
dataSource
.
title
}
}
func
updataSubViews
()
{
guard
let
listModel
=
listModel
else
{
return
}
let
imageSize
=
getImageSize
(
listModel
.
img_url
)
var
imageHeight
=
0.0
if
imageSize
.
width
==
0
{
imageHeight
=
width
}
else
{
imageHeight
=
width
*
imageSize
.
height
/
imageSize
.
width
if
imageHeight
>
280
{
imageHeight
=
280
}
}
titleImageView
.
snp
.
remakeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
imageHeight
)
}
if
let
url
=
URL
(
string
:
listModel
.
img_url
)
{
titleImageView
.
kf
.
setImage
(
with
:
url
)
}
descripeLable
.
text
=
listModel
.
title
}
func
getImageSize
(
_
url
:
String
?)
->
CGSize
{
func
getImageSize
(
_
url
:
String
?)
->
CGSize
{
guard
let
urlStr
=
url
,
urlStr
.
count
!=
0
else
{
guard
let
urlStr
=
url
,
urlStr
.
count
!=
0
else
{
return
CGSize
.
zero
return
CGSize
.
zero
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
4aa501ba
...
@@ -14,6 +14,8 @@ class YHAllApiName {
...
@@ -14,6 +14,8 @@ class YHAllApiName {
//首页配置接口
//首页配置接口
static
let
homeConfigApi
=
"common/homepage-config/index"
static
let
homeConfigApi
=
"common/homepage-config/index"
static
let
consult
=
"infoflow/home/consult"
}
}
//order 模块
//order 模块
...
...
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