Commit 6877e63c authored by pete谢兆麟's avatar pete谢兆麟

香港办事

parent 032a33a9
......@@ -240,6 +240,8 @@
048B2A482BC7CE4800A93BF0 /* YHFourKingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */; };
048B2A4A2BC7D9DC00A93BF0 /* YHMyLikeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A492BC7D9DC00A93BF0 /* YHMyLikeViewController.swift */; };
048B2A4D2BC7DAE800A93BF0 /* YHMyLikeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A4C2BC7DAE800A93BF0 /* YHMyLikeViewModel.swift */; };
048B2A4F2BC8031500A93BF0 /* YHHKEventViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A4E2BC8031500A93BF0 /* YHHKEventViewController.swift */; };
048B2A512BC8063F00A93BF0 /* YHHKEventModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048B2A502BC8063F00A93BF0 /* YHHKEventModel.swift */; };
0493B3DC2BA7EFE600AF9393 /* YHCertificateSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0493B3DB2BA7EFE600AF9393 /* YHCertificateSearchViewController.swift */; };
0493B3DE2BA80C2300AF9393 /* YHCertificateFilterButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0493B3DD2BA80C2300AF9393 /* YHCertificateFilterButton.swift */; };
049537852BA9B28500AF7E59 /* YHCertificateTemplateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */; };
......@@ -686,6 +688,8 @@
048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFourKingViewController.swift; sourceTree = "<group>"; };
048B2A492BC7D9DC00A93BF0 /* YHMyLikeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyLikeViewController.swift; sourceTree = "<group>"; };
048B2A4C2BC7DAE800A93BF0 /* YHMyLikeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyLikeViewModel.swift; sourceTree = "<group>"; };
048B2A4E2BC8031500A93BF0 /* YHHKEventViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKEventViewController.swift; sourceTree = "<group>"; };
048B2A502BC8063F00A93BF0 /* YHHKEventModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKEventModel.swift; sourceTree = "<group>"; };
0493B3DB2BA7EFE600AF9393 /* YHCertificateSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchViewController.swift; sourceTree = "<group>"; };
0493B3DD2BA80C2300AF9393 /* YHCertificateFilterButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateFilterButton.swift; sourceTree = "<group>"; };
049537842BA9B28500AF7E59 /* YHCertificateTemplateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateCell.swift; sourceTree = "<group>"; };
......@@ -2186,6 +2190,7 @@
049AC4CD2BC674A700F857F4 /* YHHomeClassifyModel.swift */,
A5A4FD642BC799A9001EF9F7 /* YHConfigModel.swift */,
048B2A452BC7912400A93BF0 /* YHWebModel.swift */,
048B2A502BC8063F00A93BF0 /* YHHKEventModel.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -2233,6 +2238,7 @@
044E1E802BC3BBC200A3B4AF /* YHSearchInfomationVC.swift */,
A5A4FD622BC79901001EF9F7 /* YHConfigManager.swift */,
048B2A472BC7CE4800A93BF0 /* YHFourKingViewController.swift */,
048B2A4E2BC8031500A93BF0 /* YHHKEventViewController.swift */,
);
path = C;
sourceTree = "<group>";
......@@ -2508,6 +2514,7 @@
045EEEA72B9F171A0022A143 /* YHWorkExperienceViewController.swift in Sources */,
044E1E8B2BC3E1CE00A3B4AF /* YHSearchInfoCell.swift in Sources */,
A5FD63BD2B623C2C00D1D9DA /* YHInformationPerfectListVC.swift in Sources */,
048B2A4F2BC8031500A93BF0 /* YHHKEventViewController.swift in Sources */,
045EEE8D2B9F171A0022A143 /* YHPreviewInfoCell.swift in Sources */,
045EEF0C2B9F171A0022A143 /* YHBasicInfoFillBottomView.swift in Sources */,
A5ACE93D2B4564F7002C94D2 /* UIButton+Extension.swift in Sources */,
......@@ -2657,6 +2664,7 @@
045EEEE82B9F171A0022A143 /* YHFamilyMemberViewModel.swift in Sources */,
04E86E092B707ACE00A35F4B /* YHPhoneLoginViewController.swift in Sources */,
045EEED02B9F171A0022A143 /* YHScoreResultView.swift in Sources */,
048B2A512BC8063F00A93BF0 /* YHHKEventModel.swift in Sources */,
0425E6442BA95FE100A5E763 /* YHSchemeTableHeadView.swift in Sources */,
045EEEBC2B9F171A0022A143 /* YHClipperButton.swift in Sources */,
045EEF102B9F171A0022A143 /* YHMainApplicantInformationViewModel.swift in Sources */,
......
//
// YHHKEventViewController.swift
// galaxy
//
// Created by EDY on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import WebKit
class YHHKEventViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var sectionView: YHServiceSectionView!
var webview = WKWebView()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
}
extension YHHKEventViewController {
func loadData() {
homeViewModel.getHKEvent {[weak self] success, error in
guard let self = self else { return }
self.sectionView.type = 1
self.sectionView.dataSource = self.homeViewModel.hkList ?? []
guard let model = self.homeViewModel.hkList?.first, let urlString = model.list.first else { return }
let url = NSURL(string: urlString)
// 创建请求
let request = NSURLRequest(url: url! as URL)
// 加载请求
self.webview.load(request as URLRequest)
}
}
func setupUI() {
gk_navBarAlpha = 1
sectionView = {
let view = YHServiceSectionView()
view.hkBlock = {[weak self] model in
guard let self = self else { return }
guard let urlString = model.list.first else { return }
let url = NSURL(string: urlString)
// 创建请求
let request = NSURLRequest(url: url! as URL)
// 加载请求
self.webview.load(request as URLRequest)
}
return view
}()
view.addSubview(sectionView)
sectionView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(48)
}
let navHeight = self.navigationController?.navigationBar.frame.height
//获取状态栏高度
let statusHeight = k_Height_statusBar()
// 创建wkwebview
webview = WKWebView(frame: CGRect(x: 0, y: statusHeight + navHeight! + 48, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 48))
// 添加wkwebview
self.view.addSubview(webview)
}
}
//
// YHHKEventModel.swift
// galaxy
//
// Created by EDY on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHHKEventModel: YHBaseModel {
var tag: String = ""
var list: [String] = []
}
......@@ -72,6 +72,8 @@ private extension YHHomeKingKongBlockView {
UIViewController.current?.navigationController?.pushViewController(vc)
printLog("跳转 客户心声")
case 3:
let vc = YHHKEventViewController()
UIViewController.current?.navigationController?.pushViewController(vc)
printLog("跳转 香港办事")
default:
break
......
......@@ -14,7 +14,7 @@ class YHHomePageViewModel : YHBaseViewModel {
var arrHomeNewsData: [YHHomeListModel]?
var banners: [YHBannerModel]?
var classify: [YHHomeClassifyModel]?
var hkList: [YHHKEventModel]?
//首页相关参数
private var curPageIndex : Int = 1
private var page_Size : Int = 10
......@@ -152,7 +152,7 @@ extension YHHomePageViewModel {
"page_size": 10,
"classify_id": classifyID]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.article
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
if json.code == 200 {
......@@ -177,4 +177,27 @@ extension YHHomePageViewModel {
callBackBlock(false,err)
}
}
func getHKEvent(callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.hklist
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
if json.code == 200 {
let dic = json.data
guard let result = [YHHKEventModel].deserialize(from: dic as? [Any]) else {
callBackBlock(false,nil)
return
}
self.hkList = (result as! [YHHKEventModel])
callBackBlock(true, nil)
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
......@@ -12,12 +12,22 @@ class YHServiceSectionView: UIView {
typealias Block = (YHClassifyModel) -> ()
var block: Block?
typealias HkBlock = (YHHKEventModel) -> ()
var hkBlock: HkBlock?
var items: [YHClassifyModel] = [] {
didSet {
self.myCollectView.reloadData()
}
}
var dataSource: [YHHKEventModel] = [] {
didSet {
self.myCollectView.reloadData()
}
}
var type: Int = 0
var selectIndex = 0
lazy var myCollectView = {
// 设置布局方向
......@@ -66,12 +76,20 @@ class YHServiceSectionView: UIView {
extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return items.count
if type == 0 {
return items.count
} else {
return dataSource.count
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHServiceSectionCollectionViewCell
cell.dataSource = items[indexPath.row]
if type == 0 {
cell.dataSource = items[indexPath.row]
} else {
cell.setTag(dataSource[indexPath.row].tag)
}
if indexPath.row == selectIndex {
cell.setSelectedStyle()
} else {
......@@ -84,9 +102,16 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIndex = indexPath.row
collectionView.reloadData()
let model = items[indexPath.row]
if let block = block {
block(model)
if type == 0 {
let model = items[indexPath.row]
if let block = block {
block(model)
}
} else {
let model = dataSource[indexPath.row]
if let block = hkBlock {
block(model)
}
}
print("index is \(indexPath.row)")
}
......@@ -145,4 +170,8 @@ class YHServiceSectionCollectionViewCell: UICollectionViewCell {
guard let dataSource = dataSource else { return }
descripeLable.text = dataSource.name
}
func setTag(_ tag: String) {
descripeLable.text = tag
}
}
......@@ -30,6 +30,8 @@ class YHAllApiName {
static let user = "infoflow/user/consult"
//我的浏览
static let userLook = "infoflow/user/view"
//获取香港办事
static let hklist = "infoflow/tool/list"
}
//order 模块
......
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