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
13c843e0
Commit
13c843e0
authored
Jul 19, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
身份优势UI
parent
1dff4aae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
241 additions
and
2 deletions
+241
-2
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+4
-0
YHStatusAdvantageVC.swift
...laxy/Classes/Modules/Home(首页)/C/YHStatusAdvantageVC.swift
+234
-0
YHHomeKingKongBlockView.swift
.../Classes/Modules/Home(首页)/V/YHHomeKingKongBlockView.swift
+3
-2
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
13c843e0
...
...
@@ -482,6 +482,7 @@
A592FE972BA6DB340062FACA
/* YHCertificateViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A592FE962BA6DB340062FACA
/* YHCertificateViewModel.swift */
;
};
A59B43C72C48F68200B28379
/* YHEvaluationView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A59B43C62C48F68200B28379
/* YHEvaluationView.swift */
;
};
A59B43C92C491FB100B28379
/* YHEvaluationViewVC.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A59B43C82C491FB100B28379
/* YHEvaluationViewVC.swift */
;
};
A59B43CB2C4A151200B28379
/* YHStatusAdvantageVC.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A59B43CA2C4A151200B28379
/* YHStatusAdvantageVC.swift */
;
};
A5A89FD72C256B94005A71DD
/* YHHomeLastMessageModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5A89FD62C256B94005A71DD
/* YHHomeLastMessageModel.swift */
;
};
A5ACE9282B4564F7002C94D2
/* YHSmsCodeView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8DE2B4564F7002C94D2
/* YHSmsCodeView.swift */
;
};
A5ACE9292B4564F7002C94D2
/* YHSmsCodeInputView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A5ACE8E02B4564F7002C94D2
/* YHSmsCodeInputView.swift */
;
};
...
...
@@ -1080,6 +1081,7 @@
A592FE962BA6DB340062FACA
/* YHCertificateViewModel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateViewModel.swift
;
sourceTree
=
"<group>"
;
};
A59B43C62C48F68200B28379
/* YHEvaluationView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHEvaluationView.swift
;
sourceTree
=
"<group>"
;
};
A59B43C82C491FB100B28379
/* YHEvaluationViewVC.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHEvaluationViewVC.swift
;
sourceTree
=
"<group>"
;
};
A59B43CA2C4A151200B28379
/* YHStatusAdvantageVC.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHStatusAdvantageVC.swift
;
sourceTree
=
"<group>"
;
};
A5A89FD62C256B94005A71DD
/* YHHomeLastMessageModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHHomeLastMessageModel.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8DE2B4564F7002C94D2
/* YHSmsCodeView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSmsCodeView.swift
;
sourceTree
=
"<group>"
;
};
A5ACE8E02B4564F7002C94D2
/* YHSmsCodeInputView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHSmsCodeInputView.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -2549,6 +2551,7 @@
04213B282C48EF5200797900
/* YHHomeInformationViewController.swift */
,
04213B2E2C49154900797900
/* YHHomeInfoDetailContainerViewController.swift */
,
04213B302C4917BD00797900
/* YHHomeInfoDetailViewController.swift */
,
A59B43CA2C4A151200B28379
/* YHStatusAdvantageVC.swift */
,
);
path
=
C
;
sourceTree
=
"<group>"
;
...
...
@@ -3632,6 +3635,7 @@
04EA230C2BB5199D009DA928
/* YHDocumentToActionTableViewCell.swift in Sources */
,
044D0C022C216AAF00C5CF5E
/* YHInformationAuthorizeViewModel.swift in Sources */
,
A5ACE9572B4564F7002C94D2
/* YHBasicContentView.swift in Sources */
,
A59B43CB2C4A151200B28379
/* YHStatusAdvantageVC.swift in Sources */
,
A5DF3D462BF72BA1003D5F03
/* YHTestViewController.swift in Sources */
,
A566A79C2C227C9B00980D06
/* YHOrderTipsItemView.swift in Sources */
,
A517A4E52BB6C4BB000DEECD
/* YHDocumentFileItemView.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHStatusAdvantageVC.swift
0 → 100644
View file @
13c843e0
//
// YHStatusAdvantageVC.swift
// galaxy
//
// Created by davidhuangA on 2024/7/19.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
WebKit
/*
身份优势
*/
class
YHStatusAdvantageVC
:
YHBaseViewController
,
WKUIDelegate
,
WKNavigationDelegate
{
var
webview
=
WKWebView
()
var
progBar
=
UIProgressView
()
var
url
=
"https://cdn-public.galaxy-immi.com/app/pic/sfys.png"
lazy
var
noNetWorkTipsView
:
YHEmptyDataView
=
{
let
view
=
YHEmptyDataView
.
createView
(
"无网络"
,
kNotNetWorkBgName
)
view
.
topMargin
=
222
view
.
backgroundColor
=
.
white
view
.
isHidden
=
true
return
view
}()
//是否曾今有过网络
private
var
isNetWorkOkBefore
:
Bool
=
false
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
gk_navBarAlpha
=
1.0
gk_navLineHidden
=
false
gk_navTitle
=
"身份优势"
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
updateNetWorkUI
)
,
name
:
.
reachabilityChanged
,
object
:
nil
)
view
.
backgroundColor
=
.
white
//获取导航栏高度
let
navHeight
=
self
.
navigationController
?
.
navigationBar
.
frame
.
height
//获取状态栏高度
let
statusHeight
=
k_Height_statusBar
()
// 创建wkwebview
webview
=
WKWebView
(
frame
:
CGRect
(
x
:
0
,
y
:
statusHeight
+
navHeight
!
,
width
:
self
.
view
.
frame
.
width
,
height
:
self
.
view
.
frame
.
height
-
statusHeight
-
navHeight
!
-
59
-
k_Height_safeAreaInsetsBottom
()))
webview
.
navigationDelegate
=
self
// 创建网址
let
url
=
NSURL
(
string
:
url
)
// 创建请求
let
request
=
NSURLRequest
(
url
:
url
!
as
URL
)
// 加载请求
webview
.
load
(
request
as
URLRequest
)
// 添加wkwebview
self
.
view
.
addSubview
(
webview
)
webview
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
.
offset
(
-
20
)
make
.
left
.
right
.
bottom
.
equalToSuperview
()
}
webview
.
scrollView
.
contentInsetAdjustmentBehavior
=
.
never
// 加载网页的进度条
progBar
=
UIProgressView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
self
.
view
.
frame
.
width
,
height
:
30
))
progBar
.
progress
=
0.0
progBar
.
tintColor
=
UIColor
.
brandMainColor
webview
.
addSubview
(
progBar
)
// 监听网页加载的进度
webview
.
addObserver
(
self
,
forKeyPath
:
"estimatedProgress"
,
options
:
.
new
,
context
:
nil
)
view
.
addSubview
(
noNetWorkTipsView
)
self
.
noNetWorkTipsView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
top
.
equalToSuperview
()
.
offset
(
k_Height_NavigationtBarAndStatuBar
)
}
updateNetWorkStatusUI
(
needReload
:
false
)
}
deinit
{
webview
.
removeObserver
(
self
,
forKeyPath
:
"estimatedProgress"
)
NotificationCenter
.
default
.
removeObserver
(
self
)
}
}
// MARK: - 内部方法
private
extension
YHStatusAdvantageVC
{
func
addRightItems
()
{
let
rightButtonItem
=
UIBarButtonItem
(
image
:
UIImage
(
named
:
"share_item"
)?
.
withRenderingMode
(
.
alwaysOriginal
),
style
:
.
plain
,
target
:
self
,
action
:
#selector(
share
)
)
gk_navRightBarButtonItem
=
rightButtonItem
gk_navItemRightSpace
=
16
}
@objc
func
share
()
{
if
!
YHNetworkStatusManager
.
shared
.
isNetWorkOK
{
YHHUD
.
flash
(
message
:
"网络不可用,请检查网络设置"
)
return
}
// YHShareManager.shared.sendLinkContent("", "", , link: self.url)
// YHShareManager.shared.sendLinkContent(link: "https://www.baidu.com/")
YHShareManager
.
shared
.
sendLinkContent
(
"Nick哥:我是标题"
,
"Nick哥-这是分享描述"
,
UIImage
(
named
:
"AppIcon"
)
??
UIImage
(),
link
:
"https://www.baidu.com/"
)
//todo : for test hjl
// YHShareManager.shared.sendMiniProgram(path: <#T##String#>, name: <#T##String#>)
// if YHLoginManager.shared.isLogin() {
// if vcTitle == "香港身份测评码" {
// guard let url = URL(string: url) else {
// return
// }
// let task = URLSession.shared.dataTask(with: url) { data, response, error in
// DispatchQueue.main.async {
// guard let data = data, error == nil else { return }
// let image = UIImage(data: data)
// if let image = image {
// YHShareManager.shared.sendImageContent(image)
// }
// }
// }
// task.resume()
// } else {
// guard let url = URL(string: self.model.img_url) else {
// return
// }
// let task = URLSession.shared.dataTask(with: url) { data, response, error in
// DispatchQueue.main.async {
// guard let data = data, error == nil else { return }
// let image = UIImage(data: data)
// if let image = image {
// YHShareManager.shared.sendLinkContent(self.model.title, "", image, link: self.url)
// }
// }
// }
// task.resume()
// }
// } else {
// YHOneKeyLoginManager.shared.oneKeyLogin()
// }
}
@objc
func
updateNetWorkUI
()
{
updateNetWorkStatusUI
(
needReload
:
true
)
}
func
updateNetWorkStatusUI
(
needReload
:
Bool
)
{
DispatchQueue
.
main
.
async
{
if
YHNetworkStatusManager
.
shared
.
isNetWorkOK
{
if
needReload
&&
self
.
isNetWorkOkBefore
==
false
{
self
.
webview
.
stopLoading
()
let
targetUrl
=
NSURL
(
string
:
self
.
url
)
let
request
=
NSURLRequest
(
url
:
targetUrl
!
as
URL
)
self
.
webview
.
load
(
request
as
URLRequest
)
}
self
.
isNetWorkOkBefore
=
true
}
if
self
.
isNetWorkOkBefore
==
false
{
self
.
view
.
bringSubviewToFront
(
self
.
noNetWorkTipsView
)
self
.
noNetWorkTipsView
.
isHidden
=
YHNetworkStatusManager
.
shared
.
isNetWorkOK
}
else
{
self
.
noNetWorkTipsView
.
isHidden
=
true
}
}
}
// MARK: - webview function
@objc
func
toBack
()
{
if
webview
.
canGoBack
{
webview
.
goBack
()
}
}
@objc
func
toForward
()
{
if
webview
.
canGoForward
{
webview
.
goForward
()
}
}
}
// MARK: - WKNavigationDelegate
extension
YHStatusAdvantageVC
{
override
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
if
keyPath
==
"estimatedProgress"
{
self
.
progBar
.
alpha
=
1.0
progBar
.
setProgress
(
Float
(
webview
.
estimatedProgress
),
animated
:
true
)
//进度条的值最大为1.0
if
(
self
.
webview
.
estimatedProgress
>=
1.0
)
{
UIView
.
animate
(
withDuration
:
0.3
,
delay
:
0.1
,
options
:
.
curveEaseInOut
,
animations
:
{
()
->
Void
in
self
.
progBar
.
alpha
=
0.0
},
completion
:
{
(
finished
:
Bool
)
->
Void
in
self
.
progBar
.
progress
=
0
})
}
}
}
override
class
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
}
func
webView
(
_
webView
:
WKWebView
,
didFinish
navigation
:
WKNavigation
!
)
{
// addRightItems()
}
func
webView
(
_
webView
:
WKWebView
,
createWebViewWith
configuration
:
WKWebViewConfiguration
,
for
navigationAction
:
WKNavigationAction
,
windowFeatures
:
WKWindowFeatures
)
->
WKWebView
?
{
// 实现非安全链接的跳转。如果目标主视图不为空,则允许导航
if
!
(
navigationAction
.
targetFrame
?
.
isMainFrame
!=
nil
)
{
webview
.
load
(
navigationAction
.
request
)
}
return
nil
}
func
webView
(
_
webView
:
WKWebView
,
runJavaScriptAlertPanelWithMessage
message
:
String
,
initiatedByFrame
frame
:
WKFrameInfo
,
completionHandler
:
@escaping
()
->
Void
)
{
// 修复弹窗弹出的问题
let
alert
=
UIAlertController
(
title
:
nil
,
message
:
message
,
preferredStyle
:
.
alert
)
alert
.
addAction
(
UIAlertAction
(
title
:
"Ok"
,
style
:
.
default
,
handler
:
{
(
_
)
->
Void
in
completionHandler
()
}))
self
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
func
webView
(
_
webView
:
WKWebView
,
didFailProvisionalNavigation
navigation
:
WKNavigation
!
,
withError
error
:
Error
)
{
printLog
(
"
\(
error
.
localizedDescription
)
"
)
}
}
galaxy/galaxy/Classes/Modules/Home(首页)/V/YHHomeKingKongBlockView.swift
View file @
13c843e0
...
...
@@ -52,9 +52,10 @@ private extension YHHomeKingKongBlockView {
if
let
tag
=
gestureRecognizer
.
view
?
.
tag
{
switch
tag
{
case
0
:
let
vc
=
YHOtherServiceViewController
()
vc
.
classID
=
3
//身份优势
let
vc
=
YHStatusAdvantageVC
()
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
case
1
:
let
vc
=
YHOtherServiceViewController
()
vc
.
classID
=
4
...
...
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