CNLiveViateWorkModelLayout.swift
5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//
// CNLiveViateWorkModelLayout.swift
// metaCode
//
// Created by zx on 2024/8/1.
//
import Foundation
class CNLiveViateWorkModelLayout:NSObject{
///cell高度
var cellH:CGFloat = 0.0
// var descH:Float = 40.0
var _workModel : CNLiveVitaeWorksModel?
var workModel : CNLiveVitaeWorksModel? {
get{
_workModel
}
set{
_workModel = newValue
}
}
init(model:CNLiveVitaeWorksModel,descH:Float,isPreview:Bool,isExpand:Bool,isShowExpand:Bool){
super.init()
var gangwei:Float = 10
if model.position.count == 0{
gangwei = 0
}else{
}
model.isExpand = isExpand
model.isShowExpand = isShowExpand
var expand:Float = 20
let titleLabel = UILabel.init(frame: CGRectMake(0, 0, KSreenWidth-60, 40))
titleLabel.textColor = HexColor("#999999")
titleLabel.textAlignment = .left
titleLabel.font = Font_14
titleLabel.backgroundColor = .clear
titleLabel.text = "描述"
titleLabel.numberOfLines = 0
titleLabel.text = model.jobDuties
let lines = titleLabel.getRealLabelTextLines()
let height = titleLabel.qmui_lineHeight
var tempisShowExpand = false
if lines <= 2{
tempisShowExpand = false
}else{
tempisShowExpand = true
}
if tempisShowExpand{
expand = 20
}else{
expand = 0
}
self.workModel = model
var companyH:Float = 25
let companyStr = model.companyName
if companyStr.count == 0 || companyStr == ""{
companyH = 0
}else{
companyH = 25
}
let imgArr = model.imgs.components(separatedBy: ",")
var hang:Float = 1
if imgArr.count > 0{
if imgArr.count <= 3{
hang = 1
}else if imgArr.count <= 6{
hang = 2
}else if imgArr.count <= 9{
hang = 3
}else{
hang = 4
}
}else{
hang = 0
}
var imgWH:Float = Float((KSreenWidth-60-15-10)/3.0+10)
var cityH:Float = 35
let cityStr = model.city
if cityStr.count == 0 || cityStr == "请选择"{
cityH = 0
}else{
}
if isPreview == false{//工作记录详情页
_workModel?.cellH = Float(123-25)+gangwei+companyH+descH+expand+Float(hang*imgWH)-10+cityH+55+15
}else{//预览工作记录
imgWH = Float((Float(KSreenWidth)-30-40-50)/3.0+10)
_workModel?.cellH = Float(162-58-25)+companyH+descH+expand+Float(hang*imgWH)+cityH//+55
}
}
func getCellHModel()->CNLiveVitaeWorksModel{
return _workModel!
}
}
//获奖
class CNLiveViateAwardModelLayout:NSObject{
///cell高度
var cellH:CGFloat = 0.0
// var descH:Float = 40.0
var _awardModel : CNLiveVitaeAwardsModel?
var awardModel : CNLiveVitaeAwardsModel? {
get{
_awardModel
}
set{
_awardModel = newValue
}
}
init(model:CNLiveVitaeAwardsModel,descH:Float,isPreview:Bool,isExpand:Bool,isShowExpand:Bool){
super.init()
model.isExpand = isExpand
model.isShowExpand = isShowExpand
var expand:Float = 20
let titleLabel = UILabel.init(frame: CGRectMake(0, 0, KSreenWidth-60, 40))
titleLabel.textColor = HexColor("#999999")
titleLabel.textAlignment = .left
titleLabel.font = Font_14
titleLabel.backgroundColor = .clear
titleLabel.text = "描述"
titleLabel.numberOfLines = 0
titleLabel.text = model.description
let lines = titleLabel.getRealLabelTextLines()
let height = titleLabel.qmui_lineHeight
var tempisShowExpand = false
if lines <= 2{
tempisShowExpand = false
}else{
tempisShowExpand = true
}
if tempisShowExpand{
expand = 20
}else{
expand = 0
}
self.awardModel = model
var companyH:Float = 25
let companyStr = model.company
if companyStr.count == 0 || companyStr == ""{
companyH = 0
}else{
companyH = 25
}
let imgArr = model.imgs.components(separatedBy: ",")
var hang:Float = 1
if imgArr.count > 0{
if imgArr.count <= 3{
hang = 1
}else if imgArr.count <= 6{
hang = 2
}else if imgArr.count <= 9{
hang = 3
}else{
hang = 4
}
}else{
hang = 0
}
var imgWH:Float = Float((KSreenWidth-60-15)/3.0+10)
if isPreview == false{//获奖详情页
_awardModel?.cellH = Float(123-25)+companyH+descH+expand+Float(hang*imgWH)-10+55+15
}else{//预览获奖
imgWH = Float((Float(KSreenWidth)-30-40-50)/3.0+10)
_awardModel?.cellH = Float(162-58-25-25)+companyH+descH+expand+Float(hang*imgWH)//+55
}
}
func getCellHModel()->CNLiveVitaeAwardsModel{
return _awardModel!
}
}