diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage/ViewControllers/Mine/MineViewController.swift b/Meterage/ViewControllers/Mine/MineViewController.swift index 78cfc77..766bed0 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.swift +++ b/Meterage/ViewControllers/Mine/MineViewController.swift @@ -15,6 +15,7 @@ @IBOutlet weak var userAvatarView: UIImageView! @IBOutlet weak var userNameView: UILabel! @IBOutlet weak var userDeptView: UILabel! + @IBOutlet weak var noticeView: UIImageView! @IBOutlet weak var noticeCountView: UILabel! @IBOutlet weak var tableView: UITableView! @@ -33,6 +34,11 @@ noticeCountView.layer.cornerRadius = 7 noticeCountView.layer.masksToBounds = true + /// 给UIImageView添加点击事件 + let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClick)) + noticeView.addGestureRecognizer(singleTapGesture) + noticeView.isUserInteractionEnabled = true + tableView.register(UINib(nibName: "MineTableViewCell", bundle: nil), forCellReuseIdentifier: "mineTableViewCell") tableView.dataSource = self tableView.delegate = self @@ -74,6 +80,14 @@ } } + /// 消息图标点击事件 + @objc func imageViewClick(){ + let destinationController = NoticeListViewController(nibName: "NoticeListViewController", bundle: nil) + let navigation = UINavigationController(rootViewController: destinationController) + navigation.modalPresentationStyle = UIModalPresentationStyle.fullScreen + present(navigation, animated: true, completion: nil) + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage/ViewControllers/Mine/MineViewController.swift b/Meterage/ViewControllers/Mine/MineViewController.swift index 78cfc77..766bed0 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.swift +++ b/Meterage/ViewControllers/Mine/MineViewController.swift @@ -15,6 +15,7 @@ @IBOutlet weak var userAvatarView: UIImageView! @IBOutlet weak var userNameView: UILabel! @IBOutlet weak var userDeptView: UILabel! + @IBOutlet weak var noticeView: UIImageView! @IBOutlet weak var noticeCountView: UILabel! @IBOutlet weak var tableView: UITableView! @@ -33,6 +34,11 @@ noticeCountView.layer.cornerRadius = 7 noticeCountView.layer.masksToBounds = true + /// 给UIImageView添加点击事件 + let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClick)) + noticeView.addGestureRecognizer(singleTapGesture) + noticeView.isUserInteractionEnabled = true + tableView.register(UINib(nibName: "MineTableViewCell", bundle: nil), forCellReuseIdentifier: "mineTableViewCell") tableView.dataSource = self tableView.delegate = self @@ -74,6 +80,14 @@ } } + /// 消息图标点击事件 + @objc func imageViewClick(){ + let destinationController = NoticeListViewController(nibName: "NoticeListViewController", bundle: nil) + let navigation = UINavigationController(rootViewController: destinationController) + navigation.modalPresentationStyle = UIModalPresentationStyle.fullScreen + present(navigation, animated: true, completion: nil) + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } diff --git a/Meterage/ViewControllers/Mine/MineViewController.xib b/Meterage/ViewControllers/Mine/MineViewController.xib index 09c76b0..deb35d7 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.xib +++ b/Meterage/ViewControllers/Mine/MineViewController.xib @@ -12,6 +12,7 @@ + diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage/ViewControllers/Mine/MineViewController.swift b/Meterage/ViewControllers/Mine/MineViewController.swift index 78cfc77..766bed0 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.swift +++ b/Meterage/ViewControllers/Mine/MineViewController.swift @@ -15,6 +15,7 @@ @IBOutlet weak var userAvatarView: UIImageView! @IBOutlet weak var userNameView: UILabel! @IBOutlet weak var userDeptView: UILabel! + @IBOutlet weak var noticeView: UIImageView! @IBOutlet weak var noticeCountView: UILabel! @IBOutlet weak var tableView: UITableView! @@ -33,6 +34,11 @@ noticeCountView.layer.cornerRadius = 7 noticeCountView.layer.masksToBounds = true + /// 给UIImageView添加点击事件 + let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClick)) + noticeView.addGestureRecognizer(singleTapGesture) + noticeView.isUserInteractionEnabled = true + tableView.register(UINib(nibName: "MineTableViewCell", bundle: nil), forCellReuseIdentifier: "mineTableViewCell") tableView.dataSource = self tableView.delegate = self @@ -74,6 +80,14 @@ } } + /// 消息图标点击事件 + @objc func imageViewClick(){ + let destinationController = NoticeListViewController(nibName: "NoticeListViewController", bundle: nil) + let navigation = UINavigationController(rootViewController: destinationController) + navigation.modalPresentationStyle = UIModalPresentationStyle.fullScreen + present(navigation, animated: true, completion: nil) + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } diff --git a/Meterage/ViewControllers/Mine/MineViewController.xib b/Meterage/ViewControllers/Mine/MineViewController.xib index 09c76b0..deb35d7 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.xib +++ b/Meterage/ViewControllers/Mine/MineViewController.xib @@ -12,6 +12,7 @@ + diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift new file mode 100644 index 0000000..005dcf4 --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift @@ -0,0 +1,111 @@ +// +// NoticeDetailViewController.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Alamofire +import UIKit +import DefaultsKit +import SwiftyJSON +import RichTextView + +class NoticeDetailViewController: UIViewController, TransferValueDelegate, UIScrollViewDelegate { + + private var paramDic: [String: Any] = [:] + + func transfer(controller: UIViewController, dic: [String: Any]) { + paramDic = dic + } + + @IBOutlet weak var noticeDateView: UILabel! + @IBOutlet weak var noticePublisherView: UILabel! + @IBOutlet weak var noticeCompanyView: UILabel! + @IBOutlet weak var noticeNoView: UILabel! + @IBOutlet weak var noticeTitleView: UILabel! + @IBOutlet weak var noticeSketchView: UILabel! + @IBOutlet weak var minioFileView: UILabel! + + private let defaults = Defaults.shared + private let device = DeviceSizeUtil.shared + + private var htmlScrollView: UIScrollView! + private var htmlLabelView: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .mainBackground + navigationItem.title = "通知公告" + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.mainTextColor] + // Do any additional setup after loading the view. + + //数据请求 + let baseURL = defaults.get(for: serverConfigKey)! + let token = defaults.get(for: tokenKey) ?? "" + let noticeListURL = baseURL + Constant.noticeList.rawValue + "?limit=20&offset=1" + let paramDic: [String: Any] = ["noticeNo": paramDic["noticeNo"]!, "noticeTitle": paramDic["noticeTitle"]!, "noticePublisher": paramDic["noticePublisher"]!, "noticeStartTime": "", "noticeEndTime": ""] + Alamofire.request(HttpRequestCreator.shared.createPostRequest(url: noticeListURL, dic: paramDic, token: token)).responseJSON { [self] response in + switch response.result { + case let .success(value): + let notice = NoticeListModel(respJson: JSON(value)).data.rows[0] + noticeDateView.text = notice.noticeTime + noticePublisherView.text = "发布人 \(String(describing: notice.noticePublisher!))" + noticeCompanyView.text = "发布单位 \(String(describing: notice.noticeCompany!))" + + noticeNoView.text = notice.noticeNo + noticeTitleView.text = notice.noticeTitle + noticeSketchView.text = notice.noticeSketch + + htmlScrollView = UIScrollView() + htmlScrollView.layer.cornerRadius = 7 + htmlScrollView.layer.masksToBounds = true + htmlScrollView.backgroundColor = .white + htmlScrollView.delegate = self + view.addSubview(htmlScrollView) + let safeAreaHeight = device.getSafeAreaFrame(self).height + let htmlScrollViewHeight = safeAreaHeight - 80 - 105 - 35 - 2 * 10 + htmlScrollView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.width.equalTo(SCREEN_WIDTH - 20) + make.height.equalTo(htmlScrollViewHeight - 20) + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(205) + } + + let strHtml = notice.noticeContent! + htmlLabelView = UILabel(frame: CGRect(x: 0, y: 0, width: (SCREEN_WIDTH - 20), height: htmlScrollViewHeight - 20)) + htmlScrollView.addSubview(htmlLabelView) + htmlLabelView.layer.cornerRadius = 10 + htmlLabelView.layer.masksToBounds = true + htmlLabelView.text = notice.noticeContent + htmlLabelView.numberOfLines = 0 //Line break when the current line is full display. + htmlLabelView.lineBreakMode = NSLineBreakMode.byClipping; //Tips:Supported six types. + do { + let srtData = strHtml.data(using: .unicode, allowLossyConversion: true)! + let strOptions = [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html]//Tips:Supported four types. + let attrStr = try NSAttributedString(data: srtData, options: strOptions, documentAttributes: nil) + htmlLabelView.attributedText = attrStr + } catch let error as NSError { + print(error.localizedDescription) + } + + if notice.minioFileName == nil { + minioFileView.text = "暂无附件" + } else { + if notice.minioFileName!.isEmpty { + minioFileView.text = "暂无附件" + } else { + let minioFileName = notice.minioFileName! + let minioFileAttrStr: NSMutableAttributedString = NSMutableAttributedString(string: minioFileName) + let range: NSRange = NSRange(location: 0, length: minioFileName.count) + minioFileAttrStr.addAttribute(.underlineStyle, value: 1, range: range) + minioFileView.attributedText = minioFileAttrStr + minioFileView.textColor = .mainThemeColor + } + } + case .failure: + AlertHub.shared.showWaringAlert(controller: self, message: "请求失败,请检查网络") + } + } + } +} diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage/ViewControllers/Mine/MineViewController.swift b/Meterage/ViewControllers/Mine/MineViewController.swift index 78cfc77..766bed0 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.swift +++ b/Meterage/ViewControllers/Mine/MineViewController.swift @@ -15,6 +15,7 @@ @IBOutlet weak var userAvatarView: UIImageView! @IBOutlet weak var userNameView: UILabel! @IBOutlet weak var userDeptView: UILabel! + @IBOutlet weak var noticeView: UIImageView! @IBOutlet weak var noticeCountView: UILabel! @IBOutlet weak var tableView: UITableView! @@ -33,6 +34,11 @@ noticeCountView.layer.cornerRadius = 7 noticeCountView.layer.masksToBounds = true + /// 给UIImageView添加点击事件 + let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClick)) + noticeView.addGestureRecognizer(singleTapGesture) + noticeView.isUserInteractionEnabled = true + tableView.register(UINib(nibName: "MineTableViewCell", bundle: nil), forCellReuseIdentifier: "mineTableViewCell") tableView.dataSource = self tableView.delegate = self @@ -74,6 +80,14 @@ } } + /// 消息图标点击事件 + @objc func imageViewClick(){ + let destinationController = NoticeListViewController(nibName: "NoticeListViewController", bundle: nil) + let navigation = UINavigationController(rootViewController: destinationController) + navigation.modalPresentationStyle = UIModalPresentationStyle.fullScreen + present(navigation, animated: true, completion: nil) + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } diff --git a/Meterage/ViewControllers/Mine/MineViewController.xib b/Meterage/ViewControllers/Mine/MineViewController.xib index 09c76b0..deb35d7 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.xib +++ b/Meterage/ViewControllers/Mine/MineViewController.xib @@ -12,6 +12,7 @@ + diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift new file mode 100644 index 0000000..005dcf4 --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift @@ -0,0 +1,111 @@ +// +// NoticeDetailViewController.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Alamofire +import UIKit +import DefaultsKit +import SwiftyJSON +import RichTextView + +class NoticeDetailViewController: UIViewController, TransferValueDelegate, UIScrollViewDelegate { + + private var paramDic: [String: Any] = [:] + + func transfer(controller: UIViewController, dic: [String: Any]) { + paramDic = dic + } + + @IBOutlet weak var noticeDateView: UILabel! + @IBOutlet weak var noticePublisherView: UILabel! + @IBOutlet weak var noticeCompanyView: UILabel! + @IBOutlet weak var noticeNoView: UILabel! + @IBOutlet weak var noticeTitleView: UILabel! + @IBOutlet weak var noticeSketchView: UILabel! + @IBOutlet weak var minioFileView: UILabel! + + private let defaults = Defaults.shared + private let device = DeviceSizeUtil.shared + + private var htmlScrollView: UIScrollView! + private var htmlLabelView: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .mainBackground + navigationItem.title = "通知公告" + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.mainTextColor] + // Do any additional setup after loading the view. + + //数据请求 + let baseURL = defaults.get(for: serverConfigKey)! + let token = defaults.get(for: tokenKey) ?? "" + let noticeListURL = baseURL + Constant.noticeList.rawValue + "?limit=20&offset=1" + let paramDic: [String: Any] = ["noticeNo": paramDic["noticeNo"]!, "noticeTitle": paramDic["noticeTitle"]!, "noticePublisher": paramDic["noticePublisher"]!, "noticeStartTime": "", "noticeEndTime": ""] + Alamofire.request(HttpRequestCreator.shared.createPostRequest(url: noticeListURL, dic: paramDic, token: token)).responseJSON { [self] response in + switch response.result { + case let .success(value): + let notice = NoticeListModel(respJson: JSON(value)).data.rows[0] + noticeDateView.text = notice.noticeTime + noticePublisherView.text = "发布人 \(String(describing: notice.noticePublisher!))" + noticeCompanyView.text = "发布单位 \(String(describing: notice.noticeCompany!))" + + noticeNoView.text = notice.noticeNo + noticeTitleView.text = notice.noticeTitle + noticeSketchView.text = notice.noticeSketch + + htmlScrollView = UIScrollView() + htmlScrollView.layer.cornerRadius = 7 + htmlScrollView.layer.masksToBounds = true + htmlScrollView.backgroundColor = .white + htmlScrollView.delegate = self + view.addSubview(htmlScrollView) + let safeAreaHeight = device.getSafeAreaFrame(self).height + let htmlScrollViewHeight = safeAreaHeight - 80 - 105 - 35 - 2 * 10 + htmlScrollView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.width.equalTo(SCREEN_WIDTH - 20) + make.height.equalTo(htmlScrollViewHeight - 20) + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(205) + } + + let strHtml = notice.noticeContent! + htmlLabelView = UILabel(frame: CGRect(x: 0, y: 0, width: (SCREEN_WIDTH - 20), height: htmlScrollViewHeight - 20)) + htmlScrollView.addSubview(htmlLabelView) + htmlLabelView.layer.cornerRadius = 10 + htmlLabelView.layer.masksToBounds = true + htmlLabelView.text = notice.noticeContent + htmlLabelView.numberOfLines = 0 //Line break when the current line is full display. + htmlLabelView.lineBreakMode = NSLineBreakMode.byClipping; //Tips:Supported six types. + do { + let srtData = strHtml.data(using: .unicode, allowLossyConversion: true)! + let strOptions = [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html]//Tips:Supported four types. + let attrStr = try NSAttributedString(data: srtData, options: strOptions, documentAttributes: nil) + htmlLabelView.attributedText = attrStr + } catch let error as NSError { + print(error.localizedDescription) + } + + if notice.minioFileName == nil { + minioFileView.text = "暂无附件" + } else { + if notice.minioFileName!.isEmpty { + minioFileView.text = "暂无附件" + } else { + let minioFileName = notice.minioFileName! + let minioFileAttrStr: NSMutableAttributedString = NSMutableAttributedString(string: minioFileName) + let range: NSRange = NSRange(location: 0, length: minioFileName.count) + minioFileAttrStr.addAttribute(.underlineStyle, value: 1, range: range) + minioFileView.attributedText = minioFileAttrStr + minioFileView.textColor = .mainThemeColor + } + } + case .failure: + AlertHub.shared.showWaringAlert(controller: self, message: "请求失败,请检查网络") + } + } + } +} diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib b/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib new file mode 100644 index 0000000..e33b72f --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage/ViewControllers/Mine/MineViewController.swift b/Meterage/ViewControllers/Mine/MineViewController.swift index 78cfc77..766bed0 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.swift +++ b/Meterage/ViewControllers/Mine/MineViewController.swift @@ -15,6 +15,7 @@ @IBOutlet weak var userAvatarView: UIImageView! @IBOutlet weak var userNameView: UILabel! @IBOutlet weak var userDeptView: UILabel! + @IBOutlet weak var noticeView: UIImageView! @IBOutlet weak var noticeCountView: UILabel! @IBOutlet weak var tableView: UITableView! @@ -33,6 +34,11 @@ noticeCountView.layer.cornerRadius = 7 noticeCountView.layer.masksToBounds = true + /// 给UIImageView添加点击事件 + let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClick)) + noticeView.addGestureRecognizer(singleTapGesture) + noticeView.isUserInteractionEnabled = true + tableView.register(UINib(nibName: "MineTableViewCell", bundle: nil), forCellReuseIdentifier: "mineTableViewCell") tableView.dataSource = self tableView.delegate = self @@ -74,6 +80,14 @@ } } + /// 消息图标点击事件 + @objc func imageViewClick(){ + let destinationController = NoticeListViewController(nibName: "NoticeListViewController", bundle: nil) + let navigation = UINavigationController(rootViewController: destinationController) + navigation.modalPresentationStyle = UIModalPresentationStyle.fullScreen + present(navigation, animated: true, completion: nil) + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } diff --git a/Meterage/ViewControllers/Mine/MineViewController.xib b/Meterage/ViewControllers/Mine/MineViewController.xib index 09c76b0..deb35d7 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.xib +++ b/Meterage/ViewControllers/Mine/MineViewController.xib @@ -12,6 +12,7 @@ + diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift new file mode 100644 index 0000000..005dcf4 --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift @@ -0,0 +1,111 @@ +// +// NoticeDetailViewController.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Alamofire +import UIKit +import DefaultsKit +import SwiftyJSON +import RichTextView + +class NoticeDetailViewController: UIViewController, TransferValueDelegate, UIScrollViewDelegate { + + private var paramDic: [String: Any] = [:] + + func transfer(controller: UIViewController, dic: [String: Any]) { + paramDic = dic + } + + @IBOutlet weak var noticeDateView: UILabel! + @IBOutlet weak var noticePublisherView: UILabel! + @IBOutlet weak var noticeCompanyView: UILabel! + @IBOutlet weak var noticeNoView: UILabel! + @IBOutlet weak var noticeTitleView: UILabel! + @IBOutlet weak var noticeSketchView: UILabel! + @IBOutlet weak var minioFileView: UILabel! + + private let defaults = Defaults.shared + private let device = DeviceSizeUtil.shared + + private var htmlScrollView: UIScrollView! + private var htmlLabelView: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .mainBackground + navigationItem.title = "通知公告" + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.mainTextColor] + // Do any additional setup after loading the view. + + //数据请求 + let baseURL = defaults.get(for: serverConfigKey)! + let token = defaults.get(for: tokenKey) ?? "" + let noticeListURL = baseURL + Constant.noticeList.rawValue + "?limit=20&offset=1" + let paramDic: [String: Any] = ["noticeNo": paramDic["noticeNo"]!, "noticeTitle": paramDic["noticeTitle"]!, "noticePublisher": paramDic["noticePublisher"]!, "noticeStartTime": "", "noticeEndTime": ""] + Alamofire.request(HttpRequestCreator.shared.createPostRequest(url: noticeListURL, dic: paramDic, token: token)).responseJSON { [self] response in + switch response.result { + case let .success(value): + let notice = NoticeListModel(respJson: JSON(value)).data.rows[0] + noticeDateView.text = notice.noticeTime + noticePublisherView.text = "发布人 \(String(describing: notice.noticePublisher!))" + noticeCompanyView.text = "发布单位 \(String(describing: notice.noticeCompany!))" + + noticeNoView.text = notice.noticeNo + noticeTitleView.text = notice.noticeTitle + noticeSketchView.text = notice.noticeSketch + + htmlScrollView = UIScrollView() + htmlScrollView.layer.cornerRadius = 7 + htmlScrollView.layer.masksToBounds = true + htmlScrollView.backgroundColor = .white + htmlScrollView.delegate = self + view.addSubview(htmlScrollView) + let safeAreaHeight = device.getSafeAreaFrame(self).height + let htmlScrollViewHeight = safeAreaHeight - 80 - 105 - 35 - 2 * 10 + htmlScrollView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.width.equalTo(SCREEN_WIDTH - 20) + make.height.equalTo(htmlScrollViewHeight - 20) + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(205) + } + + let strHtml = notice.noticeContent! + htmlLabelView = UILabel(frame: CGRect(x: 0, y: 0, width: (SCREEN_WIDTH - 20), height: htmlScrollViewHeight - 20)) + htmlScrollView.addSubview(htmlLabelView) + htmlLabelView.layer.cornerRadius = 10 + htmlLabelView.layer.masksToBounds = true + htmlLabelView.text = notice.noticeContent + htmlLabelView.numberOfLines = 0 //Line break when the current line is full display. + htmlLabelView.lineBreakMode = NSLineBreakMode.byClipping; //Tips:Supported six types. + do { + let srtData = strHtml.data(using: .unicode, allowLossyConversion: true)! + let strOptions = [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html]//Tips:Supported four types. + let attrStr = try NSAttributedString(data: srtData, options: strOptions, documentAttributes: nil) + htmlLabelView.attributedText = attrStr + } catch let error as NSError { + print(error.localizedDescription) + } + + if notice.minioFileName == nil { + minioFileView.text = "暂无附件" + } else { + if notice.minioFileName!.isEmpty { + minioFileView.text = "暂无附件" + } else { + let minioFileName = notice.minioFileName! + let minioFileAttrStr: NSMutableAttributedString = NSMutableAttributedString(string: minioFileName) + let range: NSRange = NSRange(location: 0, length: minioFileName.count) + minioFileAttrStr.addAttribute(.underlineStyle, value: 1, range: range) + minioFileView.attributedText = minioFileAttrStr + minioFileView.textColor = .mainThemeColor + } + } + case .failure: + AlertHub.shared.showWaringAlert(controller: self, message: "请求失败,请检查网络") + } + } + } +} diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib b/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib new file mode 100644 index 0000000..e33b72f --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Meterage/ViewControllers/Notice/NoticeListViewController.swift b/Meterage/ViewControllers/Notice/NoticeListViewController.swift index aa9159e..ad56bd3 100644 --- a/Meterage/ViewControllers/Notice/NoticeListViewController.swift +++ b/Meterage/ViewControllers/Notice/NoticeListViewController.swift @@ -20,6 +20,7 @@ private var isUpdate: Bool = false private var rowsArray: [RowModel] = [] private let defaults = Defaults.shared + private var valueDelegate: TransferValueDelegate! override func viewDidLoad() { super.viewDidLoad() @@ -64,6 +65,7 @@ let token = defaults.get(for: tokenKey) ?? "" let paramDic: [String: Any] = ["noticeNo": "", "noticeTitle": "", "noticePublisher": "", "noticeStartTime": "", "noticeEndTime": ""] +// LoadingHub.shared.showLoading(text: "数据加载中,请稍后") Alamofire.request(HttpRequestCreator.shared.createPostRequest(url: noticeListURL, dic: paramDic, token: token)).responseJSON { [self] response in switch response.result { case let .success(value): @@ -81,8 +83,10 @@ } else { AlertHub.shared.showWaringAlert(controller: self, message: "数据加载失败,请重试") } +// LoadingHub.shared.hideLoading() case .failure: AlertHub.shared.showWaringAlert(controller: self, message: "未知错误") +// LoadingHub.shared.hideLoading() } } } @@ -115,14 +119,15 @@ } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { -// let mapViewController = InspectMapViewController(nibName: "InspectMapViewController", bundle: nil) -// // 委托代理 -// valueDelegate = mapViewController -// // 实现代理的方法,传值 -// let row = (indexPath as NSIndexPath).row -// let model = rowsArray[row] -// valueDelegate.transfer(controller: self, dic: ["id": model.id]) -// navigationController?.pushViewController(mapViewController, animated: true) + let detailViewController = NoticeDetailViewController(nibName: "NoticeDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let paramDic: [String: Any] = ["noticeNo": model.noticeNo!, "noticeTitle": model.noticeTitle!, "noticePublisher": model.noticePublisher!, "noticeStartTime": "", "noticeEndTime": ""] + valueDelegate.transfer(controller: self, dic: paramDic) + navigationController?.pushViewController(detailViewController, animated: true) } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { diff --git a/Meterage.xcodeproj/project.pbxproj b/Meterage.xcodeproj/project.pbxproj index 6985f9e..f79f99b 100644 --- a/Meterage.xcodeproj/project.pbxproj +++ b/Meterage.xcodeproj/project.pbxproj @@ -34,6 +34,9 @@ 65A55E452990CE5F00093341 /* NoticeListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E432990CE5F00093341 /* NoticeListViewController.xib */; }; 65A55E482990E22F00093341 /* NoticeListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */; }; 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */; }; + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */; }; + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */; }; + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */; }; 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */; }; 65AEA690298A632B00B8FF09 /* HomePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */; }; 65AEA691298A632B00B8FF09 /* HomePageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */; }; @@ -90,6 +93,9 @@ 65A55E432990CE5F00093341 /* NoticeListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListViewController.xib; sourceTree = ""; }; 65A55E462990E22F00093341 /* NoticeListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListTableViewCell.swift; sourceTree = ""; }; 65A55E472990E22F00093341 /* NoticeListTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeListTableViewCell.xib; sourceTree = ""; }; + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferValueDelegate.swift; sourceTree = ""; }; + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeDetailViewController.swift; sourceTree = ""; }; + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeDetailViewController.xib; sourceTree = ""; }; 65AEA683298A5F9500B8FF09 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 65AEA68E298A632B00B8FF09 /* HomePageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageViewController.swift; sourceTree = ""; }; 65AEA68F298A632B00B8FF09 /* HomePageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomePageViewController.xib; sourceTree = ""; }; @@ -149,6 +155,7 @@ 2CD9B3CCE520A689E073AA57 /* Meterage */ = { isa = PBXGroup; children = ( + 65A55E4A2990F03F00093341 /* Protocol */, 65BF61D0298BC08600F99671 /* Cells */, 65AEA6AA298B603700B8FF09 /* Utils */, 65AEA6A2298A651900B8FF09 /* Model */, @@ -186,10 +193,20 @@ children = ( 65A55E422990CE5F00093341 /* NoticeListViewController.swift */, 65A55E432990CE5F00093341 /* NoticeListViewController.xib */, + 65A55E4D2990F08200093341 /* NoticeDetailViewController.swift */, + 65A55E4E2990F08200093341 /* NoticeDetailViewController.xib */, ); path = Notice; sourceTree = ""; }; + 65A55E4A2990F03F00093341 /* Protocol */ = { + isa = PBXGroup; + children = ( + 65A55E4B2990F04D00093341 /* TransferValueDelegate.swift */, + ); + path = Protocol; + sourceTree = ""; + }; 65AEA68A298A62FC00B8FF09 /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -382,6 +399,7 @@ 65A55E38299089CA00093341 /* TotalTaskTableViewCell.xib in Resources */, 65A55E402990972800093341 /* UnderTaskTableViewCell.xib in Resources */, 65A55E492990E22F00093341 /* NoticeListTableViewCell.xib in Resources */, + 65A55E502990F08200093341 /* NoticeDetailViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,6 +483,7 @@ 65AEA69D298A649F00B8FF09 /* LoginViewController.swift in Sources */, 65A55E31298D17AD00093341 /* TotalTaskViewController.swift in Sources */, 65AEA6A1298A64EE00B8FF09 /* UIColor.swift in Sources */, + 65A55E4F2990F08200093341 /* NoticeDetailViewController.swift in Sources */, 65AEA6B2298B642400B8FF09 /* BaseConfigModel.swift in Sources */, 65AEA6A8298A69D500B8FF09 /* GuideViewController.swift in Sources */, 65AEA684298A5F9500B8FF09 /* AppCoordinator.swift in Sources */, @@ -473,6 +492,7 @@ 65BF61D3298BC0A900F99671 /* MineTableViewCell.swift in Sources */, 65A55E3F2990972800093341 /* UnderTaskTableViewCell.swift in Sources */, 65AEA6B4298B64DC00B8FF09 /* LoginResultModel.swift in Sources */, + 65A55E4C2990F04D00093341 /* TransferValueDelegate.swift in Sources */, 65A55E25298D0A2000093341 /* SampleCollectionViewCell.swift in Sources */, 65AEA6A4298A652700B8FF09 /* MenuItemModel.swift in Sources */, 2CD9B9317E39E14700E7C9C2 /* AppDelegate.swift in Sources */, diff --git a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate index 0ab1ab7..03edd5f 100644 --- a/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate +++ b/Meterage.xcworkspace/xcuserdata/a203.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ diff --git a/Meterage/Protocol/TransferValueDelegate.swift b/Meterage/Protocol/TransferValueDelegate.swift new file mode 100644 index 0000000..03eebbf --- /dev/null +++ b/Meterage/Protocol/TransferValueDelegate.swift @@ -0,0 +1,14 @@ +// +// TransferValueDelegate.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Foundation +import UIKit + +protocol TransferValueDelegate: NSObjectProtocol { + // 传递字典类型数据 + func transfer(controller: UIViewController, dic: [String: Any]) +} diff --git a/Meterage/ViewControllers/Mine/MineViewController.swift b/Meterage/ViewControllers/Mine/MineViewController.swift index 78cfc77..766bed0 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.swift +++ b/Meterage/ViewControllers/Mine/MineViewController.swift @@ -15,6 +15,7 @@ @IBOutlet weak var userAvatarView: UIImageView! @IBOutlet weak var userNameView: UILabel! @IBOutlet weak var userDeptView: UILabel! + @IBOutlet weak var noticeView: UIImageView! @IBOutlet weak var noticeCountView: UILabel! @IBOutlet weak var tableView: UITableView! @@ -33,6 +34,11 @@ noticeCountView.layer.cornerRadius = 7 noticeCountView.layer.masksToBounds = true + /// 给UIImageView添加点击事件 + let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(imageViewClick)) + noticeView.addGestureRecognizer(singleTapGesture) + noticeView.isUserInteractionEnabled = true + tableView.register(UINib(nibName: "MineTableViewCell", bundle: nil), forCellReuseIdentifier: "mineTableViewCell") tableView.dataSource = self tableView.delegate = self @@ -74,6 +80,14 @@ } } + /// 消息图标点击事件 + @objc func imageViewClick(){ + let destinationController = NoticeListViewController(nibName: "NoticeListViewController", bundle: nil) + let navigation = UINavigationController(rootViewController: destinationController) + navigation.modalPresentationStyle = UIModalPresentationStyle.fullScreen + present(navigation, animated: true, completion: nil) + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 60 } diff --git a/Meterage/ViewControllers/Mine/MineViewController.xib b/Meterage/ViewControllers/Mine/MineViewController.xib index 09c76b0..deb35d7 100644 --- a/Meterage/ViewControllers/Mine/MineViewController.xib +++ b/Meterage/ViewControllers/Mine/MineViewController.xib @@ -12,6 +12,7 @@ + diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift new file mode 100644 index 0000000..005dcf4 --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.swift @@ -0,0 +1,111 @@ +// +// NoticeDetailViewController.swift +// Meterage +// +// Created by 203 on 2023/2/6. +// + +import Alamofire +import UIKit +import DefaultsKit +import SwiftyJSON +import RichTextView + +class NoticeDetailViewController: UIViewController, TransferValueDelegate, UIScrollViewDelegate { + + private var paramDic: [String: Any] = [:] + + func transfer(controller: UIViewController, dic: [String: Any]) { + paramDic = dic + } + + @IBOutlet weak var noticeDateView: UILabel! + @IBOutlet weak var noticePublisherView: UILabel! + @IBOutlet weak var noticeCompanyView: UILabel! + @IBOutlet weak var noticeNoView: UILabel! + @IBOutlet weak var noticeTitleView: UILabel! + @IBOutlet weak var noticeSketchView: UILabel! + @IBOutlet weak var minioFileView: UILabel! + + private let defaults = Defaults.shared + private let device = DeviceSizeUtil.shared + + private var htmlScrollView: UIScrollView! + private var htmlLabelView: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .mainBackground + navigationItem.title = "通知公告" + navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.mainTextColor] + // Do any additional setup after loading the view. + + //数据请求 + let baseURL = defaults.get(for: serverConfigKey)! + let token = defaults.get(for: tokenKey) ?? "" + let noticeListURL = baseURL + Constant.noticeList.rawValue + "?limit=20&offset=1" + let paramDic: [String: Any] = ["noticeNo": paramDic["noticeNo"]!, "noticeTitle": paramDic["noticeTitle"]!, "noticePublisher": paramDic["noticePublisher"]!, "noticeStartTime": "", "noticeEndTime": ""] + Alamofire.request(HttpRequestCreator.shared.createPostRequest(url: noticeListURL, dic: paramDic, token: token)).responseJSON { [self] response in + switch response.result { + case let .success(value): + let notice = NoticeListModel(respJson: JSON(value)).data.rows[0] + noticeDateView.text = notice.noticeTime + noticePublisherView.text = "发布人 \(String(describing: notice.noticePublisher!))" + noticeCompanyView.text = "发布单位 \(String(describing: notice.noticeCompany!))" + + noticeNoView.text = notice.noticeNo + noticeTitleView.text = notice.noticeTitle + noticeSketchView.text = notice.noticeSketch + + htmlScrollView = UIScrollView() + htmlScrollView.layer.cornerRadius = 7 + htmlScrollView.layer.masksToBounds = true + htmlScrollView.backgroundColor = .white + htmlScrollView.delegate = self + view.addSubview(htmlScrollView) + let safeAreaHeight = device.getSafeAreaFrame(self).height + let htmlScrollViewHeight = safeAreaHeight - 80 - 105 - 35 - 2 * 10 + htmlScrollView.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.width.equalTo(SCREEN_WIDTH - 20) + make.height.equalTo(htmlScrollViewHeight - 20) + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(205) + } + + let strHtml = notice.noticeContent! + htmlLabelView = UILabel(frame: CGRect(x: 0, y: 0, width: (SCREEN_WIDTH - 20), height: htmlScrollViewHeight - 20)) + htmlScrollView.addSubview(htmlLabelView) + htmlLabelView.layer.cornerRadius = 10 + htmlLabelView.layer.masksToBounds = true + htmlLabelView.text = notice.noticeContent + htmlLabelView.numberOfLines = 0 //Line break when the current line is full display. + htmlLabelView.lineBreakMode = NSLineBreakMode.byClipping; //Tips:Supported six types. + do { + let srtData = strHtml.data(using: .unicode, allowLossyConversion: true)! + let strOptions = [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html]//Tips:Supported four types. + let attrStr = try NSAttributedString(data: srtData, options: strOptions, documentAttributes: nil) + htmlLabelView.attributedText = attrStr + } catch let error as NSError { + print(error.localizedDescription) + } + + if notice.minioFileName == nil { + minioFileView.text = "暂无附件" + } else { + if notice.minioFileName!.isEmpty { + minioFileView.text = "暂无附件" + } else { + let minioFileName = notice.minioFileName! + let minioFileAttrStr: NSMutableAttributedString = NSMutableAttributedString(string: minioFileName) + let range: NSRange = NSRange(location: 0, length: minioFileName.count) + minioFileAttrStr.addAttribute(.underlineStyle, value: 1, range: range) + minioFileView.attributedText = minioFileAttrStr + minioFileView.textColor = .mainThemeColor + } + } + case .failure: + AlertHub.shared.showWaringAlert(controller: self, message: "请求失败,请检查网络") + } + } + } +} diff --git a/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib b/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib new file mode 100644 index 0000000..e33b72f --- /dev/null +++ b/Meterage/ViewControllers/Notice/NoticeDetailViewController.xib @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Meterage/ViewControllers/Notice/NoticeListViewController.swift b/Meterage/ViewControllers/Notice/NoticeListViewController.swift index aa9159e..ad56bd3 100644 --- a/Meterage/ViewControllers/Notice/NoticeListViewController.swift +++ b/Meterage/ViewControllers/Notice/NoticeListViewController.swift @@ -20,6 +20,7 @@ private var isUpdate: Bool = false private var rowsArray: [RowModel] = [] private let defaults = Defaults.shared + private var valueDelegate: TransferValueDelegate! override func viewDidLoad() { super.viewDidLoad() @@ -64,6 +65,7 @@ let token = defaults.get(for: tokenKey) ?? "" let paramDic: [String: Any] = ["noticeNo": "", "noticeTitle": "", "noticePublisher": "", "noticeStartTime": "", "noticeEndTime": ""] +// LoadingHub.shared.showLoading(text: "数据加载中,请稍后") Alamofire.request(HttpRequestCreator.shared.createPostRequest(url: noticeListURL, dic: paramDic, token: token)).responseJSON { [self] response in switch response.result { case let .success(value): @@ -81,8 +83,10 @@ } else { AlertHub.shared.showWaringAlert(controller: self, message: "数据加载失败,请重试") } +// LoadingHub.shared.hideLoading() case .failure: AlertHub.shared.showWaringAlert(controller: self, message: "未知错误") +// LoadingHub.shared.hideLoading() } } } @@ -115,14 +119,15 @@ } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { -// let mapViewController = InspectMapViewController(nibName: "InspectMapViewController", bundle: nil) -// // 委托代理 -// valueDelegate = mapViewController -// // 实现代理的方法,传值 -// let row = (indexPath as NSIndexPath).row -// let model = rowsArray[row] -// valueDelegate.transfer(controller: self, dic: ["id": model.id]) -// navigationController?.pushViewController(mapViewController, animated: true) + let detailViewController = NoticeDetailViewController(nibName: "NoticeDetailViewController", bundle: nil) + // 委托代理 + valueDelegate = detailViewController + // 实现代理的方法,传值 + let row = (indexPath as NSIndexPath).row + let model = rowsArray[row] + let paramDic: [String: Any] = ["noticeNo": model.noticeNo!, "noticeTitle": model.noticeTitle!, "noticePublisher": model.noticePublisher!, "noticeStartTime": "", "noticeEndTime": ""] + valueDelegate.transfer(controller: self, dic: paramDic) + navigationController?.pushViewController(detailViewController, animated: true) } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { diff --git a/Podfile.lock b/Podfile.lock index 646e40d..db7311e 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -35,7 +35,7 @@ - HXPHPicker/Picker/Lite (1.4.6): - HXPHPicker/Core - IQKeyboardManagerSwift (6.5.11) - - Kingfisher (7.5.0) + - Kingfisher (7.6.0) - MBProgressHUD (1.2.0) - MJRefresh (3.7.5) - SnapKit (5.6.0) @@ -88,7 +88,7 @@ Hue: c129cb67be7d093a82bbbc30ce8a96757bf6f37a HXPHPicker: 44b541272c3066196da5d0af6d7f5ac61234b8cc IQKeyboardManagerSwift: c7955c0bdbf7b2eb29bb7daaa44e3d90f55a9a85 - Kingfisher: b9c2a4a4af2990a768445c277359b27bde287d71 + Kingfisher: b9bb0cd6907813593db268be80ddb931423c33b2 MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 MJRefresh: fdf5e979eb406a0341468932d1dfc8b7f9fce961 SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25