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
50404ff8
Commit
50404ff8
authored
Oct 15, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 活动
parent
ede3b0aa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
156 additions
and
75 deletions
+156
-75
YHActivitySignSuccessViewController.swift
.../Activity(活动)/C/YHActivitySignSuccessViewController.swift
+32
-41
YHActivityModel.swift
...odules/Community(社区)/Activity(活动)/M/YHActivityModel.swift
+0
-16
YHSignSuccessActivity.swift
.../Community(社区)/Activity(活动)/M/YHSignSuccessActivity.swift
+51
-2
YHSignActivityInfoCell.swift
...Community(社区)/Activity(活动)/V/YHSignActivityInfoCell.swift
+7
-10
YHSignPrizeCell.swift
...odules/Community(社区)/Activity(活动)/V/YHSignPrizeCell.swift
+28
-6
YHActivityViewModel.swift
...s/Community(社区)/Activity(活动)/VM/YHActivityViewModel.swift
+35
-0
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+3
-0
No files found.
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/C/YHActivitySignSuccessViewController.swift
View file @
50404ff8
...
@@ -10,10 +10,12 @@ import UIKit
...
@@ -10,10 +10,12 @@ import UIKit
class
YHActivitySignSuccessViewController
:
YHBaseViewController
{
class
YHActivitySignSuccessViewController
:
YHBaseViewController
{
var
activityId
:
String
=
"75"
let
viewModel
:
YHActivityViewModel
=
YHActivityViewModel
()
private
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
private
let
tableView
=
UITableView
(
frame
:
.
zero
,
style
:
.
grouped
)
private
var
hasPrize
:
Bool
=
false
private
var
hasPrize
:
Bool
=
false
private
var
prize
:
Prize
?
private
var
result
:
YHSignSuccessActivity
?
private
var
event
:
CheckInEvent
?
lazy
var
backImgV
:
UIImageView
=
{
lazy
var
backImgV
:
UIImageView
=
{
let
v
=
UIImageView
()
let
v
=
UIImageView
()
...
@@ -74,7 +76,7 @@ class YHActivitySignSuccessViewController: YHBaseViewController {
...
@@ -74,7 +76,7 @@ class YHActivitySignSuccessViewController: YHBaseViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
setupUI
()
setupUI
()
setupWithPrize
()
// 切换到 setupWithoutPrize() 查看无奖品情况
requestData
()
}
}
private
func
setupUI
()
{
private
func
setupUI
()
{
...
@@ -111,38 +113,20 @@ class YHActivitySignSuccessViewController: YHBaseViewController {
...
@@ -111,38 +113,20 @@ class YHActivitySignSuccessViewController: YHBaseViewController {
}
}
}
}
// 有奖品的情况
func
requestData
()
{
private
func
setupWithPrize
()
{
self
.
viewModel
.
getActivitySign
(
id
:
self
.
activityId
)
{
[
weak
self
]
success
in
hasPrize
=
true
guard
let
self
=
self
else
{
prize
=
Prize
(
return
greeting
:
"你好,侯林先生"
,
}
instruction
:
"请联系现场工作人员领取您的奖品"
,
self
.
tableView
.
isHidden
=
!
success
image
:
"prize_sofa"
self
.
signFailBgView
.
isHidden
=
success
)
self
.
result
=
self
.
viewModel
.
signActivityModel
event
=
CheckInEvent
(
self
.
hasPrize
=
false
title
:
"翱翔云端·探索无限2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙2025无人机创新科技沙龙"
,
if
let
gift
=
self
.
viewModel
.
signActivityModel
?
.
gift
{
subtitle
:
"2025无人机创新科技沙龙"
,
self
.
hasPrize
=
true
date
:
"2025-09-13 周六 09:30"
,
}
location
:
"银河集团香港体验中心(香港湾仔港湾道26号华润大厦27楼2705室)"
,
self
.
tableView
.
reloadData
()
subLocation
:
"请于机导航至银河集团香港体验中心"
,
}
thumbnailImage
:
"event_thumb"
)
tableView
.
reloadData
()
}
// 无奖品的情况
private
func
setupWithoutPrize
()
{
hasPrize
=
false
prize
=
nil
event
=
CheckInEvent
(
title
:
"翱翔云端·探索无限"
,
subtitle
:
"2025无人机创新科技沙龙"
,
date
:
"2024-08-06 周日 09:30"
,
location
:
"本元大厦26A银河集团体验中心"
,
subLocation
:
"距地铁10号线亮马站D口步行62"
,
thumbnailImage
:
"event_thumb"
)
tableView
.
reloadData
()
}
}
}
}
...
@@ -168,17 +152,24 @@ extension YHActivitySignSuccessViewController: UITableViewDelegate, UITableViewD
...
@@ -168,17 +152,24 @@ extension YHActivitySignSuccessViewController: UITableViewDelegate, UITableViewD
guard
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHSignPrizeCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHSignPrizeCell
else
{
guard
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHSignPrizeCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHSignPrizeCell
else
{
return
UITableViewCell
()
return
UITableViewCell
()
}
}
if
let
prize
=
prize
{
if
let
result
=
self
.
result
{
cell
.
configure
(
with
:
prize
)
cell
.
configure
(
with
:
result
)
cell
.
onImageHeightChanged
=
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
UIView
.
performWithoutAnimation
{
self
.
tableView
.
reloadRows
(
at
:
[
indexPath
],
with
:
.
none
)
}
}
}
}
return
cell
return
cell
}
else
{
}
else
{
// 活动信息 Cell
// 活动信息 Cell
guard
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHSignActivityInfoCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHSignActivityInfoCell
else
{
guard
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHSignActivityInfoCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHSignActivityInfoCell
else
{
return
UITableViewCell
()
return
UITableViewCell
()
}
}
if
let
event
=
even
t
{
if
let
result
=
self
.
resul
t
{
cell
.
configure
(
with
:
even
t
)
cell
.
configure
(
with
:
resul
t
)
}
}
return
cell
return
cell
}
}
...
@@ -187,8 +178,8 @@ extension YHActivitySignSuccessViewController: UITableViewDelegate, UITableViewD
...
@@ -187,8 +178,8 @@ extension YHActivitySignSuccessViewController: UITableViewDelegate, UITableViewD
guard
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHSignActivityInfoCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHSignActivityInfoCell
else
{
guard
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHSignActivityInfoCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as?
YHSignActivityInfoCell
else
{
return
UITableViewCell
()
return
UITableViewCell
()
}
}
if
let
event
=
even
t
{
if
let
result
=
self
.
resul
t
{
cell
.
configure
(
with
:
even
t
)
cell
.
configure
(
with
:
resul
t
)
}
}
return
cell
return
cell
}
}
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/M/YHActivityModel.swift
View file @
50404ff8
...
@@ -74,19 +74,3 @@ class YHActivityModel: SmartCodable {
...
@@ -74,19 +74,3 @@ class YHActivityModel: SmartCodable {
}
}
}
}
// MARK: - 数据模型
struct
CheckInEvent
{
let
title
:
String
let
subtitle
:
String
let
date
:
String
let
location
:
String
let
subLocation
:
String
let
thumbnailImage
:
String
?
}
struct
Prize
{
let
greeting
:
String
let
instruction
:
String
let
image
:
String
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/M/YHSignSuccessActivity.swift
View file @
50404ff8
...
@@ -37,10 +37,59 @@ class YHSignSuccessActivity: SmartCodable {
...
@@ -37,10 +37,59 @@ class YHSignSuccessActivity: SmartCodable {
var
cover
:
String
=
""
var
cover
:
String
=
""
var
beginTime
:
String
=
""
var
beginTime
:
String
=
""
var
endTime
:
String
=
""
var
endTime
:
String
=
""
var
gift
:
YHSignGift
=
YHSignGift
()
var
gift
:
YHSignGift
?
var
user
:
YHSignUser
=
YHSignUser
()
var
user
:
YHSignUser
?
var
formatTime
:
String
=
""
required
init
()
{
required
init
()
{
}
}
func
getDateString
(
format
:
String
=
"MM/dd"
)
->
String
{
if
formatTime
.
isEmpty
{
if
let
tttt
=
beginTime
.
double
()
{
// 1.
// 将时间戳转换为Date对象
let
date
=
Date
(
timeIntervalSince1970
:
TimeInterval
(
tttt
))
// 创建一个DateFormatter实例
let
dateFormatter
=
DateFormatter
()
// 设置日期格式,这里设置为"年-月-日 时:分:秒"
dateFormatter
.
dateFormat
=
format
// HH:mm:ss
// 使用DateFormatter将Date对象转换为字符串
let
dateString
=
dateFormatter
.
string
(
from
:
date
)
dateFormatter
.
dateFormat
=
"HH:mm"
let
titmeString
=
dateFormatter
.
string
(
from
:
date
)
// 获取Calendar的当前实例
let
calendar
=
Calendar
.
current
// 使用Calendar来获取星期几
let
weekday
=
calendar
.
component
(
.
weekday
,
from
:
date
)
// 星期几的名称,根据weekday的值,1到7分别代表周一到周日
if
weekday
>
0
&&
weekday
<
8
{
let
weekdayName
=
[
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
][
weekday
-
1
]
if
let
tttt
=
endTime
.
double
()
{
// 将时间戳转换为Date对象
let
date2
=
Date
(
timeIntervalSince1970
:
TimeInterval
(
tttt
))
let
titmeString2
=
dateFormatter
.
string
(
from
:
date2
)
if
titmeString
.
contains
(
titmeString2
)
{
formatTime
=
dateString
+
" "
+
weekdayName
+
" "
+
titmeString
}
else
{
formatTime
=
dateString
+
" "
+
weekdayName
+
" "
+
titmeString
+
"-"
+
titmeString2
}
}
}
}
}
return
formatTime
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/V/YHSignActivityInfoCell.swift
View file @
50404ff8
...
@@ -46,7 +46,6 @@ class YHSignActivityInfoCell: UITableViewCell {
...
@@ -46,7 +46,6 @@ class YHSignActivityInfoCell: UITableViewCell {
thumbnailImageView
.
contentMode
=
.
scaleAspectFit
thumbnailImageView
.
contentMode
=
.
scaleAspectFit
thumbnailImageView
.
layer
.
cornerRadius
=
4
thumbnailImageView
.
layer
.
cornerRadius
=
4
thumbnailImageView
.
clipsToBounds
=
true
thumbnailImageView
.
clipsToBounds
=
true
thumbnailImageView
.
backgroundColor
=
.
red
containerView
.
addSubview
(
thumbnailImageView
)
containerView
.
addSubview
(
thumbnailImageView
)
timeLabel
.
text
=
"时间"
timeLabel
.
text
=
"时间"
...
@@ -127,14 +126,12 @@ class YHSignActivityInfoCell: UITableViewCell {
...
@@ -127,14 +126,12 @@ class YHSignActivityInfoCell: UITableViewCell {
}
}
}
}
func
configure
(
with
event
:
CheckInEvent
)
{
func
configure
(
with
model
:
YHSignSuccessActivity
)
{
titleLabel
.
text
=
event
.
title
titleLabel
.
text
=
model
.
name
timeValueLabel
.
text
=
event
.
date
timeValueLabel
.
text
=
model
.
getDateString
(
format
:
"yyyy-MM-dd"
)
locationValueLabel
.
text
=
event
.
location
locationValueLabel
.
text
=
model
.
place
subLocationLabel
.
text
=
event
.
subLocation
subLocationLabel
.
text
=
model
.
guidance
thumbnailImageView
.
sd_setImage
(
with
:
URL
(
string
:
model
.
cover
),
placeholderImage
:
UIImage
(
named
:
"global_default_image"
),
context
:
nil
)
if
let
imageName
=
event
.
thumbnailImage
,
let
image
=
UIImage
(
named
:
imageName
)
{
thumbnailImageView
.
image
=
image
}
}
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/V/YHSignPrizeCell.swift
View file @
50404ff8
...
@@ -9,7 +9,11 @@
...
@@ -9,7 +9,11 @@
import
UIKit
import
UIKit
class
YHSignPrizeCell
:
UITableViewCell
{
class
YHSignPrizeCell
:
UITableViewCell
{
static
let
cellReuseIdentifier
=
"YHSignPrizeCell"
static
let
cellReuseIdentifier
=
"YHSignPrizeCell"
static
let
img_ratio
=
1.0
var
onImageHeightChanged
:
(()
->
Void
)?
private
let
containerView
=
UIView
()
private
let
containerView
=
UIView
()
private
let
greetingLabel
=
UILabel
()
private
let
greetingLabel
=
UILabel
()
...
@@ -40,12 +44,12 @@ class YHSignPrizeCell: UITableViewCell {
...
@@ -40,12 +44,12 @@ class YHSignPrizeCell: UITableViewCell {
instructionLabel
.
font
=
.
PFSC_R
(
ofSize
:
14
)
instructionLabel
.
font
=
.
PFSC_R
(
ofSize
:
14
)
instructionLabel
.
textColor
=
.
brandGrayColor7
instructionLabel
.
textColor
=
.
brandGrayColor7
instructionLabel
.
text
=
"请联系现场工作人员领取您的奖品"
containerView
.
addSubview
(
instructionLabel
)
containerView
.
addSubview
(
instructionLabel
)
prizeImageView
.
contentMode
=
.
scaleAspectFill
prizeImageView
.
contentMode
=
.
scaleAspectFill
prizeImageView
.
clipsToBounds
=
true
prizeImageView
.
clipsToBounds
=
true
prizeImageView
.
layer
.
cornerRadius
=
6
prizeImageView
.
layer
.
cornerRadius
=
6
prizeImageView
.
backgroundColor
=
.
red
containerView
.
addSubview
(
prizeImageView
)
containerView
.
addSubview
(
prizeImageView
)
containerView
.
snp
.
makeConstraints
{
make
in
containerView
.
snp
.
makeConstraints
{
make
in
...
@@ -76,11 +80,29 @@ class YHSignPrizeCell: UITableViewCell {
...
@@ -76,11 +80,29 @@ class YHSignPrizeCell: UITableViewCell {
}
}
}
}
func
configure
(
with
prize
:
Prize
)
{
func
configure
(
with
model
:
YHSignSuccessActivity
)
{
greetingLabel
.
text
=
prize
.
greeting
greetingLabel
.
text
=
"你好,"
+
(
model
.
user
?
.
name
??
""
)
instructionLabel
.
text
=
prize
.
instruction
if
let
gift
=
model
.
gift
{
if
let
image
=
UIImage
(
named
:
prize
.
image
)
{
if
let
url
=
URL
(
string
:
gift
.
url
)
{
prizeImageView
.
image
=
image
prizeImageView
.
sd_setImage
(
with
:
url
,
placeholderImage
:
UIImage
(
named
:
"global_default_image"
))
{
[
weak
self
]
image
,
_
,
_
,
_
in
guard
let
self
=
self
else
{
return
}
guard
let
image
=
image
,
image
.
size
.
width
>
0
,
image
.
size
.
height
>
0
else
{
return
}
let
ratio
=
image
.
size
.
height
/
image
.
size
.
width
self
.
prizeImageView
.
snp
.
updateConstraints
{
make
in
make
.
height
.
equalTo
(
ratio
*
(
KScreenWidth
-
40.0
*
2
))
}
self
.
onImageHeightChanged
?()
}
}
else
{
self
.
prizeImageView
.
snp
.
updateConstraints
{
make
in
make
.
height
.
equalTo
(
YHSignPrizeCell
.
img_ratio
*
(
KScreenWidth
-
40.0
*
2
))
}
}
}
}
}
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/VM/YHActivityViewModel.swift
View file @
50404ff8
...
@@ -45,6 +45,9 @@ class YHActivityViewModel: YHBaseViewModel {
...
@@ -45,6 +45,9 @@ class YHActivityViewModel: YHBaseViewModel {
// 4.活动行程单
// 4.活动行程单
var
activityTravelModel
:
YHActivityTravelModel
?
var
activityTravelModel
:
YHActivityTravelModel
?
// 签到活动
var
signActivityModel
:
YHSignSuccessActivity
?
}
}
extension
YHActivityViewModel
{
extension
YHActivityViewModel
{
...
@@ -283,4 +286,36 @@ extension YHActivityViewModel {
...
@@ -283,4 +286,36 @@ extension YHActivityViewModel {
}
}
}
}
func
getActivitySign
(
id
:
String
,
callback
:
@escaping
(
Bool
)
->
Void
)
{
let
params
:
[
String
:
Any
]
=
[
"activityId"
:
id
,
"appId"
:
1
]
var
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
Activity
.
sign
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
_
in
guard
let
self
=
self
else
{
return
}
// 1. json字符串 转 对象
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
String
:
Any
],
let
result
=
YHSignSuccessActivity
.
deserialize
(
from
:
dic
)
else
{
self
.
signActivityModel
=
nil
callback
(
false
)
return
}
self
.
signActivityModel
=
result
callback
(
true
)
}
else
{
self
.
signActivityModel
=
nil
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callback
(
false
)
}
}
failBlock
:
{
_
in
self
.
signActivityModel
=
nil
callback
(
false
)
}
}
}
}
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
50404ff8
...
@@ -71,6 +71,9 @@ class YHAllApiName {
...
@@ -71,6 +71,9 @@ class YHAllApiName {
// 取消活动报名
// 取消活动报名
static
let
cancelApi
=
"super-app/activity/cancel"
static
let
cancelApi
=
"super-app/activity/cancel"
// 活动签到
static
let
sign
=
"super-app/activity/sign-in"
}
}
// 首页界面相关接口
// 首页界面相关接口
...
...
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