Commit 1cb500b0 authored by pete谢兆麟's avatar pete谢兆麟

香港办事左右滑动接入

parent 3e079c45
...@@ -305,6 +305,8 @@ ...@@ -305,6 +305,8 @@
04F5F8682C198372004A463C /* YHHKClassListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8672C198372004A463C /* YHHKClassListViewController.swift */; }; 04F5F8682C198372004A463C /* YHHKClassListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8672C198372004A463C /* YHHKClassListViewController.swift */; };
04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */; }; 04F5F86A2C1A95BB004A463C /* YHOtherServiceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */; };
04F5F86C2C1A9B52004A463C /* YHOtherServiceListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */; }; 04F5F86C2C1A9B52004A463C /* YHOtherServiceListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */; };
04F5F86E2C1AC351004A463C /* YHHKEventCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F86D2C1AC351004A463C /* YHHKEventCenterViewController.swift */; };
04F5F8702C1AC4C2004A463C /* YHHKEventWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F5F86F2C1AC4C2004A463C /* YHHKEventWebViewController.swift */; };
04FA8B2B2C06F59D00ABE43F /* YHAppleLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FA8B2A2C06F59D00ABE43F /* YHAppleLoginManager.swift */; }; 04FA8B2B2C06F59D00ABE43F /* YHAppleLoginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FA8B2A2C06F59D00ABE43F /* YHAppleLoginManager.swift */; };
04FA8B2E2C084C7E00ABE43F /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */; }; 04FA8B2E2C084C7E00ABE43F /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */; };
04FA8B302C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FA8B2F2C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift */; }; 04FA8B302C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04FA8B2F2C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift */; };
...@@ -790,6 +792,8 @@ ...@@ -790,6 +792,8 @@
04F5F8672C198372004A463C /* YHHKClassListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKClassListViewController.swift; sourceTree = "<group>"; }; 04F5F8672C198372004A463C /* YHHKClassListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKClassListViewController.swift; sourceTree = "<group>"; };
04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceViewController.swift; sourceTree = "<group>"; }; 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceViewController.swift; sourceTree = "<group>"; };
04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceListViewController.swift; sourceTree = "<group>"; }; 04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOtherServiceListViewController.swift; sourceTree = "<group>"; };
04F5F86D2C1AC351004A463C /* YHHKEventCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKEventCenterViewController.swift; sourceTree = "<group>"; };
04F5F86F2C1AC4C2004A463C /* YHHKEventWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKEventWebViewController.swift; sourceTree = "<group>"; };
04FA8B2A2C06F59D00ABE43F /* YHAppleLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppleLoginManager.swift; sourceTree = "<group>"; }; 04FA8B2A2C06F59D00ABE43F /* YHAppleLoginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppleLoginManager.swift; sourceTree = "<group>"; };
04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; }; 04FA8B2D2C084C7E00ABE43F /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = ATAuthSDK.bundle; path = "galaxy/Classes/Modules/AutoLogin(一键登录)/framework/ATAuthSDK_D.framework/ATAuthSDK.bundle"; sourceTree = "<group>"; };
04FA8B2F2C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOneKeyLoginViewModel.swift; sourceTree = "<group>"; }; 04FA8B2F2C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHOneKeyLoginViewModel.swift; sourceTree = "<group>"; };
...@@ -2108,6 +2112,8 @@ ...@@ -2108,6 +2112,8 @@
A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */, A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */,
A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */, A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */,
A567E5792BD7643D00D5D5A0 /* YHHKEventViewController.swift */, A567E5792BD7643D00D5D5A0 /* YHHKEventViewController.swift */,
04F5F86D2C1AC351004A463C /* YHHKEventCenterViewController.swift */,
04F5F86F2C1AC4C2004A463C /* YHHKEventWebViewController.swift */,
A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */, A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */,
); );
path = C; path = C;
...@@ -2804,6 +2810,7 @@ ...@@ -2804,6 +2810,7 @@
045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */, 045EEF132B9F171A0022A143 /* YHCountryMessage.swift in Sources */,
045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */, 045EEE7B2B9F171A0022A143 /* YHPersonInfoCellModel2.swift in Sources */,
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */, A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */,
04F5F8702C1AC4C2004A463C /* YHHKEventWebViewController.swift in Sources */,
045EEE892B9F171A0022A143 /* YHPreviewBaseViewController.swift in Sources */, 045EEE892B9F171A0022A143 /* YHPreviewBaseViewController.swift in Sources */,
045EEEA42B9F171A0022A143 /* YHImageResultViewController.swift in Sources */, 045EEEA42B9F171A0022A143 /* YHImageResultViewController.swift in Sources */,
045EEE812B9F171A0022A143 /* YHPreviewQuestionAndAnswerModel.swift in Sources */, 045EEE812B9F171A0022A143 /* YHPreviewQuestionAndAnswerModel.swift in Sources */,
...@@ -2905,6 +2912,7 @@ ...@@ -2905,6 +2912,7 @@
045EEEAE2B9F171A0022A143 /* YHWorkHighlightsTableViewCell.swift in Sources */, 045EEEAE2B9F171A0022A143 /* YHWorkHighlightsTableViewCell.swift in Sources */,
A567E59A2BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift in Sources */, A567E59A2BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift in Sources */,
045EEF062B9F171A0022A143 /* YHFormItemQuestionsCell.swift in Sources */, 045EEF062B9F171A0022A143 /* YHFormItemQuestionsCell.swift in Sources */,
04F5F86E2C1AC351004A463C /* YHHKEventCenterViewController.swift in Sources */,
A567E5922BD7643D00D5D5A0 /* YHHomeWebViewModel.swift in Sources */, A567E5922BD7643D00D5D5A0 /* YHHomeWebViewModel.swift in Sources */,
A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */, A5D5ADEF2BB90FBC0039FA6B /* YHCheckEamilAlertView.swift in Sources */,
04A671602BA0280800C1FB91 /* YHFileRenameInputView.swift in Sources */, 04A671602BA0280800C1FB91 /* YHFileRenameInputView.swift in Sources */,
......
//
// YHHKEventCenterViewController.swift
// galaxy
//
// Created by EDY on 2024/6/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHHKEventCenterViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var myDefaultNavItemIndex : Int = 0 {
didSet {
self.segmentedView.selectItemAt(index: self.myDefaultNavItemIndex)
}
}
var hkList: [YHHKEventModel] = []
var arrItemTitles: [String] = []
var arrItemVCs : [YHHKEventWebViewController] = []
var segmentedView : JXSegmentedView = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: 55))
lazy var segmentedDataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.titles = arrItemTitles
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 14)
dataSource.titleSelectedColor = UIColor.labelTextColor2
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 14)
dataSource.titleSelectedColor = UIColor.white
dataSource.isTitleMaskEnabled = true
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = JXSegmentedViewAutomaticDimension
dataSource.itemSpacing = 24
return dataSource
}()
//分类title 所对应的VC
lazy var listContainerView: JXSegmentedListContainerView! = {
return JXSegmentedListContainerView(dataSource: self, type: .collectionView)
}()
override func viewDidLoad() {
super.viewDidLoad()
let rightButtonItem = UIBarButtonItem(image: UIImage(named: "share_item")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(share))
gk_navRightBarButtonItem = rightButtonItem
gk_navItemRightSpace = 16
//segmentedViewDataSource一定要通过属性强持有!!!!!!!!!
segmentedView.dataSource = segmentedDataSource
segmentedView.delegate = self
view.addSubview(segmentedView)
segmentedView.listContainer = listContainerView
view.addSubview(listContainerView)
//分类Title
segmentedView.dataSource = segmentedDataSource
segmentedView.delegate = self
//配置指示器
let indicator = JXSegmentedIndicatorBackgroundView()
indicator.indicatorColor = UIColor.brandMainColor
indicator.indicatorHeight = 32
segmentedView.indicators = [indicator]
segmentedView.defaultSelectedIndex = self.myDefaultNavItemIndex
getData()
}
func getData() {
gk_navTitle = "香港办事"
homeViewModel.getHKEvent {[weak self] success, error in
guard let self = self else { return }
self.hkList = self.homeViewModel.hkList ?? []
self.arrItemTitles.removeAll()
for item in self.hkList {
self.arrItemTitles.append(item.tag)
let vc = YHHKEventWebViewController()
vc.model = item
arrItemVCs.append(vc)
}
self.segmentedDataSource.titles = arrItemTitles
self.segmentedView.dataSource = segmentedDataSource
self.segmentedView.reloadData()
}
}
func updateViews() {
if arrItemTitles.count != 1 {
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 55)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar + 55, width: view.bounds.size.width, height: view.bounds.size.height - 55 - k_Height_NavigationtBarAndStatuBar)
} else {
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 0)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: view.bounds.size.height - k_Height_NavigationtBarAndStatuBar)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
//处于第一个item的时候,才允许屏幕边缘手势返回
navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//离开页面的时候,需要恢复屏幕边缘手势,不能影响其他页面
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
segmentedView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: view.bounds.size.width, height: 55)
listContainerView.frame = CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar + 55, width: view.bounds.size.width, height: view.bounds.size.height - 55 - k_Height_NavigationtBarAndStatuBar)
segmentedView.backgroundColor = .white
}
@objc func share() {
if YHLoginManager.shared.isLogin() {
let model = self.hkList[segmentedView.selectedIndex]
if model.tag.contains("日历") {
guard let urlString = model.list.first, let url = URL(string: urlString) 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 urlString = model.list.first else {
return
}
YHShareManager.shared.sendLinkContent("一图看清香港办事", "", UIImage(named: "AppIcon") ?? UIImage(), link: urlString)
}
} else {
YHOneKeyLoginManager.shared.oneKeyLogin()
}
}
}
extension YHHKEventCenterViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
}
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
}
}
extension YHHKEventCenterViewController: JXSegmentedListContainerViewDataSource {
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
return titleDataSource.dataSource.count
}
return 0
}
func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
return arrItemVCs[index] as JXSegmentedListContainerViewListDelegate
}
}
//
// YHHKEventWebViewController.swift
// galaxy
//
// Created by EDY on 2024/6/13.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import Photos
import WebKit
import JXSegmentedView
class YHHKEventWebViewController: YHBaseViewController {
var webview = WKWebView()
var model: YHHKEventModel = YHHKEventModel()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
setupUI()
loadData()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// loadData()
}
lazy var bottomViewForSavePic: YHHomeWebViewBottomForSavePicView = {
let view = YHHomeWebViewBottomForSavePicView()
view.isHidden = true
return view
}()
private var picUrl : String = ""
}
extension YHHKEventWebViewController {
func loadData() {
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)
if model.tag.contains("日历") {
picUrl = urlString
bottomViewForSavePic.isHidden = false
// 创建wkwebview
webview.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height - YHHomeWebViewBottomForSavePicView.viewH)
} else {
bottomViewForSavePic.isHidden = true
webview.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)
}
}
func setupUI() {
gk_navigationBar.isHidden = true
// 创建wkwebview
webview = WKWebView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height - 0))
// 添加wkwebview
view.addSubview(webview)
view.addSubview(bottomViewForSavePic)
bottomViewForSavePic.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.height.equalTo(YHHomeWebViewBottomForSavePicView.viewH)
}
bottomViewForSavePic.block = { tag in
self.saveImageToPhotoLib()
}
}
}
extension YHHKEventWebViewController {
func saveImageToPhotoLib() {
let urlString = self.picUrl
guard let url = URL(string: urlString) else {
YHHUD.flash(message: "参数错误,保存失败")
return
}
YHHUD.show(.progress(message: "处理中..."))
let task = URLSession.shared.dataTask(with: url) { data, response, error in
DispatchQueue.main.async {
YHHUD.hide()
guard let data = data, error == nil else { return YHHUD.flash(message: "保存成功") }
let image = UIImage(data: data)
if let image = image {
// 保存图片到图库
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAsset(from: image)
}, completionHandler: { success, error in
if success {
// 图片保存成功
DispatchQueue.main.async {
YHHUD.flash(message: "保存成功")
}
} else if let error = error {
// 保存失败
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败")
}
print("保存图片出错: \(error.localizedDescription)")
}
})
}
}
}
task.resume()
}
}
extension YHHKEventWebViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
...@@ -64,7 +64,7 @@ private extension YHHomeKingKongBlockView { ...@@ -64,7 +64,7 @@ private extension YHHomeKingKongBlockView {
vc.classID = 5 vc.classID = 5
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
case 3: case 3:
let vc = YHHKEventViewController() let vc = YHHKEventCenterViewController()
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
default: default:
break break
......
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