Commit 9bf31cd0bc66e09b13dcd3e12ff32686b61dec03
1 parent
78239991
提交修改
Showing
14 changed files
with
374 additions
and
113 deletions
Podfile
| ... | ... | @@ -37,6 +37,8 @@ target 'metaCode' do |
| 37 | 37 | pod 'SwiftGifOrigin', '~> 1.7.0' |
| 38 | 38 | #数据库存储 |
| 39 | 39 | pod 'WCDB.swift' |
| 40 | + #占位按钮 | |
| 41 | + pod 'APButton' | |
| 40 | 42 | #分类滚动切换视图 |
| 41 | 43 | pod 'JXSegmentedView', :git => 'https://gitee.com/mirrors/JXSegmentedView.git' |
| 42 | 44 | pod 'JXPagingView/Paging' | ... | ... |
metaCode/Classes/Extensions/NSDate+CNLiveExtensions.swift
| ... | ... | @@ -16,4 +16,16 @@ extension NSDate{ |
| 16 | 16 | return formatter.string(from: self as Date) |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | + //时间戳转成字符串 | |
| 20 | + static func timeIntervalChangeToTimeStr(timeInterval: Double, _ dateFormat:String? = "yyyy-MM-dd") -> String { | |
| 21 | + let date:Date = Date.init(timeIntervalSince1970: timeInterval) | |
| 22 | + let formatter = DateFormatter.init() | |
| 23 | + if dateFormat == nil { | |
| 24 | + formatter.dateFormat = "yyyy-MM-dd" | |
| 25 | + }else{ | |
| 26 | + formatter.dateFormat = dateFormat | |
| 27 | + } | |
| 28 | + return formatter.string(from: date as Date) | |
| 29 | + } | |
| 30 | + | |
| 19 | 31 | } | ... | ... |
metaCode/Classes/Extensions/UIButton+CNLiveExtensions.swift
| ... | ... | @@ -82,4 +82,6 @@ extension UIButton { |
| 82 | 82 | self.imageEdgeInsets = UIEdgeInsets(top: ((selfHeight - totalHeight) / 2 + titleRect.size.height + padding - imageRect.origin.y), left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2), bottom: -((selfHeight - totalHeight) / 2 + titleRect.size.height + padding - imageRect.origin.y), right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2)) |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | + | |
| 86 | + | |
| 85 | 87 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
| ... | ... | @@ -303,6 +303,10 @@ extension CNLiveMineAddInfoViewController { |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| 306 | + if _show_type == .message { | |
| 307 | + let listModel = listArray[indexPath.row] | |
| 308 | + return 76 + listModel.textHeight | |
| 309 | + } | |
| 306 | 310 | return 100 |
| 307 | 311 | } |
| 308 | 312 | func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnListViewController.swift
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | import JXPagingView |
| 10 | 10 | import MJRefresh |
| 11 | +import EmptyDataSet_Swift | |
| 11 | 12 | |
| 12 | 13 | enum MineEarnShowType { |
| 13 | 14 | case record //积分记录 |
| ... | ... | @@ -15,7 +16,7 @@ enum MineEarnShowType { |
| 15 | 16 | } |
| 16 | 17 | |
| 17 | 18 | typealias CallBack = (_ scrollView: UIScrollView) -> Void |
| 18 | -class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewListViewDelegate, UITableViewDelegate, UITableViewDataSource { | |
| 19 | +class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewListViewDelegate, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate{ | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | let kMIneBodyFiveViewCellIdentifier = "kMIneBodyFiveViewCellIdentifier" |
| ... | ... | @@ -23,6 +24,8 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 23 | 24 | let tableView = UITableView.init(frame: .zero, style: .plain) |
| 24 | 25 | tableView.delegate = self |
| 25 | 26 | tableView.dataSource = self |
| 27 | + tableView.emptyDataSetSource = self | |
| 28 | + tableView.emptyDataSetDelegate = self | |
| 26 | 29 | tableView.backgroundColor = .clear |
| 27 | 30 | tableView.separatorStyle = .none |
| 28 | 31 | tableView.showsVerticalScrollIndicator = false |
| ... | ... | @@ -44,34 +47,65 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 44 | 47 | var pageNum: NSInteger! |
| 45 | 48 | var _callBack: CallBack! |
| 46 | 49 | var _show_type : MineEarnShowType! |
| 50 | + var network_type: CNLiveMineResponseType! | |
| 47 | 51 | init(show_type: MineEarnShowType) { |
| 48 | 52 | pageNum = 1 |
| 49 | 53 | super.init(nibName: nil, bundle: nil) |
| 50 | 54 | _show_type = show_type |
| 51 | 55 | } |
| 52 | 56 | |
| 53 | - func loadDataWithTradRecord(page: NSInteger) { | |
| 54 | - | |
| 57 | + func loadDataWithTradRecord(page: NSInteger, resultBlock: @escaping resultNewsBlock) { | |
| 58 | + if page == 1 { | |
| 59 | + self.pageNum = 1 | |
| 60 | + } | |
| 55 | 61 | if _show_type == .balance { |
| 56 | - CNLiveMineViewModel.requestWithTradRecord(page: page) {result, respStatue in | |
| 62 | + CNLiveMineViewModel.requestWithTradRecord(page: page) { result, respStatue in | |
| 57 | 63 | if respStatue == .success { |
| 64 | + let listModel = result as! MineTradingRecordBaseModel | |
| 65 | + self.network_type = .success | |
| 58 | 66 | self.dataArray.removeAllObjects() |
| 59 | - self.dataArray.addObjects(from: result as! [MineTradingRecordModel]) | |
| 67 | + self.dataArray.addObjects(from: listModel.list) | |
| 60 | 68 | self.tableView.reloadData() |
| 61 | 69 | self.tableView.mj_header?.endRefreshing() |
| 62 | 70 | self.tableView.mj_footer?.endRefreshing() |
| 71 | + if self.dataArray.count > 0 { | |
| 72 | + self.addRefreshView() | |
| 73 | + } | |
| 74 | + }else if (respStatue == .noNetwork) { | |
| 75 | + self.network_type = .noNetwork | |
| 76 | + self.tableView.reloadEmptyDataSet() | |
| 77 | + } else { | |
| 78 | + self.network_type = .failed | |
| 79 | + self.tableView.reloadEmptyDataSet() | |
| 63 | 80 | } |
| 81 | + resultBlock(result, respStatue) | |
| 64 | 82 | } |
| 65 | 83 | } |
| 66 | 84 | if _show_type == .record { |
| 67 | 85 | CNLiveMineViewModel.requestWithIntegralRecord(page: page) { result, respStatue in |
| 68 | 86 | if respStatue == .success { |
| 87 | + let listModel = result as! MineIntegralRecordModel | |
| 88 | + self.network_type = .success | |
| 69 | 89 | self.dataArray.removeAllObjects() |
| 70 | - self.dataArray.addObjects(from: (result as! MineIntegralRecordModel).integralList) | |
| 90 | + self.dataArray.addObjects(from: listModel.integralList) | |
| 71 | 91 | self.tableView.reloadData() |
| 72 | 92 | self.tableView.mj_header?.endRefreshing() |
| 73 | 93 | self.tableView.mj_footer?.endRefreshing() |
| 94 | + if self.dataArray.count > 0 { | |
| 95 | + self.addRefreshView() | |
| 96 | + } | |
| 97 | + if !listModel.hasNext { | |
| 98 | + self.tableView.mj_footer?.endRefreshing() | |
| 99 | + self.tableView.mj_footer?.endRefreshingWithNoMoreData() | |
| 100 | + } | |
| 101 | + }else if (respStatue == .noNetwork) { | |
| 102 | + self.network_type = .noNetwork | |
| 103 | + self.tableView.reloadEmptyDataSet() | |
| 104 | + } else { | |
| 105 | + self.network_type = .failed | |
| 106 | + self.tableView.reloadEmptyDataSet() | |
| 74 | 107 | } |
| 108 | + resultBlock(result, respStatue) | |
| 75 | 109 | } |
| 76 | 110 | } |
| 77 | 111 | } |
| ... | ... | @@ -83,22 +117,23 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 83 | 117 | override func viewDidLoad() { |
| 84 | 118 | super.viewDidLoad() |
| 85 | 119 | |
| 86 | - loadDataWithTradRecord(page: self.pageNum) | |
| 120 | + loadDataWithTradRecord(page: self.pageNum) {result,respStatue in } | |
| 121 | + | |
| 87 | 122 | view.addSubview(tableView) |
| 88 | 123 | tableView.snp.makeConstraints { make in |
| 89 | 124 | make.top.bottom.equalToSuperview() |
| 90 | 125 | make.left.equalToSuperview().offset(20) |
| 91 | 126 | make.right.equalToSuperview().offset(-20) |
| 92 | 127 | } |
| 93 | - | |
| 94 | - addRefreshView() | |
| 95 | 128 | } |
| 96 | 129 | |
| 97 | 130 | private func addRefreshView() { |
| 98 | - tableView.mj_footer = MJRefreshFooter.init(refreshingBlock: {[weak self] in | |
| 131 | + let footerView = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | |
| 99 | 132 | self!.pageNum += 1 |
| 100 | - self!.loadDataWithTradRecord(page: self!.pageNum) | |
| 133 | + self!.loadDataWithTradRecord(page: self!.pageNum) {result,respStatue in } | |
| 101 | 134 | }) |
| 135 | + footerView.setTitle("123456", for: .noMoreData) | |
| 136 | + tableView.mj_footer = footerView | |
| 102 | 137 | } |
| 103 | 138 | } |
| 104 | 139 | extension CNLiveMineEarnListViewController { |
| ... | ... | @@ -135,6 +170,51 @@ extension CNLiveMineEarnListViewController { |
| 135 | 170 | |
| 136 | 171 | extension CNLiveMineEarnListViewController { |
| 137 | 172 | |
| 173 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | |
| 174 | + if network_type == .failed || network_type == .unkonw { | |
| 175 | + return UIImage(named: "mine_list_source_unusual_failed") | |
| 176 | + } | |
| 177 | + if network_type == .noNetwork { | |
| 178 | + return UIImage(named: "mine_list_source_unusual_noNet") | |
| 179 | + } | |
| 180 | + return UIImage(named: "mine_list_source_unusual_empty") | |
| 181 | + } | |
| 182 | + | |
| 183 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | |
| 184 | + var defult_string = "" | |
| 185 | + if network_type == .failed || network_type == .unkonw { | |
| 186 | + defult_string = "接口请求错误,刷新试试~" | |
| 187 | + } | |
| 188 | + if network_type == .noNetwork { | |
| 189 | + defult_string = "网络开小差了,刷新试试~" | |
| 190 | + } | |
| 191 | + if dataArray.count == 0 && network_type == .success{ | |
| 192 | + defult_string = "暂无记录~" | |
| 193 | + } | |
| 194 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | |
| 195 | + } | |
| 196 | + | |
| 197 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | |
| 198 | + if (network_type == .failed || network_type == .noNetwork) { | |
| 199 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | |
| 200 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | |
| 201 | + return NSAttributedString(string: "刷新", attributes: attributes as [NSAttributedString.Key : Any]) | |
| 202 | + } | |
| 203 | + return nil | |
| 204 | + } | |
| 205 | + | |
| 206 | + func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? { | |
| 207 | + return UIColor.white | |
| 208 | + } | |
| 209 | + | |
| 210 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | |
| 211 | + pageNum = 1 | |
| 212 | + loadDataWithTradRecord(page: 1) {result,respStatue in } | |
| 213 | + } | |
| 214 | +} | |
| 215 | + | |
| 216 | +extension CNLiveMineEarnListViewController { | |
| 217 | + | |
| 138 | 218 | func listView() -> UIView { |
| 139 | 219 | return view |
| 140 | 220 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnViewController.swift
| ... | ... | @@ -120,6 +120,7 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega |
| 120 | 120 | override func viewDidAppear(_ animated: Bool) { |
| 121 | 121 | super.viewDidAppear(animated) |
| 122 | 122 | categoryView.selectItemAt(index: _index) |
| 123 | + pagingView.listContainerView.didClickSelectedItem(at: _index) | |
| 123 | 124 | } |
| 124 | 125 | |
| 125 | 126 | override func viewDidLoad() { |
| ... | ... | @@ -128,12 +129,13 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega |
| 128 | 129 | titleName = "我的收益" |
| 129 | 130 | |
| 130 | 131 | view.addSubview(pagingView) |
| 131 | - pagingView.listContainerView.didClickSelectedItem(at: _index) | |
| 132 | + | |
| 132 | 133 | |
| 133 | 134 | pagingView.mainTableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: { [self] in |
| 134 | - pagingView.mainTableView.mj_header?.endRefreshing() | |
| 135 | -// self!.pageNum = 1 | |
| 136 | -// self!.loadDataWithTradRecord(page: self!.pageNum) | |
| 135 | + let vc = viewControllers[pagingView.listContainerView.currentIndex] as! CNLiveMineEarnListViewController | |
| 136 | + vc.loadDataWithTradRecord(page: 1) { [self] result, respStatue in | |
| 137 | + pagingView.mainTableView.mj_header?.endRefreshing() | |
| 138 | + } | |
| 137 | 139 | }) |
| 138 | 140 | } |
| 139 | 141 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
| ... | ... | @@ -12,7 +12,7 @@ import HXPHPicker |
| 12 | 12 | typealias resultUploadImageBlock = (_ url: String) -> Void |
| 13 | 13 | class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate, PhotoPickerControllerDelegate{ |
| 14 | 14 | |
| 15 | - let kMineBodyInputAuthCellIdentifier = "kMineBodyInputAuthCellIdentifier" | |
| 15 | + static let kMineBodyInputAuthCellIdentifier = "kMineBodyInputAuthCellIdentifier" | |
| 16 | 16 | lazy var tableView: UITableView = { |
| 17 | 17 | let tableView = UITableView(frame: .zero, style: .plain) |
| 18 | 18 | tableView.delegate = self |
| ... | ... | @@ -23,7 +23,6 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg |
| 23 | 23 | tableView.tableFooterView = UIView.init() |
| 24 | 24 | tableView.contentInsetAdjustmentBehavior = .scrollableAxes |
| 25 | 25 | tableView.separatorStyle = .none |
| 26 | - tableView.register(MineBodyInputAuthCell.self, forCellReuseIdentifier: kMineBodyInputAuthCellIdentifier) | |
| 27 | 26 | return tableView |
| 28 | 27 | }() |
| 29 | 28 | |
| ... | ... | @@ -106,13 +105,16 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg |
| 106 | 105 | CNLiveMineViewModel.requestsStandInfo(identityId: "\(_listModel.id)", type: .nodate) {[weak self] result, respStatue in |
| 107 | 106 | if respStatue == .success { |
| 108 | 107 | self?.dataArray.addObjects(from: result as! [Any]) |
| 109 | - self?.tableView.reloadData() | |
| 110 | 108 | if (self?.dataArray.count)! > 0 { |
| 111 | 109 | self?.sendButton.isHidden = false |
| 112 | 110 | self?.tipLabel.isHidden = false |
| 113 | 111 | self?.tableView.tableHeaderView = self?.setupHeaderAndFooter(is_last: false) |
| 114 | 112 | self?.tableView.tableFooterView = self?.setupHeaderAndFooter(is_last: true) |
| 113 | + for i in 0..<(self?.dataArray.count)! { | |
| 114 | + self?.tableView.register(MineBodyInputAuthCell.self, forCellReuseIdentifier: CNLiveMineInputViewController.kMineBodyInputAuthCellIdentifier+"\(i)") | |
| 115 | + } | |
| 115 | 116 | } |
| 117 | + self?.tableView.reloadData() | |
| 116 | 118 | } |
| 117 | 119 | } |
| 118 | 120 | } |
| ... | ... | @@ -183,7 +185,7 @@ extension CNLiveMineInputViewController { |
| 183 | 185 | |
| 184 | 186 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 185 | 187 | |
| 186 | - let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyInputAuthCellIdentifier) as! MineBodyInputAuthCell | |
| 188 | + let cell = tableView.dequeueReusableCell(withIdentifier: CNLiveMineInputViewController.kMineBodyInputAuthCellIdentifier+"\(indexPath.row)") as! MineBodyInputAuthCell | |
| 187 | 189 | cell.setListModel(infoModel: self.dataArray[indexPath.row] as! MineStandInfoModel, is_last: indexPath.row == self.dataArray.count - 1) {[weak self] type in |
| 188 | 190 | if type == .end { |
| 189 | 191 | let is_result = self?.inspectResult() | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineQuestViewController.swift
| ... | ... | @@ -6,14 +6,17 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | +import EmptyDataSet_Swift | |
| 9 | 10 | |
| 10 | -class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource { | |
| 11 | +class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { | |
| 11 | 12 | |
| 12 | 13 | let kMineBodyFourViewCellIdentifier = "kMineBodyFourViewCellIdentifier" |
| 13 | 14 | lazy var tableView: UITableView = { |
| 14 | 15 | let tableView = UITableView.init(frame: .zero, style: .plain) |
| 15 | 16 | tableView.delegate = self |
| 16 | 17 | tableView.dataSource = self |
| 18 | + tableView.emptyDataSetSource = self | |
| 19 | + tableView.emptyDataSetDelegate = self | |
| 17 | 20 | tableView.backgroundColor = .clear |
| 18 | 21 | tableView.separatorStyle = .none |
| 19 | 22 | tableView.register(MineBodyFourViewCell.self, forCellReuseIdentifier: kMineBodyFourViewCellIdentifier) |
| ... | ... | @@ -61,6 +64,7 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega |
| 61 | 64 | }() |
| 62 | 65 | |
| 63 | 66 | var _checkModel: MinePointCheckInModel! |
| 67 | + var network_type: CNLiveMineResponseType! | |
| 64 | 68 | init(checkModel:MinePointCheckInModel) { |
| 65 | 69 | super.init(nibName:nil, bundle:nil) |
| 66 | 70 | _checkModel = checkModel |
| ... | ... | @@ -89,14 +93,65 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega |
| 89 | 93 | func loadDataWithTaskList() { |
| 90 | 94 | CNLiveMineViewModel.requestWithTaskList { result, respStatue in |
| 91 | 95 | if respStatue == .success { |
| 96 | + self.network_type = .success | |
| 92 | 97 | self.dataArray.addObjects(from: result as! [MineTaskCheckListModel]) |
| 93 | 98 | self.tableView.reloadData() |
| 99 | + }else if (respStatue == .noNetwork) { | |
| 100 | + self.network_type = .noNetwork | |
| 101 | + self.tableView.reloadEmptyDataSet() | |
| 102 | + } else { | |
| 103 | + self.network_type = .failed | |
| 104 | + self.tableView.reloadEmptyDataSet() | |
| 94 | 105 | } |
| 95 | 106 | } |
| 96 | 107 | } |
| 97 | 108 | } |
| 98 | 109 | |
| 99 | 110 | extension CNLiveMineQuestViewController { |
| 111 | + | |
| 112 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | |
| 113 | + if network_type == .failed || network_type == .unkonw { | |
| 114 | + return UIImage(named: "mine_list_source_unusual_failed") | |
| 115 | + } | |
| 116 | + if network_type == .noNetwork { | |
| 117 | + return UIImage(named: "mine_list_source_unusual_noNet") | |
| 118 | + } | |
| 119 | + return UIImage(named: "mine_list_source_unusual_empty") | |
| 120 | + } | |
| 121 | + | |
| 122 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | |
| 123 | + var defult_string = "" | |
| 124 | + if network_type == .failed || network_type == .unkonw { | |
| 125 | + defult_string = "接口请求错误,刷新试试~" | |
| 126 | + } | |
| 127 | + if network_type == .noNetwork { | |
| 128 | + defult_string = "网络开小差了,刷新试试~" | |
| 129 | + } | |
| 130 | + if dataArray.count == 0 && network_type == .success{ | |
| 131 | + defult_string = "暂无任务~" | |
| 132 | + } | |
| 133 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | |
| 134 | + } | |
| 135 | + | |
| 136 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | |
| 137 | + if (network_type == .failed || network_type == .noNetwork) { | |
| 138 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | |
| 139 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | |
| 140 | + return NSAttributedString(string: "刷新", attributes: attributes as [NSAttributedString.Key : Any]) | |
| 141 | + } | |
| 142 | + return nil | |
| 143 | + } | |
| 144 | + | |
| 145 | + func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? { | |
| 146 | + return UIColor.white | |
| 147 | + } | |
| 148 | + | |
| 149 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | |
| 150 | + loadDataWithTaskList() | |
| 151 | + } | |
| 152 | +} | |
| 153 | + | |
| 154 | +extension CNLiveMineQuestViewController { | |
| 100 | 155 | func numberOfSections(in tableView: UITableView) -> Int { |
| 101 | 156 | return 1 |
| 102 | 157 | } | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| ... | ... | @@ -135,9 +135,9 @@ extension CNLiveMineViewController { |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 138 | - if indexPath.section == 0 { | |
| 139 | - self.navigationController?.pushViewController(CNLiveMineQuestViewController.init(checkModel: checkModel), animated: true) | |
| 140 | - } | |
| 138 | +// if indexPath.section == 0 { | |
| 139 | +// self.navigationController?.pushViewController(CNLiveMineQuestViewController.init(checkModel: checkModel), animated: true) | |
| 140 | +// } | |
| 141 | 141 | if indexPath.section == 1 { |
| 142 | 142 | self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true) |
| 143 | 143 | } | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import Kingfisher |
| 10 | +import APButton | |
| 10 | 11 | |
| 11 | 12 | class MineBodyOneListViewCell : UITableViewCell { |
| 12 | 13 | |
| ... | ... | @@ -59,6 +60,7 @@ class MineBodyOneListViewCell : UITableViewCell { |
| 59 | 60 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 60 | 61 | self.selectionStyle = .none |
| 61 | 62 | self.backgroundColor = .clear |
| 63 | + contentView.backgroundColor = .clear | |
| 62 | 64 | |
| 63 | 65 | addSubview(mainView) |
| 64 | 66 | mainView.addSubview(headerView) |
| ... | ... | @@ -194,6 +196,7 @@ class MineBodyTwoListViewCell : UITableViewCell { |
| 194 | 196 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 195 | 197 | self.selectionStyle = .none |
| 196 | 198 | self.backgroundColor = .clear |
| 199 | + contentView.backgroundColor = .clear | |
| 197 | 200 | |
| 198 | 201 | addSubview(mainView) |
| 199 | 202 | mainView.addSubview(headerView) |
| ... | ... | @@ -298,6 +301,7 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 298 | 301 | let mainView = UIImageView.init() |
| 299 | 302 | mainView.backgroundColor = .clear |
| 300 | 303 | mainView.contentMode = .scaleToFill |
| 304 | + mainView.isUserInteractionEnabled = true | |
| 301 | 305 | mainView.image = UIImage(named: "mine_header_point_back") |
| 302 | 306 | return mainView |
| 303 | 307 | }() |
| ... | ... | @@ -313,11 +317,12 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 313 | 317 | lazy var pointButton: UIButton = { |
| 314 | 318 | let pointButton = UIButton.init(type: .custom) |
| 315 | 319 | pointButton.backgroundColor = .clear |
| 316 | - pointButton.setTitle(" 去赚积分", for: .normal) | |
| 320 | + pointButton.setTitle(" 去赚积分", for: .normal) | |
| 317 | 321 | pointButton.titleLabel?.font = Font_12 |
| 318 | 322 | pointButton.imageView?.contentMode = .scaleToFill |
| 319 | 323 | pointButton.setTitleColor(HexColor("#FFE4C4"), for: .normal) |
| 320 | 324 | pointButton.setImage(UIImage(named: "mine_header_point_gold_coin"), for: .normal) |
| 325 | + pointButton.addTarget(self, action: #selector(pushMineQuestView), for: .touchUpInside) | |
| 321 | 326 | return pointButton |
| 322 | 327 | }() |
| 323 | 328 | |
| ... | ... | @@ -350,16 +355,7 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 350 | 355 | balanceLabel.textAlignment = .left |
| 351 | 356 | return balanceLabel |
| 352 | 357 | }() |
| 353 | - | |
| 354 | - lazy var balanceNumberLabel: UILabel = { | |
| 355 | - let balanceNumberLabel = UILabel.init() | |
| 356 | - balanceNumberLabel.text = "0" | |
| 357 | - balanceNumberLabel.font = BoldFont_19_Fit | |
| 358 | - balanceNumberLabel.textAlignment = .left | |
| 359 | - balanceNumberLabel.textColor = HexColor("#FFE4C4") | |
| 360 | - return balanceNumberLabel | |
| 361 | - }() | |
| 362 | - | |
| 358 | + | |
| 363 | 359 | lazy var pointLabel: UILabel = { |
| 364 | 360 | let pointLabel = UILabel.init() |
| 365 | 361 | pointLabel.text = "积分" |
| ... | ... | @@ -369,13 +365,24 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 369 | 365 | return pointLabel |
| 370 | 366 | }() |
| 371 | 367 | |
| 372 | - lazy var pointNumberLabel: UILabel = { | |
| 373 | - let pointNumberLabel = UILabel.init() | |
| 374 | - pointNumberLabel.font = BoldFont_19_Fit | |
| 375 | - pointNumberLabel.text = "0" | |
| 376 | - pointNumberLabel.textAlignment = .left | |
| 377 | - pointNumberLabel.textColor = HexColor("#FFE4C4") | |
| 378 | - return pointNumberLabel | |
| 368 | + lazy var balanceNumberButton: APButton = { | |
| 369 | + let balanceNumberButton = APButton() | |
| 370 | + balanceNumberButton.setTitle("0", for: .normal) | |
| 371 | + balanceNumberButton.activityIndicator.color = .white | |
| 372 | + balanceNumberButton.titleLabel?.font = BoldFont_19_Fit | |
| 373 | + balanceNumberButton.setTitleColor(HexColor("#FFE4C4"), for: .normal) | |
| 374 | + balanceNumberButton.addTarget(self, action: #selector(pushBalanceMothed), for: .touchUpInside) | |
| 375 | + return balanceNumberButton | |
| 376 | + }() | |
| 377 | + | |
| 378 | + lazy var pointNumberButton: APButton = { | |
| 379 | + let pointNumberButton = APButton() | |
| 380 | + pointNumberButton.activityIndicator.color = .white | |
| 381 | + pointNumberButton.titleLabel?.font = BoldFont_19_Fit | |
| 382 | + pointNumberButton.setTitle("0", for: .normal) | |
| 383 | + pointNumberButton.setTitleColor(HexColor("#FFE4C4"), for: .normal) | |
| 384 | + pointNumberButton.addTarget(self, action: #selector(pushPointsMothed), for: .touchUpInside) | |
| 385 | + return pointNumberButton | |
| 379 | 386 | }() |
| 380 | 387 | |
| 381 | 388 | var _checkModel : MinePointCheckInModel? |
| ... | ... | @@ -385,8 +392,10 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 385 | 392 | } |
| 386 | 393 | set{ |
| 387 | 394 | _checkModel = newValue |
| 388 | - balanceNumberLabel.text = newValue?.money | |
| 389 | - pointNumberLabel.text = newValue?.integral | |
| 395 | + balanceNumberButton.stopAnimating() | |
| 396 | + pointNumberButton.stopAnimating() | |
| 397 | + balanceNumberButton.setTitle(newValue?.money, for: .normal) | |
| 398 | + pointNumberButton.setTitle(newValue?.integral, for: .normal) | |
| 390 | 399 | } |
| 391 | 400 | } |
| 392 | 401 | |
| ... | ... | @@ -394,6 +403,7 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 394 | 403 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 395 | 404 | self.selectionStyle = .none |
| 396 | 405 | self.backgroundColor = .clear |
| 406 | + contentView.backgroundColor = .clear | |
| 397 | 407 | |
| 398 | 408 | addSubview(mainView) |
| 399 | 409 | mainView.addSubview(moreView) |
| ... | ... | @@ -402,12 +412,14 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 402 | 412 | |
| 403 | 413 | mainView.addSubview(line_left_label) |
| 404 | 414 | mainView.addSubview(balanceLabel) |
| 405 | - mainView.addSubview(balanceNumberLabel) | |
| 415 | + mainView.addSubview(balanceNumberButton) | |
| 406 | 416 | |
| 407 | 417 | mainView.addSubview(line_right_label) |
| 408 | 418 | mainView.addSubview(pointLabel) |
| 409 | - mainView.addSubview(pointNumberLabel) | |
| 419 | + mainView.addSubview(pointNumberButton) | |
| 410 | 420 | |
| 421 | + pointNumberButton.startAnimating() | |
| 422 | + balanceNumberButton.startAnimating() | |
| 411 | 423 | |
| 412 | 424 | setupConstraints() |
| 413 | 425 | } |
| ... | ... | @@ -426,7 +438,7 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 426 | 438 | } |
| 427 | 439 | moreView.snp.makeConstraints { make in |
| 428 | 440 | make.centerY.equalTo(pointButton) |
| 429 | - make.left.equalTo(pointButton.snp.right) | |
| 441 | + make.left.equalTo(pointButton.snp.right).offset(-5) | |
| 430 | 442 | } |
| 431 | 443 | questLabel.snp.makeConstraints { make in |
| 432 | 444 | make.left.equalToSuperview().offset(10) |
| ... | ... | @@ -444,7 +456,7 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 444 | 456 | make.left.equalTo(line_left_label.snp.right).offset(10) |
| 445 | 457 | make.top.equalToSuperview().offset(15) |
| 446 | 458 | } |
| 447 | - balanceNumberLabel.snp.makeConstraints { make in | |
| 459 | + balanceNumberButton.snp.makeConstraints { make in | |
| 448 | 460 | make.left.equalTo(line_left_label.snp.right).offset(10) |
| 449 | 461 | make.centerY.equalToSuperview().offset(10) |
| 450 | 462 | } |
| ... | ... | @@ -459,12 +471,24 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 459 | 471 | make.centerY.equalTo(balanceLabel) |
| 460 | 472 | make.left.equalTo(line_right_label.snp.right).offset(10) |
| 461 | 473 | } |
| 462 | - pointNumberLabel.snp.makeConstraints { make in | |
| 463 | - make.centerY.equalTo(balanceNumberLabel) | |
| 474 | + pointNumberButton.snp.makeConstraints { make in | |
| 475 | + make.centerY.equalTo(balanceNumberButton) | |
| 464 | 476 | make.left.equalTo(line_right_label.snp.right).offset(10) |
| 465 | 477 | } |
| 466 | 478 | |
| 467 | 479 | } |
| 480 | + | |
| 481 | + @objc func pushBalanceMothed(sender: APButton) { | |
| 482 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineEarnViewController.init(index: 1, checkModel: _checkModel!), animated: true) | |
| 483 | + } | |
| 484 | + | |
| 485 | + @objc func pushPointsMothed(sender: APButton) { | |
| 486 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineEarnViewController.init(index: 0, checkModel: _checkModel!), animated: true) | |
| 487 | + } | |
| 488 | + | |
| 489 | + @objc func pushMineQuestView() { | |
| 490 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineQuestViewController.init(checkModel: _checkModel!), animated: true) | |
| 491 | + } | |
| 468 | 492 | |
| 469 | 493 | |
| 470 | 494 | required init?(coder: NSCoder) { |
| ... | ... | @@ -478,6 +502,7 @@ class MineBodyFourViewCell: UITableViewCell { |
| 478 | 502 | lazy var mainView: UIView = { |
| 479 | 503 | let mainView = UIView.init() |
| 480 | 504 | mainView.backgroundColor = .white |
| 505 | + mainView.isUserInteractionEnabled = true | |
| 481 | 506 | return mainView |
| 482 | 507 | }() |
| 483 | 508 | |
| ... | ... | @@ -505,16 +530,18 @@ class MineBodyFourViewCell: UITableViewCell { |
| 505 | 530 | return descLabel |
| 506 | 531 | }() |
| 507 | 532 | |
| 508 | - lazy var shareBtn: UIButton = { | |
| 509 | - let shareBtn = UIButton.init(type: .custom) | |
| 533 | + lazy var shareBtn: APButton = { | |
| 534 | + let shareBtn = APButton() | |
| 510 | 535 | shareBtn.frame = CGRect(x: 0, y: 0, width: 70, height: 30) |
| 511 | 536 | shareBtn.setTitleColor(.white, for: .normal) |
| 512 | 537 | shareBtn.titleLabel?.font = Font_12 |
| 513 | 538 | shareBtn.layer.cornerRadius = 15 |
| 514 | 539 | shareBtn.layer.masksToBounds = true |
| 540 | + shareBtn.activityIndicator.color = UIColor.white | |
| 515 | 541 | shareBtn.setTitle("去完成", for: .normal) |
| 516 | 542 | shareBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) |
| 517 | 543 | shareBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) |
| 544 | + shareBtn.addTarget(self, action: #selector(checkInAction), for: .touchUpInside) | |
| 518 | 545 | return shareBtn |
| 519 | 546 | }() |
| 520 | 547 | |
| ... | ... | @@ -522,6 +549,7 @@ class MineBodyFourViewCell: UITableViewCell { |
| 522 | 549 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 523 | 550 | self.selectionStyle = .none |
| 524 | 551 | self.backgroundColor = .clear |
| 552 | + contentView.backgroundColor = .clear | |
| 525 | 553 | |
| 526 | 554 | addSubview(mainView) |
| 527 | 555 | mainView.addSubview(iconView) |
| ... | ... | @@ -565,7 +593,17 @@ class MineBodyFourViewCell: UITableViewCell { |
| 565 | 593 | nameLabel.text = listModel.title ?? "" |
| 566 | 594 | descLabel.text = "积分值+\(listModel.score ?? "")" |
| 567 | 595 | if listModel.taskId!.contains("check_in") { |
| 568 | - shareBtn.setTitle("去签到", for: .normal) | |
| 596 | + if listModel.status!.contains("false") { | |
| 597 | + shareBtn.setTitle("去签到", for: .normal) | |
| 598 | + }else{ | |
| 599 | + shareBtn.titleEdgeInsets = UIEdgeInsets.zero | |
| 600 | + shareBtn.imageEdgeInsets = UIEdgeInsets.zero | |
| 601 | + shareBtn.setTitleColor(HexColor("#999999"), for: .normal) | |
| 602 | + shareBtn.setTitle("已完成", for: .normal) | |
| 603 | + shareBtn.setImage(nil, for: .normal) | |
| 604 | + shareBtn.isUserInteractionEnabled = false | |
| 605 | + shareBtn.setGradient(colors: [HexColor("#f9f9f9")!,HexColor("#f9f9f9")!], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | |
| 606 | + } | |
| 569 | 607 | } |
| 570 | 608 | } |
| 571 | 609 | |
| ... | ... | @@ -573,6 +611,20 @@ class MineBodyFourViewCell: UITableViewCell { |
| 573 | 611 | fatalError("init(coder:) has not been implemented") |
| 574 | 612 | } |
| 575 | 613 | |
| 614 | + @objc func checkInAction(sender: APButton) { | |
| 615 | + sender.startAnimating() | |
| 616 | + showLoading(message: "") | |
| 617 | + CNLiveMineViewModel.requestWithCheckInAction { [self] result, respStatue in | |
| 618 | + sender.stopAnimating() | |
| 619 | + showMessage(message: "签到成功") | |
| 620 | + shareBtn.titleEdgeInsets = UIEdgeInsets.zero | |
| 621 | + shareBtn.imageEdgeInsets = UIEdgeInsets.zero | |
| 622 | + shareBtn.setTitleColor(HexColor("#999999"), for: .normal) | |
| 623 | + shareBtn.setTitle("已完成", for: .normal) | |
| 624 | + shareBtn.setImage(UIImage(), for: .normal) | |
| 625 | + shareBtn.setGradient(colors: [HexColor("#f9f9f9")!,HexColor("#f9f9f9")!], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5)) | |
| 626 | + } | |
| 627 | + } | |
| 576 | 628 | } |
| 577 | 629 | |
| 578 | 630 | class MIneBodyFiveViewCell: UITableViewCell { |
| ... | ... | @@ -617,6 +669,7 @@ class MIneBodyFiveViewCell: UITableViewCell { |
| 617 | 669 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 618 | 670 | selectionStyle = .none |
| 619 | 671 | backgroundColor = .clear |
| 672 | + contentView.backgroundColor = .clear | |
| 620 | 673 | |
| 621 | 674 | addSubview(mainView) |
| 622 | 675 | mainView.addSubview(nameLabel) |
| ... | ... | @@ -685,6 +738,7 @@ enum CNLiveBodyInputAuthShowType { |
| 685 | 738 | typealias resultInputBlock = (_ type: CNLiveBodyInputAuthShowType) -> Void |
| 686 | 739 | class MineBodyInputAuthCell: UITableViewCell, UITextFieldDelegate { |
| 687 | 740 | |
| 741 | + var identifier = false | |
| 688 | 742 | lazy var mainView: UIView = { |
| 689 | 743 | let mainView = UIView.init(frame: CGRect.zero) |
| 690 | 744 | mainView.backgroundColor = .white |
| ... | ... | @@ -837,6 +891,12 @@ class MineBodyInputAuthCell: UITableViewCell, UITextFieldDelegate { |
| 837 | 891 | } |
| 838 | 892 | |
| 839 | 893 | func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { |
| 894 | + if textField == contentField { | |
| 895 | + if contentField.text!.count > _infoModel!.length { | |
| 896 | + showMessage(message: "\(_infoModel!.name ?? "")最大限制\(_infoModel!.length)个字") | |
| 897 | + return false | |
| 898 | + } | |
| 899 | + } | |
| 840 | 900 | return contentField.resignFirstResponder() |
| 841 | 901 | } |
| 842 | 902 | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
| ... | ... | @@ -312,44 +312,39 @@ class MineQuestHeaderView: UIView { |
| 312 | 312 | pointBtn.setTitleColor(.white, for: .normal) |
| 313 | 313 | pointBtn.titleLabel?.font = Font_15 |
| 314 | 314 | pointBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) |
| 315 | - pointBtn.addTarget(self, action: #selector(pushEarnRecordAction), for: .touchUpInside) | |
| 316 | 315 | return pointBtn |
| 317 | 316 | }() |
| 318 | 317 | |
| 319 | -// lazy var pointView: UIImageView = { | |
| 320 | -// | |
| 321 | -// return <#value#> | |
| 322 | -// }() | |
| 323 | - | |
| 324 | 318 | lazy var balanceBtn: UIButton = { |
| 325 | 319 | let balanceBtn = UIButton(type: .custom) |
| 326 | 320 | balanceBtn.size = CGSize(width: 102, height: 20) |
| 327 | 321 | balanceBtn.backgroundColor = .clear |
| 328 | 322 | balanceBtn.setTitle("元码余额收益", for: .normal) |
| 329 | 323 | balanceBtn.setTitleColor(.white, for: .normal) |
| 330 | - balanceBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) | |
| 324 | +// balanceBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) | |
| 331 | 325 | balanceBtn.titleLabel?.font = Font_15 |
| 332 | - balanceBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) | |
| 333 | - balanceBtn.addTarget(self, action: #selector(pushEarnBalanceAction), for: .touchUpInside) | |
| 326 | +// balanceBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) | |
| 334 | 327 | return balanceBtn |
| 335 | 328 | }() |
| 336 | 329 | |
| 337 | - lazy var pointLabel: UILabel = { | |
| 338 | - let pointLabel = UILabel.init() | |
| 339 | - pointLabel.text = "0" | |
| 340 | - pointLabel.textColor = .white | |
| 341 | - pointLabel.backgroundColor = .clear | |
| 342 | - pointLabel.font = BoldFont_25_Fit | |
| 343 | - return pointLabel | |
| 330 | + lazy var pointDescButton: UIButton = { | |
| 331 | + let pointDescButton = UIButton.init(type: .custom) | |
| 332 | + pointDescButton.setTitle("0", for: .normal) | |
| 333 | + pointDescButton.setTitleColor(.white, for: .normal) | |
| 334 | + pointDescButton.backgroundColor = .clear | |
| 335 | + pointDescButton.titleLabel?.font = BoldFont_25_Fit | |
| 336 | + pointDescButton.addTarget(self, action: #selector(pushEarnRecordAction), for: .touchUpInside) | |
| 337 | + return pointDescButton | |
| 344 | 338 | }() |
| 345 | 339 | |
| 346 | - lazy var balanceLabel: UILabel = { | |
| 347 | - let balanceLabel = UILabel.init() | |
| 348 | - balanceLabel.text = "0" | |
| 349 | - balanceLabel.textColor = .white | |
| 350 | - balanceLabel.backgroundColor = .clear | |
| 351 | - balanceLabel.font = BoldFont_25_Fit | |
| 352 | - return balanceLabel | |
| 340 | + lazy var balanceDescButton: UIButton = { | |
| 341 | + let balanceDescButton = UIButton.init(type: .custom) | |
| 342 | + balanceDescButton.setTitle("0", for: .normal) | |
| 343 | + balanceDescButton.setTitleColor(.white, for: .normal) | |
| 344 | + balanceDescButton.backgroundColor = .clear | |
| 345 | + balanceDescButton.titleLabel?.font = BoldFont_25_Fit | |
| 346 | + balanceDescButton.addTarget(self, action: #selector(pushEarnBalanceAction), for: .touchUpInside) | |
| 347 | + return balanceDescButton | |
| 353 | 348 | }() |
| 354 | 349 | |
| 355 | 350 | lazy var descBtn: UIButton = { |
| ... | ... | @@ -371,12 +366,12 @@ class MineQuestHeaderView: UIView { |
| 371 | 366 | addSubview(mainView) |
| 372 | 367 | mainView.addSubview(pointBtn) |
| 373 | 368 | mainView.addSubview(balanceBtn) |
| 374 | - mainView.addSubview(pointLabel) | |
| 375 | - mainView.addSubview(balanceLabel) | |
| 369 | + mainView.addSubview(pointDescButton) | |
| 370 | + mainView.addSubview(balanceDescButton) | |
| 376 | 371 | mainView.addSubview(descBtn) |
| 377 | 372 | |
| 378 | - balanceLabel.text = checkModel.money | |
| 379 | - pointLabel.text = checkModel.integral | |
| 373 | + balanceDescButton.setTitle(checkModel.money, for: .normal) | |
| 374 | + pointDescButton.setTitle(checkModel.integral, for: .normal) | |
| 380 | 375 | |
| 381 | 376 | setupConstraints() |
| 382 | 377 | } |
| ... | ... | @@ -397,11 +392,11 @@ class MineQuestHeaderView: UIView { |
| 397 | 392 | make.centerX.equalToSuperview().offset(50) |
| 398 | 393 | make.top.equalToSuperview().offset(15) |
| 399 | 394 | } |
| 400 | - pointLabel.snp.makeConstraints { make in | |
| 395 | + pointDescButton.snp.makeConstraints { make in | |
| 401 | 396 | make.left.equalTo(pointBtn.snp.left) |
| 402 | 397 | make.top.equalTo(pointBtn.snp.bottom).offset(10) |
| 403 | 398 | } |
| 404 | - balanceLabel.snp.makeConstraints { make in | |
| 399 | + balanceDescButton.snp.makeConstraints { make in | |
| 405 | 400 | make.left.equalTo(balanceBtn.snp.left) |
| 406 | 401 | make.top.equalTo(balanceBtn.snp.bottom).offset(10) |
| 407 | 402 | } | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
| ... | ... | @@ -32,6 +32,7 @@ class MineInfoLListTableViewCell : UITableViewCell { |
| 32 | 32 | titleLabel.backgroundColor = .clear |
| 33 | 33 | titleLabel.textColor = .black |
| 34 | 34 | titleLabel.font = BoldFont_18_Fit |
| 35 | + titleLabel.adjustsFontSizeToFitWidth=true | |
| 35 | 36 | titleLabel.minimumScaleFactor = 14*FontFit |
| 36 | 37 | return titleLabel |
| 37 | 38 | }() |
| ... | ... | @@ -133,6 +134,9 @@ class MineStandInfoTableViewCell: UITableViewCell { |
| 133 | 134 | let titleLabel = UILabel.init() |
| 134 | 135 | titleLabel.backgroundColor = .clear |
| 135 | 136 | titleLabel.textColor = .black |
| 137 | + titleLabel.numberOfLines = 0 | |
| 138 | + titleLabel.adjustsFontSizeToFitWidth=true | |
| 139 | + titleLabel.lineBreakMode = .byWordWrapping | |
| 136 | 140 | titleLabel.font = BoldFont_18_Fit |
| 137 | 141 | return titleLabel |
| 138 | 142 | }() |
| ... | ... | @@ -200,19 +204,19 @@ class MineStandInfoTableViewCell: UITableViewCell { |
| 200 | 204 | make.left.equalToSuperview().offset(15) |
| 201 | 205 | make.size.equalTo(50) |
| 202 | 206 | } |
| 207 | + timeLabel.snp.makeConstraints { make in | |
| 208 | + make.centerY.equalToSuperview() | |
| 209 | + make.right.equalToSuperview().offset(-10) | |
| 210 | + } | |
| 203 | 211 | titleLabel.snp.makeConstraints { make in |
| 204 | 212 | make.centerY.equalToSuperview().offset(-15) |
| 205 | 213 | make.left.equalTo(iconView.snp.right).offset(10) |
| 206 | - make.right.equalToSuperview().offset(-10) | |
| 214 | + make.right.equalToSuperview().offset(-30) | |
| 207 | 215 | } |
| 208 | 216 | numberLabel.snp.makeConstraints { make in |
| 209 | 217 | make.centerY.equalToSuperview().offset(15) |
| 210 | 218 | make.left.equalTo(iconView.snp.right).offset(10) |
| 211 | 219 | } |
| 212 | - timeLabel.snp.makeConstraints { make in | |
| 213 | - make.centerY.equalToSuperview() | |
| 214 | - make.right.equalToSuperview().offset(-10) | |
| 215 | - } | |
| 216 | 220 | } |
| 217 | 221 | |
| 218 | 222 | required init?(coder: NSCoder) { |
| ... | ... | @@ -313,7 +317,7 @@ class MessageDescTableViewCell: UITableViewCell { |
| 313 | 317 | }() |
| 314 | 318 | |
| 315 | 319 | lazy var contentLabel: UILabel = { |
| 316 | - let contentLabel = UILabel.init() | |
| 320 | + let contentLabel = UILabel.init(frame: CGRect.zero) | |
| 317 | 321 | contentLabel.backgroundColor = .white |
| 318 | 322 | contentLabel.textColor = HexColor("#666666") |
| 319 | 323 | contentLabel.lineBreakMode = .byCharWrapping |
| ... | ... | @@ -394,12 +398,13 @@ class MessageDescTableViewCell: UITableViewCell { |
| 394 | 398 | // make.right.equalToSuperview().offset(-10) |
| 395 | 399 | // make.height.equalTo(1) |
| 396 | 400 | // } |
| 397 | - contentLabel.snp.makeConstraints { make in | |
| 398 | - make.left.top.equalToSuperview().offset(10) | |
| 399 | - make.right.equalToSuperview().offset(-10) | |
| 400 | - make.width.equalTo(KSreenWidth - 110) | |
| 401 | - make.height.equalTo(0) | |
| 402 | - } | |
| 401 | + | |
| 402 | +// contentLabel.snp.makeConstraints { make in | |
| 403 | +// make.left.top.equalToSuperview().offset(10) | |
| 404 | +// make.right.equalToSuperview().offset(-10) | |
| 405 | +// make.width.equalTo(KSreenWidth - 110) | |
| 406 | +// make.height.equalTo(0) | |
| 407 | +// } | |
| 403 | 408 | } |
| 404 | 409 | |
| 405 | 410 | public func setupWithDataSource(listModel: NewsListModel) { |
| ... | ... | @@ -416,14 +421,15 @@ class MessageDescTableViewCell: UITableViewCell { |
| 416 | 421 | iconView.kf.setImage(with: URL(string: listModel.poster), placeholder: UIImage.imageWithColor(color: .red, size: CGSizeMake(40, 40))) |
| 417 | 422 | } |
| 418 | 423 | cView.snp.updateConstraints { make in |
| 419 | - make.height.equalTo(listModel.textHeight + 60) | |
| 420 | - } | |
| 421 | - contentLabel.snp.updateConstraints { make in | |
| 422 | - make.left.top.equalToSuperview().offset(10) | |
| 423 | - make.right.equalToSuperview().offset(-10) | |
| 424 | - make.width.equalTo(KSreenWidth - 110) | |
| 425 | - make.height.equalTo(listModel.textHeight) | |
| 424 | + make.height.equalTo(listModel.textHeight + 30) //20 | |
| 426 | 425 | } |
| 426 | +// contentLabel.snp.updateConstraints { make in | |
| 427 | +// make.left.top.equalToSuperview().offset(10) | |
| 428 | +// make.right.equalToSuperview().offset(-10) | |
| 429 | +// make.width.equalTo(KSreenWidth - 110) | |
| 430 | +// make.height.equalTo(listModel.textHeight) | |
| 431 | +// } | |
| 432 | + contentLabel.frame = CGRectMake(10, 15, KSreenWidth - 110, listModel.textHeight) | |
| 427 | 433 | } |
| 428 | 434 | |
| 429 | 435 | required init?(coder: NSCoder) { | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| ... | ... | @@ -302,6 +302,7 @@ class MinePointCheckInModel: BaseModel { |
| 302 | 302 | class MineTaskCheckListModel: BaseModel { |
| 303 | 303 | var icon: String? = "" |
| 304 | 304 | var score: String? = "" |
| 305 | + /**1 为第一次签到显示签到弹框,其他不显示*/ | |
| 305 | 306 | var status: String? = "" |
| 306 | 307 | var taskId: String? = "" |
| 307 | 308 | var taskType: String? = "" |
| ... | ... | @@ -311,6 +312,14 @@ class MineTaskCheckListModel: BaseModel { |
| 311 | 312 | var url: String? = "" |
| 312 | 313 | } |
| 313 | 314 | // !!!: /Daren/transaction/getTransactionRecord.action 余额交易记录 |
| 315 | + | |
| 316 | +class MineTradingRecordBaseModel: BaseModel { | |
| 317 | + var defray: String? = "" | |
| 318 | + var lasePage: Bool = false | |
| 319 | + var income: String? = "" | |
| 320 | + var list = [MineTradingRecordModel]() | |
| 321 | +} | |
| 322 | + | |
| 314 | 323 | class MineTradingRecordModel: BaseModel { |
| 315 | 324 | |
| 316 | 325 | var disburseRecord: String? = ""//支出 | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -433,7 +433,7 @@ class CNLiveMineViewModel: NSObject { |
| 433 | 433 | /// - resultBlock: 返回 |
| 434 | 434 | static func requestsStandInfo(identityId: String, type: CNLiveMineGetWriteType, resultBlock: @escaping resultNewsBlock) { |
| 435 | 435 | let param = NSMutableDictionary() |
| 436 | - param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")//UserInfoManager.shared.userInfo.uid //10458139 | |
| 436 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 437 | 437 | param.setValue(identityId, forKey: "identityId") |
| 438 | 438 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 439 | 439 | CNLiveNetworking.setupShowDataResult(false) |
| ... | ... | @@ -673,8 +673,8 @@ class CNLiveMineViewModel: NSObject { |
| 673 | 673 | let param = NSMutableDictionary() |
| 674 | 674 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "targetId") |
| 675 | 675 | param.setValue("0", forKey: "type")//0全部(默认) 1收入 2支出 |
| 676 | - param.setValue("1692610120000", forKey: "startTime") | |
| 677 | - param.setValue("1695202120000", forKey: "endTime") | |
| 676 | + param.setValue("\((timeStamp * 1000) - 30*24*60*60)", forKey: "startTime")//"1600569015000" | |
| 677 | + param.setValue("\((timeStamp * 1000))", forKey: "endTime")//"1603074615000" | |
| 678 | 678 | param.setValue("10", forKey: "pageSize") |
| 679 | 679 | param.setValue("\(page)", forKey: "pageNo") |
| 680 | 680 | let custom_param = NSMutableDictionary() |
| ... | ... | @@ -690,14 +690,8 @@ class CNLiveMineViewModel: NSObject { |
| 690 | 690 | let resp = result as! NSDictionary |
| 691 | 691 | let errorCode = "\(resp["errorCode"] ?? "0")" |
| 692 | 692 | if (errorCode == "0") { |
| 693 | - let dict = resp["data"] as! NSDictionary | |
| 694 | - let array = dict["list"] as! NSArray | |
| 695 | - let tempArray = NSMutableArray() | |
| 696 | - for item in array { | |
| 697 | - let listModel = dictionaryToModel(item as! [String : Any], MineTradingRecordModel.self,"") as! MineTradingRecordModel | |
| 698 | - tempArray.add(listModel) | |
| 699 | - } | |
| 700 | - resultBlock(tempArray,.success) | |
| 693 | + let listModel = dictionaryToModel(resp as! [String : Any], MineTradingRecordBaseModel.self,"data") as! MineTradingRecordBaseModel | |
| 694 | + resultBlock(listModel,.success) | |
| 701 | 695 | } else { |
| 702 | 696 | showMessage(message: resp["errorMessage"] as! String) |
| 703 | 697 | resultBlock(NSNull(),.failed) |
| ... | ... | @@ -719,10 +713,12 @@ class CNLiveMineViewModel: NSObject { |
| 719 | 713 | /// - page: 页数 |
| 720 | 714 | /// - resultBlock: 返回 |
| 721 | 715 | static func requestWithIntegralRecord(page: NSInteger, resultBlock: @escaping resultNewsBlock) { |
| 716 | + let startTime = NSDate.timeIntervalChangeToTimeStr(timeInterval: Double((timeStamp * 1000) - 30*24*60*60)) | |
| 717 | + let endTime = NSDate.timeIntervalChangeToTimeStr(timeInterval: Double(timeStamp * 1000)) | |
| 722 | 718 | let param = NSMutableDictionary() |
| 723 | 719 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") |
| 724 | - param.setValue("2022-08-21", forKey: "startTime")//开始时间 | |
| 725 | - param.setValue("2022-09-20", forKey: "endTime")//开始时间 | |
| 720 | + param.setValue(startTime, forKey: "startTime")//开始时间 "2022-08-21" | |
| 721 | + param.setValue(endTime, forKey: "endTime")//开始时间 "2022-09-20" | |
| 726 | 722 | param.setValue("0", forKey: "type")//0全部(默认) 1收入 2支出 |
| 727 | 723 | param.setValue("10", forKey: "pageSize") |
| 728 | 724 | param.setValue("\(page)", forKey: "pageNo") |
| ... | ... | @@ -757,6 +753,42 @@ class CNLiveMineViewModel: NSObject { |
| 757 | 753 | } |
| 758 | 754 | } |
| 759 | 755 | |
| 756 | + /// 签到功能 | |
| 757 | + /// - Parameters: | |
| 758 | + /// - resultBlock: 返回 | |
| 759 | + static func requestWithCheckInAction(resultBlock: @escaping resultNewsBlock) { | |
| 760 | + let param = NSMutableDictionary() | |
| 761 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 762 | + let custom_param = NSMutableDictionary() | |
| 763 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 764 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 765 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 766 | + CNLiveNetworking.setupShowDataResult(false) | |
| 767 | + CNLiveNetworking.setupSignRequestKey(APPKey_wjj) | |
| 768 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 769 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjUrl+"/Daren/integral/checkIn.action", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 770 | + hiddenLoading() | |
| 771 | + if (error == nil) { | |
| 772 | + let resp = result as! NSDictionary | |
| 773 | + let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 774 | + if (errorCode == "0") { | |
| 775 | + resultBlock(resp,.success) | |
| 776 | + } else { | |
| 777 | + showMessage(message: resp["errorMessage"] as! String) | |
| 778 | + resultBlock(NSNull(),.failed) | |
| 779 | + } | |
| 780 | + } else { | |
| 781 | + if CNLiveNetworking.isNetworking() { | |
| 782 | + showMessage(message: "签到失败") | |
| 783 | + resultBlock(NSNull(),.failed) | |
| 784 | + } else { | |
| 785 | + showMessage(message: "似乎与网络断开链接") | |
| 786 | + resultBlock(NSNull(),.noNetwork) | |
| 787 | + } | |
| 788 | + } | |
| 789 | + } | |
| 790 | + } | |
| 791 | + | |
| 760 | 792 | /// 获取十位时间戳 |
| 761 | 793 | static var timeStamp: Int { |
| 762 | 794 | let timeInterval: TimeInterval = NSDate().timeIntervalSince1970 | ... | ... |