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
e8d86656
Commit
e8d86656
authored
Sep 29, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 名片
parent
95247cd3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
526 additions
and
289 deletions
+526
-289
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHConnectListViewController.swift
...y(社区)/Connections(人脉)/C/YHConnectListViewController.swift
+3
-4
YHMyNewViewController.swift
...xy/Classes/Modules/Mine(我的)/C/YHMyNewViewController.swift
+1
-1
YHNameCardContainerViewController.swift
...的)/NameCard(名片)/C/YHNameCardContainerViewController.swift
+36
-267
YHNameCardDynamicViewController.swift
...(我的)/NameCard(名片)/C/YHNameCardDynamicViewController.swift
+45
-3
YHNameCardHomePageViewController.swift
...我的)/NameCard(名片)/C/YHNameCardHomePageViewController.swift
+28
-14
YHNewNameCardViewController.swift
...Mine(我的)/NameCard(名片)/C/YHNewNameCardViewController.swift
+409
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
e8d86656
...
@@ -1168,6 +1168,7 @@
...
@@ -1168,6 +1168,7 @@
0468D42E2B5654A500CFB916
/* CoreTelephony.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D42D2B5654A500CFB916
/* CoreTelephony.framework */
;
};
0468D42E2B5654A500CFB916
/* CoreTelephony.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D42D2B5654A500CFB916
/* CoreTelephony.framework */
;
};
0468D4302B5654B500CFB916
/* SystemConfiguration.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D42F2B5654B500CFB916
/* SystemConfiguration.framework */
;
};
0468D4302B5654B500CFB916
/* SystemConfiguration.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D42F2B5654B500CFB916
/* SystemConfiguration.framework */
;
};
0468D4312B5654C100CFB916
/* libresolv.tbd in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D42C2B56549200CFB916
/* libresolv.tbd */
;
};
0468D4312B5654C100CFB916
/* libresolv.tbd in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0468D42C2B56549200CFB916
/* libresolv.tbd */
;
};
04760F982E8A57C600B8F776
/* YHNewNameCardViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04760F972E8A57C600B8F776
/* YHNewNameCardViewController.swift */
;
};
047A96832D1674010033BB4E
/* YHGCSchemeTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
047A96822D1674010033BB4E
/* YHGCSchemeTableViewCell.swift */
;
};
047A96832D1674010033BB4E
/* YHGCSchemeTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
047A96822D1674010033BB4E
/* YHGCSchemeTableViewCell.swift */
;
};
047A96862D1698150033BB4E
/* YHGCMySchemeViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
047A96852D1698150033BB4E
/* YHGCMySchemeViewModel.swift */
;
};
047A96862D1698150033BB4E
/* YHGCMySchemeViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
047A96852D1698150033BB4E
/* YHGCMySchemeViewModel.swift */
;
};
047A96892D169A5F0033BB4E
/* YHGCMySchemeModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
047A96882D169A5F0033BB4E
/* YHGCMySchemeModel.swift */
;
};
047A96892D169A5F0033BB4E
/* YHGCMySchemeModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
047A96882D169A5F0033BB4E
/* YHGCMySchemeModel.swift */
;
};
...
@@ -2532,6 +2533,7 @@
...
@@ -2532,6 +2533,7 @@
0468D42C2B56549200CFB916
/* libresolv.tbd */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"sourcecode.text-based-dylib-definition"
;
name
=
libresolv.tbd
;
path
=
usr/lib/libresolv.tbd
;
sourceTree
=
SDKROOT
;
};
0468D42C2B56549200CFB916
/* libresolv.tbd */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"sourcecode.text-based-dylib-definition"
;
name
=
libresolv.tbd
;
path
=
usr/lib/libresolv.tbd
;
sourceTree
=
SDKROOT
;
};
0468D42D2B5654A500CFB916
/* CoreTelephony.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
CoreTelephony.framework
;
path
=
System/Library/Frameworks/CoreTelephony.framework
;
sourceTree
=
SDKROOT
;
};
0468D42D2B5654A500CFB916
/* CoreTelephony.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
CoreTelephony.framework
;
path
=
System/Library/Frameworks/CoreTelephony.framework
;
sourceTree
=
SDKROOT
;
};
0468D42F2B5654B500CFB916
/* SystemConfiguration.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
SystemConfiguration.framework
;
path
=
System/Library/Frameworks/SystemConfiguration.framework
;
sourceTree
=
SDKROOT
;
};
0468D42F2B5654B500CFB916
/* SystemConfiguration.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
SystemConfiguration.framework
;
path
=
System/Library/Frameworks/SystemConfiguration.framework
;
sourceTree
=
SDKROOT
;
};
04760F972E8A57C600B8F776
/* YHNewNameCardViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHNewNameCardViewController.swift
;
sourceTree
=
"<group>"
;
};
047A96822D1674010033BB4E
/* YHGCSchemeTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCSchemeTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
047A96822D1674010033BB4E
/* YHGCSchemeTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCSchemeTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
047A96852D1698150033BB4E
/* YHGCMySchemeViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMySchemeViewModel.swift
;
sourceTree
=
"<group>"
;
};
047A96852D1698150033BB4E
/* YHGCMySchemeViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMySchemeViewModel.swift
;
sourceTree
=
"<group>"
;
};
047A96882D169A5F0033BB4E
/* YHGCMySchemeModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMySchemeModel.swift
;
sourceTree
=
"<group>"
;
};
047A96882D169A5F0033BB4E
/* YHGCMySchemeModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHGCMySchemeModel.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -6933,6 +6935,7 @@
...
@@ -6933,6 +6935,7 @@
04B30B7D2E86374E004E4B12
/* C */
=
{
04B30B7D2E86374E004E4B12
/* C */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
04760F972E8A57C600B8F776
/* YHNewNameCardViewController.swift */
,
0426E09B2E851A91005C9F5D
/* YHNameCardContainerViewController.swift */
,
0426E09B2E851A91005C9F5D
/* YHNameCardContainerViewController.swift */
,
04B30B7A2E86307C004E4B12
/* YHNameCardHomePageViewController.swift */
,
04B30B7A2E86307C004E4B12
/* YHNameCardHomePageViewController.swift */
,
04B30B8D2E88C837004E4B12
/* YHNameCardDynamicViewController.swift */
,
04B30B8D2E88C837004E4B12
/* YHNameCardDynamicViewController.swift */
,
...
@@ -8790,6 +8793,7 @@
...
@@ -8790,6 +8793,7 @@
045C13A22D12CA5F00BD2DC0
/* YHBottomPresentationController.swift in Sources */
,
045C13A22D12CA5F00BD2DC0
/* YHBottomPresentationController.swift in Sources */
,
045C13A32D12CA5F00BD2DC0
/* YHHKRecordsEditButtonCell.swift in Sources */
,
045C13A32D12CA5F00BD2DC0
/* YHHKRecordsEditButtonCell.swift in Sources */
,
045C13A42D12CA5F00BD2DC0
/* YHEducationDetailVC.swift in Sources */
,
045C13A42D12CA5F00BD2DC0
/* YHEducationDetailVC.swift in Sources */
,
04760F982E8A57C600B8F776
/* YHNewNameCardViewController.swift in Sources */
,
045C13A52D12CA5F00BD2DC0
/* YHBouncesContentView.swift in Sources */
,
045C13A52D12CA5F00BD2DC0
/* YHBouncesContentView.swift in Sources */
,
045C13A62D12CA5F00BD2DC0
/* YHTravelDocsPreparationViewModel.swift in Sources */
,
045C13A62D12CA5F00BD2DC0
/* YHTravelDocsPreparationViewModel.swift in Sources */
,
045C13A72D12CA5F00BD2DC0
/* YHWorkExampleMessageTableViewCell.swift in Sources */
,
045C13A72D12CA5F00BD2DC0
/* YHWorkExampleMessageTableViewCell.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/Connections(人脉)/C/YHConnectListViewController.swift
View file @
e8d86656
...
@@ -123,10 +123,9 @@ extension YHConnectListViewController: UITableViewDelegate, UITableViewDataSourc
...
@@ -123,10 +123,9 @@ extension YHConnectListViewController: UITableViewDelegate, UITableViewDataSourc
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
0
<=
indexPath
.
row
&&
indexPath
.
row
<
arr
.
count
{
if
0
<=
indexPath
.
row
&&
indexPath
.
row
<
arr
.
count
{
let
vc
=
YHNameCardContainerViewController
()
let
contact
=
arr
[
indexPath
.
row
]
if
let
userId
=
YHLoginManager
.
shared
.
userModel
?
.
id
{
let
vc
=
YHNewNameCardViewController
()
vc
.
userId
=
userId
vc
.
userId
=
contact
.
yh_id
}
navigationController
?
.
pushViewController
(
vc
)
navigationController
?
.
pushViewController
(
vc
)
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyNewViewController.swift
View file @
e8d86656
...
@@ -667,7 +667,7 @@ extension YHMyNewViewController {
...
@@ -667,7 +667,7 @@ extension YHMyNewViewController {
switch
item
.
type
{
switch
item
.
type
{
case
.
myCard
:
// 我的名片
case
.
myCard
:
// 我的名片
let
vc
=
YHN
ameCardContainer
ViewController
()
let
vc
=
YHN
ewNameCard
ViewController
()
if
let
userId
=
YHLoginManager
.
shared
.
userModel
?
.
id
{
if
let
userId
=
YHLoginManager
.
shared
.
userModel
?
.
id
{
vc
.
userId
=
userId
vc
.
userId
=
userId
}
}
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/NameCard(名片)/C/YHNameCardContainerViewController.swift
View file @
e8d86656
...
@@ -14,133 +14,20 @@ class YHNameCardContainerViewController: YHBaseViewController {
...
@@ -14,133 +14,20 @@ class YHNameCardContainerViewController: YHBaseViewController {
var
userId
:
String
=
""
var
userId
:
String
=
""
var
defaultIndex
=
0
var
canScroll
:
Bool
=
false
{
let
viewModel
=
YHMatchUserViewModel
()
didSet
{
homePageVC
.
vcCanScroll
=
canScroll
lazy
var
containerScrollView
:
UIScrollView
=
{
dynamicVC
.
vcCanScroll
=
canScroll
let
scrollView
=
UIScrollView
(
frame
:
.
zero
)
scrollView
.
delegate
=
self
scrollView
.
contentInsetAdjustmentBehavior
=
.
never
return
scrollView
}()
lazy
var
containerView
:
UIView
=
{
let
view
=
UIView
()
return
view
}()
lazy
var
headerView
:
UIView
=
{
let
view
=
UIView
()
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
UIColor
(
hexString
:
"#E2E3E8"
)
let
bgImgView
=
UIImageView
()
bgImgView
.
image
=
UIImage
(
named
:
"name_card_bg"
)
view
.
addSubview
(
bgImgView
)
bgImgView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
bgImgView
.
snp
.
width
)
.
multipliedBy
(
800.0
/
375.0
)
}
view
.
addSubview
(
avatarImgView
)
avatarImgView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
top
.
equalTo
(
24
+
k_Height_NavigationtBarAndStatuBar
)
make
.
width
.
height
.
equalTo
(
68
)
}
view
.
addSubview
(
editBtn
)
editBtn
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
20
)
make
.
centerY
.
equalTo
(
avatarImgView
)
make
.
right
.
equalTo
(
-
20
)
}
view
.
addSubview
(
nameTextView
)
nameTextView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
make
.
top
.
equalTo
(
avatarImgView
.
snp
.
bottom
)
.
offset
(
12
)
}
}
view
.
addSubview
(
professionalLabel
)
}
professionalLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
var
defaultIndex
:
Int
=
0
{
make
.
right
.
equalTo
(
-
20
)
didSet
{
make
.
top
.
equalTo
(
nameTextView
.
snp
.
bottom
)
.
offset
(
4
)
self
.
segmentedView
.
selectItemAt
(
index
:
self
.
defaultIndex
)
}
view
.
addSubview
(
signatureLabel
)
signatureLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
make
.
top
.
equalTo
(
professionalLabel
.
snp
.
bottom
)
.
offset
(
6
)
make
.
bottom
.
equalTo
(
-
32
)
}
}
return
view
}
}()
lazy
var
avatarImgView
:
UIImageView
=
{
let
avatarImgV
=
UIImageView
()
avatarImgV
.
backgroundColor
=
UIColor
.
brandGrayColor8
avatarImgV
.
layer
.
cornerRadius
=
68.0
/
2
avatarImgV
.
clipsToBounds
=
true
return
avatarImgV
}()
lazy
var
editBtn
:
UIButton
=
{
let
btn
=
UIButton
(
type
:
.
custom
)
btn
.
setBackgroundImage
(
UIImage
(
named
:
"name_card_edit"
),
for
:
.
normal
)
btn
.
addTarget
(
self
,
action
:
#selector(
didBasciInfoBtnClicked
)
,
for
:
.
touchUpInside
)
return
btn
}()
lazy
var
nameTextView
:
UITextView
=
{
let
viewModel
=
YHMatchUserViewModel
()
let
textView
=
UITextView
()
textView
.
textColor
=
UIColor
.
brandGrayColor8
textView
.
backgroundColor
=
.
clear
textView
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
21
)
textView
.
isScrollEnabled
=
false
textView
.
isEditable
=
false
textView
.
isSelectable
=
false
return
textView
}()
lazy
var
professionalLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
left
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
label
.
numberOfLines
=
2
return
label
}()
lazy
var
signatureLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
left
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
label
.
numberOfLines
=
2
return
label
}()
lazy
var
cityLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
center
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
10
)
label
.
layer
.
cornerRadius
=
9.0
label
.
layer
.
borderColor
=
UIColor
.
brandGrayColor8
.
cgColor
label
.
layer
.
borderWidth
=
0.5
return
label
}()
lazy
var
zodiacLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
center
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
10
)
label
.
layer
.
cornerRadius
=
9.0
label
.
layer
.
borderColor
=
UIColor
.
brandGrayColor8
.
cgColor
label
.
layer
.
borderWidth
=
0.5
label
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
42
,
height
:
18
)
return
label
}()
lazy
var
segmentedDataSource
:
JXSegmentedTitleDataSource
=
{
lazy
var
segmentedDataSource
:
JXSegmentedTitleDataSource
=
{
let
dataSource
=
JXSegmentedTitleDataSource
()
let
dataSource
=
JXSegmentedTitleDataSource
()
...
@@ -185,26 +72,8 @@ class YHNameCardContainerViewController: YHBaseViewController {
...
@@ -185,26 +72,8 @@ class YHNameCardContainerViewController: YHBaseViewController {
return
vc
return
vc
}()
}()
lazy
var
bottomBtn
:
UIButton
=
{
let
btn
=
UIButton
(
type
:
.
custom
)
btn
.
setTitle
(
"发布动态"
,
for
:
.
normal
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
13
)
btn
.
setTitleColor
(
.
white
,
for
:
.
normal
)
btn
.
backgroundColor
=
UIColor
.
brandGrayColor8
btn
.
layer
.
cornerRadius
=
3.0
btn
.
masksToBounds
=
true
return
btn
}()
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
gk_navigationBar
.
backgroundColor
=
.
clear
let
rightButtonItem
=
UIBarButtonItem
(
image
:
UIImage
(
named
:
"name_card_authorize"
)?
.
withRenderingMode
(
.
alwaysOriginal
),
style
:
.
plain
,
target
:
self
,
action
:
#selector(
authorizeBtnClicked
)
)
gk_navRightBarButtonItem
=
rightButtonItem
gk_navItemRightSpace
=
16
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
leaveTopOp
)
,
name
:
Notification
.
Name
(
rawValue
:
"leaveTop0"
),
object
:
nil
)
createUI
()
createUI
()
}
}
...
@@ -212,73 +81,22 @@ class YHNameCardContainerViewController: YHBaseViewController {
...
@@ -212,73 +81,22 @@ class YHNameCardContainerViewController: YHBaseViewController {
NotificationCenter
.
default
.
removeObserver
(
self
)
NotificationCenter
.
default
.
removeObserver
(
self
)
}
}
func
freshData
()
{
homePageVC
.
requestNameCardInfo
()
}
func
requestNameCardInfo
()
{
func
requestNameCardInfo
()
{
self
.
viewModel
.
getUserNameCardInfo
(
uid
:
self
.
userId
)
{
self
.
viewModel
.
getUserNameCardInfo
(
uid
:
self
.
userId
)
{
_
,
_
in
_
,
_
in
}
}
}
}
@objc
func
authorizeBtnClicked
()
{
}
@objc
func
didBasciInfoBtnClicked
()
{
let
vc
=
YHEditBaseUserInfoViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
}
func
createUI
()
{
func
createUI
()
{
gk_navigationBar
.
isHidden
=
true
view
.
backgroundColor
=
.
white
view
.
backgroundColor
=
.
white
view
.
addSubview
(
containerScrollView
)
containerScrollView
.
addSubview
(
containerView
)
view
.
addSubview
(
bottomBtn
)
containerScrollView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
bottomBtn
.
snp
.
top
)
.
offset
(
-
8
)
}
containerView
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
KScreenWidth
)
make
.
edges
.
equalToSuperview
()
}
bottomBtn
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
16
)
make
.
right
.
equalTo
(
-
16
)
make
.
height
.
equalTo
(
46
)
make
.
bottom
.
equalTo
(
-
k_Height_safeAreaInsetsBottom
()
-
10
)
}
containerView
.
addSubview
(
headerView
)
headerView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
}
segmentedView
.
dataSource
=
segmentedDataSource
segmentedView
.
dataSource
=
segmentedDataSource
segmentedView
.
delegate
=
self
segmentedView
.
delegate
=
self
containerView
.
addSubview
(
segmentedView
)
segmentedView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalTo
(
headerView
.
snp
.
bottom
)
make
.
height
.
equalTo
(
30
)
}
segmentedView
.
listContainer
=
listContainerView
segmentedView
.
listContainer
=
listContainerView
containerView
.
addSubview
(
listContainerView
)
listContainerView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalTo
(
segmentedView
.
snp
.
bottom
)
.
offset
(
0.0
)
make
.
height
.
equalTo
(
KScreenHeight
-
k_Height_NavigationtBarAndStatuBar
-
30
-
k_Height_safeAreaInsetsBottom
()
-
46
-
10
)
make
.
bottom
.
equalTo
(
containerView
)
}
// 分类Title
segmentedView
.
dataSource
=
segmentedDataSource
segmentedView
.
delegate
=
self
// 配置指示器
// 配置指示器
let
indicator
=
JXSegmentedIndicatorLineView
()
let
indicator
=
JXSegmentedIndicatorLineView
()
indicator
.
indicatorWidth
=
16.0
indicator
.
indicatorWidth
=
16.0
...
@@ -287,45 +105,34 @@ class YHNameCardContainerViewController: YHBaseViewController {
...
@@ -287,45 +105,34 @@ class YHNameCardContainerViewController: YHBaseViewController {
indicator
.
indicatorCornerRadius
=
0
indicator
.
indicatorCornerRadius
=
0
segmentedView
.
indicators
=
[
indicator
]
segmentedView
.
indicators
=
[
indicator
]
segmentedView
.
defaultSelectedIndex
=
defaultIndex
segmentedView
.
defaultSelectedIndex
=
defaultIndex
view
.
addSubview
(
segmentedView
)
updateModel
()
segmentedView
.
snp
.
makeConstraints
{
make
in
}
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
30
)
func
updateModel
()
{
}
let
cityText
=
" 北京市 "
view
.
addSubview
(
listContainerView
)
cityLabel
.
text
=
cityText
listContainerView
.
snp
.
makeConstraints
{
make
in
let
cityWidth
=
getWith
(
font
:
cityLabel
.
font
,
height
:
18
,
string
:
cityText
)
make
.
left
.
right
.
bottom
.
equalToSuperview
()
cityLabel
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
cityWidth
+
8
,
height
:
18
)
make
.
top
.
equalTo
(
segmentedView
.
snp
.
bottom
)
.
offset
(
0.0
)
make
.
height
.
equalTo
(
KScreenHeight
-
k_Height_NavigationtBarAndStatuBar
-
30
-
k_Height_safeAreaInsetsBottom
()
-
46
-
10
)
let
zodiacText
=
" 金牛座 "
}
zodiacLabel
.
text
=
zodiacText
let
zodiacWidth
=
getWith
(
font
:
zodiacLabel
.
font
,
height
:
18
,
string
:
zodiacText
)
zodiacLabel
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
zodiacWidth
+
8
,
height
:
18
)
// self.signImgV.isHidden = !self.userModel.isSigned
let
name
:
ASAttributedString
=
.
init
(
string
:
"阿萨德减肥啦拒收到付垃圾啊送达了开发机山卡拉"
,
.
font
(
UIFont
.
PFSC_M
(
ofSize
:
21
)),
.
foreground
(
UIColor
.
brandGrayColor8
))
let
cityTag
:
ASAttributedString
=
"
\(
.
view
(
cityLabel
,
.
original
(
.
center
))
)
"
let
zodiacTag
:
ASAttributedString
=
"
\(
.
view
(
zodiacLabel
,
.
original
(
.
center
))
)
"
nameTextView
.
attributed
.
text
=
name
+
cityTag
+
zodiacTag
professionalLabel
.
text
=
"说法舒服多了撒记得发啦手机大发立卡手机大发立卡手机大发卡拉季山卡拉代发金卡拉萨放大机阿卡说法卡拉生发剂凯撒的剪发卡"
signatureLabel
.
text
=
"阿萨德节流阀上课了打飞机阿萨漏打卡飞机王企鹅批发金娃女会计收纳大V江西子女科技哈师大聚哈挖了溶剂法搞起我金卡阿斯加德发卡量世纪东方啦苏卡达飞机阿萨达佛IE秋季日期忘记哦"
}
func
getWith
(
font
:
UIFont
,
height
:
CGFloat
,
string
:
String
)
->
CGFloat
{
let
size
=
CGSize
(
width
:
CGFloat
(
MAXFLOAT
),
height
:
height
)
let
dic
=
[
NSAttributedString
.
Key
.
font
:
font
]
// swift 4.2
let
strSize
=
string
.
boundingRect
(
with
:
size
,
options
:
[
.
usesLineFragmentOrigin
],
attributes
:
dic
,
context
:
nil
)
.
size
return
CGSize
(
width
:
ceil
(
strSize
.
width
),
height
:
strSize
.
height
)
.
width
}
}
}
}
extension
YHNameCardContainerViewController
:
JXSegmentedViewDelegate
{
extension
YHNameCardContainerViewController
:
JXSegmentedViewDelegate
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didSelectedItemAt
index
:
Int
)
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
didSelectedItemAt
index
:
Int
)
{
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"scrollViewDidEndDragging0"
),
object
:
nil
)
}
}
/// 正在滚动中的回调
///
/// - Parameters:
/// - segmentedView: JXSegmentedView
/// - leftIndex: 正在滚动中,相对位置处于左边的index
/// - rightIndex: 正在滚动中,相对位置处于右边的index
/// - percent: 从左往右计算的百分比
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
scrollingFrom
leftIndex
:
Int
,
to
rightIndex
:
Int
,
percent
:
CGFloat
)
{
func
segmentedView
(
_
segmentedView
:
JXSegmentedView
,
scrollingFrom
leftIndex
:
Int
,
to
rightIndex
:
Int
,
percent
:
CGFloat
)
{
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"scrollViewWillBeginDragging0"
),
object
:
nil
)
}
}
}
}
...
@@ -344,41 +151,3 @@ extension YHNameCardContainerViewController: JXSegmentedListContainerViewDataSou
...
@@ -344,41 +151,3 @@ extension YHNameCardContainerViewController: JXSegmentedListContainerViewDataSou
return
vc
return
vc
}
}
}
}
extension
YHNameCardContainerViewController
:
UIScrollViewDelegate
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
if
scrollView
.
contentOffset
.
y
>
0
{
var
alpha
=
scrollView
.
contentOffset
.
y
/
(
24
)
if
alpha
>
1.0
{
alpha
=
1.0
}
gk_navBarAlpha
=
alpha
gk_navBackgroundColor
=
.
white
gk_navTitle
=
"我的名片"
}
else
{
gk_navBarAlpha
=
0.0
gk_navBackgroundColor
=
.
clear
gk_navTitle
=
nil
}
// 吸顶
let
fixOffSetY
:
CGFloat
=
self
.
headerView
.
height
-
k_Height_NavigationtBarAndStatuBar
if
scrollView
.
contentOffset
.
y
>=
fixOffSetY
{
scrollView
.
contentOffset
=
CGPoint
(
x
:
0
,
y
:
fixOffSetY
)
scrollView
.
isScrollEnabled
=
false
homePageVC
.
vcCanScroll
=
true
}
else
{
containerScrollView
.
isScrollEnabled
=
true
homePageVC
.
vcCanScroll
=
false
}
}
}
extension
YHNameCardContainerViewController
{
@objc
func
leaveTopOp
()
{
containerScrollView
.
isScrollEnabled
=
true
}
}
galaxy/galaxy/Classes/Modules/Mine(我的)/NameCard(名片)/C/YHNameCardDynamicViewController.swift
View file @
e8d86656
...
@@ -12,9 +12,10 @@ import JXSegmentedView
...
@@ -12,9 +12,10 @@ import JXSegmentedView
class
YHNameCardDynamicViewController
:
YHBaseViewController
{
class
YHNameCardDynamicViewController
:
YHBaseViewController
{
var
arr
:
[
String
]
=
[
""
,
""
,
""
,
""
]
var
arr
:
[
String
]
=
[
""
,
""
,
""
,
""
]
var
vcCanScroll
:
Bool
=
true
lazy
var
tableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
lazy
var
tableView
:
YHGestureTableView
=
{
let
tableView
=
YHGestureTableView
(
frame
:
.
zero
,
style
:
.
grouped
)
tableView
.
estimatedSectionHeaderHeight
=
100
tableView
.
estimatedSectionHeaderHeight
=
100
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
separatorStyle
=
.
none
tableView
.
separatorStyle
=
.
none
...
@@ -25,11 +26,16 @@ class YHNameCardDynamicViewController: YHBaseViewController {
...
@@ -25,11 +26,16 @@ class YHNameCardDynamicViewController: YHBaseViewController {
tableView
.
register
(
YHNameCardDynamicCell
.
self
,
forCellReuseIdentifier
:
YHNameCardDynamicCell
.
cellReuseIdentifier
)
tableView
.
register
(
YHNameCardDynamicCell
.
self
,
forCellReuseIdentifier
:
YHNameCardDynamicCell
.
cellReuseIdentifier
)
return
tableView
return
tableView
}()
}()
deinit
{
NotificationCenter
.
default
.
removeObserver
(
self
)
}
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
view
.
backgroundColor
=
.
white
view
.
backgroundColor
=
.
white
gk_navigationBar
.
isHidden
=
true
gk_navigationBar
.
isHidden
=
true
addObserver
()
view
.
addSubview
(
self
.
tableView
)
view
.
addSubview
(
self
.
tableView
)
self
.
tableView
.
snp
.
makeConstraints
{
make
in
self
.
tableView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
left
.
equalTo
(
20
)
...
@@ -38,6 +44,11 @@ class YHNameCardDynamicViewController: YHBaseViewController {
...
@@ -38,6 +44,11 @@ class YHNameCardDynamicViewController: YHBaseViewController {
make
.
top
.
equalToSuperview
()
make
.
top
.
equalToSuperview
()
}
}
}
}
func
addObserver
()
{
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
beginDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewWillBeginDragging0"
),
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
endDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewDidEndDragging0"
),
object
:
nil
)
}
}
}
extension
YHNameCardDynamicViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
extension
YHNameCardDynamicViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
...
@@ -79,3 +90,34 @@ extension YHNameCardDynamicViewController: JXSegmentedListContainerViewListDeleg
...
@@ -79,3 +90,34 @@ extension YHNameCardDynamicViewController: JXSegmentedListContainerViewListDeleg
return
view
return
view
}
}
}
}
// **********************************************************************************
extension
YHNameCardDynamicViewController
:
UIScrollViewDelegate
{
// 控制滑动交互
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
let
scrollViewSet
:
CGFloat
=
scrollView
.
contentOffset
.
y
if
vcCanScroll
==
false
{
// 不能滚动时
scrollView
.
contentOffset
=
CGPoint
(
x
:
0
,
y
:
0
)
}
else
{
if
scrollViewSet
<=
0
{
scrollView
.
contentOffset
=
CGPoint
(
x
:
0
,
y
:
0
)
vcCanScroll
=
false
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
rawValue
:
"leaveTop0"
),
object
:
nil
)
}
else
{
scrollView
.
contentOffset
=
CGPoint
(
x
:
0
,
y
:
scrollViewSet
)
}
}
}
}
extension
YHNameCardDynamicViewController
{
@objc
func
beginDragging
()
{
tableView
.
isScrollEnabled
=
false
vcCanScroll
=
false
}
@objc
func
endDragging
()
{
tableView
.
isScrollEnabled
=
true
}
}
galaxy/galaxy/Classes/Modules/Mine(我的)/NameCard(名片)/C/YHNameCardHomePageViewController.swift
View file @
e8d86656
...
@@ -15,11 +15,7 @@ class YHNameCardHomePageViewController: YHBaseViewController {
...
@@ -15,11 +15,7 @@ class YHNameCardHomePageViewController: YHBaseViewController {
var
cardInfoArr
:
[
YHUserNameCardInfo
]
=
[]
var
cardInfoArr
:
[
YHUserNameCardInfo
]
=
[]
let
viewModel
=
YHMatchUserViewModel
()
let
viewModel
=
YHMatchUserViewModel
()
var
vcCanScroll
:
Bool
=
false
{
var
vcCanScroll
:
Bool
=
true
didSet
{
tableView
.
isScrollEnabled
=
vcCanScroll
}
}
var
isCurrentUser
:
Bool
{
var
isCurrentUser
:
Bool
{
get
{
get
{
...
@@ -27,9 +23,9 @@ class YHNameCardHomePageViewController: YHBaseViewController {
...
@@ -27,9 +23,9 @@ class YHNameCardHomePageViewController: YHBaseViewController {
}
}
}
}
lazy
var
tableView
:
UI
TableView
=
{
lazy
var
tableView
:
YHGesture
TableView
=
{
let
tableView
=
UI
TableView
(
frame
:
.
zero
,
style
:
.
grouped
)
let
tableView
=
YHGesture
TableView
(
frame
:
.
zero
,
style
:
.
grouped
)
tableView
.
estimatedSectionHeaderHeight
=
1
0
0
tableView
.
estimatedSectionHeaderHeight
=
1
.
0
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
separatorStyle
=
.
none
tableView
.
separatorStyle
=
.
none
tableView
.
delegate
=
self
tableView
.
delegate
=
self
...
@@ -50,6 +46,7 @@ class YHNameCardHomePageViewController: YHBaseViewController {
...
@@ -50,6 +46,7 @@ class YHNameCardHomePageViewController: YHBaseViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
addObserver
()
view
.
backgroundColor
=
.
white
view
.
backgroundColor
=
.
white
gk_navigationBar
.
isHidden
=
true
gk_navigationBar
.
isHidden
=
true
createUI
()
createUI
()
...
@@ -57,7 +54,6 @@ class YHNameCardHomePageViewController: YHBaseViewController {
...
@@ -57,7 +54,6 @@ class YHNameCardHomePageViewController: YHBaseViewController {
}
}
func
createUI
()
{
func
createUI
()
{
vcCanScroll
=
false
view
.
addSubview
(
self
.
tableView
)
view
.
addSubview
(
self
.
tableView
)
self
.
tableView
.
snp
.
makeConstraints
{
make
in
self
.
tableView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
0
)
make
.
left
.
equalTo
(
0
)
...
@@ -67,6 +63,11 @@ class YHNameCardHomePageViewController: YHBaseViewController {
...
@@ -67,6 +63,11 @@ class YHNameCardHomePageViewController: YHBaseViewController {
}
}
}
}
func
addObserver
()
{
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
beginDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewWillBeginDragging0"
),
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
endDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewDidEndDragging0"
),
object
:
nil
)
}
func
requestNameCardInfo
()
{
func
requestNameCardInfo
()
{
self
.
viewModel
.
getUserNameCardInfo
(
uid
:
self
.
userId
)
{
self
.
viewModel
.
getUserNameCardInfo
(
uid
:
self
.
userId
)
{
_
,
_
in
_
,
_
in
...
@@ -172,11 +173,11 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
...
@@ -172,11 +173,11 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
if
cardInfo
.
type
==
.
honor
{
if
cardInfo
.
type
==
.
honor
{
let
vc
=
YHEditHonorViewController
()
let
vc
=
YHEditHonorViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
else
if
cardInfo
.
type
==
.
introduce
{
}
else
if
cardInfo
.
type
==
.
introduce
{
let
vc
=
YHEditPersonalProfileViewController
()
let
vc
=
YHEditPersonalProfileViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
}
return
introCell
return
introCell
...
@@ -194,7 +195,7 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
...
@@ -194,7 +195,7 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditSchoolViewController
()
let
vc
=
YHEditSchoolViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
eduCell
return
eduCell
}
}
...
@@ -211,7 +212,7 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
...
@@ -211,7 +212,7 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditWorkViewController
()
let
vc
=
YHEditWorkViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
workCell
return
workCell
}
}
...
@@ -223,7 +224,7 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
...
@@ -223,7 +224,7 @@ extension YHNameCardHomePageViewController: UITableViewDelegate, UITableViewData
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
vc
=
YHEditInterestViewController
()
let
vc
=
YHEditInterestViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
return
topicCell
return
topicCell
}
}
...
@@ -261,6 +262,8 @@ extension YHNameCardHomePageViewController: JXSegmentedListContainerViewListDele
...
@@ -261,6 +262,8 @@ extension YHNameCardHomePageViewController: JXSegmentedListContainerViewListDele
}
}
}
}
// **********************************************************************************
extension
YHNameCardHomePageViewController
:
UIScrollViewDelegate
{
extension
YHNameCardHomePageViewController
:
UIScrollViewDelegate
{
// 控制滑动交互
// 控制滑动交互
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
...
@@ -278,3 +281,14 @@ extension YHNameCardHomePageViewController: UIScrollViewDelegate {
...
@@ -278,3 +281,14 @@ extension YHNameCardHomePageViewController: UIScrollViewDelegate {
}
}
}
}
}
}
extension
YHNameCardHomePageViewController
{
@objc
func
beginDragging
()
{
tableView
.
isScrollEnabled
=
false
vcCanScroll
=
false
}
@objc
func
endDragging
()
{
tableView
.
isScrollEnabled
=
true
}
}
galaxy/galaxy/Classes/Modules/Mine(我的)/NameCard(名片)/C/YHNewNameCardViewController.swift
0 → 100644
View file @
e8d86656
//
// YHNameCardViewController.swift
// galaxy
//
// Created by Dufet on 2025/9/29.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
AttributedString
class
YHNewNameCardViewController
:
YHBaseViewController
{
var
userId
:
String
=
""
var
defaultIndex
=
0
let
viewModel
=
YHMatchUserViewModel
()
var
headerHeight
:
CGFloat
=
300.0
let
containerCellHeight
=
KScreenHeight
-
k_Height_NavigationtBarAndStatuBar
-
k_Height_safeAreaInsetsBottom
()
-
46
-
10
-
8
var
canScroll
:
Bool
=
true
var
isCurrentUser
:
Bool
{
get
{
return
(
!
self
.
userId
.
isEmpty
&&
self
.
userId
==
YHLoginManager
.
shared
.
userModel
?
.
id
)
}
}
lazy
var
tableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
tableView
.
estimatedSectionHeaderHeight
=
1.0
tableView
.
contentInsetAdjustmentBehavior
=
.
never
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
separatorStyle
=
.
none
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
tableView
.
backgroundColor
=
.
clear
tableView
.
register
(
UITableViewCell
.
self
,
forCellReuseIdentifier
:
"UITableViewCell"
)
return
tableView
}()
lazy
var
containerVC
:
YHNameCardContainerViewController
=
{
let
vc
=
YHNameCardContainerViewController
()
return
vc
}()
lazy
var
headerView
:
UIView
=
{
let
view
=
UIView
()
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
UIColor
(
hexString
:
"#E2E3E8"
)
let
bgImgView
=
UIImageView
()
bgImgView
.
image
=
UIImage
(
named
:
"name_card_bg"
)
view
.
addSubview
(
bgImgView
)
bgImgView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
bgImgView
.
snp
.
width
)
.
multipliedBy
(
800.0
/
375.0
)
}
view
.
addSubview
(
avatarImgView
)
avatarImgView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
top
.
equalTo
(
24
+
k_Height_NavigationtBarAndStatuBar
)
make
.
width
.
height
.
equalTo
(
68
)
}
view
.
addSubview
(
editBtn
)
editBtn
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
20
)
make
.
centerY
.
equalTo
(
avatarImgView
)
make
.
right
.
equalTo
(
-
20
)
}
view
.
addSubview
(
nameTextView
)
nameTextView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
make
.
top
.
equalTo
(
avatarImgView
.
snp
.
bottom
)
.
offset
(
12
)
}
view
.
addSubview
(
professionalLabel
)
professionalLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
make
.
top
.
equalTo
(
nameTextView
.
snp
.
bottom
)
.
offset
(
4
)
}
view
.
addSubview
(
signatureLabel
)
signatureLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
20
)
make
.
right
.
equalTo
(
-
20
)
make
.
top
.
equalTo
(
professionalLabel
.
snp
.
bottom
)
.
offset
(
6
)
make
.
bottom
.
equalTo
(
-
32
)
}
return
view
}()
lazy
var
avatarImgView
:
UIImageView
=
{
let
avatarImgV
=
UIImageView
()
avatarImgV
.
backgroundColor
=
UIColor
.
brandGrayColor8
avatarImgV
.
layer
.
cornerRadius
=
68.0
/
2
avatarImgV
.
clipsToBounds
=
true
return
avatarImgV
}()
lazy
var
editBtn
:
UIButton
=
{
let
btn
=
UIButton
(
type
:
.
custom
)
btn
.
setBackgroundImage
(
UIImage
(
named
:
"name_card_edit"
),
for
:
.
normal
)
btn
.
addTarget
(
self
,
action
:
#selector(
didBasciInfoBtnClicked
)
,
for
:
.
touchUpInside
)
return
btn
}()
lazy
var
nameTextView
:
UITextView
=
{
let
textView
=
UITextView
()
textView
.
textColor
=
UIColor
.
brandGrayColor8
textView
.
backgroundColor
=
.
clear
textView
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
21
)
textView
.
isScrollEnabled
=
false
textView
.
isEditable
=
false
textView
.
isSelectable
=
false
return
textView
}()
lazy
var
professionalLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
left
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
14
)
label
.
numberOfLines
=
2
return
label
}()
lazy
var
signatureLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
left
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
label
.
numberOfLines
=
2
return
label
}()
lazy
var
cityLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
center
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
10
)
label
.
layer
.
cornerRadius
=
9.0
label
.
layer
.
borderColor
=
UIColor
.
brandGrayColor8
.
cgColor
label
.
layer
.
borderWidth
=
0.5
return
label
}()
lazy
var
zodiacLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
UIColor
.
brandGrayColor8
label
.
textAlignment
=
.
center
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
10
)
label
.
layer
.
cornerRadius
=
9.0
label
.
layer
.
borderColor
=
UIColor
.
brandGrayColor8
.
cgColor
label
.
layer
.
borderWidth
=
0.5
label
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
42
,
height
:
18
)
return
label
}()
lazy
var
bottomBtn
:
UIButton
=
{
let
btn
=
UIButton
(
type
:
.
custom
)
btn
.
setTitle
(
"发布动态"
,
for
:
.
normal
)
btn
.
titleLabel
?
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
13
)
btn
.
setTitleColor
(
.
white
,
for
:
.
normal
)
btn
.
backgroundColor
=
UIColor
.
brandGrayColor8
btn
.
layer
.
cornerRadius
=
3.0
btn
.
masksToBounds
=
true
return
btn
}()
deinit
{
NotificationCenter
.
default
.
removeObserver
(
self
)
}
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
gk_navigationBar
.
backgroundColor
=
.
clear
if
isCurrentUser
{
let
rightButtonItem
=
UIBarButtonItem
(
image
:
UIImage
(
named
:
"name_card_authorize"
)?
.
withRenderingMode
(
.
alwaysOriginal
),
style
:
.
plain
,
target
:
self
,
action
:
#selector(
authorizeBtnClicked
)
)
gk_navRightBarButtonItem
=
rightButtonItem
gk_navItemRightSpace
=
16
}
containerVC
.
userId
=
self
.
userId
createUI
()
}
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
self
.
requestNameCardInfo
()
}
func
createUI
()
{
addObserver
()
self
.
editBtn
.
isHidden
=
!
self
.
isCurrentUser
view
.
addSubview
(
tableView
)
view
.
addSubview
(
bottomBtn
)
tableView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
bottomBtn
.
snp
.
top
)
.
offset
(
-
8
)
}
bottomBtn
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
16
)
make
.
right
.
equalTo
(
-
16
)
make
.
height
.
equalTo
(
46
)
make
.
bottom
.
equalTo
(
-
k_Height_safeAreaInsetsBottom
()
-
10
)
}
}
@objc
func
authorizeBtnClicked
()
{
}
@objc
func
didBasciInfoBtnClicked
()
{
let
vc
=
YHEditBaseUserInfoViewController
()
vc
.
model
=
self
.
viewModel
.
nameCardInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
}
func
addObserver
()
{
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
leaveTopOp
)
,
name
:
Notification
.
Name
(
rawValue
:
"leaveTop0"
),
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
beginDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewWillBeginDragging0"
),
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
endDragging
)
,
name
:
Notification
.
Name
(
rawValue
:
"scrollViewDidEndDragging0"
),
object
:
nil
)
}
func
requestNameCardInfo
()
{
containerVC
.
freshData
()
self
.
viewModel
.
getUserNameCardInfo
(
uid
:
self
.
userId
)
{
_
,
_
in
self
.
updateModel
()
self
.
tableView
.
reloadData
()
}
}
func
updateModel
()
{
if
let
url
=
URL
(
string
:
self
.
viewModel
.
nameCardInfo
.
avatar
)
{
self
.
avatarImgView
.
kf
.
setImage
(
with
:
url
,
placeholder
:
UIImage
(
named
:
"people_head_default"
))
}
else
{
self
.
avatarImgView
.
image
=
UIImage
(
named
:
"people_head_default"
)
}
// 城市和星座
let
cityText
=
self
.
viewModel
.
nameCardInfo
.
address
.
showCity
()
cityLabel
.
text
=
cityText
let
cityWidth
=
getWith
(
font
:
cityLabel
.
font
,
height
:
18
,
string
:
cityText
)
cityLabel
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
cityWidth
+
8
,
height
:
18
)
let
zodiacText
=
self
.
viewModel
.
nameCardInfo
.
zodiac
zodiacLabel
.
text
=
zodiacText
let
zodiacWidth
=
getWith
(
font
:
zodiacLabel
.
font
,
height
:
18
,
string
:
zodiacText
)
zodiacLabel
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
zodiacWidth
+
8
,
height
:
18
)
// 昵称
var
name
:
ASAttributedString
=
.
init
(
string
:
self
.
viewModel
.
nameCardInfo
.
username
,
.
font
(
UIFont
.
PFSC_M
(
ofSize
:
21
)),
.
foreground
(
UIColor
.
brandGrayColor8
))
let
cityTag
:
ASAttributedString
=
"
\(
.
view
(
cityLabel
,
.
original
(
.
center
))
)
"
let
zodiacTag
:
ASAttributedString
=
"
\(
.
view
(
zodiacLabel
,
.
original
(
.
center
))
)
"
if
!
cityText
.
isEmpty
{
name
+=
cityTag
}
if
!
zodiacText
.
isEmpty
{
name
+=
zodiacTag
}
nameTextView
.
attributed
.
text
=
name
// 职业行业
var
text1
=
""
var
text1Arr
:
[
String
]
=
[]
if
!
self
.
viewModel
.
nameCardInfo
.
position
.
isEmpty
{
text1Arr
.
append
(
self
.
viewModel
.
nameCardInfo
.
position
)
}
if
!
self
.
viewModel
.
nameCardInfo
.
industry
.
isEmpty
{
text1Arr
.
append
(
self
.
viewModel
.
nameCardInfo
.
industry
)
}
if
text1Arr
.
count
>
0
{
text1
=
text1Arr
.
joined
(
separator
:
" | "
)
}
self
.
professionalLabel
.
textColor
=
UIColor
.
brandGrayColor8
if
text1
.
isEmpty
{
if
self
.
isCurrentUser
{
// 当前用户默认文案
self
.
professionalLabel
.
textColor
=
UIColor
.
mainTextColor30
text1
=
"填写职位 | 填写所属行业"
}
}
self
.
professionalLabel
.
text
=
text1
// 个性签名
self
.
signatureLabel
.
textColor
=
UIColor
.
brandGrayColor8
var
text2
=
""
if
!
self
.
viewModel
.
nameCardInfo
.
signature
.
isEmpty
{
text2
=
self
.
viewModel
.
nameCardInfo
.
signature
}
else
{
if
self
.
isCurrentUser
{
// 当前用户默认文案
self
.
signatureLabel
.
textColor
=
UIColor
.
mainTextColor30
text2
=
"填写个性签名,展现真我风采,彰显独特身份"
}
}
self
.
signatureLabel
.
text
=
text2
}
func
getWith
(
font
:
UIFont
,
height
:
CGFloat
,
string
:
String
)
->
CGFloat
{
let
size
=
CGSize
(
width
:
CGFloat
(
MAXFLOAT
),
height
:
height
)
let
dic
=
[
NSAttributedString
.
Key
.
font
:
font
]
// swift 4.2
let
strSize
=
string
.
boundingRect
(
with
:
size
,
options
:
[
.
usesLineFragmentOrigin
],
attributes
:
dic
,
context
:
nil
)
.
size
return
CGSize
(
width
:
ceil
(
strSize
.
width
),
height
:
strSize
.
height
)
.
width
}
}
extension
YHNewNameCardViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
1
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
1
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
UITableView
.
automaticDimension
}
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
return
headerView
}
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
return
0.001
}
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
()
return
view
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
containerCellHeight
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
UITableViewCell
()
containerVC
.
view
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
KScreenWidth
,
height
:
containerCellHeight
)
cell
.
contentView
.
addSubview
(
containerVC
.
view
)
containerVC
.
view
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
return
cell
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
tableView
.
deselectRow
(
at
:
indexPath
,
animated
:
true
)
}
}
extension
YHNewNameCardViewController
:
UIScrollViewDelegate
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
if
scrollView
.
contentOffset
.
y
>
0
{
var
alpha
=
scrollView
.
contentOffset
.
y
/
(
24
)
if
alpha
>
1.0
{
alpha
=
1.0
}
gk_navBarAlpha
=
alpha
gk_navBackgroundColor
=
.
white
gk_navTitle
=
"我的名片"
}
else
{
gk_navBarAlpha
=
0.0
gk_navBackgroundColor
=
.
clear
gk_navTitle
=
nil
}
// 吸顶
let
containerCellY
:
CGFloat
=
tableView
.
rectForRow
(
at
:
IndexPath
(
row
:
0
,
section
:
0
))
.
origin
.
y
let
fixOffSetY
:
CGFloat
=
containerCellY
-
k_Height_NavigationtBarAndStatuBar
if
scrollView
.
contentOffset
.
y
>=
fixOffSetY
{
scrollView
.
contentOffset
=
CGPoint
(
x
:
0
,
y
:
fixOffSetY
)
canScroll
=
false
containerVC
.
canScroll
=
true
}
else
{
if
canScroll
==
false
{
scrollView
.
contentOffset
=
CGPoint
(
x
:
0
,
y
:
fixOffSetY
)
}
}
}
}
extension
YHNewNameCardViewController
{
@objc
func
leaveTopOp
()
{
canScroll
=
true
}
@objc
func
beginDragging
()
{
tableView
.
isScrollEnabled
=
false
canScroll
=
false
}
@objc
func
endDragging
()
{
tableView
.
isScrollEnabled
=
true
canScroll
=
true
}
}
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