Commit 830caff1fca077b02e9708e6053210b165b1ebea
1 parent
ea2eecc4
修改部分测试问题
Showing
10 changed files
with
55 additions
and
30 deletions
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
| ... | ... | @@ -46,9 +46,12 @@ class CNLiveBaseTabBarViewController: UITabBarController |
| 46 | 46 | super.viewDidAppear(animated) |
| 47 | 47 | print("获取用户用户数据=====>\(UserInfoManager.shared.userInfo.uid)") |
| 48 | 48 | |
| 49 | - CNLiveMineViewModel.requestSystemNews { result, respStatue in | |
| 50 | - if respStatue == .success { | |
| 51 | - UpdataAlertView.showUpdataView(updataModel: result as! UpdateInfoModel) | |
| 49 | + //已经弹出过就不用再弹框了 | |
| 50 | + if UserInfoManager.shared.userInfo.show_update != "1" { | |
| 51 | + CNLiveMineViewModel.requestSystemNews { result, respStatue in | |
| 52 | + if respStatue == .success { | |
| 53 | + UpdataAlertView.showUpdataView(updataModel: result as! UpdateInfoModel) | |
| 54 | + } | |
| 52 | 55 | } |
| 53 | 56 | } |
| 54 | 57 | } | ... | ... |
metaCode/Classes/Config/CNLiveConfigUserInfo.swift
metaCode/Classes/Main/MinePage/Controller/CNLiveInputFeedBackViewController.swift
| ... | ... | @@ -212,7 +212,7 @@ class CNLiveInputFeedBackViewController: CNLiveBaseViewController, UITextViewDel |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | @objc func sendInfoActionMothod() { |
| 215 | - CNLiveMineViewModel.requestFeedBack(text: p_textView.text ?? "", contactWay: UserInfoManager.shared.userInfo.mobile, images: imageUrlArray) { result in | |
| 215 | + CNLiveMineViewModel.requestFeedBack(text: p_textView.text ?? "", contactWay: UserInfoManager.shared.userInfo.mobile, images: imageUrlArray) { type, result in | |
| 216 | 216 | if result { |
| 217 | 217 | showMessage(message: "内容提交成功") |
| 218 | 218 | self.navigationController?.popViewController(animated: true) | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInfoViewController.swift
| ... | ... | @@ -15,7 +15,8 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl |
| 15 | 15 | lazy var imageView: UIImageView = { |
| 16 | 16 | let imageView = UIImageView.init() |
| 17 | 17 | imageView.backgroundColor = .clear |
| 18 | - imageView.contentMode = .scaleToFill | |
| 18 | + imageView.contentMode = .scaleAspectFill | |
| 19 | + imageView.clipsToBounds = true | |
| 19 | 20 | imageView.image = UIImage(named: "mine_header_icon_defult_ava") |
| 20 | 21 | imageView.kf.indicatorType = .activity |
| 21 | 22 | imageView.kf.setImage(with: URL(string: UserInfoManager.shared.userInfo.bigFaceUrl), placeholder: UIImage(named: "mine_header_icon_defult_ava")) |
| ... | ... | @@ -123,7 +124,7 @@ class CNLiveMineInfoViewController: CNLiveBaseViewController, PhotoPickerControl |
| 123 | 124 | } |
| 124 | 125 | |
| 125 | 126 | @objc func changeSendAction() { |
| 126 | - CNLiveMineViewModel.requestUploadIconAction(_select_image) { [weak self] statue in | |
| 127 | + CNLiveMineViewModel.requestUploadIconAction(_select_image) { [weak self] type, statue in | |
| 127 | 128 | if statue { |
| 128 | 129 | //再这里进行图片上传 |
| 129 | 130 | self!.reslut(self!._select_image) | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineNickViewController.swift
| ... | ... | @@ -86,7 +86,7 @@ class CNLiveMineNickViewController: CNLiveBaseViewController, UITextFieldDelegat |
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | @objc func clickSaveAction() { |
| 89 | - CNLiveMineViewModel.requestUpdateUserInfoAction(type: .nickName, value: nickField.text ?? "", resultBlock: { [weak self] result in | |
| 89 | + CNLiveMineViewModel.requestUpdateUserInfoAction(type: .nickName, value: nickField.text ?? "", resultBlock: { [weak self] type, result in | |
| 90 | 90 | if result { |
| 91 | 91 | let userInfo = UserInfoManager.shared.userInfo |
| 92 | 92 | userInfo.nickName = self!.nickField.text ?? "" | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveTypeFeedBackViewController.swift
| ... | ... | @@ -294,6 +294,7 @@ extension CNLiveTypeFeedBackViewController { |
| 294 | 294 | if indexPath.section == 3 { |
| 295 | 295 | MineInfoAlertView.showSelectView(showType: .birthday) { [weak self] text in |
| 296 | 296 | self!.updateWithDataSource() |
| 297 | + print("刷新之后的数据是=>\(UserInfoManager.shared.userInfo.birthday)") | |
| 297 | 298 | } |
| 298 | 299 | } |
| 299 | 300 | } | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
| ... | ... | @@ -18,7 +18,7 @@ class MineHeaderView : UIView { |
| 18 | 18 | iconView.backgroundColor = .clear |
| 19 | 19 | iconView.layer.cornerRadius = 30 |
| 20 | 20 | iconView.layer.masksToBounds = true |
| 21 | - iconView.contentMode = .scaleToFill | |
| 21 | + iconView.contentMode = .scaleAspectFill | |
| 22 | 22 | iconView.isUserInteractionEnabled = true |
| 23 | 23 | let tap = UITapGestureRecognizer.init(target: self, action: #selector(pushMineInfoAction)) |
| 24 | 24 | iconView.addGestureRecognizer(tap) | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
| ... | ... | @@ -114,6 +114,13 @@ class MineInfoAlertView: UIView { |
| 114 | 114 | } else { |
| 115 | 115 | // Fallback on earlier versions |
| 116 | 116 | } |
| 117 | + if UserInfoManager.shared.userInfo.birthday.count > 0 { | |
| 118 | + let dateFomatter = DateFormatter() | |
| 119 | + dateFomatter.dateFormat = "yyyy-MM-dd" | |
| 120 | + dateFomatter.locale = Locale.init(identifier: "zh_CN") | |
| 121 | + let date = dateFomatter.date(from: UserInfoManager.shared.userInfo.birthday) | |
| 122 | + datePicker.setDate(date!, animated: true) | |
| 123 | + } | |
| 117 | 124 | datePicker.minimumDate = Date.init(timeIntervalSince1970: -60*60*24*365*60) |
| 118 | 125 | datePicker.maximumDate = Date.init(timeInterval: 0, since: Date.init()) |
| 119 | 126 | datePicker.addTarget(self, action: #selector(dateChangeAction), for: .valueChanged) |
| ... | ... | @@ -267,12 +274,17 @@ class MineInfoAlertView: UIView { |
| 267 | 274 | pickerView.nameLable.text = "选择生日" |
| 268 | 275 | pickerView.contentView.isHidden = true |
| 269 | 276 | pickerView.datePicker.isHidden = false |
| 277 | + pickerView.birthday = UserInfoManager.shared.userInfo.birthday | |
| 270 | 278 | case .nickName: |
| 271 | 279 | break |
| 272 | 280 | case .email: |
| 273 | 281 | break |
| 274 | 282 | case .location: |
| 275 | 283 | break |
| 284 | + case .icon: | |
| 285 | + break | |
| 286 | + case .other: | |
| 287 | + break | |
| 276 | 288 | } |
| 277 | 289 | |
| 278 | 290 | let window = UIApplication.shared.windows.last |
| ... | ... | @@ -301,7 +313,6 @@ class MineInfoAlertView: UIView { |
| 301 | 313 | @objc func dateChangeAction(sender: UIDatePicker) { |
| 302 | 314 | let formatter = DateFormatter() |
| 303 | 315 | formatter.dateFormat = "yyyy-MM-dd" |
| 304 | - print("\(formatter.string(from: datePicker.date))") | |
| 305 | 316 | birthday = formatter.string(from: datePicker.date) |
| 306 | 317 | } |
| 307 | 318 | |
| ... | ... | @@ -315,17 +326,18 @@ class MineInfoAlertView: UIView { |
| 315 | 326 | if type == .gender { |
| 316 | 327 | value = gender ?? "" |
| 317 | 328 | } |
| 318 | - CNLiveMineViewModel.requestUpdateUserInfoAction(type: type!, value: value) { [weak self] statue in | |
| 329 | + CNLiveMineViewModel.requestUpdateUserInfoAction(type: type!, value: value) { [self] type, statue in | |
| 319 | 330 | if statue { |
| 320 | 331 | let userInfo = UserInfoManager.shared.userInfo |
| 321 | - if self!.type == .gender { | |
| 332 | + if type == .gender { | |
| 322 | 333 | userInfo.gender = (value == "m" ? "男" : "女") |
| 323 | 334 | } |
| 324 | - if self!.type == .birthday { | |
| 335 | + if type == .birthday { | |
| 325 | 336 | userInfo.birthday = value |
| 337 | + print("存储到本地的数据是=>\(userInfo.birthday)") | |
| 326 | 338 | } |
| 327 | 339 | UserInfoManager.cacheUserInfo(userInfo: userInfo) |
| 328 | - self!.result!(value) | |
| 340 | + result!(value) | |
| 329 | 341 | } |
| 330 | 342 | } |
| 331 | 343 | } |
| ... | ... | @@ -523,10 +535,12 @@ class UpdataAlertView: UIView { |
| 523 | 535 | |
| 524 | 536 | @objc func sendLoginActionMothod() -> Void { |
| 525 | 537 | print("跳转到appstore") |
| 538 | + UserInfoManager.shared.userInfo.show_update = "1" | |
| 526 | 539 | showMessage(message: "跳转到AppStore") |
| 527 | 540 | } |
| 528 | 541 | |
| 529 | 542 | @objc func setupCloseButtonAction() -> Void { |
| 543 | + UserInfoManager.shared.userInfo.show_update = "1" | |
| 530 | 544 | removeFromSuperview() |
| 531 | 545 | } |
| 532 | 546 | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
| ... | ... | @@ -107,10 +107,11 @@ class MineStandInfoTableViewCell: UITableViewCell { |
| 107 | 107 | |
| 108 | 108 | lazy var iconView : UIImageView = { |
| 109 | 109 | let iconView = UIImageView.init() |
| 110 | - iconView.contentMode = .scaleToFill | |
| 110 | + iconView.contentMode = .scaleAspectFill | |
| 111 | 111 | iconView.backgroundColor = .clear |
| 112 | 112 | iconView.layer.masksToBounds = true |
| 113 | 113 | iconView.layer.cornerRadius = 25 |
| 114 | + iconView.clipsToBounds = true | |
| 114 | 115 | return iconView |
| 115 | 116 | }() |
| 116 | 117 | |
| ... | ... | @@ -410,5 +411,6 @@ class MessageDescTableViewCell: UITableViewCell { |
| 410 | 411 | |
| 411 | 412 | @objc func textButtonAction() { |
| 412 | 413 | print("跳转H5详情界面") |
| 414 | + showMessage(message: "跳转H5详情界面") | |
| 413 | 415 | } |
| 414 | 416 | } | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -9,11 +9,13 @@ import Foundation |
| 9 | 9 | import CNLiveRequestBastKit |
| 10 | 10 | |
| 11 | 11 | enum CNLiveMineRequestType { |
| 12 | + case icon | |
| 12 | 13 | case nickName |
| 13 | 14 | case gender |
| 14 | 15 | case email |
| 15 | 16 | case location |
| 16 | 17 | case birthday |
| 18 | + case other | |
| 17 | 19 | } |
| 18 | 20 | enum CNLiveMineResponseType { |
| 19 | 21 | case success |
| ... | ... | @@ -21,7 +23,7 @@ enum CNLiveMineResponseType { |
| 21 | 23 | case noNetwork |
| 22 | 24 | case unkonw |
| 23 | 25 | } |
| 24 | -typealias resultBlock = (_ result: Bool) -> Void | |
| 26 | +typealias resultBlock = (_ type: CNLiveMineRequestType,_ result: Bool) -> Void | |
| 25 | 27 | typealias resultNewsBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void |
| 26 | 28 | class CNLiveMineViewModel: NSObject { |
| 27 | 29 | |
| ... | ... | @@ -55,6 +57,7 @@ class CNLiveMineViewModel: NSObject { |
| 55 | 57 | } |
| 56 | 58 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") |
| 57 | 59 | param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") |
| 60 | + print("给后台的数据是=>\(param)") | |
| 58 | 61 | showLoading(message: "") |
| 59 | 62 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 60 | 63 | CNLiveNetworking.setupShowDataResult(false) |
| ... | ... | @@ -65,14 +68,14 @@ class CNLiveMineViewModel: NSObject { |
| 65 | 68 | let errorCode = resp["errorCode"] |
| 66 | 69 | if (errorCode as! String == "0") { |
| 67 | 70 | showMessage(message: "更改成功") |
| 68 | - resultBlock(true) | |
| 71 | + resultBlock(type,true) | |
| 69 | 72 | } else { |
| 70 | 73 | showMessage(message: resp["errorMessage"] as! String) |
| 71 | - resultBlock(false) | |
| 74 | + resultBlock(type,false) | |
| 72 | 75 | } |
| 73 | 76 | } else { |
| 74 | 77 | showMessage(message: "修改信息失败") |
| 75 | - resultBlock(false) | |
| 78 | + resultBlock(type,false) | |
| 76 | 79 | } |
| 77 | 80 | } |
| 78 | 81 | } |
| ... | ... | @@ -84,7 +87,7 @@ class CNLiveMineViewModel: NSObject { |
| 84 | 87 | /// - resultBlock: 返回 |
| 85 | 88 | static func requestUploadIconAction(_ image: UIImage,resultBlock: @escaping resultBlock) { |
| 86 | 89 | |
| 87 | - CNLiveMineViewModel.requestAccessTokenAction() { result in | |
| 90 | + CNLiveMineViewModel.requestAccessTokenAction() { type, result in | |
| 88 | 91 | if result { |
| 89 | 92 | let param = NSMutableDictionary.init() |
| 90 | 93 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") |
| ... | ... | @@ -110,18 +113,18 @@ class CNLiveMineViewModel: NSObject { |
| 110 | 113 | userInfo.faceUrl = data["faceUrl"] as! String |
| 111 | 114 | userInfo.bigFaceUrl = data["bigFaceUrl"] as! String |
| 112 | 115 | UserInfoManager.cacheUserInfo(userInfo: userInfo) |
| 113 | - resultBlock(true) | |
| 116 | + resultBlock(.icon,true) | |
| 114 | 117 | } else { |
| 115 | 118 | showMessage(message: resp["errorMessage"] as! String) |
| 116 | - resultBlock(false) | |
| 119 | + resultBlock(.icon,false) | |
| 117 | 120 | } |
| 118 | 121 | } else { |
| 119 | 122 | showMessage(message: "头像更改成功") |
| 120 | - resultBlock(false) | |
| 123 | + resultBlock(.icon,false) | |
| 121 | 124 | } |
| 122 | 125 | } |
| 123 | 126 | } else { |
| 124 | - resultBlock(false) | |
| 127 | + resultBlock(.icon,false) | |
| 125 | 128 | } |
| 126 | 129 | } |
| 127 | 130 | } |
| ... | ... | @@ -149,18 +152,18 @@ class CNLiveMineViewModel: NSObject { |
| 149 | 152 | let expires_in = data["expires_in"] as! NSNumber |
| 150 | 153 | userInfo.expires_in = "\(expires_in.intValue+CNLiveMineViewModel.timeStamp)" |
| 151 | 154 | UserInfoManager.cacheUserInfo(userInfo: userInfo) |
| 152 | - resultBlock(true) | |
| 155 | + resultBlock(.other,true) | |
| 153 | 156 | } else { |
| 154 | 157 | showMessage(message: resp["errorMessage"] as! String) |
| 155 | - resultBlock(false) | |
| 158 | + resultBlock(.other,false) | |
| 156 | 159 | } |
| 157 | 160 | } else { |
| 158 | 161 | showMessage(message: "修改头像失败") |
| 159 | - resultBlock(false) | |
| 162 | + resultBlock(.other,false) | |
| 160 | 163 | } |
| 161 | 164 | } |
| 162 | 165 | } else { |
| 163 | - resultBlock(false) | |
| 166 | + resultBlock(.other,true) | |
| 164 | 167 | } |
| 165 | 168 | } |
| 166 | 169 | |
| ... | ... | @@ -199,14 +202,14 @@ class CNLiveMineViewModel: NSObject { |
| 199 | 202 | let resp = result as! NSDictionary |
| 200 | 203 | let errorCode = "\(resp["errorCode"] ?? "0")" |
| 201 | 204 | if (errorCode == "0") { |
| 202 | - resultBlock(true) | |
| 205 | + resultBlock(.other,true) | |
| 203 | 206 | } else { |
| 204 | 207 | showMessage(message: resp["errorMessage"] as! String) |
| 205 | - resultBlock(false) | |
| 208 | + resultBlock(.other,false) | |
| 206 | 209 | } |
| 207 | 210 | } else { |
| 208 | 211 | showMessage(message: "提交失败") |
| 209 | - resultBlock(false) | |
| 212 | + resultBlock(.other,false) | |
| 210 | 213 | } |
| 211 | 214 | } |
| 212 | 215 | } | ... | ... |