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
7829efe4
Commit
7829efe4
authored
Jul 19, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 首页资讯
parent
a59f17bf
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
106 additions
and
16 deletions
+106
-16
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHHomeInfoDetailContainerViewController.swift
.../Home(首页)/C/YHHomeInfoDetailContainerViewController.swift
+1
-1
YHHomeInfoDetailViewController.swift
...s/Modules/Home(首页)/C/YHHomeInfoDetailViewController.swift
+1
-3
YHHomeInformationViewController.swift
.../Modules/Home(首页)/C/YHHomeInformationViewController.swift
+12
-2
YHHomeInfoClassifyModel.swift
.../Classes/Modules/Home(首页)/M/YHHomeInfoClassifyModel.swift
+37
-0
YHHomeInfoSectionCell.swift
...xy/Classes/Modules/Home(首页)/V/YHHomeInfoSectionCell.swift
+9
-4
YHHomeInfoSectionHeadView.swift
...lasses/Modules/Home(首页)/V/YHHomeInfoSectionHeadView.swift
+12
-6
YHHomePageViewModel.swift
...axy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
+28
-0
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+2
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
7829efe4
...
...
@@ -31,6 +31,7 @@
04213B2D2C48FEB000797900
/* YHHomeInfoSectionHeadView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04213B2C2C48FEB000797900
/* YHHomeInfoSectionHeadView.swift */
;
};
04213B2F2C49154900797900
/* YHHomeInfoDetailContainerViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04213B2E2C49154900797900
/* YHHomeInfoDetailContainerViewController.swift */
;
};
04213B312C4917BD00797900
/* YHHomeInfoDetailViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04213B302C4917BD00797900
/* YHHomeInfoDetailViewController.swift */
;
};
04213B332C4A084600797900
/* YHHomeInfoClassifyModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04213B322C4A084600797900
/* YHHomeInfoClassifyModel.swift */
;
};
0425E63D2BA9345200A5E763
/* YHSchemeTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0425E63C2BA9345200A5E763
/* YHSchemeTableViewCell.swift */
;
};
0425E6402BA9357D00A5E763
/* YHScemeItemModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0425E63F2BA9357D00A5E763
/* YHScemeItemModel.swift */
;
};
0425E6422BA95B1B00A5E763
/* YHSchemeTableFooterView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0425E6412BA95B1B00A5E763
/* YHSchemeTableFooterView.swift */
;
};
...
...
@@ -620,6 +621,7 @@
04213B2C2C48FEB000797900
/* YHHomeInfoSectionHeadView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeInfoSectionHeadView.swift
;
sourceTree
=
"<group>"
;
};
04213B2E2C49154900797900
/* YHHomeInfoDetailContainerViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeInfoDetailContainerViewController.swift
;
sourceTree
=
"<group>"
;
};
04213B302C4917BD00797900
/* YHHomeInfoDetailViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeInfoDetailViewController.swift
;
sourceTree
=
"<group>"
;
};
04213B322C4A084600797900
/* YHHomeInfoClassifyModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeInfoClassifyModel.swift
;
sourceTree
=
"<group>"
;
};
0425E63C2BA9345200A5E763
/* YHSchemeTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSchemeTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
0425E63F2BA9357D00A5E763
/* YHScemeItemModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHScemeItemModel.swift
;
sourceTree
=
"<group>"
;
};
0425E6412BA95B1B00A5E763
/* YHSchemeTableFooterView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSchemeTableFooterView.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2527,6 +2529,7 @@
A567E5722BD7643D00D5D5A0
/* YHWebModel.swift */
,
A5A89FD62C256B94005A71DD
/* YHHomeLastMessageModel.swift */
,
A5B6ED752C2593A1001B6732
/* YHSignerInfoModel.swift */
,
04213B322C4A084600797900
/* YHHomeInfoClassifyModel.swift */
,
);
path
=
M
;
sourceTree
=
"<group>"
;
...
...
@@ -3703,6 +3706,7 @@
045EEEB82B9F171A0022A143
/* YHWorkExampleMessageView.swift in Sources */
,
04F4B76B2BAA7E1E00D13284
/* YHCertificateTemplateSheetView.swift in Sources */
,
045EEEA22B9F171A0022A143
/* YHWorkExperienceProjectModel.swift in Sources */
,
04213B332C4A084600797900
/* YHHomeInfoClassifyModel.swift in Sources */
,
04F316442C3568F000024164
/* YHAboutGalaxyViewController.swift in Sources */
,
0435FA832BA2DEB100024EAE
/* YHCardButton.swift in Sources */
,
045EEECA2B9F171A0022A143
/* YHMyDocumentsListViewController.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeInfoDetailContainerViewController.swift
View file @
7829efe4
...
...
@@ -89,7 +89,7 @@ class YHHomeInfoDetailContainerViewController: YHBaseViewController {
make
.
height
.
equalTo
(
44
)
}
self
.
listContainerView
.
snp
.
makeConstraints
{
make
in
let
gap
=
isHaveHot
?
44.0
+
19.0
:
0
.0
let
gap
=
isHaveHot
?
44.0
+
19.0
:
19
.0
make
.
top
.
equalTo
(
k_Height_NavigationtBarAndStatuBar
+
gap
)
make
.
left
.
equalTo
(
0
)
make
.
right
.
equalTo
(
0
)
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeInfoDetailViewController.swift
View file @
7829efe4
...
...
@@ -51,11 +51,9 @@ class YHHomeInfoDetailViewController: YHBaseViewController {
self
.
view
.
backgroundColor
=
.
white
self
.
view
.
addSubview
(
self
.
collectView
)
self
.
collectView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
make
.
top
.
bottom
.
equalToSuperview
()
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
let
gap
=
isShowTab
?
44.0
+
19.0
:
0.0
make
.
height
.
equalTo
(
KScreenHeight
-
k_Height_NavigationtBarAndStatuBar
-
gap
)
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeInformationViewController.swift
View file @
7829efe4
...
...
@@ -16,7 +16,7 @@ class YHHomeInformationViewController: YHBaseViewController {
return
viewModel
}()
var
sectionItems
:[
String
]
=
[
""
,
""
,
""
,
""
]
var
sectionItems
:[
YHHomeInfoClassifyModel
?]
=
[
]
lazy
var
collectView
=
{
// 设置布局方向
...
...
@@ -33,6 +33,7 @@ class YHHomeInformationViewController: YHBaseViewController {
collectinoView
.
alwaysBounceVertical
=
true
collectinoView
.
showsVerticalScrollIndicator
=
false
collectinoView
.
es
.
addYHPullToRefresh
{
self
.
getClassifies
()
self
.
getTheNewestInfoList
(
isFirstPage
:
true
)
}
collectinoView
.
es
.
addInfiniteScrolling
{
...
...
@@ -51,7 +52,7 @@ class YHHomeInformationViewController: YHBaseViewController {
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
}
self
.
getClassifies
()
self
.
getTheNewestInfoList
(
isFirstPage
:
true
)
}
}
...
...
@@ -138,6 +139,15 @@ extension YHHomeInformationViewController: JXSegmentedListContainerViewListDeleg
}
extension
YHHomeInformationViewController
{
// 获取栏目
func
getClassifies
()
{
self
.
viewModel
.
getHomeInfoClassifies
{
success
,
error
in
self
.
sectionItems
.
removeAll
()
self
.
sectionItems
.
append
(
contentsOf
:
self
.
viewModel
.
classifyArr
)
self
.
collectView
.
reloadData
()
}
}
// 获取最新资讯
func
getTheNewestInfoList
(
isFirstPage
:
Bool
)
{
self
.
viewModel
.
getList
(
isFirsPage
:
isFirstPage
)
{
success
,
error
in
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHHomeInfoClassifyModel.swift
0 → 100644
View file @
7829efe4
//
// YHHomeInfoClassifyModel.swift
// galaxy
//
// Created by edy on 2024/7/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
SmartCodable
class
YHHomeInfoClassifyModel
:
SmartCodable
{
var
id
:
Int
=
0
var
type
:
Int
=
0
var
pid
:
Int
=
0
var
sort
:
Int
=
0
var
level
:
Int
=
0
var
isShow
:
Int
=
0
var
isMessage
:
Int
=
0
var
hotNum
:
Int
=
0
var
name
:
String
=
""
var
imgURL
:
String
=
""
enum
CodingKeys
:
String
,
CodingKey
{
case
id
,
type
,
pid
,
sort
,
level
case
isShow
=
"is_show"
case
isMessage
=
"is_message"
case
hotNum
=
"hot_num"
case
name
case
imgURL
=
"img_url"
}
required
init
()
{
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeInfoSectionCell.swift
View file @
7829efe4
...
...
@@ -11,7 +11,7 @@ import UIKit
class
YHHomeInfoSectionCell
:
UICollectionViewCell
{
static
let
cellReuseIdentifier
=
"YHHomeInfoSectionCell"
lazy
var
titleLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
font
=
.
PFSC_R
(
ofSize
:
12
)
...
...
@@ -22,8 +22,7 @@ class YHHomeInfoSectionCell: UICollectionViewCell {
}()
lazy
var
imgView
:
UIImageView
=
{
let
imgV
=
UIImageView
()
imgV
.
backgroundColor
=
.
red
let
imgV
=
UIImageView
(
image
:
UIImage
(
named
:
"global_default_image"
))
return
imgV
}()
...
...
@@ -35,7 +34,7 @@ class YHHomeInfoSectionCell: UICollectionViewCell {
super
.
init
(
frame
:
frame
)
setupUI
()
}
func
setupUI
()
{
self
.
addSubview
(
self
.
imgView
)
self
.
addSubview
(
self
.
titleLabel
)
...
...
@@ -49,4 +48,10 @@ class YHHomeInfoSectionCell: UICollectionViewCell {
make
.
height
.
equalTo
(
20
)
}
}
func
updateModel
(
_
model
:
YHHomeInfoClassifyModel
)
{
self
.
titleLabel
.
text
=
model
.
name
self
.
imgView
.
kf
.
setImage
(
with
:
URL
(
string
:
model
.
imgURL
),
placeholder
:
UIImage
(
named
:
"global_default_image"
))
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeInfoSectionHeadView.swift
View file @
7829efe4
...
...
@@ -16,7 +16,7 @@ class YHHomeInfoSectionHeadView: UICollectionReusableView {
static
let
reuseIdentifier
=
"YHHomeInfoSectionHeadView"
var
items
:[
String
]
=
[]
{
var
items
:[
YHHomeInfoClassifyModel
?
]
=
[]
{
didSet
{
var
row
=
items
.
count
/
3
if
row
%
3
!=
0
{
...
...
@@ -104,16 +104,22 @@ extension YHHomeInfoSectionHeadView: UICollectionViewDelegate, UICollectionViewD
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHHomeInfoSectionCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHHomeInfoSectionCell
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
self
.
items
.
count
{
if
let
item
=
self
.
items
[
indexPath
.
row
]
{
cell
.
updateModel
(
item
)
}
}
return
cell
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
self
.
items
.
count
{
let
item
=
self
.
items
[
indexPath
.
row
]
let
vc
=
YHHomeInfoDetailContainerViewController
()
vc
.
customTitle
=
item
vc
.
isHaveHot
=
true
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
if
let
item
=
self
.
items
[
indexPath
.
row
]
{
let
vc
=
YHHomeInfoDetailContainerViewController
()
vc
.
customTitle
=
item
.
name
vc
.
isHaveHot
=
item
.
hotNum
>
0
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
View file @
7829efe4
...
...
@@ -15,6 +15,7 @@ class YHHomePageViewModel : YHBaseViewModel {
var
banners
:
[
YHBannerModel
]?
var
classify
:
[
YHHomeClassifyModel
]?
var
hkList
:
[
YHHKEventModel
]?
var
classifyArr
:[
YHHomeInfoClassifyModel
?]
=
[]
//首页相关参数
private
var
curPageIndex
:
Int
=
1
...
...
@@ -376,6 +377,33 @@ extension YHHomePageViewModel {
}
}
func
getHomeInfoClassifies
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
params
:
[
String
:
Any
]
=
[
"is_message"
:
1
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Common
.
homeInfoClassifies
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
let
dic
=
json
.
data
guard
let
result
=
[
YHHomeInfoClassifyModel
]
.
deserialize
(
array
:
dic
as?
[
Any
])
else
{
let
err
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
self
.
classifyArr
=
[]
callBackBlock
(
false
,
err
)
return
}
self
.
classifyArr
=
result
callBackBlock
(
true
,
nil
)
}
else
{
self
.
classifyArr
=
[]
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
self
.
classifyArr
=
[]
callBackBlock
(
false
,
err
)
}
}
func
getHKEvent
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Common
.
hklist
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
7829efe4
...
...
@@ -66,6 +66,8 @@ class YHAllApiName {
static
let
hklist
=
"infoflow/tool/list"
// 点赞、收藏、最近浏览数量
static
let
likeCollect
=
"infoflow/article/myArticleRecord"
// 首页资讯栏目
static
let
homeInfoClassifies
=
"infoflow/classify/classifies"
}
...
...
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