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
63fb027d
Commit
63fb027d
authored
Apr 16, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 消息
parent
e9da6f13
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
53 deletions
+85
-53
YHSearchInfoHistoryView.swift
.../Classes/Modules/Home(首页)/V/YHSearchInfoHistoryView.swift
+4
-4
YHInformationFillVC.swift
...y/Classes/Modules/Message(消息)/C/YHInformationFillVC.swift
+5
-19
YHMsgViewController.swift
...y/Classes/Modules/Message(消息)/C/YHMsgViewController.swift
+1
-1
YHInformationFillCell.swift
...Classes/Modules/Message(消息)/V/YHInformationFillCell.swift
+47
-1
YHMsgViewModel.swift
...alaxy/Classes/Modules/Message(消息)/VM/YHMsgViewModel.swift
+28
-28
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHSearchInfoHistoryView.swift
View file @
63fb027d
...
...
@@ -81,8 +81,8 @@ class YHSearchInfoHistoryView: UIView {
func
getwith
(
font
:
UIFont
,
height
:
CGFloat
,
string
:
String
)
->
CGSize
{
let
size
=
CGSize
.
init
(
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
strSize
var
strSize
=
string
.
boundingRect
(
with
:
size
,
options
:
[
.
usesLineFragmentOrigin
],
attributes
:
dic
,
context
:
nil
)
.
size
return
CGSizeMake
(
ceil
(
strSize
.
width
),
strSize
.
height
)
}
}
...
...
@@ -99,8 +99,8 @@ extension YHSearchInfoHistoryView: UICollectionViewDelegate, UICollectionViewDat
let
size
=
self
.
getwith
(
font
:
UIFont
.
systemFont
(
ofSize
:
12
),
height
:
24
,
string
:
historyItems
[
indexPath
.
item
])
var
width
=
size
.
width
+
gap
*
2.0
if
width
>
collectionView
.
width
{
width
=
collectionView
.
width
if
width
>
226.0
{
width
=
226.0
}
return
CGSize
(
width
:
width
,
height
:
cellHeight
)
}
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/C/YHInformationFillVC.swift
View file @
63fb027d
...
...
@@ -40,7 +40,7 @@ class YHInformationFillVC: YHBaseViewController {
lazy
var
tableView
:
UITableView
=
{
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
tableView
.
sectionHeaderHeight
=
46
.0
tableView
.
estimatedSectionHeaderHeight
=
1
.0
tableView
.
estimatedSectionFooterHeight
=
1.0
tableView
.
showsVerticalScrollIndicator
=
false
tableView
.
separatorStyle
=
.
none
...
...
@@ -95,13 +95,9 @@ class YHInformationFillVC: YHBaseViewController {
}
extension
YHInformationFillVC
:
UITableViewDelegate
,
UITableViewDataSource
{
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
msgArr
.
count
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
1
return
msgArr
.
count
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
...
...
@@ -119,7 +115,7 @@ extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource {
}
private
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
46
.0
return
1
.0
}
private
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
CGFloat
{
...
...
@@ -132,18 +128,8 @@ extension YHInformationFillVC: UITableViewDelegate, UITableViewDataSource {
}
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
()
let
label
=
UILabel
()
label
.
textColor
=
UIColor
(
hex
:
0x121A26
,
alpha
:
0.3
)
label
.
textAlignment
=
.
center
label
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
label
.
text
=
"2023-09-13"
view
.
addSubview
(
label
)
label
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
return
view
return
UIView
()
}
}
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/C/YHMsgViewController.swift
View file @
63fb027d
...
...
@@ -176,7 +176,7 @@ extension YHMsgViewController: UITableViewDelegate, UITableViewDataSource {
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
0
<
indexPath
.
row
&&
indexPath
.
row
<
msgArr
.
count
{
if
0
<
=
indexPath
.
row
&&
indexPath
.
row
<
msgArr
.
count
{
let
msgItem
=
msgArr
[
indexPath
.
row
]
let
vc
=
YHInformationFillVC
()
vc
.
type
=
msgItem
.
type
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/V/YHInformationFillCell.swift
View file @
63fb027d
...
...
@@ -20,6 +20,7 @@ class YHInformationFillCell: UITableViewCell {
var
unreadPointView
:
UIView
!
var
bottomBtn
:
UIButton
!
var
lineView
:
UIView
!
var
timeLabel
:
UILabel
!
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
...
...
@@ -30,10 +31,49 @@ class YHInformationFillCell: UITableViewCell {
setupUI
()
}
func
updateModel
(
_
model
:
YHDetailMessageModel
)
{
titleLabel
.
text
=
model
.
title
detailLabel
.
text
=
model
.
content
unreadPointView
.
isHidden
=
model
.
isRead
timeLabel
.
text
=
formatTimestamp
(
Double
(
model
.
time
))
}
func
formatTimestamp
(
_
timestamp
:
TimeInterval
)
->
String
{
let
currentDate
=
Date
()
let
calendar
=
Calendar
.
current
let
currentYear
=
calendar
.
component
(
.
year
,
from
:
currentDate
)
let
currentDay
=
calendar
.
component
(
.
day
,
from
:
currentDate
)
let
date
=
Date
(
timeIntervalSince1970
:
timestamp
)
let
year
=
calendar
.
component
(
.
year
,
from
:
date
)
let
day
=
calendar
.
component
(
.
day
,
from
:
date
)
let
dateFormatter
=
DateFormatter
()
if
year
==
currentYear
{
if
day
==
currentDay
{
dateFormatter
.
dateFormat
=
"HH:mm"
}
else
{
dateFormatter
.
dateFormat
=
"MM-dd"
}
}
else
{
dateFormatter
.
dateFormat
=
"yyyy-MM-dd"
}
return
dateFormatter
.
string
(
from
:
date
)
}
func
setupUI
()
{
self
.
selectionStyle
=
.
none
contentView
.
backgroundColor
=
UIColor
(
hex
:
0xF8F8F8
)
timeLabel
=
UILabel
()
timeLabel
.
textColor
=
UIColor
(
hex
:
0x121A26
,
alpha
:
0.3
)
timeLabel
.
textAlignment
=
.
center
timeLabel
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
12
)
timeLabel
.
text
=
"2023-09-13"
contentView
.
addSubview
(
timeLabel
)
whiteView
=
UIView
()
whiteView
.
backgroundColor
=
.
white
...
...
@@ -71,10 +111,16 @@ class YHInformationFillCell: UITableViewCell {
bottomBtn
.
addTarget
(
self
,
action
:
#selector(
didBottomBtnClicked
)
,
for
:
.
touchUpInside
)
whiteView
.
addSubview
(
bottomBtn
)
timeLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
top
.
equalToSuperview
()
make
.
height
.
equalTo
(
46.0
)
}
whiteView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
16
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
16
)
make
.
top
.
bottom
.
equalToSuperview
()
make
.
top
.
equalTo
(
timeLabel
.
snp
.
bottom
)
make
.
bottom
.
equalToSuperview
()
}
titleLabel
.
snp
.
makeConstraints
{
make
in
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/VM/YHMsgViewModel.swift
View file @
63fb027d
...
...
@@ -21,34 +21,34 @@ class YHMsgViewModel: NSObject {
var
dic
=
json
.
data
var
json
=
json
json
.
code
=
200
dic
=
[
"information"
:
[
"unread_count"
:
0
,
"last_message"
:
"阿法守法所发生的法师打发"
,
"last_message_time"
:
1586507545
,
"type"
:
0
],
"certificate"
:
[
"unread_count"
:
3
,
"last_message"
:
"发生发顺丰大声道发生大发萨法沙发沙发沙发沙发阿斯顿发生发顺丰阿凡达放大第三方"
,
"last_message_time"
:
1586507545
,
"type"
:
0
],
"draft"
:
[
"unread_count"
:
100
,
"last_message"
:
"发生发顺丰大声道发生大发"
,
"last_message_time"
:
1712737945
,
"type"
:
0
],
"signature"
:
[
"unread_count"
:
87
,
"last_message"
:
"发生发"
,
"last_message_time"
:
1713236425
,
"type"
:
0
]
]
//
var json = json
//
json.code = 200
//
dic = [
//
"information": [
//
"unread_count": 0,
//
"last_message": "阿法守法所发生的法师打发",
//
"last_message_time": 1586507545,
//
"type": 0
//
],
//
"certificate": [
//
"unread_count": 3,
//
"last_message": "发生发顺丰大声道发生大发萨法沙发沙发沙发沙发阿斯顿发生发顺丰阿凡达放大第三方",
//
"last_message_time": 1586507545,
//
"type": 0
//
],
//
"draft": [
//
"unread_count": 100,
//
"last_message": "发生发顺丰大声道发生大发",
//
"last_message_time": 1712737945,
//
"type": 0
//
],
//
"signature": [
//
"unread_count": 87,
//
"last_message": "发生发",
//
"last_message_time": 1713236425,
//
"type": 0
//
]
//
]
printLog
(
"model 是 ==>
\(
json
)
"
)
if
json
.
code
==
200
{
...
...
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