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
a9f44649
Commit
a9f44649
authored
Mar 25, 2025
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 方案
parent
56c9e815
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
150 additions
and
16 deletions
+150
-16
YHMyNewViewController.swift
...xy/Classes/Modules/Mine(我的)/C/YHMyNewViewController.swift
+6
-0
YHPlanViewController.swift
...axy/Classes/Modules/Plan(方案)/C/YHPlanViewController.swift
+12
-10
YHPlanScoreChart.swift
.../galaxy/Classes/Modules/Plan(方案)/V/YHPlanScoreChart.swift
+131
-3
YHPlanScoreView.swift
...y/galaxy/Classes/Modules/Plan(方案)/V/YHPlanScoreView.swift
+0
-2
Contents.json
...ts.xcassets/Plan/plan_score_square.imageset/Contents.json
+1
-1
中间图形.png
.../Assets.xcassets/Plan/plan_score_square.imageset/中间图形.png
+0
-0
中间图形@2x.png
...sets.xcassets/Plan/plan_score_square.imageset/中间图形@2x.png
+0
-0
中间图形@3x.png
...sets.xcassets/Plan/plan_score_square.imageset/中间图形@3x.png
+0
-0
No files found.
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyNewViewController.swift
View file @
a9f44649
...
...
@@ -628,6 +628,12 @@ extension YHMyNewViewController {
}
func
clickItem
(
_
item
:
PersonalModuleItem
)
{
do
{
let
vc
=
YHPlanViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
return
}
if
!
checkLogin
()
{
return
}
...
...
galaxy/galaxy/Classes/Modules/Plan(方案)/C/YHPlanViewController.swift
View file @
a9f44649
...
...
@@ -10,21 +10,23 @@ import UIKit
class
YHPlanViewController
:
YHBaseViewController
{
let
v
=
YHPlanScoreChart
(
frame
:
.
zero
)
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Do any additional setup after loading the view.
self
.
view
.
addSubview
(
v
)
v
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
248
)
make
.
centerX
.
equalToSuperview
()
make
.
centerY
.
equalToSuperview
()
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
v
.
updateScores
([
1.3
,
3.5
,
2.5
,
4.5
])
}
*/
}
galaxy/galaxy/Classes/Modules/Plan(方案)/V/YHPlanScoreChart.swift
View file @
a9f44649
...
...
@@ -8,7 +8,55 @@
import
UIKit
class
YHPlanScoreItemView
:
UIView
{
class
YHPlanScoreDrawView
:
UIView
{
// 定义四个坐标点
var
points
:
[
CGPoint
]
=
[]
{
didSet
{
setNeedsDisplay
()
// 坐标变化时触发重绘
if
self
.
pointViews
.
count
==
points
.
count
{
for
(
index
,
view
)
in
self
.
pointViews
.
enumerated
()
{
view
.
removeFromSuperview
()
view
.
center
=
points
[
index
]
self
.
addSubview
(
view
)
}
}
}
}
lazy
var
pointViews
:
[
YHPlanScorePointView
]
=
{
let
v1
=
YHPlanScorePointView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
8
,
height
:
8
))
let
v2
=
YHPlanScorePointView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
8
,
height
:
8
))
let
v3
=
YHPlanScorePointView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
8
,
height
:
8
))
let
v4
=
YHPlanScorePointView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
8
,
height
:
8
))
return
[
v1
,
v2
,
v3
,
v4
]
}()
override
func
draw
(
_
rect
:
CGRect
)
{
guard
points
.
count
==
4
else
{
return
}
// 确保有四个点
// 创建一个路径
let
path
=
UIBezierPath
()
// 移动到第一个点
path
.
move
(
to
:
points
[
0
])
path
.
addLine
(
to
:
points
[
1
])
path
.
addLine
(
to
:
points
[
2
])
path
.
addLine
(
to
:
points
[
3
])
path
.
close
()
// 设置填充颜色为黑色,透明度50%
UIColor
.
init
(
hex
:
0xAE6C32
)
.
withAlphaComponent
(
0.1
)
.
setFill
()
path
.
fill
()
// 设置线条颜色为红色
UIColor
.
init
(
hex
:
0xAE6C32
)
.
setStroke
()
path
.
lineWidth
=
1.0
path
.
stroke
()
}
}
class
YHPlanScoreItemView
:
UIView
{
lazy
var
titleLabel
:
UILabel
=
{
let
lable
=
UILabel
()
...
...
@@ -52,8 +100,53 @@ class YHPlanScoreItemView: UIView {
}
}
class
YHPlanScorePointView
:
UIView
{
lazy
var
bigCircleView
:
UIView
=
{
let
v
=
UIView
()
v
.
backgroundColor
=
UIColor
.
init
(
hex
:
0xAE6C32
,
alpha
:
0.2
)
v
.
layer
.
cornerRadius
=
4.0
return
v
}()
lazy
var
smallCircleView
:
UIView
=
{
let
v
=
UIView
()
v
.
backgroundColor
=
UIColor
.
init
(
hex
:
0xAE6C32
)
v
.
layer
.
cornerRadius
=
2.0
return
v
}()
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
createUI
()
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
func
createUI
()
{
self
.
addSubview
(
bigCircleView
)
self
.
addSubview
(
smallCircleView
)
bigCircleView
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
8
)
make
.
centerX
.
equalToSuperview
()
make
.
centerY
.
equalToSuperview
()
}
smallCircleView
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
4
)
make
.
centerX
.
equalToSuperview
()
make
.
centerY
.
equalToSuperview
()
}
}
}
class
YHPlanScoreChart
:
UIView
{
let
squareWidth
=
180.0
lazy
var
squareImgV
:
UIImageView
=
{
let
v
=
UIImageView
()
v
.
image
=
UIImage
(
named
:
"plan_score_square"
)
...
...
@@ -66,6 +159,12 @@ class YHPlanScoreChart: UIView {
return
v
}()
lazy
var
drawView
:
YHPlanScoreDrawView
=
{
let
v
=
YHPlanScoreDrawView
(
frame
:
.
zero
)
v
.
backgroundColor
=
.
clear
return
v
}()
lazy
var
careerItemView
:
YHPlanScoreItemView
=
{
let
v
=
YHPlanScoreItemView
(
frame
:
.
zero
)
v
.
titleLabel
.
text
=
"事业"
...
...
@@ -103,6 +202,23 @@ class YHPlanScoreChart: UIView {
fatalError
(
"init(coder:) has not been implemented"
)
}
func
updateScores
(
_
scores
:
[
CGFloat
])
{
guard
scores
.
count
==
4
else
{
return
}
// 确保有四个点
let
point1
=
CGPoint
(
x
:
squareWidth
/
2.0
,
y
:
(
1.0
-
scores
[
0
]
/
5.0
)
*
squareWidth
/
2.0
)
let
point2
=
CGPoint
(
x
:
(
1.0
+
scores
[
1
]
/
5.0
)
*
squareWidth
/
2.0
,
y
:
squareWidth
/
2.0
)
let
point3
=
CGPoint
(
x
:
squareWidth
/
2.0
,
y
:
(
1.0
+
scores
[
2
]
/
5.0
)
*
squareWidth
/
2.0
)
let
point4
=
CGPoint
(
x
:
(
1.0
-
scores
[
3
]
/
5.0
)
*
squareWidth
/
2.0
,
y
:
squareWidth
/
2.0
)
let
points
=
[
point1
,
point2
,
point3
,
point4
]
self
.
drawView
.
points
=
points
careerItemView
.
scoreLabel
.
text
=
"
\(
scores
[
0
]
)
"
lifeItemView
.
scoreLabel
.
text
=
"
\(
scores
[
1
]
)
"
investItemView
.
scoreLabel
.
text
=
"
\(
scores
[
2
]
)
"
stayItemView
.
scoreLabel
.
text
=
"
\(
scores
[
3
]
)
"
}
func
createUI
()
{
self
.
addSubview
(
circleBgImgV
)
self
.
addSubview
(
squareImgV
)
...
...
@@ -110,9 +226,10 @@ class YHPlanScoreChart: UIView {
self
.
addSubview
(
lifeItemView
)
self
.
addSubview
(
investItemView
)
self
.
addSubview
(
stayItemView
)
squareImgV
.
addSubview
(
drawView
)
squareImgV
.
snp
.
makeConstraints
{
make
in
make
.
height
.
width
.
equalTo
(
182
)
make
.
height
.
width
.
equalTo
(
squareWidth
)
make
.
centerX
.
equalToSuperview
()
make
.
centerY
.
equalToSuperview
()
}
...
...
@@ -123,6 +240,10 @@ class YHPlanScoreChart: UIView {
make
.
centerY
.
equalToSuperview
()
}
drawView
.
snp
.
makeConstraints
{
make
in
make
.
edges
.
equalToSuperview
()
}
careerItemView
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
squareImgV
.
snp
.
top
)
.
offset
(
-
5
)
...
...
@@ -139,7 +260,14 @@ class YHPlanScoreChart: UIView {
investItemView
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
squareImgV
.
snp
.
top
)
.
offset
(
-
5
)
make
.
top
.
equalTo
(
squareImgV
.
snp
.
bottom
)
.
offset
(
5
)
make
.
height
.
equalTo
(
38
)
make
.
width
.
equalTo
(
40
)
}
stayItemView
.
snp
.
makeConstraints
{
make
in
make
.
centerY
.
equalToSuperview
()
make
.
right
.
equalTo
(
squareImgV
.
snp
.
left
)
.
offset
(
-
5
)
make
.
height
.
equalTo
(
38
)
make
.
width
.
equalTo
(
40
)
}
...
...
galaxy/galaxy/Classes/Modules/Plan(方案)/V/YHPlanScoreView.swift
View file @
a9f44649
...
...
@@ -34,8 +34,6 @@ class YHPlanScoreView: UIView {
return
lable
}()
func
setupUI
()
{
backgroundColor
=
.
clear
...
...
galaxy/galaxy/Res/Assets.xcassets/Plan/plan_score_square.imageset/Contents.json
View file @
a9f44649
...
...
@@ -5,7 +5,7 @@
"scale"
:
"1x"
},
{
"filename"
:
"中间图形.png"
,
"filename"
:
"中间图形
@2x
.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
...
...
galaxy/galaxy/Res/Assets.xcassets/Plan/plan_score_square.imageset/中间图形.png
deleted
100644 → 0
View file @
56c9e815
5.61 KB
galaxy/galaxy/Res/Assets.xcassets/Plan/plan_score_square.imageset/中间图形@2x.png
0 → 100644
View file @
a9f44649
5.63 KB
galaxy/galaxy/Res/Assets.xcassets/Plan/plan_score_square.imageset/中间图形@3x.png
View replaced file @
56c9e815
View file @
a9f44649
8.09 KB
|
W:
|
H:
8.17 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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