Commit 91e5b0aa authored by pete谢兆麟's avatar pete谢兆麟

细节调整

parent 06b601d7
......@@ -139,11 +139,16 @@ class YHInformationAuthorizeViewModel: YHBaseViewModel {
}
func requestSaveUserInfo(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let username = model.username.trimmingCharacters(in: .whitespaces)
if username.count == 0 {
YHHUD.flash(message: "名字不合法")
return
}
let address: [String: Any] = ["country": model.address.country,
"province": model.address.province,
"city": model.address.city]
let params: [String: Any] = ["avatar": model.avatar,
"username": model.username,
"username": username,
"college": model.college,
"industry": model.industry,
"position": model.position,
......
......@@ -76,6 +76,7 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
viewModel.requestBusinessCardAuthorize {[weak self] success, error in
guard let self = self else { return }
self.dismiss(animated: true)
}
}
}
......
......@@ -151,8 +151,13 @@ class YHUserInfoSettingViewController: YHBaseViewController {
return
}
self.name = nameTextField.text ?? ""
let username = name.trimmingCharacters(in: .whitespaces)
if username.count == 0 {
YHHUD.flash(message: "名字不合法")
return
}
// 请求接口逻辑
viewModel.requestSaveUserInfo(head: headUrl, name: name) {[weak self] success, error in
viewModel.requestSaveUserInfo(head: headUrl, name: username) {[weak self] success, error in
guard let self = self else { return }
let vc = YHAllowUseMyInfoViewController()
self.navigationController?.pushViewController(vc)
......
......@@ -32,6 +32,13 @@ class YHEditBaseUserInfoViewController: YHBaseViewController {
photoImageView.kf.setImage(with: url)
footView.dataSource = self.viewModel.model.signature
tableView.reloadData()
if self.viewModel.isCanNext(step: 1) {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
func setView() {
......@@ -173,6 +180,13 @@ extension YHEditBaseUserInfoViewController: UITableViewDelegate, UITableViewData
if model.id != .id1 {
self.getData()
}
if self.viewModel.isCanNext(step: 1) {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
return cell
}
......
......@@ -196,6 +196,9 @@ extension YHEditInterestViewController: UICollectionViewDelegate, UICollectionVi
if section == 0 {
return normalItems.count
} else {
if likeItems.count > 20 {
return 20
}
return likeItems.count
}
}
......
......@@ -25,6 +25,13 @@ class YHEditSchoolViewController: YHBaseViewController {
viewModel.model = model
items = viewModel.getBaseSchoolDataSource()
tableView.reloadData()
if self.viewModel.isCanNext(step: 3) {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
func setView() {
......@@ -96,6 +103,13 @@ extension YHEditSchoolViewController: UITableViewDelegate, UITableViewDataSource
if model.id != .id8 {
self.getData()
}
if self.viewModel.isCanNext(step: 3) {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
return cell
}
......
......@@ -25,6 +25,13 @@ class YHEditWorkViewController: YHBaseViewController {
viewModel.model = model
items = viewModel.getBaseWorkDataSource()
tableView.reloadData()
if self.viewModel.isCanNext(step: 4) {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
func setView() {
......@@ -96,6 +103,13 @@ extension YHEditWorkViewController: UITableViewDelegate, UITableViewDataSource {
if model.id != .id5 || model.id != .id10 {
self.getData()
}
if self.viewModel.isCanNext(step: 4) {
nextButton.isEnabled = true
nextButton.backgroundColor = UIColor.brandMainColor
} else {
nextButton.isEnabled = false
nextButton.backgroundColor = UIColor.brandMainColor.withAlphaComponent(0.4)
}
}
return cell
}
......
......@@ -96,11 +96,16 @@ class YHEditViewModel: YHBaseViewModel {
}
func requestSaveUserInfo(callBackBlock:@escaping (_ success: Bool, _ error: YHErrorModel?)->()) {
let username = model.username.trimmingCharacters(in: .whitespaces)
if username.count == 0 {
YHHUD.flash(message: "名字不合法")
return
}
let address: [String: Any] = ["country": model.address.country,
"province": model.address.province,
"city": model.address.city]
let basic: [String: Any] = ["avatar": model.avatar,
"username": model.username,
"username": username,
"zodiac": model.zodiac,
"address": address,
"signature": model.signature,
......@@ -216,4 +221,33 @@ class YHEditViewModel: YHBaseViewModel {
callBackBlock(false, err)
}
}
func isCanNext(step: Int = 1) -> Bool {
if step == 1 {
let avatar = model.avatar
let username = model.username
let country = model.address.country
let provice = model.address.province
let city = model.address.city
guard avatar.count > 0 else { return false }
guard country.count > 0 else { return false }
guard username.count > 0 else { return false }
if country.contains("中国") {
guard provice.count > 0 else { return false }
guard city.count > 0 else { return false }
}
}
if step == 3 {
let college = model.college
guard college.count > 0 else { return false }
}
if step == 4 {
let position = model.position
let industry = model.industry
guard position.count > 0 else { return false }
guard industry.count > 0 else { return false }
}
return true
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment