Commit 077cabd1c50a978f8e4d9bfefa454578c63bf25a

Authored by liushiyu
1 parent b617f1f7

我的界面逻辑修改

metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
... ... @@ -7,10 +7,16 @@
7 7  
8 8 import Foundation
9 9  
  10 +enum CNLiveMineInfoShowType {
  11 + case add//添加身份
  12 + case info//身份信息
  13 + case message//消息中心
  14 +}
  15 +
10 16 class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, UITableViewDragDelegate, UITableViewDropDelegate {
11 17  
12 18 let kCNLiveMineInfoLListTableViewIdentifier = "kCNLiveMineInfoLListTableViewIdentifier"
13   -
  19 + let kCNLiveMineStandInfoTableViewIdentifier = "kCNLiveMineStandInfoTableViewIdentifier"
14 20 lazy var tableView: UITableView = {
15 21 let tableView = UITableView(frame: .zero, style: .plain)
16 22 tableView.delegate = self
... ... @@ -20,27 +26,77 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
20 26 tableView.backgroundColor = HexColor("#F7F8FA")
21 27 tableView.tableFooterView = UIView.init()
22 28 tableView.rowHeight = 100
23   - tableView.dragInteractionEnabled = true
24 29 tableView.contentInsetAdjustmentBehavior = .scrollableAxes
25 30 tableView.separatorStyle = .none
26 31 tableView.register(MineInfoLListTableViewCell.self, forCellReuseIdentifier: kCNLiveMineInfoLListTableViewIdentifier)
  32 + tableView.register(MineStandInfoTableViewCell.self, forCellReuseIdentifier: kCNLiveMineStandInfoTableViewIdentifier)
27 33 return tableView
28 34 }()
29 35  
30 36 lazy var dataArray: NSMutableArray = {
31 37 let dataArray = NSMutableArray()
32   - dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份"])
33   - dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份"])
  38 + if _show_type == .add {
  39 + dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份"])
  40 + dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份"])
  41 + }
  42 + if _show_type == .info {
  43 + dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者身份","number":"证件编号:410800111127954"])
  44 + dataArray.add(["image":"mine_header_icon_defult_ava","name":"退伍军人身份","number":"证件编号:410800111127954"])
  45 + }
  46 + if _show_type == .message {
  47 + dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者云","number":"志愿者大礼包发放中,快来领取吧!","time":"03-12"])
  48 + dataArray.add(["image":"mine_header_icon_defult_ava","name":"志愿者·志愿云","number":"志愿者大礼包快来领取吧~","time":"03-12"])
  49 + }
34 50 return dataArray
35 51 }()
36 52  
37   - override func viewWillAppear(_ animated: Bool) {
38   - navigationBarHidden = false
  53 + lazy var setButton = {
  54 + let setButton = UIButton.init(type: .custom)
  55 + setButton.frame = CGRectMake(KSreenWidth - 35, (get_system_nav_height() - (get_system_statusBar_height() + 20))/2 + get_system_statusBar_height(), 20, 20)
  56 + setButton.backgroundColor = .white
  57 + setButton.setImage(UIImage(named: "mine_sub_header_note_set"), for: .normal)
  58 + setButton.imageView?.contentMode = .scaleToFill
  59 + setButton.addTarget(self, action: #selector(noteSetAction), for: .touchUpInside)
  60 + return setButton
  61 + }()
  62 +
  63 + lazy var copyButton = {
  64 + let copyButton = UIButton.init(type: .custom)
  65 + copyButton.frame = CGRectMake(KSreenWidth - 70, (get_system_nav_height() - (get_system_statusBar_height() + 20))/2 + get_system_statusBar_height(), 20, 20)
  66 + copyButton.backgroundColor = .white
  67 + copyButton.setImage(UIImage(named: "mine_sub_header_back_up_copy"), for: .normal)
  68 + copyButton.imageView?.contentMode = .scaleToFill
  69 + copyButton.addTarget(self, action: #selector(backCopyAction), for: .touchUpInside)
  70 + return copyButton
  71 + }()
  72 +
  73 + var _show_type:CNLiveMineInfoShowType!
  74 + init(show_type:CNLiveMineInfoShowType) {
  75 + super.init(nibName:nil, bundle:nil)
  76 + _show_type = show_type
  77 + }
  78 +
  79 + required init?(coder: NSCoder) {
  80 + fatalError("init(coder:) has not been implemented")
39 81 }
40 82  
41 83 override func viewDidLoad() {
42 84 super.viewDidLoad()
43   - titleName = "添加身份"
  85 + switch _show_type {
  86 + case .add:
  87 + titleName = "添加身份"
  88 + case .info:
  89 + titleName = "身份信息"
  90 + tableView.dragInteractionEnabled = true
  91 + case .message:
  92 + titleName = "消息中心"
  93 + topNavView.addSubview(setButton)
  94 + topNavView.addSubview(copyButton)
  95 + case .none:
  96 + break
  97 + }
  98 +
  99 + navigationBarHidden = false
44 100 view.addSubview(tableView)
45 101 tableView.snp.makeConstraints { make in
46 102 make.top.equalTo(get_system_nav_height())
... ... @@ -48,11 +104,11 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
48 104 }
49 105 }
50 106  
51   - private func dragCell(cell:UITableViewCell?) {
52   - if #available(iOS 11.0, *) {
53   - /// 当cell在拖拽过程中是否允许交互
54   - cell?.userInteractionEnabledWhileDragging = false
55   - } else {}
  107 + @objc func noteSetAction() {
  108 +
  109 + }
  110 + @objc func backCopyAction() {
  111 +
56 112 }
57 113 }
58 114  
... ... @@ -65,13 +121,32 @@ extension CNLiveMineAddInfoViewController {
65 121 return dataArray.count
66 122 }
67 123 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
68   - guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineInfoLListTableViewIdentifier) as? MineInfoLListTableViewCell else{
69   - return MineInfoLListTableViewCell()
  124 + if _show_type == .add {
  125 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineInfoLListTableViewIdentifier) as? MineInfoLListTableViewCell else {
  126 + return MineInfoLListTableViewCell()
  127 + }
  128 + let dict = dataArray[indexPath.row] as! Dictionary<String, Any>
  129 + cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String)
  130 + cell.userInteractionEnabledWhileDragging = true
  131 + return cell
  132 +
  133 + } else if _show_type == .message {
  134 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineStandInfoTableViewIdentifier) as? MineStandInfoTableViewCell else {
  135 + return MineStandInfoTableViewCell()
  136 + }
  137 + let dict = dataArray[indexPath.row] as! Dictionary<String, Any>
  138 + cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String,number: dict["number"] as! String, time: dict["time"] as! String)
  139 + cell.userInteractionEnabledWhileDragging = true
  140 + return cell
  141 + } else {
  142 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineStandInfoTableViewIdentifier) as? MineStandInfoTableViewCell else {
  143 + return MineStandInfoTableViewCell()
  144 + }
  145 + let dict = dataArray[indexPath.row] as! Dictionary<String, Any>
  146 + cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String,number: dict["number"] as! String)
  147 + cell.userInteractionEnabledWhileDragging = false
  148 + return cell
70 149 }
71   - let dict = dataArray[indexPath.row] as! Dictionary<String, Any>
72   - cell.setupWithDataSource(icon: dict["image"] as! String, name: dict["name"] as! String)
73   - dragCell(cell: cell)
74   - return cell
75 150 }
76 151 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
77 152 return 100
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
... ... @@ -84,6 +84,7 @@ extension CNLiveMineViewController {
84 84  
85 85 if indexPath.section == 0 {
86 86 let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineOneViewCellIdentifier) as! MineBodyOneListViewCell
  87 +
87 88 return cell
88 89 }
89 90 let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineTwoViewCellIdentifier) as! MineBodyTwoListViewCell
... ... @@ -103,7 +104,7 @@ extension CNLiveMineViewController {
103 104  
104 105 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
105 106 if indexPath.section == 1 {
106   - self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(), animated: true)
  107 + self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .add), animated: true)
107 108 }
108 109 if indexPath.section == 2 && indexPath.row == 0 {
109 110 self.navigationController?.pushViewController(CNLiveHelpFeedBackViewController.init(), animated: true)
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
... ... @@ -42,6 +42,7 @@ class MineBodyOneListViewCell : UITableViewCell {
42 42 lookBtn.titleLabel?.font = BoldFont_14
43 43 lookBtn.layer.masksToBounds = true
44 44 lookBtn.layer.cornerRadius = 15
  45 + lookBtn.addTarget(self, action: #selector(pushLookAction), for: .touchUpInside)
45 46 return lookBtn
46 47 }()
47 48  
... ... @@ -68,6 +69,10 @@ class MineBodyOneListViewCell : UITableViewCell {
68 69 setupConstraints()
69 70 }
70 71  
  72 + @objc func pushLookAction() {
  73 + currentViewController()?.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true)
  74 + }
  75 +
71 76 required init?(coder: NSCoder) {
72 77 fatalError("init(coder:) has not been implemented")
73 78 }
... ... @@ -238,8 +243,6 @@ class MineBodyTwoListViewCell : UITableViewCell {
238 243 moreLabel.font = Font_15_Fit
239 244 }
240 245 moreLabel.text = "\(dict["more"] ?? "")"
241   -
242   -
243 246 }
244 247 if (dict.keys.contains("avatar") && (dict["avatar"] as! String).count > 0) {
245 248 avatarView.isHidden = false
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
... ... @@ -72,7 +72,7 @@ class MineHeaderView : UIView {
72 72 }
73 73  
74 74 @objc func tipBtnAction() {
75   -
  75 + currentViewController()?.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .message), animated: true)
76 76 }
77 77  
78 78 @objc func pushMineInfoAction() {
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
... ... @@ -7,7 +7,7 @@
7 7  
8 8 import Foundation
9 9  
10   -enum CNLiveMineInfoShowType {
  10 +enum CNLiveMineInfoAlertShowType {
11 11 case gender
12 12 case birthday
13 13 }
... ... @@ -148,7 +148,6 @@ class MineInfoAlertView: UIView {
148 148 }()
149 149  
150 150 var gender: String?
151   - var show_type: CNLiveMineInfoShowType?
152 151 var result: CloseGenderResultBlock?
153 152 override init(frame: CGRect) {
154 153 super.init(frame: frame)
... ... @@ -167,16 +166,7 @@ class MineInfoAlertView: UIView {
167 166 backView.addSubview(lineLable)
168 167 backView.addSubview(closeButton)
169 168 backView.addSubview(doneButton)
170   - switch show_type {
171   - case .gender:
172   - nameLable.text = "设置性别"
173   - contentView.isHidden = false
174   - datePicker.isHidden = true
175   - default:
176   - nameLable.text = "选择生日"
177   - contentView.isHidden = true
178   - datePicker.isHidden = false
179   - }
  169 +
180 170 wBtn.isSelected = UserInfoManager.shared.userInfo.gender == "男"
181 171 mBtn.isSelected = UserInfoManager.shared.userInfo.gender == "女"
182 172 wView.isHidden = UserInfoManager.shared.userInfo.gender == "男"
... ... @@ -212,7 +202,7 @@ class MineInfoAlertView: UIView {
212 202 lineLable.snp.makeConstraints { make in
213 203 make.left.right.equalToSuperview()
214 204 make.height.equalTo(1)
215   - make.top.equalTo(nameLable.snp.bottom).offset(10)
  205 + make.top.equalTo(doneButton.snp.bottom).offset(10)
216 206 }
217 207 datePicker.snp.makeConstraints { make in
218 208 make.bottom.equalToSuperview()
... ... @@ -255,11 +245,21 @@ class MineInfoAlertView: UIView {
255 245  
256 246 }
257 247  
258   - static public func showSelectView(showType: CNLiveMineInfoShowType, result: @escaping CloseGenderResultBlock){
  248 + static public func showSelectView(showType: CNLiveMineInfoAlertShowType, result: @escaping CloseGenderResultBlock){
259 249 let pickerView = MineInfoAlertView()
260   - pickerView.show_type = showType
261 250 pickerView.result = result
262 251  
  252 + switch showType {
  253 + case .gender:
  254 + pickerView.nameLable.text = "设置性别"
  255 + pickerView.contentView.isHidden = false
  256 + pickerView.datePicker.isHidden = true
  257 + case .birthday:
  258 + pickerView.nameLable.text = "选择生日"
  259 + pickerView.contentView.isHidden = true
  260 + pickerView.datePicker.isHidden = false
  261 + }
  262 +
263 263 let window = UIApplication.shared.windows.last
264 264 window?.addSubview(pickerView)
265 265 pickerView.snp.makeConstraints { make in
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
... ... @@ -93,6 +93,114 @@ class MineInfoLListTableViewCell : UITableViewCell {
93 93 }
94 94 }
95 95  
  96 +class MineStandInfoTableViewCell: UITableViewCell {
  97 +
  98 + lazy var mainView: UIImageView = {
  99 + let mainView = UIImageView.init()
  100 + mainView.contentMode = .scaleToFill
  101 + mainView.backgroundColor = .white
  102 + mainView.isUserInteractionEnabled = true
  103 + mainView.layer.masksToBounds = true
  104 + mainView.layer.cornerRadius = 8
  105 + return mainView
  106 + }()
  107 +
  108 + lazy var iconView : UIImageView = {
  109 + let iconView = UIImageView.init()
  110 + iconView.contentMode = .scaleToFill
  111 + iconView.backgroundColor = .clear
  112 + iconView.layer.masksToBounds = true
  113 + iconView.layer.cornerRadius = 25
  114 + return iconView
  115 + }()
  116 +
  117 + lazy var titleLabel: UILabel = {
  118 + let titleLabel = UILabel.init()
  119 + titleLabel.backgroundColor = .clear
  120 + titleLabel.textColor = .black
  121 + titleLabel.font = BoldFont_18_Fit
  122 + return titleLabel
  123 + }()
  124 +
  125 + lazy var numberLabel: UILabel = {
  126 + let numberLabel = UILabel.init()
  127 + numberLabel.textColor = HexColor("#A2A7B8")
  128 + numberLabel.font = Font_12_Fit
  129 + numberLabel.backgroundColor = .clear
  130 + return numberLabel
  131 + }()
  132 +
  133 + lazy var timeLabel: UILabel = {
  134 + let timeLabel = UILabel.init()
  135 + timeLabel.textColor = HexColor("#A2A7B8")
  136 + timeLabel.font = Font_12
  137 + timeLabel.backgroundColor = .clear
  138 + timeLabel.isHidden = true
  139 + return timeLabel
  140 + }()
  141 +
  142 + public func setupWithDataSource(icon: String, name: String,number: String) {
  143 + iconView.image = UIImage(named: icon)
  144 + titleLabel.text = name
  145 + numberLabel.text = number
  146 + }
  147 +
  148 + public func setupWithDataSource(icon: String, name: String,number: String, time: String) {
  149 + iconView.image = UIImage(named: icon)
  150 + titleLabel.text = name
  151 + numberLabel.text = number
  152 + timeLabel.text = time
  153 + timeLabel.isHidden = false
  154 + }
  155 +
  156 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  157 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  158 + self.selectionStyle = .none
  159 + self.backgroundColor = .clear
  160 +
  161 + addSubview(mainView)
  162 + mainView.addSubview(iconView)
  163 + mainView.addSubview(titleLabel)
  164 + mainView.addSubview(numberLabel)
  165 + mainView.addSubview(timeLabel)
  166 +
  167 + setupConstraints()
  168 + }
  169 +
  170 + func setupConstraints() {
  171 + mainView.snp.makeConstraints { make in
  172 + make.left.equalToSuperview().offset(15)
  173 + make.right.equalToSuperview().offset(-15)
  174 + make.top.equalToSuperview().offset(5)
  175 + make.bottom.equalToSuperview().offset(-5)
  176 + }
  177 + iconView.snp.makeConstraints { make in
  178 + make.centerY.equalToSuperview()
  179 + make.left.equalToSuperview().offset(15)
  180 + make.size.equalTo(50)
  181 + }
  182 + titleLabel.snp.makeConstraints { make in
  183 + make.centerY.equalToSuperview().offset(-15)
  184 + make.left.equalTo(iconView.snp.right).offset(10)
  185 + }
  186 + numberLabel.snp.makeConstraints { make in
  187 + make.centerY.equalToSuperview().offset(15)
  188 + make.left.equalTo(iconView.snp.right).offset(10)
  189 + }
  190 + timeLabel.snp.makeConstraints { make in
  191 + make.centerY.equalToSuperview()
  192 + make.right.equalToSuperview().offset(-10)
  193 + }
  194 + }
  195 +
  196 + required init?(coder: NSCoder) {
  197 + fatalError("init(coder:) has not been implemented")
  198 + }
  199 +}
  200 +
  201 +
  202 +
  203 +
96 204 class MineFeedBackListCollectViewCell : UICollectionViewCell {
97 205  
98 206 lazy var iconView: UIImageView = {
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_info_stand_add_btn.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_info_stand_add_btn@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_info_stand_add_btn@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_info_stand_add_btn.imageset/mine_info_stand_add_btn@2x.png 0 → 100644

7.95 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_info_stand_add_btn.imageset/mine_info_stand_add_btn@3x.png 0 → 100644

15.7 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_sub_header_back_up_copy.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_sub_header_back_up_copy@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_sub_header_back_up_copy@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_sub_header_back_up_copy.imageset/mine_sub_header_back_up_copy@2x.png 0 → 100644

1.09 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_sub_header_back_up_copy.imageset/mine_sub_header_back_up_copy@3x.png 0 → 100644

1.8 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_sub_header_note_set.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "mine_sub_header_note_set@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "mine_sub_header_note_set@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/MinePage/mine_sub_header_note_set.imageset/mine_sub_header_note_set@2x.png 0 → 100644

1.64 KB

metaCode/Supporting Files/Assets.xcassets/MinePage/mine_sub_header_note_set.imageset/mine_sub_header_note_set@3x.png 0 → 100644

3.13 KB