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
7f297b2a
Commit
7f297b2a
authored
Dec 03, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H5 交互方法
parent
0f3a4b28
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
0 deletions
+49
-0
YHHomeHoldViewPageViewController.swift
...Modules/Home(首页)/C/YHHomeHoldViewPageViewController.swift
+11
-0
YHH5WebViewVC.swift
.../Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
+17
-0
YHJsApi.swift
...galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
+19
-0
YhConstant.swift
galaxy/galaxy/Classes/Tools/Helper/YhConstant.swift
+2
-0
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeHoldViewPageViewController.swift
View file @
7f297b2a
...
@@ -144,8 +144,19 @@ class YHHomeHoldViewPageViewController: YHBaseViewController {
...
@@ -144,8 +144,19 @@ class YHHomeHoldViewPageViewController: YHBaseViewController {
checkHomeAlertView
()
checkHomeAlertView
()
getCurrentUserInfo
()
getCurrentUserInfo
()
getConfigData
()
getConfigData
()
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleNotification(_:)
)
,
name
:
YhConstant
.
YhNotification
.
backToHomeNotification
,
object
:
nil
)
}
}
@objc
func
handleNotification
(
_
notification
:
Notification
)
{
if
let
userInfo
=
notification
.
userInfo
,
let
value
=
userInfo
[
"value"
]
as?
Int
{
segmentedView
.
selectItemAt
(
index
:
value
)
}
}
deinit
{
// 移除观察者
NotificationCenter
.
default
.
removeObserver
(
self
)
}
private
func
isViewVisibleOnScreen
(
view
:
UIView
)
->
Bool
{
private
func
isViewVisibleOnScreen
(
view
:
UIView
)
->
Bool
{
let
viewFrame
=
view
.
convert
(
view
.
bounds
,
to
:
UIScreen
.
main
.
coordinateSpace
)
let
viewFrame
=
view
.
convert
(
view
.
bounds
,
to
:
UIScreen
.
main
.
coordinateSpace
)
...
...
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
View file @
7f297b2a
...
@@ -661,6 +661,23 @@ extension YHH5WebViewVC {
...
@@ -661,6 +661,23 @@ extension YHH5WebViewVC {
}
}
}
}
func
savePicToLocal
(
_
data
:
String
)
{
func
saveBase64ImageToPhotoLibrary
(
base64String
:
String
)
{
// 解码 Base64 字符串为 Data
guard
let
imageData
=
Data
(
base64Encoded
:
base64String
)
else
{
printLog
(
"无法解码 Base64 字符串"
)
return
}
// 创建 UIImage
guard
let
image
=
UIImage
(
data
:
imageData
)
else
{
printLog
(
"无法创建 UIImage"
)
return
}
self
.
saveImage
(
image
)
}
}
func
saveImage
(
_
image
:
UIImage
)
{
func
saveImage
(
_
image
:
UIImage
)
{
// 确保应用有权访问相册
// 确保应用有权访问相册
PHPhotoLibrary
.
requestAuthorization
{
status
in
PHPhotoLibrary
.
requestAuthorization
{
status
in
...
...
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
View file @
7f297b2a
...
@@ -535,4 +535,23 @@ extension YHJsApi {
...
@@ -535,4 +535,23 @@ extension YHJsApi {
}
}
}
}
}
}
//1.保存base64图片格式到本地
@objc
func
savePicToLocal
(
_
data
:
String
)
{
DispatchQueue
.
main
.
async
{
if
let
delegate
=
self
.
delegate
as?
YHH5WebViewVC
{
delegate
.
savePicToLocal
(
data
)
}
}
}
//1.保存base64图片格式到本地
@objc
func
backToHomeIndex
(
_
index
:
Int
)
{
DispatchQueue
.
main
.
async
{
UIViewController
.
current
?
.
navigationController
?
.
popToRootViewController
(
animated
:
true
)
UIViewController
.
current
?
.
tabBarController
?
.
selectedIndex
=
0
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
backToHomeNotification
,
object
:
nil
,
userInfo
:
[
"value"
:
index
])
}
}
}
}
galaxy/galaxy/Classes/Tools/Helper/YhConstant.swift
View file @
7f297b2a
...
@@ -320,5 +320,7 @@ extension YhConstant {
...
@@ -320,5 +320,7 @@ extension YhConstant {
// 已经展示银河管家
// 已经展示银河管家
public
static
let
didLoadYhManagerNotification
=
Notification
.
Name
(
rawValue
:
"com.yinhe.didLoadYhManager"
)
public
static
let
didLoadYhManagerNotification
=
Notification
.
Name
(
rawValue
:
"com.yinhe.didLoadYhManager"
)
public
static
let
backToHomeNotification
=
Notification
.
Name
(
rawValue
:
"com.yinhe.backToHomeNotification"
)
}
}
}
}
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