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
c0a1eca0
Commit
c0a1eca0
authored
Sep 23, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善 H5的逻辑
parent
bd29786d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
4 deletions
+55
-4
YHJsApi.swift
...galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
+55
-4
No files found.
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHJsApi.swift
View file @
c0a1eca0
...
...
@@ -18,6 +18,57 @@ class YHJsApi: NSObject {
extension
YHJsApi
{
//9、跳转资讯列表页
@objc
func
goNewsInfomationListUISyn
(
_
dicData
:
String
)
{
DispatchQueue
.
main
.
async
{
if
let
data
=
dicData
.
data
(
using
:
.
utf8
)
{
do
{
if
let
jsonObject
=
try
JSONSerialization
.
jsonObject
(
with
:
data
,
options
:
[])
as?
[
String
:
Any
]
{
// 转换成功,jsonObject 是一个字典
print
(
"JSON字符串转换为字典成功:
\(
jsonObject
)
"
)
/*
{
id:1,
name:"教学升学",
hot_num: 1. // 顶部栏目数量(最新,精品)
}
*/
if
!
jsonObject
.
isEmpty
{
let
name
:
String
=
jsonObject
[
"name"
]
as?
String
??
""
let
id
:
Int
=
jsonObject
[
"id"
]
as?
Int
??
-
1
let
hot_num
:
Int
=
jsonObject
[
"hot_num"
]
as?
Int
??
0
if
id
>
0
{
let
vc
=
YHHomeInfoDetailContainerViewController
()
vc
.
customTitle
=
name
vc
.
isHaveHot
=
hot_num
>
0
vc
.
classifyId
=
id
UIViewController
.
current
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
else
{
printLog
(
"ddddd"
)
}
}
else
{
printLog
(
"JSON字符串不是有效的字典格式"
)
}
}
catch
{
printLog
(
"JSON解析错误:
\(
error
)
"
)
}
}
}
}
//8、跳转案例分享UI
@objc
func
goCaseShareUISyn
(
_
caseId
:
String
)
{
DispatchQueue
.
main
.
async
{
if
let
id
=
Int
(
caseId
)
{
let
vc
=
YHResignGuidelinesExampleViewController
()
vc
.
id
=
id
self
.
delegate
?
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
//7、跳转 首页-生活 tab
@objc
func
goHomeLifeTabSyn
()
{
DispatchQueue
.
main
.
async
{
...
...
@@ -28,9 +79,9 @@ extension YHJsApi {
}
//6、跳转H5界面
@objc
func
goH5UISyn
(
_
dic
H5
:
String
)
{
@objc
func
goH5UISyn
(
_
dic
Data
:
String
)
{
DispatchQueue
.
main
.
async
{
if
let
data
=
dic
H5
.
data
(
using
:
.
utf8
)
{
if
let
data
=
dic
Data
.
data
(
using
:
.
utf8
)
{
do
{
if
let
jsonObject
=
try
JSONSerialization
.
jsonObject
(
with
:
data
,
options
:
[])
as?
[
String
:
Any
]
{
// 转换成功,jsonObject 是一个字典
...
...
@@ -111,9 +162,9 @@ extension YHJsApi {
}
//2、展示图片组
@objc
func
showPicsSyn
(
_
dic
Pics
:
String
)
{
@objc
func
showPicsSyn
(
_
dic
Data
:
String
)
{
DispatchQueue
.
main
.
async
{
if
let
data
=
dic
Pics
.
data
(
using
:
.
utf8
)
{
if
let
data
=
dic
Data
.
data
(
using
:
.
utf8
)
{
do
{
if
let
jsonObject
=
try
JSONSerialization
.
jsonObject
(
with
:
data
,
options
:
[])
as?
[
String
:
Any
]
{
// 转换成功,jsonObject 是一个字典
...
...
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