42 lines
1.1 KiB
Swift
42 lines
1.1 KiB
Swift
//
|
|
// EmergencyContactAddVC.swift
|
|
// QuickLocation
|
|
//
|
|
// Created by 八条 on 2026/6/11.
|
|
//
|
|
|
|
import UIKit
|
|
import RxSwift
|
|
import RxCocoa
|
|
|
|
class EmergencyContactAddVC: BaseViewController {
|
|
|
|
fileprivate var rootView: EmergencyContactAddView!
|
|
|
|
override func loadView() {
|
|
rootView = EmergencyContactAddView(frame: UIScreen.main.bounds)
|
|
view = rootView
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
// Do any additional setup after loading the view.
|
|
|
|
rootView.saveBtn.rx.tap.subscribe(onNext: { _ in
|
|
self.requestEmergencyContactAdd()
|
|
}).disposed(by: disposeBag)
|
|
}
|
|
|
|
// MARK: - API 添加紧急联系人
|
|
private func requestEmergencyContactAdd() {
|
|
guard let name = rootView.nameTF.text, let phone = rootView.phoneTF.text else { return }
|
|
DLToast.showLoading()
|
|
UserService.emergencyContactAdd(requestData: ["name": name, "phone": phone]).subscribe(onNext: { response in
|
|
DLToast.show(text: "添加成功") {
|
|
AppRouter.shared.popOrDismiss()
|
|
}
|
|
}, onError: { _ in }).disposed(by: disposeBag)
|
|
}
|
|
}
|