Commit 383d2e8f authored by pete谢兆麟's avatar pete谢兆麟

college_id逻辑添加

parent 2ea552a2
...@@ -196,7 +196,7 @@ class YHMyInformationItemCell: UITableViewCell { ...@@ -196,7 +196,7 @@ class YHMyInformationItemCell: UITableViewCell {
case .school: case .school:
let vc = YHCollegeSearchViewController() let vc = YHCollegeSearchViewController()
vc.searchCollegeName = self.dataSource?.message vc.searchCollegeName = self.dataSource?.message
vc.selectBlock = {[weak self] text in vc.selectBlock = {[weak self] text, id in
guard let self = self else { return } guard let self = self else { return }
self.dataSource?.message = text self.dataSource?.message = text
self.updateAllViews() self.updateAllViews()
......
...@@ -12,7 +12,7 @@ class YHCollegeSearchViewController: YHBaseViewController { ...@@ -12,7 +12,7 @@ class YHCollegeSearchViewController: YHBaseViewController {
var orderId:Int = 0 var orderId:Int = 0
var searchCollegeName:String? var searchCollegeName:String?
var selectBlock:((String?)->Void)? var selectBlock:((String?, Int)->Void)?
var colleges:[YHCollegeInfo] = [] var colleges:[YHCollegeInfo] = []
var isShowSureButton: Bool = true var isShowSureButton: Bool = true
let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel() let educationRequest:YHEducationRequestViewModel = YHEducationRequestViewModel()
...@@ -76,7 +76,7 @@ class YHCollegeSearchViewController: YHBaseViewController { ...@@ -76,7 +76,7 @@ class YHCollegeSearchViewController: YHBaseViewController {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if let selectBlock = selectBlock { if let selectBlock = selectBlock {
selectBlock(searchBar.textField.text) selectBlock(searchBar.textField.text, 0)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} }
...@@ -151,7 +151,7 @@ extension YHCollegeSearchViewController: UITableViewDelegate, UITableViewDataSou ...@@ -151,7 +151,7 @@ extension YHCollegeSearchViewController: UITableViewDelegate, UITableViewDataSou
if let selectBlock = selectBlock { if let selectBlock = selectBlock {
if indexPath.row < colleges.count { if indexPath.row < colleges.count {
let college:YHCollegeInfo = colleges[indexPath.row] let college:YHCollegeInfo = colleges[indexPath.row]
selectBlock(college.getCollegeName()) selectBlock(college.getCollegeName(), college.id)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
......
...@@ -349,13 +349,14 @@ extension YHGCEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -349,13 +349,14 @@ extension YHGCEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
vc.orderId = self.orderId vc.orderId = self.orderId
vc.searchCollegeName = detailInfo.college vc.searchCollegeName = detailInfo.college
vc.selectBlock = { vc.selectBlock = {
[weak self] text in [weak self] text, id in
guard let self = self else { return } guard let self = self else { return }
if let text = text, !text.isEmpty { if let text = text, !text.isEmpty {
detailInfo.college = text detailInfo.college = text
} else { } else {
detailInfo.college = "" detailInfo.college = ""
} }
detailInfo.college_id = id
loadInfo() loadInfo()
saveInfoSilent() saveInfoSilent()
} }
...@@ -666,7 +667,8 @@ extension YHGCEducationDetailVC { ...@@ -666,7 +667,8 @@ extension YHGCEducationDetailVC {
guard var dict:[String:Any] = detailInfo.toDictionary() else { return } guard var dict:[String:Any] = detailInfo.toDictionary() else { return }
dict["order_id"] = self.orderId dict["order_id"] = self.orderId
dict["is_aboard_school"] = detailInfo.isSchoolInAboard() dict["is_aboard_school"] = detailInfo.isSchoolInAboard()
dict["college_id"] = detailInfo.college_id
self.educationRequest.saveEducationInfo(params: dict, isSilent: !isShowToast) { self.educationRequest.saveEducationInfo(params: dict, isSilent: !isShowToast) {
[weak self] success, error in [weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
......
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