Commit e1329891 authored by Steven杜宇's avatar Steven杜宇

Merge branch 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into youhua-dev

parents 3c9c7468 c14fe571
...@@ -302,6 +302,7 @@ ...@@ -302,6 +302,7 @@
04AD317B2C2428CB00DF5655 /* YHPeopleSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */; }; 04AD317B2C2428CB00DF5655 /* YHPeopleSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */; };
04AD317D2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */; }; 04AD317D2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */; };
04AD317F2C295C0300DF5655 /* YHChangeHeadModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */; }; 04AD317F2C295C0300DF5655 /* YHChangeHeadModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */; };
04ADBCA22C3674E300C37F10 /* YHMyLikeActivityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04ADBCA12C3674E300C37F10 /* YHMyLikeActivityViewController.swift */; };
04AF514E2BEB585C00009E3A /* YHVideoPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */; }; 04AF514E2BEB585C00009E3A /* YHVideoPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; }; 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04AF82D62C25542D0028CE2A /* YHInterestTopicLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */; }; 04AF82D62C25542D0028CE2A /* YHInterestTopicLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */; };
...@@ -418,11 +419,9 @@ ...@@ -418,11 +419,9 @@
A567E59A2BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5712BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift */; }; A567E59A2BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5712BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift */; };
A567E59B2BD7643D00D5D5A0 /* YHWebModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5722BD7643D00D5D5A0 /* YHWebModel.swift */; }; A567E59B2BD7643D00D5D5A0 /* YHWebModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5722BD7643D00D5D5A0 /* YHWebModel.swift */; };
A567E59C2BD7643D00D5D5A0 /* YHSearchInfomationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */; }; A567E59C2BD7643D00D5D5A0 /* YHSearchInfomationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */; };
A567E59D2BD7643D00D5D5A0 /* YHFourKingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5752BD7643D00D5D5A0 /* YHFourKingViewController.swift */; };
A567E59E2BD7643D00D5D5A0 /* YHHomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */; }; A567E59E2BD7643D00D5D5A0 /* YHHomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */; };
A567E59F2BD7643D00D5D5A0 /* YHStartPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */; }; A567E59F2BD7643D00D5D5A0 /* YHStartPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */; };
A567E5A02BD7643D00D5D5A0 /* YHHomeWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */; }; A567E5A02BD7643D00D5D5A0 /* YHHomeWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */; };
A567E5A12BD7643D00D5D5A0 /* YHHKEventViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5792BD7643D00D5D5A0 /* YHHKEventViewController.swift */; };
A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */; }; A567E5A22BD7643D00D5D5A0 /* YHConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */; };
A567E5A32BD7643D00D5D5A0 /* YHHomeBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E57C2BD7643D00D5D5A0 /* YHHomeBannerView.swift */; }; A567E5A32BD7643D00D5D5A0 /* YHHomeBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E57C2BD7643D00D5D5A0 /* YHHomeBannerView.swift */; };
A567E5A42BD7643D00D5D5A0 /* YHSearchInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E57D2BD7643D00D5D5A0 /* YHSearchInfoCell.swift */; }; A567E5A42BD7643D00D5D5A0 /* YHSearchInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E57D2BD7643D00D5D5A0 /* YHSearchInfoCell.swift */; };
...@@ -879,6 +878,7 @@ ...@@ -879,6 +878,7 @@
04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPeopleSuccessView.swift; sourceTree = "<group>"; }; 04AD317A2C2428CB00DF5655 /* YHPeopleSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPeopleSuccessView.swift; sourceTree = "<group>"; };
04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserInfoSettingViewModel.swift; sourceTree = "<group>"; }; 04AD317C2C295AE800DF5655 /* YHUserInfoSettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHUserInfoSettingViewModel.swift; sourceTree = "<group>"; };
04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChangeHeadModel.swift; sourceTree = "<group>"; }; 04AD317E2C295C0300DF5655 /* YHChangeHeadModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHChangeHeadModel.swift; sourceTree = "<group>"; };
04ADBCA12C3674E300C37F10 /* YHMyLikeActivityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyLikeActivityViewController.swift; sourceTree = "<group>"; };
04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerVC.swift; sourceTree = "<group>"; }; 04AF514D2BEB585C00009E3A /* YHVideoPlayerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHVideoPlayerVC.swift; sourceTree = "<group>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; }; 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestTopicLayout.swift; sourceTree = "<group>"; }; 04AF82D52C25542D0028CE2A /* YHInterestTopicLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInterestTopicLayout.swift; sourceTree = "<group>"; };
...@@ -1000,11 +1000,9 @@ ...@@ -1000,11 +1000,9 @@
A567E5712BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeKingKongBlockModel.swift; sourceTree = "<group>"; }; A567E5712BD7643D00D5D5A0 /* YHHomeKingKongBlockModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeKingKongBlockModel.swift; sourceTree = "<group>"; };
A567E5722BD7643D00D5D5A0 /* YHWebModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHWebModel.swift; sourceTree = "<group>"; }; A567E5722BD7643D00D5D5A0 /* YHWebModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHWebModel.swift; sourceTree = "<group>"; };
A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchInfomationVC.swift; sourceTree = "<group>"; }; A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchInfomationVC.swift; sourceTree = "<group>"; };
A567E5752BD7643D00D5D5A0 /* YHFourKingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFourKingViewController.swift; sourceTree = "<group>"; };
A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomePageViewController.swift; sourceTree = "<group>"; }; A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomePageViewController.swift; sourceTree = "<group>"; };
A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHStartPageViewController.swift; sourceTree = "<group>"; }; A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHStartPageViewController.swift; sourceTree = "<group>"; };
A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeWebViewController.swift; sourceTree = "<group>"; }; A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeWebViewController.swift; sourceTree = "<group>"; };
A567E5792BD7643D00D5D5A0 /* YHHKEventViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHKEventViewController.swift; sourceTree = "<group>"; };
A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHConfigManager.swift; sourceTree = "<group>"; }; A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHConfigManager.swift; sourceTree = "<group>"; };
A567E57C2BD7643D00D5D5A0 /* YHHomeBannerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeBannerView.swift; sourceTree = "<group>"; }; A567E57C2BD7643D00D5D5A0 /* YHHomeBannerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeBannerView.swift; sourceTree = "<group>"; };
A567E57D2BD7643D00D5D5A0 /* YHSearchInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchInfoCell.swift; sourceTree = "<group>"; }; A567E57D2BD7643D00D5D5A0 /* YHSearchInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchInfoCell.swift; sourceTree = "<group>"; };
...@@ -2499,13 +2497,11 @@ ...@@ -2499,13 +2497,11 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */, A567E5742BD7643D00D5D5A0 /* YHSearchInfomationVC.swift */,
A567E5752BD7643D00D5D5A0 /* YHFourKingViewController.swift */,
04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */, 04F5F86B2C1A9B52004A463C /* YHOtherServiceListViewController.swift */,
04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */, 04F5F8692C1A95BB004A463C /* YHOtherServiceViewController.swift */,
A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */, A567E5762BD7643D00D5D5A0 /* YHHomePageViewController.swift */,
A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */, A567E5772BD7643D00D5D5A0 /* YHStartPageViewController.swift */,
A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */, A567E5782BD7643D00D5D5A0 /* YHHomeWebViewController.swift */,
A567E5792BD7643D00D5D5A0 /* YHHKEventViewController.swift */,
04F5F86D2C1AC351004A463C /* YHHKEventCenterViewController.swift */, 04F5F86D2C1AC351004A463C /* YHHKEventCenterViewController.swift */,
04F5F86F2C1AC4C2004A463C /* YHHKEventWebViewController.swift */, 04F5F86F2C1AC4C2004A463C /* YHHKEventWebViewController.swift */,
A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */, A567E57A2BD7643D00D5D5A0 /* YHConfigManager.swift */,
...@@ -2657,6 +2653,7 @@ ...@@ -2657,6 +2653,7 @@
048B2A492BC7D9DC00A93BF0 /* YHMyLikeViewController.swift */, 048B2A492BC7D9DC00A93BF0 /* YHMyLikeViewController.swift */,
04174D632BCD52BD000BA46D /* YHDeviceInfoViewController.swift */, 04174D632BCD52BD000BA46D /* YHDeviceInfoViewController.swift */,
A5DF3D452BF72BA0003D5F03 /* YHTestViewController.swift */, A5DF3D452BF72BA0003D5F03 /* YHTestViewController.swift */,
04ADBCA12C3674E300C37F10 /* YHMyLikeActivityViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3215,7 +3212,6 @@ ...@@ -3215,7 +3212,6 @@
04CE1ADA2C2AD91F001CB80A /* YHActivityTravelitemView.swift in Sources */, 04CE1ADA2C2AD91F001CB80A /* YHActivityTravelitemView.swift in Sources */,
045EEEA12B9F171A0022A143 /* YHWorkExperienceDetailModel.swift in Sources */, 045EEEA12B9F171A0022A143 /* YHWorkExperienceDetailModel.swift in Sources */,
A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */, A5573ED22B317BFF00D98EC0 /* AppDelegate.swift in Sources */,
A567E5A12BD7643D00D5D5A0 /* YHHKEventViewController.swift in Sources */,
A5ACE9542B4564F7002C94D2 /* YHNavigationController.swift in Sources */, A5ACE9542B4564F7002C94D2 /* YHNavigationController.swift in Sources */,
044D0C002C21663300C5CF5E /* YHMyInformationItemCell.swift in Sources */, 044D0C002C21663300C5CF5E /* YHMyInformationItemCell.swift in Sources */,
045EEF252B9F171A0022A143 /* YHMainInformationCardTableViewCell.swift in Sources */, 045EEF252B9F171A0022A143 /* YHMainInformationCardTableViewCell.swift in Sources */,
...@@ -3275,7 +3271,6 @@ ...@@ -3275,7 +3271,6 @@
045EEEB02B9F171A0022A143 /* YHWorkItemView.swift in Sources */, 045EEEB02B9F171A0022A143 /* YHWorkItemView.swift in Sources */,
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */, 0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */,
048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */, 048787D12BCE61B20036E221 /* YHServiceNoOrderView.swift in Sources */,
A567E59D2BD7643D00D5D5A0 /* YHFourKingViewController.swift in Sources */,
A567E5AC2BD7643D00D5D5A0 /* YHAgreementAlertView.swift in Sources */, A567E5AC2BD7643D00D5D5A0 /* YHAgreementAlertView.swift in Sources */,
04CE1ADD2C2AD91F001CB80A /* YHActivityDetailCell.swift in Sources */, 04CE1ADD2C2AD91F001CB80A /* YHActivityDetailCell.swift in Sources */,
04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */, 04AA19FD2BB40D5C00C1CBBD /* Applegate(JPush).swift in Sources */,
...@@ -3378,6 +3373,7 @@ ...@@ -3378,6 +3373,7 @@
A5ACE9502B4564F7002C94D2 /* YhCacheTool.swift in Sources */, A5ACE9502B4564F7002C94D2 /* YhCacheTool.swift in Sources */,
04F957452C1FEC4A003C631C /* YHMessageBellView.swift in Sources */, 04F957452C1FEC4A003C631C /* YHMessageBellView.swift in Sources */,
A567E5992BD7643D00D5D5A0 /* YHBannerModel.swift in Sources */, A567E5992BD7643D00D5D5A0 /* YHBannerModel.swift in Sources */,
04ADBCA22C3674E300C37F10 /* YHMyLikeActivityViewController.swift in Sources */,
045EEEFC2B9F171A0022A143 /* YHSheetPickerView.swift in Sources */, 045EEEFC2B9F171A0022A143 /* YHSheetPickerView.swift in Sources */,
A567E59C2BD7643D00D5D5A0 /* YHSearchInfomationVC.swift in Sources */, A567E59C2BD7643D00D5D5A0 /* YHSearchInfomationVC.swift in Sources */,
04174D732BCD5B74000BA46D /* YHMsgViewModel.swift in Sources */, 04174D732BCD5B74000BA46D /* YHMsgViewModel.swift in Sources */,
......
//
// YHFourKingViewController.swift
// galaxy
//
// Created by EDY on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHFourKingViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var tableFootView: YHServiceTableFootView!
var sectionView: YHServiceSectionView!
var id = 3
var classId: Int = 0
var dataSouce: [YHHomeListModel?] = [] {
didSet {
self.tableFootView.items = dataSouce
}
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
}
}
extension YHFourKingViewController {
func loadData() {
homeViewModel.getHomeClassify{[weak self] success, error in
guard let self = self, let classify = self.homeViewModel.classify else { return }
for item in classify {
let model = item as YHHomeClassifyModel
if model.id == self.id {
if self.classId == 0 {
gk_navTitle = model.name
self.sectionView.items = model.children
if model.children.count == 1 {
self.updateAllView()
}
let classifyID = model.children.first?.id ?? 0
self.classId = classifyID
self.homeViewModel.getList(true, classifyID) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.homeViewModel.arrHomeNewsData ?? []
if self.homeViewModel.hasMoreForHomeNews == false {
self.tableFootView.myCollectView.es.noticeNoMoreData()
self.tableFootView.myCollectView.footer?.alpha = 1
}
}
}
}
}
}
}
func updateAllView() {
sectionView.snp.remakeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(0)
}
tableFootView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
}
}
func setupUI() {
gk_navBarAlpha = 1
sectionView = {
let view = YHServiceSectionView()
view.block = {[weak self] model in
guard let self = self else { return }
self.tableFootView.myCollectView.es.resetNoMoreData()
self.tableFootView.myCollectView.setContentOffset(CGPoint.zero, animated: false)
self.classId = model.id
self.homeViewModel.getList(true, model.id) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.homeViewModel.arrHomeNewsData ?? []
if self.homeViewModel.hasMoreForHomeNews == false {
self.tableFootView.myCollectView.es.noticeNoMoreData()
self.tableFootView.myCollectView.footer?.alpha = 1
}
}
}
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)
}
tableFootView = YHServiceTableFootView()
tableFootView.moreBlock = {[weak self] in
guard let self = self else { return }
self.homeViewModel.getList(false, self.classId) {[weak self] success, error in
guard let self = self else { return }
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.35, execute: {
CATransaction.setDisableActions(true)
self.dataSouce = self.homeViewModel.arrHomeNewsData ?? []
CATransaction.commit()
self.tableFootView.myCollectView.es.stopLoadingMore()
if self.homeViewModel.hasMoreForHomeNews == false {
self.tableFootView.myCollectView.es.noticeNoMoreData()
}
})
}
}
view.addSubview(tableFootView)
tableFootView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar + 48)
}
}
}
//
// YHHKEventViewController.swift
// galaxy
//
// Created by EDY on 2024/4/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import WebKit
import Photos
class YHHKEventViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var sectionView: YHServiceSectionView!
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 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 }
self.model = model
let url = NSURL(string: urlString)
// 创建请求
let request = NSURLRequest(url: url! as URL)
// 加载请求
self.webview.load(request as URLRequest)
}
}
func setupUI() {
gk_navBarAlpha = 1
gk_navTitle = "香港办事"
let rightButtonItem = UIBarButtonItem(image: UIImage(named: "share_item")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(share))
gk_navRightBarButtonItem = rightButtonItem
gk_navItemRightSpace = 16
printLog(gk_navigationBar.isHidden)
sectionView = {
let view = YHServiceSectionView()
view.hkBlock = {[weak self] model in
guard let self = self else { return }
guard let urlString = model.list.first else { return }
self.model = model
let url = NSURL(string: urlString)
// 创建请求
let request = NSURLRequest(url: url! as URL)
// 加载请求
self.webview.load(request as URLRequest)
let navHeight = self.navigationController?.navigationBar.frame.height
//获取状态栏高度
let statusHeight = k_Height_statusBar()
if model.tag.contains("日历") {
picUrl = urlString
bottomViewForSavePic.isHidden = false
// 创建wkwebview
webview.frame = CGRect(x: 0, y: statusHeight + navHeight! + 48, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 48 - YHHomeWebViewBottomForSavePicView.viewH)
} else {
bottomViewForSavePic.isHidden = true
webview.frame = CGRect(x: 0, y: statusHeight + navHeight! + 48, width: self.view.frame.width, height: self.view.frame.height - statusHeight - navHeight! - 48)
}
}
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
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()
}
}
@objc func share() {
if YHLoginManager.shared.isLogin() {
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 YHHKEventViewController {
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()
}
}
...@@ -49,11 +49,11 @@ extension YHHKEventWebViewController { ...@@ -49,11 +49,11 @@ extension YHHKEventWebViewController {
picUrl = urlString picUrl = urlString
bottomViewForSavePic.isHidden = false bottomViewForSavePic.isHidden = false
// 创建wkwebview // 创建wkwebview
webview.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height - YHHomeWebViewBottomForSavePicView.viewH) webview.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height - YHHomeWebViewBottomForSavePicView.viewH - 55 - k_Height_NavigationtBarAndStatuBar)
} else { } else {
bottomViewForSavePic.isHidden = true bottomViewForSavePic.isHidden = true
webview.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height) webview.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height - 55 - k_Height_NavigationtBarAndStatuBar)
} }
} }
......
...@@ -29,26 +29,18 @@ class YHHomeWebViewBottomForSavePicView: UIView { ...@@ -29,26 +29,18 @@ class YHHomeWebViewBottomForSavePicView: UIView {
private extension YHHomeWebViewBottomForSavePicView { private extension YHHomeWebViewBottomForSavePicView {
func setupUI() { func setupUI() {
backgroundColor = .white backgroundColor = UIColor(hex: 0x00634A)
saveButton = { saveButton = {
let button = UIButton(type: .custom) let button = UIButton(type: .custom)
button.backgroundColor = UIColor.contentBkgColor button.adjustsImageWhenHighlighted = false
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15) button.setBackgroundImage(UIImage(named: "hk_event_picture_save"), for: .normal)
button.contentHorizontalAlignment = .center
button.setTitle("保存到相册", for: .normal)
button.setTitleColor(UIColor.brandMainColor, for: .normal)
button.layer.cornerRadius = kCornerRadius3
button.layer.borderWidth = 0.5
button.layer.borderColor = UIColor.brandMainColor.cgColor
button.addTarget(self, action: #selector(save), for: .touchUpInside) button.addTarget(self, action: #selector(save), for: .touchUpInside)
return button return button
}() }()
addSubview(saveButton) addSubview(saveButton)
saveButton.snp.makeConstraints { make in saveButton.snp.makeConstraints { make in
make.left.equalTo(kMargin) make.left.right.top.equalToSuperview()
make.right.equalTo(-kMargin) make.height.equalTo(67)
make.top.equalTo(12)
make.height.equalTo(44)
} }
} }
......
...@@ -26,7 +26,7 @@ class YHServiceTableFootView: UIView { ...@@ -26,7 +26,7 @@ class YHServiceTableFootView: UIView {
flowLayout.minimumInteritemSpacing = 7.0 flowLayout.minimumInteritemSpacing = 7.0
flowLayout.minimumColumnSpacing = 7.0 flowLayout.minimumColumnSpacing = 7.0
flowLayout.sectionInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20) flowLayout.sectionInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
let collectinoView = YHGestureCollectionView(frame: .zero, collectionViewLayout: flowLayout) let collectinoView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.backgroundColor = .white collectinoView.backgroundColor = .white
collectinoView.register(YHHomeCollectionViewCell.self, forCellWithReuseIdentifier:YHHomeCollectionViewCell.cellReuseIdentifier) collectinoView.register(YHHomeCollectionViewCell.self, forCellWithReuseIdentifier:YHHomeCollectionViewCell.cellReuseIdentifier)
collectinoView.delegate = self collectinoView.delegate = self
......
//
// YHMyLikeActivityViewController.swift
// galaxy
//
// Created by EDY on 2024/7/4.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import JXSegmentedView
class YHMyLikeActivityViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
var myDefaultNavItemIndex : Int = 0 {
didSet {
self.segmentedView.selectItemAt(index: self.myDefaultNavItemIndex)
}
}
var arrItemTitles: [String] = ["我的点赞", "我的收藏", "最近浏览"]
var arrItemVCs : [YHMyLikeViewController] = []
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 = 60
return dataSource
}()
//分类title 所对应的VC
lazy var listContainerView: JXSegmentedListContainerView! = {
return JXSegmentedListContainerView(dataSource: self, type: .collectionView)
}()
override func viewDidLoad() {
super.viewDidLoad()
for i in 0..<arrItemTitles.count {
if i == 0 {
let vc = YHMyLikeViewController()
vc.id = 1
arrItemVCs.append(vc)
} else if i == 1{
let vc = YHMyLikeViewController()
vc.id = 2
arrItemVCs.append(vc)
} else {
let vc = YHMyLikeViewController()
vc.id = 3
arrItemVCs.append(vc)
}
}
//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 = "我的足迹"
}
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
}
}
extension YHMyLikeActivityViewController: JXSegmentedViewDelegate {
func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
}
func segmentedView(_ segmentedView: JXSegmentedView, scrollingFrom leftIndex: Int, to rightIndex: Int, percent: CGFloat) {
}
}
extension YHMyLikeActivityViewController: 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
}
}
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
import UIKit import UIKit
import JXSegmentedView
class YHMyLikeViewController: YHBaseViewController { class YHMyLikeViewController: YHBaseViewController {
let viewModel: YHMyLikeViewModel = YHMyLikeViewModel() let viewModel: YHMyLikeViewModel = YHMyLikeViewModel()
...@@ -27,15 +28,6 @@ class YHMyLikeViewController: YHBaseViewController { ...@@ -27,15 +28,6 @@ class YHMyLikeViewController: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
var title = "我的收藏"
if id == 1 {
title = "我的点赞"
} else if id == 2{
title = "我的收藏"
} else {
title = "浏览记录"
}
gk_navTitle = title
setupUI() setupUI()
} }
...@@ -83,7 +75,7 @@ extension YHMyLikeViewController { ...@@ -83,7 +75,7 @@ extension YHMyLikeViewController {
} }
func setupUI() { func setupUI() {
gk_navBarAlpha = 1 gk_navigationBar.isHidden = true
view.backgroundColor = .white view.backgroundColor = .white
tableFootView = { tableFootView = {
...@@ -125,8 +117,7 @@ extension YHMyLikeViewController { ...@@ -125,8 +117,7 @@ extension YHMyLikeViewController {
view.addSubview(tableFootView) view.addSubview(tableFootView)
tableFootView.snp.makeConstraints { make in tableFootView.snp.makeConstraints { make in
make.bottom.left.right.equalToSuperview() make.top.bottom.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
} }
view.addSubview(noDataView) view.addSubview(noDataView)
...@@ -138,3 +129,9 @@ extension YHMyLikeViewController { ...@@ -138,3 +129,9 @@ extension YHMyLikeViewController {
} }
} }
} }
extension YHMyLikeViewController: JXSegmentedListContainerViewListDelegate {
func listView() -> UIView {
return view
}
}
...@@ -117,8 +117,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -117,8 +117,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if !checkLogin() { return } if !checkLogin() { return }
let vc = YHMyLikeViewController() let vc = YHMyLikeActivityViewController()
vc.id = 1 vc.myDefaultNavItemIndex = 0
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
print("点赞") print("点赞")
} }
...@@ -126,8 +126,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -126,8 +126,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if !checkLogin() { return } if !checkLogin() { return }
let vc = YHMyLikeViewController() let vc = YHMyLikeActivityViewController()
vc.id = 2 vc.myDefaultNavItemIndex = 1
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
print("收藏") print("收藏")
} }
...@@ -135,8 +135,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -135,8 +135,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if !checkLogin() { return } if !checkLogin() { return }
let vc = YHMyLikeViewController() let vc = YHMyLikeActivityViewController()
vc.id = 3 vc.myDefaultNavItemIndex = 2
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
print("最近浏览") print("最近浏览")
} }
......
...@@ -172,6 +172,31 @@ class YHEditBaseUserInfoViewController: YHBaseViewController { ...@@ -172,6 +172,31 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
} }
} }
} }
override func backItemClick(_ sender: Any) {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
} else {
self.navigationController?.popViewController()
}
}
/// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
return false
}
return true
}
} }
extension YHEditBaseUserInfoViewController: UITableViewDelegate, UITableViewDataSource { extension YHEditBaseUserInfoViewController: UITableViewDelegate, UITableViewDataSource {
......
...@@ -125,6 +125,29 @@ class YHEditHonorViewController: YHBaseViewController { ...@@ -125,6 +125,29 @@ class YHEditHonorViewController: YHBaseViewController {
} }
} }
} }
override func backItemClick(_ sender: Any) {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
} else {
self.navigationController?.popViewController()
}
}
/// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
return false
}
return true
}
} }
extension YHEditHonorViewController: UITextViewDelegate { extension YHEditHonorViewController: UITextViewDelegate {
...@@ -138,7 +161,7 @@ extension YHEditHonorViewController: UITextViewDelegate { ...@@ -138,7 +161,7 @@ extension YHEditHonorViewController: UITextViewDelegate {
} }
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length let newLength = (textView.text as NSString).length + text.count - range.length
viewModel.didChange = true
return newLength <= 200 return newLength <= 200
} }
} }
...@@ -114,13 +114,15 @@ class YHEditInterestViewController: YHBaseViewController { ...@@ -114,13 +114,15 @@ class YHEditInterestViewController: YHBaseViewController {
guard let self = self else { return } guard let self = self else { return }
if let text = text { if let text = text {
if let index = normalItems.firstIndex(where: {$0.name == text}) { if let _ = normalItems.firstIndex(where: {$0.name == text}) {
YHHUD.flash(message: "请不要添加重复的标签噢") YHHUD.flash(message: "请不要添加重复的标签噢")
return return
} }
if let index = likeItems.firstIndex(where: {$0.name == text}) { YHHUD.flash(message: "请不要添加重复的标签噢") if let _ = likeItems.firstIndex(where: {$0.name == text}) {
YHHUD.flash(message: "请不要添加重复的标签噢")
return return
} }
self.viewModel.didChange = true
let model = YHInterestModel(name: text, isNormal: false, isSelect: false) let model = YHInterestModel(name: text, isNormal: false, isSelect: false)
self.likeItems.insert(model, at: 0) self.likeItems.insert(model, at: 0)
self.collectionView.reloadData() self.collectionView.reloadData()
...@@ -166,6 +168,29 @@ class YHEditInterestViewController: YHBaseViewController { ...@@ -166,6 +168,29 @@ class YHEditInterestViewController: YHBaseViewController {
var strSize = string.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size var strSize = string.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return CGSizeMake(ceil(strSize.width), strSize.height) return CGSizeMake(ceil(strSize.width), strSize.height)
} }
override func backItemClick(_ sender: Any) {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
} else {
self.navigationController?.popViewController()
}
}
/// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
return false
}
return true
}
} }
extension YHEditInterestViewController { extension YHEditInterestViewController {
...@@ -251,6 +276,7 @@ extension YHEditInterestViewController: UICollectionViewDelegate, UICollectionVi ...@@ -251,6 +276,7 @@ extension YHEditInterestViewController: UICollectionViewDelegate, UICollectionVi
guard let self = self else { return } guard let self = self else { return }
self.likeItems.remove(at: indexPath.item) self.likeItems.remove(at: indexPath.item)
self.collectionView.reloadData() self.collectionView.reloadData()
self.viewModel.didChange = true
} }
return cell return cell
} }
...@@ -268,6 +294,7 @@ extension YHEditInterestViewController: UICollectionViewDelegate, UICollectionVi ...@@ -268,6 +294,7 @@ extension YHEditInterestViewController: UICollectionViewDelegate, UICollectionVi
} }
} }
collectionView.reloadData() collectionView.reloadData()
viewModel.didChange = true
} }
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
......
...@@ -125,6 +125,31 @@ class YHEditPersonalProfileViewController: YHBaseViewController { ...@@ -125,6 +125,31 @@ class YHEditPersonalProfileViewController: YHBaseViewController {
} }
} }
} }
override func backItemClick(_ sender: Any) {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
} else {
self.navigationController?.popViewController()
}
}
/// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
return false
}
return true
}
} }
extension YHEditPersonalProfileViewController: UITextViewDelegate { extension YHEditPersonalProfileViewController: UITextViewDelegate {
...@@ -138,7 +163,7 @@ extension YHEditPersonalProfileViewController: UITextViewDelegate { ...@@ -138,7 +163,7 @@ extension YHEditPersonalProfileViewController: UITextViewDelegate {
} }
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = (textView.text as NSString).length + text.count - range.length let newLength = (textView.text as NSString).length + text.count - range.length
viewModel.didChange = true
return newLength <= 200 return newLength <= 200
} }
} }
...@@ -87,6 +87,29 @@ class YHEditSchoolViewController: YHBaseViewController { ...@@ -87,6 +87,29 @@ class YHEditSchoolViewController: YHBaseViewController {
} }
} }
} }
override func backItemClick(_ sender: Any) {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
} else {
self.navigationController?.popViewController()
}
}
/// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
return false
}
return true
}
} }
extension YHEditSchoolViewController: UITableViewDelegate, UITableViewDataSource { extension YHEditSchoolViewController: UITableViewDelegate, UITableViewDataSource {
......
...@@ -87,6 +87,29 @@ class YHEditWorkViewController: YHBaseViewController { ...@@ -87,6 +87,29 @@ class YHEditWorkViewController: YHBaseViewController {
} }
} }
} }
override func backItemClick(_ sender: Any) {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
} else {
self.navigationController?.popViewController()
}
}
/// 是否可以返回,包括点击返回和手势返回,默认YES
override func navigationShouldPop() -> Bool {
if viewModel.didChange {
YHCommonAlertView.show("", "您尚未保存修改,确定关闭吗?", "关闭", "保存") {
self.navigationController?.popViewController()
} callBack: {
}
return false
}
return true
}
} }
extension YHEditWorkViewController: UITableViewDelegate, UITableViewDataSource { extension YHEditWorkViewController: UITableViewDelegate, UITableViewDataSource {
......
...@@ -10,6 +10,7 @@ import UIKit ...@@ -10,6 +10,7 @@ import UIKit
class YHEditViewModel: YHBaseViewModel { class YHEditViewModel: YHBaseViewModel {
var model: YHUserNameCardInfo = YHUserNameCardInfo() var model: YHUserNameCardInfo = YHUserNameCardInfo()
var didChange: Bool = false
override init() { override init() {
super.init() super.init()
} }
...@@ -77,6 +78,7 @@ class YHEditViewModel: YHBaseViewModel { ...@@ -77,6 +78,7 @@ class YHEditViewModel: YHBaseViewModel {
case .id10: case .id10:
model.companyName = item.message ?? "" model.companyName = item.message ?? ""
} }
didChange = true
} }
func getBaseSchoolDataSource() -> [YHUserInformationModel] { func getBaseSchoolDataSource() -> [YHUserInformationModel] {
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "hk_event_picture_save@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "hk_event_picture_save@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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