Commit c0a1eca0 authored by David黄金龙's avatar David黄金龙

完善 H5的逻辑

parent bd29786d
......@@ -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(_ dicH5: String) {
@objc func goH5UISyn(_ dicData: String) {
DispatchQueue.main.async {
if let data = dicH5.data(using: .utf8) {
if let data = dicData.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(_ dicPics: String) {
@objc func showPicsSyn(_ dicData: String) {
DispatchQueue.main.async {
if let data = dicPics.data(using: .utf8) {
if let data = dicData.data(using: .utf8) {
do {
if let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
// 转换成功,jsonObject 是一个字典
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment