IHActivityHistoryManager.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // IHActivityHistoryManager.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/19.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHActivityHistoryManager: NSObject,IHViewManagerProtocolDelegate{
  10. private var page = 1
  11. lazy var mainView: IHActivityHistoryView = {
  12. let mainView = IHActivityHistoryView()
  13. mainView.delegate = self
  14. return mainView
  15. }()
  16. private weak var vc : UIViewController?
  17. func bindController(_ vc: UIViewController) {
  18. self.vc = vc
  19. createUI()
  20. IHActivityService.share.getLoglist(1, requestSuccess: { (issuccess, msg) in
  21. if issuccess == false{
  22. //发送错误信息
  23. }
  24. }) {
  25. //发送错误信息
  26. }
  27. }
  28. func createUI() {
  29. self.vc?.navigationBarTitle = "操作日志"
  30. mainView.frame = CGRect(x: 0, y: 0, width: KSCREENWIDTH, height: KSCREENHEIGHT - KNavBarHeight )
  31. self.vc?.view.addSubview(mainView)
  32. }
  33. }
  34. extension IHActivityHistoryManager:IHActivityHistoryViewDelegate {
  35. func tableViewEsAddPullToRefresh() {
  36. page = 1
  37. IHActivityService.share.getLoglist(page, requestSuccess: { (issuccess, msg) in
  38. self.mainView.endRefresh()
  39. if issuccess == false{
  40. //发送错误信息
  41. }
  42. }) {
  43. //发送错误信息
  44. self.mainView.endRefresh()
  45. }
  46. }
  47. func tableViewEsAddInfiniteScrolling() {
  48. page += 1
  49. IHActivityService.share.getLoglist(page, requestSuccess: { (issuccess, msg) in
  50. self.mainView.endRefresh()
  51. if issuccess == false{
  52. //发送错误信息
  53. }
  54. }) {
  55. //发送错误信息
  56. self.mainView.endRefresh()
  57. }
  58. }
  59. }