提交 9d4ad50d authored 作者: 逄仁秀's avatar 逄仁秀

no message

上级 4e7ebb7d
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
88B5B9142B328F2400871A63 /* KJToRechargeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88B5B9122B328F2400871A63 /* KJToRechargeViewController.xib */; }; 88B5B9142B328F2400871A63 /* KJToRechargeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88B5B9122B328F2400871A63 /* KJToRechargeViewController.xib */; };
88B5B9162B32D5EB00871A63 /* KJRechargeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9152B32D5EB00871A63 /* KJRechargeModel.swift */; }; 88B5B9162B32D5EB00871A63 /* KJRechargeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9152B32D5EB00871A63 /* KJRechargeModel.swift */; };
88B5B9182B34381000871A63 /* KJAddBankModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9172B34381000871A63 /* KJAddBankModel.swift */; }; 88B5B9182B34381000871A63 /* KJAddBankModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9172B34381000871A63 /* KJAddBankModel.swift */; };
88B5B91B2B35804500871A63 /* KJChooseBankTVCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9192B35804500871A63 /* KJChooseBankTVCell.swift */; };
88B5B91C2B35804500871A63 /* KJChooseBankTVCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88B5B91A2B35804500871A63 /* KJChooseBankTVCell.xib */; };
88BE37D82AFCC15400D04877 /* KJHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BE37D62AFCC15400D04877 /* KJHomeViewController.swift */; }; 88BE37D82AFCC15400D04877 /* KJHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BE37D62AFCC15400D04877 /* KJHomeViewController.swift */; };
88BE37D92AFCC15400D04877 /* KJHomeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88BE37D72AFCC15400D04877 /* KJHomeViewController.xib */; }; 88BE37D92AFCC15400D04877 /* KJHomeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88BE37D72AFCC15400D04877 /* KJHomeViewController.xib */; };
88BE37DE2AFCC19F00D04877 /* KJChargeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */; }; 88BE37DE2AFCC19F00D04877 /* KJChargeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */; };
...@@ -113,6 +115,8 @@ ...@@ -113,6 +115,8 @@
88B5B9122B328F2400871A63 /* KJToRechargeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KJToRechargeViewController.xib; sourceTree = "<group>"; }; 88B5B9122B328F2400871A63 /* KJToRechargeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KJToRechargeViewController.xib; sourceTree = "<group>"; };
88B5B9152B32D5EB00871A63 /* KJRechargeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJRechargeModel.swift; sourceTree = "<group>"; }; 88B5B9152B32D5EB00871A63 /* KJRechargeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJRechargeModel.swift; sourceTree = "<group>"; };
88B5B9172B34381000871A63 /* KJAddBankModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJAddBankModel.swift; sourceTree = "<group>"; }; 88B5B9172B34381000871A63 /* KJAddBankModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJAddBankModel.swift; sourceTree = "<group>"; };
88B5B9192B35804500871A63 /* KJChooseBankTVCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJChooseBankTVCell.swift; sourceTree = "<group>"; };
88B5B91A2B35804500871A63 /* KJChooseBankTVCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KJChooseBankTVCell.xib; sourceTree = "<group>"; };
88BE37D62AFCC15400D04877 /* KJHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJHomeViewController.swift; sourceTree = "<group>"; }; 88BE37D62AFCC15400D04877 /* KJHomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJHomeViewController.swift; sourceTree = "<group>"; };
88BE37D72AFCC15400D04877 /* KJHomeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KJHomeViewController.xib; sourceTree = "<group>"; }; 88BE37D72AFCC15400D04877 /* KJHomeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KJHomeViewController.xib; sourceTree = "<group>"; };
88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJChargeViewController.swift; sourceTree = "<group>"; }; 88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJChargeViewController.swift; sourceTree = "<group>"; };
...@@ -350,6 +354,8 @@ ...@@ -350,6 +354,8 @@
88B5B90B2B304DF800871A63 /* KJChooseTableViewCell.swift */, 88B5B90B2B304DF800871A63 /* KJChooseTableViewCell.swift */,
88B5B90C2B304DF800871A63 /* KJChooseTableViewCell.xib */, 88B5B90C2B304DF800871A63 /* KJChooseTableViewCell.xib */,
88B5B90F2B317CCF00871A63 /* KJAddBankCodeAlert.swift */, 88B5B90F2B317CCF00871A63 /* KJAddBankCodeAlert.swift */,
88B5B9192B35804500871A63 /* KJChooseBankTVCell.swift */,
88B5B91A2B35804500871A63 /* KJChooseBankTVCell.xib */,
); );
path = view; path = view;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -501,6 +507,7 @@ ...@@ -501,6 +507,7 @@
88BE37EB2AFCC23300D04877 /* KJElectricityViewController.xib in Resources */, 88BE37EB2AFCC23300D04877 /* KJElectricityViewController.xib in Resources */,
88BE37E72AFCC21300D04877 /* KJTransferViewController.xib in Resources */, 88BE37E72AFCC21300D04877 /* KJTransferViewController.xib in Resources */,
88BE37DF2AFCC19F00D04877 /* KJChargeViewController.xib in Resources */, 88BE37DF2AFCC19F00D04877 /* KJChargeViewController.xib in Resources */,
88B5B91C2B35804500871A63 /* KJChooseBankTVCell.xib in Resources */,
88BE38182B0CB1B100D04877 /* KJAccountViewController.xib in Resources */, 88BE38182B0CB1B100D04877 /* KJAccountViewController.xib in Resources */,
88BE38202B0DD83D00D04877 /* KJWithdrawViewController.xib in Resources */, 88BE38202B0DD83D00D04877 /* KJWithdrawViewController.xib in Resources */,
88B5B9142B328F2400871A63 /* KJToRechargeViewController.xib in Resources */, 88B5B9142B328F2400871A63 /* KJToRechargeViewController.xib in Resources */,
...@@ -602,6 +609,7 @@ ...@@ -602,6 +609,7 @@
88B5B9102B317CCF00871A63 /* KJAddBankCodeAlert.swift in Sources */, 88B5B9102B317CCF00871A63 /* KJAddBankCodeAlert.swift in Sources */,
88B5B90D2B304DF800871A63 /* KJChooseTableViewCell.swift in Sources */, 88B5B90D2B304DF800871A63 /* KJChooseTableViewCell.swift in Sources */,
88BE381B2B0DCC3000D04877 /* KJAccountTableViewCell.swift in Sources */, 88BE381B2B0DCC3000D04877 /* KJAccountTableViewCell.swift in Sources */,
88B5B91B2B35804500871A63 /* KJChooseBankTVCell.swift in Sources */,
88B5B9162B32D5EB00871A63 /* KJRechargeModel.swift in Sources */, 88B5B9162B32D5EB00871A63 /* KJRechargeModel.swift in Sources */,
88BE37F22AFCC26100D04877 /* KJPDAMViewController.swift in Sources */, 88BE37F22AFCC26100D04877 /* KJPDAMViewController.swift in Sources */,
88B5B90A2B303F0800871A63 /* KJSingleChooseView.swift in Sources */, 88B5B90A2B303F0800871A63 /* KJSingleChooseView.swift in Sources */,
......
...@@ -3,4 +3,22 @@ ...@@ -3,4 +3,22 @@
uuid = "083033CE-6D7A-4E6A-9037-453F99AE79A1" uuid = "083033CE-6D7A-4E6A-9037-453F99AE79A1"
type = "0" type = "0"
version = "2.0"> version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "852EE982-9260-4B98-BB63-A39D481130D0"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "iOS-2kj/home/view/KJAddBankCodeAlert.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "190"
endingLineNumber = "190"
landmarkName = "sureAction()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket> </Bucket>
...@@ -17,3 +17,15 @@ class KJBankCodeListModel: HandyJSON { ...@@ -17,3 +17,15 @@ class KJBankCodeListModel: HandyJSON {
var bank_name: String? var bank_name: String?
required init() {} required init() {}
} }
class KJCardListModel: HandyJSON {
var bank_code: String?
var bank_name: String?
var card_no: String?
var create_time: String?
var id: String?
var update_time: String?
var user_id: String?
var valid: String?
required init() {}
}
...@@ -128,6 +128,7 @@ class KJAccountViewController: KJBaseViewController { ...@@ -128,6 +128,7 @@ class KJAccountViewController: KJBaseViewController {
@IBAction func withdrawAction(_ sender: Any) { @IBAction func withdrawAction(_ sender: Any) {
let vc = KJWithdrawViewController() let vc = KJWithdrawViewController()
vc.balance = balanceL.text ?? ""
navigationController?.pushViewController(vc, animated: true) navigationController?.pushViewController(vc, animated: true)
} }
......
...@@ -8,32 +8,33 @@ ...@@ -8,32 +8,33 @@
import UIKit import UIKit
class KJWithdrawViewController: KJBaseViewController { class KJWithdrawViewController: KJBaseViewController {
@IBOutlet weak var balanceL: UILabel!
var balance: String = ""
var cardList: [KJCardListModel?] = []
override func viewDidLoad() { @IBOutlet weak var tableView: UITableView!
super.viewDidLoad()
// Do any additional setup after loading the view. @IBOutlet weak var tableHeight: NSLayoutConstraint!
obtainData()
self.titleL.text = "提现"
}
func obtainData() { func obtainList() {
// 构建URL // 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/get_conv_param")! let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/bank_card")!
// 发送HTTP请求的的session对象 // 发送HTTP请求的的session对象
let session = URLSession.shared let session = URLSession.shared
// 构建请求request // 构建请求request
var request = URLRequest(url: url) var request = URLRequest(url: url)
request.httpMethod = "POST" request.httpMethod = "POST"
let param = ["method": "transfer"] request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
print(UserDefaults.standard.string(forKey: "token") ?? "")
var param = ["method": "list"]
var jsonData = NSData() var jsonData = NSData()
do { do {
jsonData = try JSONSerialization.data(withJSONObject: param, options: .prettyPrinted) as NSData jsonData = try JSONSerialization.data(withJSONObject: param, options: .prettyPrinted) as NSData
} catch { } catch {
print(error.localizedDescription) print(error.localizedDescription)
} }
request.httpBody = jsonData as Data request.httpBody = jsonData as! Data
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
// 发一个post请求 // 发一个post请求
let task = session.dataTask(with: request as URLRequest) {( let task = session.dataTask(with: request as URLRequest) {(
data, response, error) in data, response, error) in
...@@ -44,10 +45,23 @@ class KJWithdrawViewController: KJBaseViewController { ...@@ -44,10 +45,23 @@ class KJWithdrawViewController: KJBaseViewController {
let dataString = String(data: data, encoding: String.Encoding.utf8) let dataString = String(data: data, encoding: String.Encoding.utf8)
let dict = self.getDictionaryFromJSONString(jsonString: dataString!) let dict = self.getDictionaryFromJSONString(jsonString: dataString!)
print(dict) print(dict)
if let arr = [KJCardListModel].deserialize(from: dict["ret"] as! NSArray) {
self.cardList = arr
}
} }
task.resume() task.resume()
} }
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
obtainList()
self.titleL.text = "提现"
balanceL.text = balance
}
func getDictionaryFromJSONString(jsonString: String) -> NSDictionary { func getDictionaryFromJSONString(jsonString: String) -> NSDictionary {
// 将传入的 JSON 字符串 jsonString 使用 data(using:) 方法转换为 Data 类型 // 将传入的 JSON 字符串 jsonString 使用 data(using:) 方法转换为 Data 类型
let jsonData:Data = jsonString.data(using: .utf8)! let jsonData:Data = jsonString.data(using: .utf8)!
...@@ -63,6 +77,9 @@ class KJWithdrawViewController: KJBaseViewController { ...@@ -63,6 +77,9 @@ class KJWithdrawViewController: KJBaseViewController {
@IBAction func addNewCardAction(_ sender: Any) { @IBAction func addNewCardAction(_ sender: Any) {
let alert = KJAddBankCodeAlert(frame: CGRect(x: 0, y: 0, width: kjWidth, height: kjHeight)) let alert = KJAddBankCodeAlert(frame: CGRect(x: 0, y: 0, width: kjWidth, height: kjHeight))
alert.refresh = {
self.obtainList()
}
alert.show() alert.show()
} }
/* /*
...@@ -76,3 +93,16 @@ class KJWithdrawViewController: KJBaseViewController { ...@@ -76,3 +93,16 @@ class KJWithdrawViewController: KJBaseViewController {
*/ */
} }
extension KJWithdrawViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cardList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "KJChooseBankTVCell") as! KJChooseBankTVCell
return cell
}
}
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KJWithdrawViewController" customModule="iOS_2kj" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KJWithdrawViewController" customModule="iOS_2kj" customModuleProvider="target">
<connections> <connections>
<outlet property="balanceL" destination="a6Q-aQ-Vna" id="GJq-tW-dge"/>
<outlet property="tableHeight" destination="Q1Z-sD-XdS" id="5K1-QG-q9c"/>
<outlet property="tableView" destination="eVs-gj-gSe" id="WtT-UR-GyR"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections> </connections>
</placeholder> </placeholder>
......
...@@ -24,6 +24,11 @@ class KJAddBankCodeAlert: UIView { ...@@ -24,6 +24,11 @@ class KJAddBankCodeAlert: UIView {
let bankCodeValueTF = UITextField(frame: CGRect(x: 25.5, y: 156, width: kjWidth - 113, height: 23)) let bankCodeValueTF = UITextField(frame: CGRect(x: 25.5, y: 156, width: kjWidth - 113, height: 23))
let sureBtn = UIButton(type: .custom) let sureBtn = UIButton(type: .custom)
var bankCodeList: [KJBankCodeListModel?] = []
var chooseModel: KJBankCodeListModel?
var selectedIndex: Int = -1
var refresh: () -> Void = {}
func obtainData() { func obtainData() {
// 构建URL // 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/bank_card")! let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/bank_card")!
...@@ -52,6 +57,9 @@ class KJAddBankCodeAlert: UIView { ...@@ -52,6 +57,9 @@ class KJAddBankCodeAlert: UIView {
let dataString = String(data: data, encoding: String.Encoding.utf8) let dataString = String(data: data, encoding: String.Encoding.utf8)
let dict = self.getDictionaryFromJSONString(jsonString: dataString!) let dict = self.getDictionaryFromJSONString(jsonString: dataString!)
print(dict) print(dict)
if let arr = [KJBankCodeListModel].deserialize(from: dict["ret"] as! NSArray) {
self.bankCodeList = arr
}
} }
task.resume() task.resume()
} }
...@@ -94,6 +102,7 @@ class KJAddBankCodeAlert: UIView { ...@@ -94,6 +102,7 @@ class KJAddBankCodeAlert: UIView {
chooseBtn.backgroundColor = UIColor(hex: "#F9F9F9") chooseBtn.backgroundColor = UIColor(hex: "#F9F9F9")
chooseBtn.layer.cornerRadius = 5 chooseBtn.layer.cornerRadius = 5
chooseBtn.frame = CGRect(x: 15, y: 80, width: kjWidth - 80, height: 48) chooseBtn.frame = CGRect(x: 15, y: 80, width: kjWidth - 80, height: 48)
chooseBtn.addTarget(self, action: #selector(chooseBank), for: .touchUpInside)
let chooseL = UILabel(frame: CGRect(x: 25.5, y: 93.5, width: 100, height: 23)) let chooseL = UILabel(frame: CGRect(x: 25.5, y: 93.5, width: 100, height: 23))
whiteView.addSubview(chooseL) whiteView.addSubview(chooseL)
...@@ -128,7 +137,7 @@ class KJAddBankCodeAlert: UIView { ...@@ -128,7 +137,7 @@ class KJAddBankCodeAlert: UIView {
sureBtn.frame = CGRect(x: 15, y: 213, width: kjWidth - 80, height: 49) sureBtn.frame = CGRect(x: 15, y: 213, width: kjWidth - 80, height: 49)
sureBtn.backgroundColor = UIColor(hex: "#6747CD") sureBtn.backgroundColor = UIColor(hex: "#6747CD")
sureBtn.setTitle("确认", for: .normal) sureBtn.setTitle("确认", for: .normal)
sureBtn.addTarget(self, action: #selector(sureAction), for: .touchUpInside)
} }
...@@ -136,6 +145,58 @@ class KJAddBankCodeAlert: UIView { ...@@ -136,6 +145,58 @@ class KJAddBankCodeAlert: UIView {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
@objc func chooseBank() {
let alert = KJSingleChooseView(frame: CGRect(x: 0, y: 0, width: kjWidth, height: kjHeight))
alert.setBankCodeArray(arr: bankCodeList)
alert.setTitle(title: "选择银行")
alert.chooseBankComplete = {model, index in
self.selectedIndex = index
self.chooseModel = model
self.bankLabel.text = model.bank_name
self.bankLabel.textColor = UIColor(hex: "#333333")
}
alert.selectedInt = selectedIndex
alert.show()
}
@objc func sureAction() {
// 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/bank_card")!
// 发送HTTP请求的的session对象
let session = URLSession.shared
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
print(UserDefaults.standard.string(forKey: "token") ?? "")
var param = ["method": "add", "card_no": bankCodeValueTF.text ?? "", "bank_name": chooseModel?.bank_name, "bank_code": chooseModel?.bank_code]
var jsonData = NSData()
do {
jsonData = try JSONSerialization.data(withJSONObject: param, options: .prettyPrinted) as NSData
} catch {
print(error.localizedDescription)
}
request.httpBody = jsonData as! Data
// 发一个post请求
let task = session.dataTask(with: request as URLRequest) {(
data, response, error) in
guard let data = data, let _:URLResponse = response, error == nil else {
print("Request Erroor")
return
}
let dataString = String(data: data, encoding: String.Encoding.utf8)
let dict = self.getDictionaryFromJSONString(jsonString: dataString!)
print(dict)
if (dict.allKeys as NSArray).contains("success") == true {
DispatchQueue.main.async {
self.refresh()
self.dismiss()
}
}
}
task.resume()
}
func show() { func show() {
let window = UIApplication.shared.delegate?.window as! UIView let window = UIApplication.shared.delegate?.window as! UIView
window.addSubview(self) window.addSubview(self)
......
//
// KJChooseBankTVCell.swift
// iOS-2kj
//
// Created by 仁秀逄 on 2023/12/22.
//
import UIKit
class KJChooseBankTVCell: UITableViewCell {
@IBOutlet weak var titleL: UILabel!
@IBOutlet weak var numL: UILabel!
@IBOutlet weak var chooseImgV: UIImageView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="84" id="KGk-i7-Jjw" customClass="KJChooseBankTVCell" customModule="iOS_2kj" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="udK-lT-nHl">
<rect key="frame" x="13.666666666666664" y="20" width="42" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="0hr-OC-rZC"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="0.84705882352941175" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="adh-h2-dq2">
<rect key="frame" x="13.666666666666664" y="45" width="49" height="23"/>
<constraints>
<constraint firstAttribute="height" constant="23" id="Yu1-Oo-f7o"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vVY-MZ-BG8">
<rect key="frame" x="286" y="32.666666666666664" width="18.666666666666686" height="18.666666666666664"/>
<constraints>
<constraint firstAttribute="height" constant="18.5" id="Iai-SP-lRr"/>
<constraint firstAttribute="width" constant="18.5" id="roe-rz-6MD"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstItem="udK-lT-nHl" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="20" id="Ara-TI-Bi6"/>
<constraint firstItem="vVY-MZ-BG8" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="HB5-7B-6TA"/>
<constraint firstItem="udK-lT-nHl" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="13.5" id="ITD-OE-Lu4"/>
<constraint firstItem="adh-h2-dq2" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="45" id="OmA-Vv-mmB"/>
<constraint firstAttribute="trailing" secondItem="vVY-MZ-BG8" secondAttribute="trailing" constant="15.5" id="R6d-6d-N95"/>
<constraint firstItem="adh-h2-dq2" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="13.5" id="xvK-47-IXs"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="chooseImgV" destination="vVY-MZ-BG8" id="XxC-6g-Naw"/>
<outlet property="numL" destination="adh-h2-dq2" id="nTb-oM-u5l"/>
<outlet property="titleL" destination="udK-lT-nHl" id="A5C-zW-2oW"/>
</connections>
<point key="canvasLocation" x="126.71755725190839" y="2.8169014084507045"/>
</tableViewCell>
</objects>
</document>
...@@ -15,7 +15,7 @@ class KJSingleChooseView: UIView { ...@@ -15,7 +15,7 @@ class KJSingleChooseView: UIView {
let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: kjWidth, height: 66)) let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: kjWidth, height: 66))
var accountArr: [KJConfigDataParamModel] = [] var accountArr: [KJConfigDataParamModel] = []
var bankcodeArr: [KJBankCodeListModel] = [] var bankcodeArr: [KJBankCodeListModel?] = []
var chooseComplete: (_ model: KJConfigDataParamModel, _ index: Int) -> Void = {_,_ in} var chooseComplete: (_ model: KJConfigDataParamModel, _ index: Int) -> Void = {_,_ in}
var chooseBankComplete: (_ model: KJBankCodeListModel, _ index: Int) -> Void = {_,_ in} var chooseBankComplete: (_ model: KJBankCodeListModel, _ index: Int) -> Void = {_,_ in}
...@@ -56,7 +56,7 @@ class KJSingleChooseView: UIView { ...@@ -56,7 +56,7 @@ class KJSingleChooseView: UIView {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
func setBankCodeArray(arr: [KJBankCodeListModel]) { func setBankCodeArray(arr: [KJBankCodeListModel?]) {
bankcodeArr = arr bankcodeArr = arr
tableView.reloadData() tableView.reloadData()
} }
...@@ -97,7 +97,7 @@ extension KJSingleChooseView: UITableViewDelegate, UITableViewDataSource { ...@@ -97,7 +97,7 @@ extension KJSingleChooseView: UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: "KJChooseTableViewCell") as! KJChooseTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: "KJChooseTableViewCell") as! KJChooseTableViewCell
if bankcodeArr.count > 0 { if bankcodeArr.count > 0 {
let model = bankcodeArr[indexPath.row] let model = bankcodeArr[indexPath.row]
cell.titleL.text = model.bank_name cell.titleL.text = model?.bank_name
} else { } else {
let model = accountArr[indexPath.row] let model = accountArr[indexPath.row]
cell.titleL.text = model.name cell.titleL.text = model.name
...@@ -119,7 +119,7 @@ extension KJSingleChooseView: UITableViewDelegate, UITableViewDataSource { ...@@ -119,7 +119,7 @@ extension KJSingleChooseView: UITableViewDelegate, UITableViewDataSource {
tableView.reloadData() tableView.reloadData()
if bankcodeArr.count > 0 { if bankcodeArr.count > 0 {
chooseBankComplete(bankcodeArr[selectedInt], selectedInt) chooseBankComplete(bankcodeArr[selectedInt] ?? KJBankCodeListModel(), selectedInt)
} else { } else {
chooseComplete(accountArr[selectedInt], selectedInt) chooseComplete(accountArr[selectedInt], selectedInt)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论