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
8c1183ce
Commit
8c1183ce
authored
Apr 01, 2025
by
Alex朱枝文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化UI
parent
7339b650
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
2 deletions
+65
-2
YHCustomerInformationQuestionnaireVC.swift
...les/Plan(方案)/C/YHCustomerInformationQuestionnaireVC.swift
+16
-1
YHSurveyTableViewCell.swift
...xy/Classes/Modules/Plan(方案)/V/YHSurveyTableViewCell.swift
+49
-1
No files found.
galaxy/galaxy/Classes/Modules/Plan(方案)/C/YHCustomerInformationQuestionnaireVC.swift
View file @
8c1183ce
...
...
@@ -91,6 +91,7 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
private
var
displayedQuestions
:
[
YHSurveyQuestionItem
]
=
[]
/// key: 问题Id, value: 答案
private
var
answerDic
:
[
String
:
[
YHSurveyConditionOptionExtra
]]
=
[:]
private
var
needShowFail
:
Bool
=
false
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -153,6 +154,15 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
guard
let
surveyContent
=
viewModel
.
surveyContainerModel
?
.
surveyContent
else
{
return
}
if
let
lastQuestion
=
displayedQuestions
.
last
,
lastQuestion
.
isRequired
==
1
,
answerDic
[
lastQuestion
.
id
]
==
nil
{
needShowFail
=
true
let
sections
=
tableView
.
numberOfSections
if
sections
>
0
{
tableView
.
reloadSections
(
IndexSet
(
integer
:
sections
-
1
),
with
:
.
automatic
)
}
needShowFail
=
false
return
}
YHHUD
.
show
(
.
progress
(
message
:
"加载中..."
))
var
answers
:
[
YHSurveyArticleAnswerItem
]
=
[]
displayedQuestions
.
forEach
{
[
weak
self
]
question
in
...
...
@@ -307,7 +317,11 @@ extension YHCustomerInformationQuestionnaireVC: UITableViewDelegate, UITableView
}
}
}
cell
.
configure
(
with
:
"
\(
indexPath
.
section
+
1
)
. "
+
model
.
title
,
isRequired
:
model
.
isRequired
==
1
,
options
:
model
.
options
.
compactMap
{
$0
.
title
},
selectedIndices
:
selectedIndices
)
var
needShowFailButton
=
false
if
needShowFail
,
model
.
isRequired
==
1
,
answerDic
[
model
.
id
]
==
nil
{
needShowFailButton
=
true
}
cell
.
configure
(
with
:
"
\(
indexPath
.
section
+
1
)
. "
+
model
.
title
,
isRequired
:
model
.
isRequired
==
1
,
options
:
model
.
options
.
compactMap
{
$0
.
title
},
selectedIndices
:
selectedIndices
,
needShowFailButton
:
needShowFailButton
)
cell
.
optionSelected
=
{
[
weak
self
]
index
in
guard
let
self
=
self
else
{
return
...
...
@@ -344,6 +358,7 @@ extension YHCustomerInformationQuestionnaireVC: UITableViewDelegate, UITableView
self
.
displayedQuestions
.
append
(
nextQuestion
)
self
.
tableView
.
insertSections
(
IndexSet
(
integer
:
currentIndex
+
1
),
with
:
.
bottom
)
}
completion
:
{
[
weak
self
]
_
in
self
?
.
tableView
.
reloadSections
(
IndexSet
(
integer
:
currentIndex
),
with
:
.
automatic
)
self
?
.
scrollToBottom
()
}
}
...
...
galaxy/galaxy/Classes/Modules/Plan(方案)/V/YHSurveyTableViewCell.swift
View file @
8c1183ce
...
...
@@ -36,6 +36,15 @@ class YHSurveyTableViewCell: YHResignDocumentCell {
stack
.
distribution
=
.
fillProportionally
return
stack
}()
private
lazy
var
infoFailLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
font
=
.
PFSC_R
(
ofSize
:
12
)
label
.
textColor
=
.
failColor
label
.
text
=
"请选择"
label
.
isHidden
=
true
return
label
}()
// MARK: - Properties
...
...
@@ -59,6 +68,7 @@ class YHSurveyTableViewCell: YHResignDocumentCell {
updateCellCorner
(
.
single
)
subContainerView
.
addSubview
(
questionLabel
)
subContainerView
.
addSubview
(
optionsStackView
)
subContainerView
.
addSubview
(
infoFailLabel
)
questionLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
.
offset
(
24
)
...
...
@@ -72,11 +82,18 @@ class YHSurveyTableViewCell: YHResignDocumentCell {
make
.
right
.
equalToSuperview
()
.
offset
(
-
18
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
24
)
.
priority
(
.
high
)
}
infoFailLabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
questionLabel
)
make
.
right
.
lessThanOrEqualToSuperview
()
.
offset
(
-
18
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
24
)
.
priority
(
.
high
)
}
infoFailLabel
.
isHidden
=
true
}
// MARK: - Configuration
func
configure
(
with
question
:
String
,
isRequired
:
Bool
=
true
,
options
:
[
String
],
selectedIndices
:
[
Int
],
type
:
QuestionType
=
.
singleChoice
)
{
func
configure
(
with
question
:
String
,
isRequired
:
Bool
=
true
,
options
:
[
String
],
selectedIndices
:
[
Int
],
type
:
QuestionType
=
.
singleChoice
,
needShowFailButton
:
Bool
=
false
)
{
let
questionAttr
:
ASAttributedString
=
.
init
(
"
\(
question
)
"
,
.
font
(
UIFont
.
PFSC_M
(
ofSize
:
15
)),
.
foreground
(
UIColor
.
mainTextColor
))
if
isRequired
{
let
starAttr
:
ASAttributedString
=
.
init
(
"*"
,
.
font
(
UIFont
.
PFSC_M
(
ofSize
:
15
)),
.
foreground
(
UIColor
.
failColor
))
...
...
@@ -94,6 +111,37 @@ class YHSurveyTableViewCell: YHResignDocumentCell {
let
optionView
=
createOptionView
(
text
:
option
,
isSelected
:
selectedIndices
.
contains
(
index
),
index
:
index
)
optionsStackView
.
addArrangedSubview
(
optionView
)
}
updateFailState
(
needShowFailButton
)
}
private
func
updateFailState
(
_
needShowFailButton
:
Bool
=
false
)
{
if
needShowFailButton
{
optionsStackView
.
snp
.
remakeConstraints
{
make
in
make
.
top
.
equalTo
(
questionLabel
.
snp
.
bottom
)
.
offset
(
16
)
make
.
left
.
equalToSuperview
()
.
offset
(
28
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
18
)
}
infoFailLabel
.
snp
.
remakeConstraints
{
make
in
make
.
top
.
equalTo
(
optionsStackView
.
snp
.
bottom
)
.
offset
(
8
)
make
.
left
.
equalTo
(
questionLabel
)
make
.
right
.
lessThanOrEqualToSuperview
()
.
offset
(
-
18
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
24
)
.
priority
(
.
high
)
}
infoFailLabel
.
isHidden
=
false
}
else
{
optionsStackView
.
snp
.
remakeConstraints
{
make
in
make
.
top
.
equalTo
(
questionLabel
.
snp
.
bottom
)
.
offset
(
16
)
make
.
left
.
equalToSuperview
()
.
offset
(
28
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
18
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
24
)
.
priority
(
.
high
)
}
infoFailLabel
.
snp
.
remakeConstraints
{
make
in
make
.
left
.
equalTo
(
questionLabel
)
make
.
right
.
lessThanOrEqualToSuperview
()
.
offset
(
-
18
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
24
)
.
priority
(
.
high
)
}
infoFailLabel
.
isHidden
=
true
}
}
private
func
createOptionView
(
text
:
String
,
isSelected
:
Bool
,
index
:
Int
)
->
UIView
{
...
...
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