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
4b8edcdf
Commit
4b8edcdf
authored
Oct 17, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 解决活动内容显示不全的问题,以及取消报名接口调用失败的问题
parent
2f7ab0a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
20 deletions
+136
-20
YHActivityDetailModel.swift
.../Community(社区)/Activity(活动)/M/YHActivityDetailModel.swift
+65
-9
YHActivityTravelModel.swift
.../Community(社区)/Activity(活动)/M/YHActivityTravelModel.swift
+65
-1
YHActivityDetailCell1.swift
.../Community(社区)/Activity(活动)/V/YHActivityDetailCell1.swift
+5
-2
YHActivityViewModel.swift
...s/Community(社区)/Activity(活动)/VM/YHActivityViewModel.swift
+1
-8
No files found.
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/M/YHActivityDetailModel.swift
View file @
4b8edcdf
...
@@ -7,16 +7,19 @@
...
@@ -7,16 +7,19 @@
//
//
import
UIKit
import
UIKit
import
SmartCodable
class
YHActivityDetailModel
:
YHActivityModel
{
class
YHActivityDetailModel
:
SmartCodable
{
// var cover : String = "" //活动封面
// var name : String = "" //活动标题
var
id
:
Int
=
0
// 活动ID
// var tag : Int = 0 //活动标签枚举 1:V专享
var
tag
:
Int
=
0
// 活动标签枚举 1:V专享
// var beginTime : String = "" //开始时间戳
var
name
:
String
=
""
// 活动标题
// var endTime : String = "" //结束时间戳
var
cover
:
String
=
""
// 活动封面
// var place : String = "" //活动地点
var
beginTime
:
String
=
""
// 开始时间戳
// var id : Int = 0 //活动ID
var
endTime
:
String
=
""
// 结束时间戳
// var status : String = "" //活动的状态 1:立即报名 2:已报名 3:活动结束 4:已取消报名
var
place
:
String
=
""
// 活动地点
var
status
:
String
=
""
// 活动的状态 1:立即报名 2:已报名 3:活动结束 4:已取消报名 5:已下架
var
checkId
:
String
=
""
// 活动行程ID 仅当活动状态为2(已报名)时才大于0
var
tips
:
String
=
""
// 温馨提示
var
tips
:
String
=
""
// 温馨提示
var
guidance
:
String
=
""
// 交通引导
var
guidance
:
String
=
""
// 交通引导
...
@@ -37,4 +40,57 @@ class YHActivityDetailModel: YHActivityModel {
...
@@ -37,4 +40,57 @@ class YHActivityDetailModel: YHActivityModel {
coverItems
.
append
(
item
)
coverItems
.
append
(
item
)
}
}
}
}
required
init
()
{
}
private
var
beginTimeForUI
:
String
=
""
func
getDateString
(
format
:
String
=
"MM/dd"
)
->
String
{
if
beginTimeForUI
.
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
)
{
beginTimeForUI
=
dateString
+
" "
+
weekdayName
+
" "
+
titmeString
}
else
{
beginTimeForUI
=
dateString
+
" "
+
weekdayName
+
" "
+
titmeString
+
"-"
+
titmeString2
}
}
}
}
}
return
beginTimeForUI
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/M/YHActivityTravelModel.swift
View file @
4b8edcdf
...
@@ -18,10 +18,74 @@ class YHActivityApplyInfoModel: SmartCodable {
...
@@ -18,10 +18,74 @@ class YHActivityApplyInfoModel: SmartCodable {
}
}
}
}
class
YHActivityTravelModel
:
YHActivityModel
{
class
YHActivityTravelModel
:
SmartCodable
{
var
id
:
Int
=
0
// 活动ID
var
tag
:
Int
=
0
// 活动标签枚举 1:V专享
var
name
:
String
=
""
// 活动标题
var
cover
:
String
=
""
// 活动封面
var
beginTime
:
String
=
""
// 开始时间戳
var
endTime
:
String
=
""
// 结束时间戳
var
place
:
String
=
""
// 活动地点
var
status
:
String
=
""
// 活动的状态 1:立即报名 2:已报名 3:活动结束 4:已取消报名 5:已下架
var
checkId
:
String
=
""
// 活动行程ID 仅当活动状态为2(已报名)时才大于0
var
statusCn
:
String
=
""
// 行程状态
var
statusCn
:
String
=
""
// 行程状态
var
user
:
YHActivityApplyInfoModel
?
var
user
:
YHActivityApplyInfoModel
?
var
tips
:
String
=
""
// 温馨提示
var
tips
:
String
=
""
// 温馨提示
var
guidance
:
String
=
""
// 交通引导
var
guidance
:
String
=
""
// 交通引导
required
init
()
{
}
private
var
beginTimeForUI
:
String
=
""
func
getDateString
(
format
:
String
=
"MM/dd"
)
->
String
{
if
beginTimeForUI
.
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
)
{
beginTimeForUI
=
dateString
+
" "
+
weekdayName
+
" "
+
titmeString
}
else
{
beginTimeForUI
=
dateString
+
" "
+
weekdayName
+
" "
+
titmeString
+
"-"
+
titmeString2
}
}
}
}
}
return
beginTimeForUI
}
}
}
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/V/YHActivityDetailCell1.swift
View file @
4b8edcdf
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
//
//
import
UIKit
import
UIKit
import
SmartCodable
class
YHActivityCoverItem
{
class
YHActivityCoverItem
:
SmartCodable
{
var
url
:
String
=
""
var
url
:
String
=
""
let
width
:
CGFloat
=
KScreenWidth
-
40.0
let
width
:
CGFloat
=
KScreenWidth
-
40.0
var
height
:
CGFloat
=
KScreenWidth
-
40.0
var
height
:
CGFloat
=
KScreenWidth
-
40.0
...
@@ -18,6 +18,9 @@ class YHActivityCoverItem {
...
@@ -18,6 +18,9 @@ class YHActivityCoverItem {
view
.
clipsToBounds
=
true
view
.
clipsToBounds
=
true
return
view
return
view
}()
}()
required
init
()
{
}
}
}
class
YHActivityDetailCell1
:
UITableViewCell
{
class
YHActivityDetailCell1
:
UITableViewCell
{
...
...
galaxy/galaxy/Classes/Modules/Community(社区)/Activity(活动)/VM/YHActivityViewModel.swift
View file @
4b8edcdf
...
@@ -60,20 +60,13 @@ extension YHActivityViewModel {
...
@@ -60,20 +60,13 @@ extension YHActivityViewModel {
// 1. json字符串 转 对象
// 1. json字符串 转 对象
if
json
.
code
==
200
{
if
json
.
code
==
200
{
guard
let
dic
=
json
.
data
?
.
peel
as?
[
String
:
Any
],
let
result
=
YHActivityTravelModel
.
deserialize
(
from
:
dic
)
else
{
self
.
activityTravelModel
=
nil
callBackBlock
(
false
,
nil
)
return
}
self
.
activityTravelModel
=
result
callBackBlock
(
true
,
nil
)
callBackBlock
(
true
,
nil
)
}
else
{
}
else
{
// self.activityTravelModel = nil
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
callBackBlock
(
false
,
error
)
}
}
}
failBlock
:
{
err
in
}
failBlock
:
{
err
in
// self.activityTravelModel = nil
callBackBlock
(
false
,
err
)
callBackBlock
(
false
,
err
)
}
}
}
}
...
...
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