Commit f4eec786 authored by pete谢兆麟's avatar pete谢兆麟

判空提示

parent 83347472
......@@ -2158,7 +2158,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
......@@ -2184,7 +2184,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.adhoc.profile;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev.intelligenceGalaxy.profile;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0;
......@@ -2200,7 +2200,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
......@@ -2226,7 +2226,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intelligence.galaxy;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = com.adhoc.profile;
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev.intelligenceGalaxy.profile;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(TARGET_NAME)/Res/galaxy-Bridge-Header.h";
SWIFT_VERSION = 5.0;
......
......@@ -90,11 +90,23 @@ class YHMainApplicantInformationViewController: YHBaseViewController {
let bottom = YHBottomNextView()
bottom.nextblock = { [weak self] in
guard let self = self else { return }
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.viewModel.updateMainInformation(.submit) {[weak self] success in
guard let self = self else { return }
self.stepView.currentIndex = self.stepView.currentIndex
if self.viewModel.isCanNext(self.stepView.currentIndex) {
self.stepView.currentIndex = self.stepView.currentIndex + 1
self.viewModel.updateMainInformation(.submit) {[weak self] success in
guard let self = self else { return }
self.isShowPrompt = false
self.stepView.currentIndex = self.stepView.currentIndex
if self.stepView.currentIndex == self.stepView.dataSource?.count {
YHHUD.flash(message: "提交成功")
self.navigationController?.popViewController()
} else {
self.updateDataSource()
}
}
} else {
self.isShowPrompt = true
self.updateDataSource()
YHHUD.flash(message: "请完善信息")
}
}
bottom.saveBlock = { [weak self] in
......@@ -131,14 +143,16 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
cell.informationBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel.updateModel(model)
self.updateDataSource()
let id = model.id
if id != .id32 && id != .id4 && id != .id8 && id != .id9 && id != .id12 && id != .id13 && id != .id21 && id != .id22 && id != .id23 && id != .id34 && id != .id29 && id != .id30 && id != .id35 {
self.updateDataSource()
}
}
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let count = dataSource?[indexPath.row].models?.count ?? 0
if stepView.currentIndex == 1 {
return 217.0
} else {
......@@ -146,15 +160,23 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
var h = 0
for i in 0..<array.count {
let data = array[i]
if data.id == .id3 || data.id == .id4 || data.id == .id18 {
h = h + 132
} else if data.id == .id13 {
h = h + 72
let isShow = data.isShowPrompts ?? false
let message = data.message ?? ""
if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 {
h = h + 72 + 20
} else {
h = h + 72
}
} else {
h = h + 52
if isShow && message.count == 0 {
h = h + 52 + 20
} else {
h = h + 52
}
}
}
return CGFloat(count * 52 + 52 + 14)
return CGFloat(h + 52 + 14)
}
}
}
......@@ -54,7 +54,7 @@ enum YHItemID: Int {
case id32 = 31 // 现居住地址 海外地址
case id33 = 32 // 是否海外居住一年以上
case id34 = 33 // 主申请人信息 出生城市国外
case id35 = 34 // 香港ID号码
}
......
......@@ -16,6 +16,7 @@
*/
import UIKit
import Alamofire
class YHImagePickerView: UIView {
var backImage: ((UIImage) -> Void)?
......@@ -27,6 +28,13 @@ class YHImagePickerView: UIView {
var cannalButton: UIButton!
var lineView: UIView!
static func show(callBack: @escaping ((UIImage) -> Void)) {
let view = YHImagePickerView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.backImage = callBack
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
......@@ -199,9 +207,35 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
// 将图片显示给UIImageView
if let block = backImage {
block(image)
self.dismiss()
// if let block = backImage {
// block(image)
// self.dismiss()
// }
//将选择的图片保存到Document目录下
let fileManager = FileManager.default
let rootPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,
.userDomainMask, true)[0] as String
let filePath = "\(rootPath)/pickedimage.jpg"
let imageData = image.jpegData(compressionQuality: 1.0)
fileManager.createFile(atPath: filePath, contents: imageData, attributes: nil)
//上传图片
if (fileManager.fileExists(atPath: filePath)){
//取得NSURL
let imageURL = URL(fileURLWithPath: filePath)
//使用Alamofire上传
AF.upload(imageURL, to: "https://test-comserver.galaxy-immi.com/oss/upload/storage")
.responseString { response in
switch response.result {
case .success(let value):
print("Success: \(value)")
case .failure(let error): break
}
}
}
} else {
printLog("pick image wrong")
......@@ -213,5 +247,6 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
}
}
......@@ -189,6 +189,7 @@ class YHItemView: UIView {
} else {
buttonState(isLeft: true)
}
} else {
leftButton.isHidden = true
}
......@@ -204,9 +205,9 @@ class YHItemView: UIView {
if dataSource.isShowPrompts ?? false {
if dataSource.message?.count != 0 {
showPromptLabel.isHidden = false
} else {
showPromptLabel.isHidden = true
} else {
showPromptLabel.isHidden = false
}
} else {
showPromptLabel.isHidden = true
......@@ -368,6 +369,9 @@ extension YHItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
dataSource?.message = newText
if let block = block {
block(dataSource ?? YHItemModel())
}
return true
}
}
......@@ -7,6 +7,7 @@
//
import UIKit
import Alamofire
enum YHCardType: Int {
case identity = 0
......@@ -147,7 +148,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = UIColor.contentBkgColor
label.textColor = UIColor.subTextColor
label.textAlignment = .center
return label
}()
......@@ -162,7 +163,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
frontImageButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_front"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
button.addTarget(self, action: #selector(frontImageClick), for: .touchUpInside)
return button
}()
centerView.addSubview(frontImageButton)
......@@ -176,7 +177,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceImageButton = {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "service_card_back"), for: .normal)
button.addTarget(self, action: #selector(exampleClick), for: .touchUpInside)
button.addTarget(self, action: #selector(backSurfaceImageClick), for: .touchUpInside)
return button
}()
centerView.addSubview(backSurfaceImageButton)
......@@ -195,9 +196,23 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
window?.addSubview(view)
}
@objc func frontImageClick() {
YHImagePickerView.show() { image in
}
}
@objc func backSurfaceImageClick() {
YHImagePickerView.show() { image in
}
}
func updataData() {
titleLabel.text = "中国身份证(选填)"
frontLabel.text = "身份证人像面"
backSurfaceLabel.text = "身份证国徽面"
}
}
......@@ -89,18 +89,38 @@ class YHMainInformationTableViewCell: UITableViewCell {
func updateAllViews() {
titleLabel.text = dataSource?.title
mainItemView.removeSubviews()
var y = 0
for i in 0 ..< (dataSource?.models?.count ?? 0) {
let line = UIView()
line.backgroundColor = UIColor.separatorColor
mainItemView.addSubview(line)
line.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52 * i)
make.top.equalTo(y)
make.height.equalTo(1)
make.right.equalTo(-18)
}
y = y + 1
var h = 51
let data = dataSource?.models?[i] ?? YHItemModel()
let isShow = data.isShowPrompts ?? false
let message = data.message ?? ""
if data.id == .id3 || data.id == .id4 || data.id == .id32 || data.id == .id33 {
if isShow && message.count == 0 {
h = 71 + 20
} else {
h = 71
}
} else {
if isShow && message.count == 0 {
h = 51 + 20
} else {
h = 51
}
}
let itemView = YHItemView()
itemView.dataSource = dataSource?.models?[i]
itemView.dataSource = data
itemView.block = {[weak self] model in
guard let self = self else { return }
if let block = self.informationBlock {
......@@ -110,10 +130,11 @@ class YHMainInformationTableViewCell: UITableViewCell {
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
make.top.equalTo(52 * i + 1)
make.height.equalTo(51)
make.top.equalTo(y)
make.height.equalTo(h)
make.right.equalTo(-18)
}
y = y + h
}
}
}
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