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
96ca62d1
Commit
96ca62d1
authored
Nov 28, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
银河甄选逻辑及接口调试
parent
0872481f
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
544 additions
and
32 deletions
+544
-32
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+16
-0
YHLifeViewController.swift
...es/Modules/Home(首页)/Life(生活)/C/YHLifeViewController.swift
+21
-5
YHLiveModel.swift
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHLiveModel.swift
+24
-0
YHHomePageViewModel.swift
...axy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
+28
-1
YHSelectViewController.swift
.../Modules/Home(首页)/YHSelect/C/YHSelectViewController.swift
+90
-21
YHSelectCategoryModel.swift
...s/Modules/Home(首页)/YHSelect/M/YHSelectCategoryModel.swift
+76
-0
YHSelectLookHeadView.swift
...es/Modules/Home(首页)/YHSelect/V/YHSelectLookHeadView.swift
+4
-2
YHSelectLookView.swift
...lasses/Modules/Home(首页)/YHSelect/V/YHSelectLookView.swift
+6
-3
YHSelectMenuView.swift
...lasses/Modules/Home(首页)/YHSelect/V/YHSelectMenuView.swift
+182
-0
YHSelectViewModel.swift
...sses/Modules/Home(首页)/YHSelect/VM/YHSelectViewModel.swift
+92
-0
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+5
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
96ca62d1
...
@@ -7,6 +7,10 @@
...
@@ -7,6 +7,10 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
04013E362CF83956001A8E40
/* YHLiveModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04013E352CF83956001A8E40
/* YHLiveModel.swift */
;
};
04013E382CF84B29001A8E40
/* YHSelectViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04013E372CF84B29001A8E40
/* YHSelectViewModel.swift */
;
};
04013E3A2CF85086001A8E40
/* YHSelectCategoryModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04013E392CF85086001A8E40
/* YHSelectCategoryModel.swift */
;
};
04013E3C2CF86BB5001A8E40
/* YHSelectMenuView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04013E3B2CF86BB5001A8E40
/* YHSelectMenuView.swift */
;
};
040450CF2CC8A0F400D1CFE5
/* YHResignDocumentMultiLineTipsCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
040450CE2CC8A0F400D1CFE5
/* YHResignDocumentMultiLineTipsCell.swift */
;
};
040450CF2CC8A0F400D1CFE5
/* YHResignDocumentMultiLineTipsCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
040450CE2CC8A0F400D1CFE5
/* YHResignDocumentMultiLineTipsCell.swift */
;
};
0408C3632BEC7C6900DB1E25
/* YHVideoPlayerControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0408C3622BEC7C6900DB1E25
/* YHVideoPlayerControlView.swift */
;
};
0408C3632BEC7C6900DB1E25
/* YHVideoPlayerControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0408C3622BEC7C6900DB1E25
/* YHVideoPlayerControlView.swift */
;
};
0409BEEB2C5B41D4003FCFD7
/* YHPrincipleProfileListCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0409BEEA2C5B41D4003FCFD7
/* YHPrincipleProfileListCell.swift */
;
};
0409BEEB2C5B41D4003FCFD7
/* YHPrincipleProfileListCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0409BEEA2C5B41D4003FCFD7
/* YHPrincipleProfileListCell.swift */
;
};
...
@@ -1067,6 +1071,10 @@
...
@@ -1067,6 +1071,10 @@
/* End PBXCopyFilesBuildPhase section */
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
04013E352CF83956001A8E40
/* YHLiveModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHLiveModel.swift
;
sourceTree
=
"<group>"
;
};
04013E372CF84B29001A8E40
/* YHSelectViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectViewModel.swift
;
sourceTree
=
"<group>"
;
};
04013E392CF85086001A8E40
/* YHSelectCategoryModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectCategoryModel.swift
;
sourceTree
=
"<group>"
;
};
04013E3B2CF86BB5001A8E40
/* YHSelectMenuView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSelectMenuView.swift
;
sourceTree
=
"<group>"
;
};
040450CE2CC8A0F400D1CFE5
/* YHResignDocumentMultiLineTipsCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHResignDocumentMultiLineTipsCell.swift
;
sourceTree
=
"<group>"
;
};
040450CE2CC8A0F400D1CFE5
/* YHResignDocumentMultiLineTipsCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHResignDocumentMultiLineTipsCell.swift
;
sourceTree
=
"<group>"
;
};
0408C3622BEC7C6900DB1E25
/* YHVideoPlayerControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHVideoPlayerControlView.swift
;
sourceTree
=
"<group>"
;
};
0408C3622BEC7C6900DB1E25
/* YHVideoPlayerControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHVideoPlayerControlView.swift
;
sourceTree
=
"<group>"
;
};
0409BEEA2C5B41D4003FCFD7
/* YHPrincipleProfileListCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPrincipleProfileListCell.swift
;
sourceTree
=
"<group>"
;
};
0409BEEA2C5B41D4003FCFD7
/* YHPrincipleProfileListCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPrincipleProfileListCell.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -2162,6 +2170,7 @@
...
@@ -2162,6 +2170,7 @@
children
=
(
children
=
(
040AE9982CF5CB1D00310241
/* YHSelectLookHeadView.swift */
,
040AE9982CF5CB1D00310241
/* YHSelectLookHeadView.swift */
,
040AE9942CF5B9C900310241
/* YHSelectLookView.swift */
,
040AE9942CF5B9C900310241
/* YHSelectLookView.swift */
,
04013E3B2CF86BB5001A8E40
/* YHSelectMenuView.swift */
,
);
);
path
=
V
;
path
=
V
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -2169,6 +2178,7 @@
...
@@ -2169,6 +2178,7 @@
040AE9902CF5B82B00310241
/* M */
=
{
040AE9902CF5B82B00310241
/* M */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
04013E392CF85086001A8E40
/* YHSelectCategoryModel.swift */
,
);
);
path
=
M
;
path
=
M
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -2176,6 +2186,7 @@
...
@@ -2176,6 +2186,7 @@
040AE9912CF5B83000310241
/* VM */
=
{
040AE9912CF5B83000310241
/* VM */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
04013E372CF84B29001A8E40
/* YHSelectViewModel.swift */
,
);
);
path
=
VM
;
path
=
VM
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -4872,6 +4883,7 @@
...
@@ -4872,6 +4883,7 @@
04213B322C4A084600797900
/* YHHomeInfoClassifyModel.swift */
,
04213B322C4A084600797900
/* YHHomeInfoClassifyModel.swift */
,
04213B342C4F85A900797900
/* YHHomeLifeCategoryModel.swift */
,
04213B342C4F85A900797900
/* YHHomeLifeCategoryModel.swift */
,
04213B362C4F87C600797900
/* YHHomeLifeCategoryDetailModel.swift */
,
04213B362C4F87C600797900
/* YHHomeLifeCategoryDetailModel.swift */
,
04013E352CF83956001A8E40
/* YHLiveModel.swift */
,
);
);
path
=
M
;
path
=
M
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -6517,6 +6529,7 @@
...
@@ -6517,6 +6529,7 @@
04A7BD192BA441D400BD35A2
/* YHMyDocumentsUrlModel.swift in Sources */
,
04A7BD192BA441D400BD35A2
/* YHMyDocumentsUrlModel.swift in Sources */
,
04DF69BB2CBA1CC5005AA41E
/* YHResignSelectApplicantCollectCell.swift in Sources */
,
04DF69BB2CBA1CC5005AA41E
/* YHResignSelectApplicantCollectCell.swift in Sources */
,
04A91E742CC6220900E5A079
/* YHCommonAlertView+AttributedMessage.swift in Sources */
,
04A91E742CC6220900E5A079
/* YHCommonAlertView+AttributedMessage.swift in Sources */
,
04013E3A2CF85086001A8E40
/* YHSelectCategoryModel.swift in Sources */
,
04174D792BCD5B74000BA46D
/* YHMessageSessionCell.swift in Sources */
,
04174D792BCD5B74000BA46D
/* YHMessageSessionCell.swift in Sources */
,
044F39362CB6574D007CA277
/* YHVisaRenewalGuideHeaderCell.swift in Sources */
,
044F39362CB6574D007CA277
/* YHVisaRenewalGuideHeaderCell.swift in Sources */
,
04C85DE92C36BF49008B20D6
/* YHMyFileListFooterView.swift in Sources */
,
04C85DE92C36BF49008B20D6
/* YHMyFileListFooterView.swift in Sources */
,
...
@@ -6555,6 +6568,7 @@
...
@@ -6555,6 +6568,7 @@
044D0C202C22D37500C5CF5E
/* YHEditHonorViewController.swift in Sources */
,
044D0C202C22D37500C5CF5E
/* YHEditHonorViewController.swift in Sources */
,
04564D6A2CF6C0FC004456E4
/* YHLiveDetailModel.swift in Sources */
,
04564D6A2CF6C0FC004456E4
/* YHLiveDetailModel.swift in Sources */
,
04256DEC2C732F6900A37BA4
/* YHGrabingNumberListView.swift in Sources */
,
04256DEC2C732F6900A37BA4
/* YHGrabingNumberListView.swift in Sources */
,
04013E382CF84B29001A8E40
/* YHSelectViewModel.swift in Sources */
,
0457921D2CBF626000EBD99B
/* YHResignUploadDetailViewModel.swift in Sources */
,
0457921D2CBF626000EBD99B
/* YHResignUploadDetailViewModel.swift in Sources */
,
045EEEAC2B9F171A0022A143
/* YHWorkExperienceTableViewCell.swift in Sources */
,
045EEEAC2B9F171A0022A143
/* YHWorkExperienceTableViewCell.swift in Sources */
,
A5765B2A2C77268C002CD3C1
/* YHRangeDatePickerSheetView.swift in Sources */
,
A5765B2A2C77268C002CD3C1
/* YHRangeDatePickerSheetView.swift in Sources */
,
...
@@ -6692,6 +6706,7 @@
...
@@ -6692,6 +6706,7 @@
A517A4E12BB573EB000DEECD
/* YHDocListCell.swift in Sources */
,
A517A4E12BB573EB000DEECD
/* YHDocListCell.swift in Sources */
,
A58037212BAD7B2A0031C312
/* YHMySchemeModel.swift in Sources */
,
A58037212BAD7B2A0031C312
/* YHMySchemeModel.swift in Sources */
,
0493B3DE2BA80C2300AF9393
/* YHCertificateFilterButton.swift in Sources */
,
0493B3DE2BA80C2300AF9393
/* YHCertificateFilterButton.swift in Sources */
,
04013E362CF83956001A8E40
/* YHLiveModel.swift in Sources */
,
04912F862CB7EF6200CC3105
/* YHResignScheduleMultipleInfoCell.swift in Sources */
,
04912F862CB7EF6200CC3105
/* YHResignScheduleMultipleInfoCell.swift in Sources */
,
04912F8E2CB916F500CC3105
/* YHResignAppointViewModel.swift in Sources */
,
04912F8E2CB916F500CC3105
/* YHResignAppointViewModel.swift in Sources */
,
04F2435D2C9D153C00DF2C74
/* YHHKRecordsTimeSelectCell.swift in Sources */
,
04F2435D2C9D153C00DF2C74
/* YHHKRecordsTimeSelectCell.swift in Sources */
,
...
@@ -6745,6 +6760,7 @@
...
@@ -6745,6 +6760,7 @@
0430E6702C749BCF000511E2
/* YHAdopterResidentTableViewCell.swift in Sources */
,
0430E6702C749BCF000511E2
/* YHAdopterResidentTableViewCell.swift in Sources */
,
044EE2592C9D0F2800A2FE3A
/* YHResignGuidelinesViewModel.swift in Sources */
,
044EE2592C9D0F2800A2FE3A
/* YHResignGuidelinesViewModel.swift in Sources */
,
045EEEB62B9F171A0022A143
/* YHWorkExperienceItemView.swift in Sources */
,
045EEEB62B9F171A0022A143
/* YHWorkExperienceItemView.swift in Sources */
,
04013E3C2CF86BB5001A8E40
/* YHSelectMenuView.swift in Sources */
,
047AA3E42C4A6ADC009C4554
/* YHLifeHeadView.swift in Sources */
,
047AA3E42C4A6ADC009C4554
/* YHLifeHeadView.swift in Sources */
,
A58A8C942BA6C7C600632765
/* YHCertificateEntryModel.swift in Sources */
,
A58A8C942BA6C7C600632765
/* YHCertificateEntryModel.swift in Sources */
,
044F39242CB50FB4007CA277
/* YHResignDocumentUploadActionCell.swift in Sources */
,
044F39242CB50FB4007CA277
/* YHResignDocumentUploadActionCell.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/Life(生活)/C/YHLifeViewController.swift
View file @
96ca62d1
...
@@ -30,7 +30,7 @@ class YHLifeViewController: YHBaseViewController {
...
@@ -30,7 +30,7 @@ class YHLifeViewController: YHBaseViewController {
let
collectinoView
=
UICollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
flowLayout
)
let
collectinoView
=
UICollectionView
(
frame
:
.
zero
,
collectionViewLayout
:
flowLayout
)
collectinoView
.
backgroundColor
=
.
white
collectinoView
.
backgroundColor
=
.
white
collectinoView
.
contentInset
=
UIEdgeInsets
(
top
:
0
,
left
:
20
,
bottom
:
0
,
right
:
20
)
collectinoView
.
contentInset
=
UIEdgeInsets
(
top
:
16
,
left
:
20
,
bottom
:
0
,
right
:
20
)
collectinoView
.
register
(
YHLookCollectionViewCell
.
self
,
forCellWithReuseIdentifier
:
YHLookCollectionViewCell
.
cellReuseIdentifier
)
collectinoView
.
register
(
YHLookCollectionViewCell
.
self
,
forCellWithReuseIdentifier
:
YHLookCollectionViewCell
.
cellReuseIdentifier
)
collectinoView
.
delegate
=
self
collectinoView
.
delegate
=
self
collectinoView
.
dataSource
=
self
collectinoView
.
dataSource
=
self
...
@@ -85,6 +85,17 @@ extension YHLifeViewController {
...
@@ -85,6 +85,17 @@ extension YHLifeViewController {
getDetailImages
()
getDetailImages
()
}
}
self
.
viewModel
.
getLiveList
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
myCollectView
.
reloadData
()
if
self
.
viewModel
.
liveArr
.
count
==
0
{
noDataView
.
isHidden
=
false
}
else
{
noDataView
.
isHidden
=
true
}
}
}
}
func
getDetailImages
()
{
func
getDetailImages
()
{
...
@@ -247,19 +258,19 @@ extension YHLifeViewController: JXSegmentedListContainerViewListDelegate {
...
@@ -247,19 +258,19 @@ extension YHLifeViewController: JXSegmentedListContainerViewListDelegate {
extension
YHLifeViewController
:
UICollectionViewDelegate
,
UICollectionViewDataSource
{
extension
YHLifeViewController
:
UICollectionViewDelegate
,
UICollectionViewDataSource
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
items
.
count
return
self
.
viewModel
.
liveArr
.
count
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHLookCollectionViewCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHLookCollectionViewCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
YHLookCollectionViewCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHLookCollectionViewCell
cell
.
dataSource
=
items
[
indexPath
.
row
]
cell
.
dataSource
=
self
.
viewModel
.
liveArr
[
indexPath
.
row
]
return
cell
return
cell
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
//跳转直播
}
}
}
}
...
@@ -272,7 +283,7 @@ class YHLookCollectionViewCell: UICollectionViewCell {
...
@@ -272,7 +283,7 @@ class YHLookCollectionViewCell: UICollectionViewCell {
var
titleLabel
:
UILabel
!
var
titleLabel
:
UILabel
!
var
nameLabel
:
UILabel
!
var
nameLabel
:
UILabel
!
var
dataSource
:
String
?
{
var
dataSource
:
YHLiveModel
?
{
didSet
{
didSet
{
updataAllSubViews
()
updataAllSubViews
()
}
}
...
@@ -314,6 +325,7 @@ class YHLookCollectionViewCell: UICollectionViewCell {
...
@@ -314,6 +325,7 @@ class YHLookCollectionViewCell: UICollectionViewCell {
let
imageView
=
UIImageView
()
let
imageView
=
UIImageView
()
imageView
.
image
=
UIImage
(
named
:
"home_look_head"
)
imageView
.
image
=
UIImage
(
named
:
"home_look_head"
)
imageView
.
layer
.
cornerRadius
=
10
imageView
.
layer
.
cornerRadius
=
10
imageView
.
layer
.
masksToBounds
=
true
return
imageView
return
imageView
}()
}()
contentView
.
addSubview
(
headImageView
)
contentView
.
addSubview
(
headImageView
)
...
@@ -355,6 +367,10 @@ class YHLookCollectionViewCell: UICollectionViewCell {
...
@@ -355,6 +367,10 @@ class YHLookCollectionViewCell: UICollectionViewCell {
func
updataAllSubViews
()
{
func
updataAllSubViews
()
{
guard
let
dataSource
=
dataSource
else
{
return
}
guard
let
dataSource
=
dataSource
else
{
return
}
lookImageView
.
kf
.
setImage
(
with
:
URL
(
string
:
dataSource
.
live_image
))
titleLabel
.
text
=
dataSource
.
live_title
headImageView
.
kf
.
setImage
(
with
:
URL
(
string
:
dataSource
.
avatar
))
nameLabel
.
text
=
dataSource
.
account
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/M/YHLiveModel.swift
0 → 100644
View file @
96ca62d1
//
// YHLiveModel.swift
// galaxy
//
// Created by EDY on 2024/11/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
SmartCodable
class
YHLiveModel
:
SmartCodable
{
var
id
:
Int
=
0
var
account
:
String
=
""
var
avatar
:
String
=
""
var
status
:
Int
=
0
var
room_id
:
String
=
""
var
pull_url
:
String
=
""
var
live_image
:
String
=
""
var
live_title
:
String
=
""
required
init
()
{
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
View file @
96ca62d1
...
@@ -19,7 +19,7 @@ class YHHomePageViewModel : YHBaseViewModel {
...
@@ -19,7 +19,7 @@ class YHHomePageViewModel : YHBaseViewModel {
var
classifyArr
:[
YHHomeInfoClassifyModel
?]
=
[]
var
classifyArr
:[
YHHomeInfoClassifyModel
?]
=
[]
var
categoryArr
:[
YHHomeLifeCategoryModel
?]
=
[]
var
categoryArr
:[
YHHomeLifeCategoryModel
?]
=
[]
var
detailModel
:
YHHomeLifeCategoryDetailModel
=
YHHomeLifeCategoryDetailModel
()
var
detailModel
:
YHHomeLifeCategoryDetailModel
=
YHHomeLifeCategoryDetailModel
()
var
liveArr
:
[
YHLiveModel
]
=
[]
//首页相关参数
//首页相关参数
private
var
curPageIndex
:
Int
=
1
private
var
curPageIndex
:
Int
=
1
private
var
page_Size
:
Int
=
50
private
var
page_Size
:
Int
=
50
...
@@ -547,4 +547,31 @@ extension YHHomePageViewModel {
...
@@ -547,4 +547,31 @@ extension YHHomePageViewModel {
callBackBlock
(
false
,
err
)
callBackBlock
(
false
,
err
)
}
}
}
}
func
getLiveList
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
LiveSales
.
liveList
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
//1. json字符串 转 对象
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
Any
],
let
result
=
[
YHLiveModel
]
.
deserialize
(
from
:
dic
)
else
{
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
self
.
liveArr
=
[]
callBackBlock
(
false
,
error
)
return
}
self
.
liveArr
=
result
callBackBlock
(
true
,
nil
)
}
else
{
self
.
liveArr
=
[]
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
self
.
liveArr
=
[]
callBackBlock
(
false
,
err
)
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/YHSelect/C/YHSelectViewController.swift
View file @
96ca62d1
...
@@ -13,9 +13,10 @@ class YHSelectViewController: YHBaseViewController {
...
@@ -13,9 +13,10 @@ class YHSelectViewController: YHBaseViewController {
var
sectionView
:
YHSelectLookView
!
var
sectionView
:
YHSelectLookView
!
var
tableView
:
UITableView
!
var
tableView
:
UITableView
!
var
headView
:
YHSelectLookHeadView
!
var
headView
:
YHSelectLookHeadView
!
var
viewModel
:
YHHomePageViewModel
=
YHHomePageViewModel
()
var
viewModel
:
YHSelectViewModel
=
YHSelectViewModel
()
var
selectSubIndex
:
Int
=
-
1
var
selectItem
:
Int
=
100
var
selectMenuView
:
YHSelectMenuView
!
var
canShowMenu
:
Bool
=
true
lazy
var
noDataView
:
YHEmptyDataView
=
{
lazy
var
noDataView
:
YHEmptyDataView
=
{
let
view
=
YHEmptyDataView
.
createView
(
"暂无产品"
,
kEmptyCommonBgName
)
let
view
=
YHEmptyDataView
.
createView
(
"暂无产品"
,
kEmptyCommonBgName
)
view
.
isHidden
=
true
view
.
isHidden
=
true
...
@@ -32,26 +33,50 @@ class YHSelectViewController: YHBaseViewController {
...
@@ -32,26 +33,50 @@ class YHSelectViewController: YHBaseViewController {
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
super
.
viewWillAppear
(
animated
)
}
}
override
func
viewWillDisappear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
self
.
selectMenuView
.
removeFromSuperview
()
}
}
}
extension
YHSelectViewController
{
extension
YHSelectViewController
{
func
loadData
()
{
func
loadData
()
{
self
.
viewModel
.
getCategoryList
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
}
self
.
viewModel
.
getGoodsList
(
categoryID
:
"6"
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
tableView
.
reloadData
()
if
self
.
viewModel
.
goodsArray
.
count
==
0
{
noDataView
.
isHidden
=
false
}
else
{
noDataView
.
isHidden
=
true
}
}
self
.
viewModel
.
getLiveList
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
sectionView
.
items
=
self
.
viewModel
.
liveArr
}
}
}
func
getDetailImages
()
{
func
updataData
()
{
if
selectItem
<
self
.
viewModel
.
categoryArray
.
count
{
let
model
=
self
.
viewModel
.
categoryArray
[
selectItem
]
self
.
viewModel
.
getGoodsList
(
categoryID
:
model
.
id
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
tableView
.
reloadData
()
if
self
.
viewModel
.
goodsArray
.
count
==
0
{
noDataView
.
isHidden
=
false
}
else
{
noDataView
.
isHidden
=
true
}
}
}
}
}
func
getDetailImages
()
{
@objc
func
didJumpToEduTab
()
{
let
index
:
Int
=
1
if
index
<
self
.
viewModel
.
categoryArr
.
count
{
selectSubIndex
=
index
self
.
getDetailImages
()
self
.
sectionView
.
selectIndex
=
index
}
}
}
func
setupUI
()
{
func
setupUI
()
{
...
@@ -60,7 +85,6 @@ extension YHSelectViewController {
...
@@ -60,7 +85,6 @@ extension YHSelectViewController {
let
view
=
YHSelectLookView
()
let
view
=
YHSelectLookView
()
view
.
block
=
{[
weak
self
]
itemIndex
in
view
.
block
=
{[
weak
self
]
itemIndex
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
selectSubIndex
=
itemIndex
self
.
getDetailImages
()
self
.
getDetailImages
()
}
}
return
view
return
view
...
@@ -69,6 +93,22 @@ extension YHSelectViewController {
...
@@ -69,6 +93,22 @@ extension YHSelectViewController {
headView
=
{
headView
=
{
let
head
=
YHSelectLookHeadView
()
let
head
=
YHSelectLookHeadView
()
head
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
46
)
head
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
46
)
head
.
block
=
{
self
.
tableView
.
setContentOffset
(
CGPoint
(
x
:
0
,
y
:
92
),
animated
:
true
)
var
dataSource
:
[
String
]
=
[]
for
item
in
self
.
viewModel
.
categoryArray
{
dataSource
.
append
(
item
.
name
)
}
if
self
.
canShowMenu
{
self
.
canShowMenu
=
false
self
.
selectMenuView
=
YHSelectMenuView
()
self
.
selectMenuView
.
show
(
top
:
k_Height_NavigationtBarAndStatuBar
+
46
,
selectItem
:
100
,
dataSource
:
dataSource
)
{
item
in
self
.
selectItem
=
item
self
.
updataData
()
self
.
canShowMenu
=
true
}
}
}
return
head
return
head
}()
}()
...
@@ -96,7 +136,7 @@ extension YHSelectViewController {
...
@@ -96,7 +136,7 @@ extension YHSelectViewController {
// self.loadData()
// self.loadData()
// }
// }
v
iew
.
addSubview
(
noDataView
)
tableV
iew
.
addSubview
(
noDataView
)
noDataView
.
snp
.
makeConstraints
{
make
in
noDataView
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalToSuperview
()
make
.
centerX
.
equalToSuperview
()
make
.
centerY
.
equalToSuperview
()
make
.
centerY
.
equalToSuperview
()
...
@@ -108,12 +148,12 @@ extension YHSelectViewController {
...
@@ -108,12 +148,12 @@ extension YHSelectViewController {
extension
YHSelectViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
extension
YHSelectViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
10
return
self
.
viewModel
.
goodsArray
.
count
}
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHSelectLookTableViewCell
.
self
)
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHSelectLookTableViewCell
.
self
)
// cell.dataSource = self.viewModel.detailModel.products
[indexPath.row]
cell
.
dataSource
=
self
.
viewModel
.
goodsArray
[
indexPath
.
row
]
return
cell
return
cell
}
}
...
@@ -148,11 +188,41 @@ class YHSelectLookTableViewCell: UITableViewCell {
...
@@ -148,11 +188,41 @@ class YHSelectLookTableViewCell: UITableViewCell {
var
subTitleLabel
:
UILabel
!
var
subTitleLabel
:
UILabel
!
var
flagLabel
:
UILabel
!
var
flagLabel
:
UILabel
!
var
itemView
:
UIView
!
var
itemView
:
UIView
!
var
dataSource
:
YH
Product
Model
?
{
var
dataSource
:
YH
SelectGoods
Model
?
{
didSet
{
didSet
{
guard
let
dataSource
=
dataSource
else
{
return
}
guard
let
dataSource
=
dataSource
else
{
return
}
self
.
titleLabel
.
text
=
dataSource
.
name
self
.
titleLabel
.
text
=
dataSource
.
name
self
.
subTitleLabel
.
text
=
dataSource
.
description
flagLabel
.
isHidden
=
true
if
dataSource
.
catAttr
==
2
{
flagLabel
.
isHidden
=
false
}
let
a
:
ASAttributedString
=
.
init
(
"¥"
,
.
font
(
UIFont
.
PFSC_R
(
ofSize
:
14
)),
.
foreground
(
UIColor
.
mainTextColor
))
let
b
:
ASAttributedString
=
.
init
(
"
\(
dataSource
.
price
)
"
,
.
font
(
UIFont
.
PFSC_R
(
ofSize
:
20
)),
.
foreground
(
UIColor
.
mainTextColor
))
let
c
:
ASAttributedString
=
.
init
(
"¥
\(
dataSource
.
linePrice
)
"
,
.
font
(
UIFont
.
PFSC_R
(
ofSize
:
14
)),
.
foreground
(
UIColor
(
hex
:
0x8993a2
)),
.
strikethrough
(
.
single
))
self
.
subTitleLabel
.
attributed
.
text
=
a
+
b
+
c
itemView
.
removeSubviews
()
var
i
=
0
for
item
in
dataSource
.
icons
{
let
label
=
UILabel
()
label
.
text
=
" "
+
item
.
description
+
" "
label
.
textColor
=
UIColor
(
hexString
:
item
.
color
)
label
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
10
)
label
.
tag
=
100
+
i
label
.
layer
.
borderWidth
=
1
label
.
layer
.
borderColor
=
UIColor
(
hexString
:
item
.
color
)?
.
withAlphaComponent
(
0.3
)
.
cgColor
itemView
.
addSubview
(
label
)
label
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
16
)
if
i
==
0
{
make
.
left
.
equalTo
(
0
)
}
else
{
let
view
=
itemView
.
viewWithTag
(
100
+
i
-
1
)
make
.
left
.
equalTo
(
view
?
.
snp
.
right
??
0
)
.
offset
(
4
)
}
}
i
=
i
+
1
}
guard
let
url
=
URL
(
string
:
dataSource
.
image
)
else
{
return
}
guard
let
url
=
URL
(
string
:
dataSource
.
image
)
else
{
return
}
self
.
centerImageView
.
kf
.
setImage
(
with
:
url
)
self
.
centerImageView
.
kf
.
setImage
(
with
:
url
)
}
}
...
@@ -241,7 +311,6 @@ class YHSelectLookTableViewCell: UITableViewCell {
...
@@ -241,7 +311,6 @@ class YHSelectLookTableViewCell: UITableViewCell {
itemView
=
{
itemView
=
{
let
view
=
UIView
()
let
view
=
UIView
()
view
.
backgroundColor
=
.
red
return
view
return
view
}()
}()
contentView
.
addSubview
(
itemView
)
contentView
.
addSubview
(
itemView
)
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/YHSelect/M/YHSelectCategoryModel.swift
0 → 100644
View file @
96ca62d1
//
// YHSelectCaViewModel.swift
// galaxy
//
// Created by EDY on 2024/11/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
SmartCodable
class
YHSelectCategoryModel
:
SmartCodable
{
var
id
:
String
=
""
var
name
:
String
=
""
var
pid
:
Int
=
0
var
`
operator
`:
String
=
""
var
operatorName
:
String
=
""
var
status
:
Int
=
0
var
createdAt
:
String
=
""
var
updatedAt
:
String
=
""
var
sort
:
Int
=
0
required
init
()
{
}
}
class
YHSelectGoodModel
:
SmartCodable
{
var
total
:
Int
=
0
var
list
:
[
YHSelectGoodsModel
]
=
[]
required
init
()
{
}
}
class
YHSelectGoodsModel
:
SmartCodable
{
var
id
:
String
=
""
var
name
:
String
=
""
var
products
:
[
Int
]
=
[]
var
catAttr
:
Int
=
0
var
price
:
String
=
""
var
cost
:
String
=
""
var
thirdCost
:
String
=
""
var
concessions
:
String
=
""
var
deposit
:
String
=
""
var
`
operator
`:
String
=
""
var
status
:
Int
=
0
var
createdAt
:
String
=
""
var
updatedAt
:
String
=
""
var
sn
:
String
=
""
var
image
:
String
=
""
var
banner
:[
Int
]
=
[]
var
viewConfig
:
String
=
""
var
description
:
String
=
""
var
serviceCost
:
String
=
""
var
linePrice
:
String
=
""
var
details
:
[
Int
]
=
[]
var
stock
:
Int
=
0
var
startTime
:
String
=
""
var
endTime
:
String
=
""
var
statusText
:
String
=
""
var
catAttrText
:
String
=
""
var
icons
:
[
YHSelectGoodIconModel
]
=
[]
required
init
()
{
}
}
class
YHSelectGoodIconModel
:
SmartCodable
{
var
description
:
String
=
""
var
color
:
String
=
""
required
init
()
{
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/YHSelect/V/YHSelectLookHeadView.swift
View file @
96ca62d1
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
import
UIKit
import
UIKit
class
YHSelectLookHeadView
:
UIView
{
class
YHSelectLookHeadView
:
UIView
{
typealias
Block
=
(
Int
)
->
()
typealias
Block
=
()
->
()
var
block
:
Block
?
var
block
:
Block
?
var
itemButton
:
UIButton
!
var
itemButton
:
UIButton
!
...
@@ -52,6 +52,8 @@ class YHSelectLookHeadView: UIView {
...
@@ -52,6 +52,8 @@ class YHSelectLookHeadView: UIView {
}
}
@objc
func
itemClick
()
{
@objc
func
itemClick
()
{
if
let
block
=
self
.
block
{
block
()
}
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/YHSelect/V/YHSelectLookView.swift
View file @
96ca62d1
...
@@ -14,7 +14,7 @@ class YHSelectLookView: UIView {
...
@@ -14,7 +14,7 @@ class YHSelectLookView: UIView {
typealias
Block
=
(
Int
)
->
()
typealias
Block
=
(
Int
)
->
()
var
block
:
Block
?
var
block
:
Block
?
var
items
:
[
String
]
=
[
"11"
,
"2"
]
{
var
items
:
[
YHLiveModel
]
=
[
]
{
didSet
{
didSet
{
self
.
myCollectView
.
reloadData
()
self
.
myCollectView
.
reloadData
()
}
}
...
@@ -103,10 +103,12 @@ class YHSelectLookViewCell: UICollectionViewCell {
...
@@ -103,10 +103,12 @@ class YHSelectLookViewCell: UICollectionViewCell {
lazy
var
headIamge
:
UIImageView
=
{
lazy
var
headIamge
:
UIImageView
=
{
let
image
=
UIImageView
()
let
image
=
UIImageView
()
image
.
image
=
UIImage
(
named
:
"home_look_head"
)
image
.
image
=
UIImage
(
named
:
"home_look_head"
)
image
.
layer
.
cornerRadius
=
27
image
.
layer
.
masksToBounds
=
true
return
image
return
image
}()
}()
var
dataSource
:
String
?
{
var
dataSource
:
YHLiveModel
?
{
didSet
{
didSet
{
updataAllSubViews
()
updataAllSubViews
()
}
}
...
@@ -146,7 +148,8 @@ class YHSelectLookViewCell: UICollectionViewCell {
...
@@ -146,7 +148,8 @@ class YHSelectLookViewCell: UICollectionViewCell {
func
updataAllSubViews
()
{
func
updataAllSubViews
()
{
guard
let
dataSource
=
dataSource
else
{
return
}
guard
let
dataSource
=
dataSource
else
{
return
}
descripeLable
.
text
=
dataSource
descripeLable
.
text
=
dataSource
.
account
headIamge
.
kf
.
setImage
(
with
:
URL
(
string
:
dataSource
.
avatar
))
}
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/YHSelect/V/YHSelectMenuView.swift
0 → 100644
View file @
96ca62d1
//
// YHSelectMenuView.swift
// galaxy
//
// Created by EDY on 2024/11/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHSelectMenuView
:
UIView
{
var
backDate
:
((
Int
)
->
Void
)?
var
centerView
:
UIView
!
var
tableView
:
UITableView
!
var
dataSource
:
[
String
]
=
[]
{
didSet
{
self
.
tableView
.
reloadData
()
}
}
var
selectItem
:
Int
=
10000
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
backgroundColor
=
UIColor
(
white
:
0.5
,
alpha
:
0.1
)
let
tap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
handleTap
)
)
tap
.
delegate
=
self
addGestureRecognizer
(
tap
)
setView
()
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
func
setView
()
{
backgroundColor
=
UIColor
(
hex
:
0x0000
,
alpha
:
0.5
)
centerView
=
{
let
view
=
UIView
()
view
.
backgroundColor
=
.
white
return
view
}()
addSubview
(
centerView
)
centerView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
484
)
}
tableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
tableView
.
contentInsetAdjustmentBehavior
=
.
never
tableView
.
backgroundColor
=
.
clear
tableView
.
separatorStyle
=
.
none
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
tableView
.
register
(
cellWithClass
:
YHSelectMenuCell
.
self
)
return
tableView
}()
centerView
.
addSubview
(
tableView
)
tableView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
376
)
make
.
left
.
right
.
equalToSuperview
()
}
// centerView.layoutIfNeeded()
// let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
// let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(kCornerRadius6, kCornerRadius6))
// let layer = CAShapeLayer()
// layer.frame = centerView.bounds
// layer.path = path.cgPath
// centerView.layer.mask = layer
}
@objc
private
func
handleTap
(
_
sender
:
AnyObject
?)
{
dismiss
()
}
func
show
(
top
:
CGFloat
,
selectItem
:
Int
=
1000
,
dataSource
:
[
String
],
callBack
:
@escaping
((
Int
)
->
Void
))
{
self
.
frame
=
CGRect
(
x
:
0
,
y
:
top
,
width
:
KScreenWidth
,
height
:
KScreenHeight
-
top
)
self
.
selectItem
=
selectItem
self
.
dataSource
=
dataSource
self
.
backDate
=
callBack
let
window
=
UIApplication
.
shared
.
yhKeyWindow
()
window
?
.
addSubview
(
self
)
}
@objc
func
dismiss
()
{
if
let
block
=
backDate
{
block
(
selectItem
)
}
removeFromSuperview
()
}
}
extension
YHSelectMenuView
:
UIGestureRecognizerDelegate
{
func
gestureRecognizer
(
_
gestureRecognizer
:
UIGestureRecognizer
,
shouldReceive
touch
:
UITouch
)
->
Bool
{
if
touch
.
view
==
self
{
return
true
}
return
false
}
}
extension
YHSelectMenuView
:
UITableViewDelegate
,
UITableViewDataSource
{
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
dataSource
.
count
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHSelectMenuCell
.
self
)
cell
.
updateModel
(
dataSource
[
indexPath
.
row
])
if
selectItem
==
indexPath
.
row
{
cell
.
nameLabel
.
textColor
=
UIColor
.
brandMainColor
}
else
{
cell
.
nameLabel
.
textColor
=
UIColor
.
mainTextColor
}
return
cell
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
40
}
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
7
))
return
view
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
0.01
}
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
return
UIView
()
}
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
return
0.01
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
let
block
=
self
.
backDate
{
block
(
indexPath
.
row
)
}
removeFromSuperview
()
}
}
class
YHSelectMenuCell
:
UITableViewCell
{
var
nameLabel
:
UILabel
!
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
setupUI
()
}
func
updateModel
(
_
model
:
String
)
{
nameLabel
.
text
=
model
}
func
setupUI
()
{
self
.
selectionStyle
=
.
none
contentView
.
backgroundColor
=
.
white
nameLabel
=
UILabel
()
nameLabel
.
textColor
=
UIColor
.
mainTextColor
nameLabel
.
textAlignment
=
.
left
nameLabel
.
numberOfLines
=
0
nameLabel
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
14
)
contentView
.
addSubview
(
nameLabel
)
nameLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
18
)
make
.
top
.
right
.
bottom
.
equalToSuperview
()
}
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/YHSelect/VM/YHSelectViewModel.swift
0 → 100644
View file @
96ca62d1
//
// YHSelectViewModel.swift
// galaxy
//
// Created by EDY on 2024/11/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHSelectViewModel
:
YHBaseViewModel
{
//数据源
var
categoryArray
:[
YHSelectCategoryModel
]
=
[]
var
goodsArray
:[
YHSelectGoodsModel
]
=
[]
var
liveArr
:
[
YHLiveModel
]
=
[]
}
extension
YHSelectViewModel
{
func
getCategoryList
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
LiveSales
.
categoryList
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
//1. json字符串 转 对象
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
Any
],
let
result
=
[
YHSelectCategoryModel
]
.
deserialize
(
from
:
dic
)
else
{
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
callBackBlock
(
false
,
error
)
return
}
self
.
categoryArray
=
result
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
getGoodsList
(
categoryID
:
String
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
params
:[
String
:
Any
]
=
[
"goods_category_id"
:
categoryID
,
"page"
:
1
,
"page_size"
:
20
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
LiveSales
.
goodsList
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
//1. json字符串 转 对象
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
String
:
Any
],
let
resultModel
=
YHSelectGoodModel
.
deserialize
(
from
:
dic
)
else
{
callBackBlock
(
false
,
nil
)
return
}
self
.
goodsArray
=
resultModel
.
list
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
getLiveList
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
LiveSales
.
liveList
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
//1. json字符串 转 对象
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
Any
],
let
result
=
[
YHLiveModel
]
.
deserialize
(
from
:
dic
)
else
{
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
self
.
liveArr
=
[]
callBackBlock
(
false
,
error
)
return
}
self
.
liveArr
=
result
callBackBlock
(
true
,
nil
)
}
else
{
self
.
liveArr
=
[]
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
self
.
liveArr
=
[]
callBackBlock
(
false
,
err
)
}
}
}
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
96ca62d1
...
@@ -671,5 +671,10 @@ class YHAllApiName {
...
@@ -671,5 +671,10 @@ class YHAllApiName {
static
let
fetchHuanXinToken
=
"super-app/live/get-huanxin-token"
static
let
fetchHuanXinToken
=
"super-app/live/get-huanxin-token"
// 获取录播详情
// 获取录播详情
static
let
recordedDetail
=
"super-app/recorded-video/app-recorded-detail"
static
let
recordedDetail
=
"super-app/recorded-video/app-recorded-detail"
static
let
liveList
=
"super-app/live/app-live-list"
static
let
categoryList
=
"super-app/goods/category-list"
static
let
goodsList
=
"super-app/goods/list"
}
}
}
}
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