ApplyCardHelpListViewController.swift 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // HelpListViewController.swift
  3. // xingchuangke
  4. //
  5. // Created by Virgil on 2019/4/16.
  6. // Copyright © 2019 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. class ApplyCardHelpListViewController: BaseViewController, UITableViewDataSource, UITableViewDelegate {
  10. @IBOutlet weak var tableView: UITableView!
  11. override func viewDidLoad() {
  12. super.viewDidLoad()
  13. initNavLeftBackButton()
  14. self.title = "常见问题"
  15. tableView.register(UINib(nibName: "HelpListTableViewCell", bundle: nil), forCellReuseIdentifier: "HelpListTableViewCell")
  16. tableView.delegate = self
  17. tableView.dataSource = self
  18. tableView.separatorStyle = .none
  19. tableView.showsVerticalScrollIndicator = false
  20. tableView.estimatedRowHeight = 100
  21. tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {[weak self] in
  22. self!.currentPage = 1
  23. self!.loadData()
  24. })
  25. tableView.mj_header?.lastUpdatedTimeKey = "ShowTableViewCell"
  26. tableView.mj_footer = MJRefreshBackNormalFooter(refreshingBlock: {[weak self] in
  27. self!.currentPage += 1
  28. self!.loadData()
  29. })
  30. tableView.mj_header?.beginRefreshing()
  31. // Do any additional setup after loading the view.
  32. }
  33. //btnAddTarget(view: self.view, selector: #selector(self.btnMenuClick))
  34. @IBAction func btnMenuClick(_ sender: AnyObject) {
  35. switch (sender as! UIButton).tag {
  36. case 1001: // 在线客服
  37. break
  38. case 1002: // 电话客服
  39. if CommonUntils.getIsSimulator() {
  40. SVProgressHUD.showError(withStatus: "模拟器环境下不能拨打电话")
  41. } else {
  42. if CommonValue.getDefaultValueForKey(key: "customer_phone") != "" {
  43. CommonUntils.callPhone(phone: CommonValue.getDefaultValueForKey(key: "customer_phone"))
  44. }
  45. }
  46. break
  47. case 1003: //
  48. break
  49. case 1004: //
  50. break
  51. case 1005: //
  52. break
  53. case 1006: //
  54. break
  55. default:
  56. break
  57. }
  58. }
  59. // MARK: =============加载数据===============
  60. func loadData() {
  61. let url = RequestURL.helpPageList
  62. let params = NSMutableDictionary()
  63. loadDataList(url: url, params: params, tableView: self.tableView, tag: 1001)
  64. }
  65. override func returnData(tag: Int) {
  66. if tag == 1001 {
  67. tableView.reloadData()
  68. }
  69. }
  70. override func returnError(tag: Int, type: String) {
  71. }
  72. // MARK: TABLEVLEW 实现
  73. func numberOfSections(in tableView: UITableView) -> Int {
  74. return 1
  75. }
  76. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  77. return self.arrData.count
  78. }
  79. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  80. let cell = tableView.dequeueReusableCell(withIdentifier: "HelpListTableViewCell", for: indexPath as IndexPath) as! HelpListTableViewCell
  81. cell.lblTitle.text = getString(current: indexPath.row, key: "title")
  82. cell.lblTitle.setTextLineSpace(lineSpace: 4)
  83. return cell
  84. }
  85. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  86. let view = CommonWebViewViewController()
  87. view.strTitle = "详情"//getString(current: indexPath.row, key: "title");
  88. view.url = getString(current: indexPath.row, key: "webUrl")
  89. toViewController(viewController: view)
  90. }
  91. override func viewWillAppear(_ animated: Bool) {
  92. super.viewWillAppear(animated)
  93. }
  94. override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
  95. super.init(nibName: "ApplyCardHelpListViewController", bundle: nil)
  96. }
  97. required init?(coder aDecoder: NSCoder) {
  98. fatalError("init(coder:) has not been implemented")
  99. }
  100. }