提交 028fbdc0 authored 作者: 逄仁秀's avatar 逄仁秀

no message

上级 a627137b
......@@ -23,6 +23,10 @@
88B5B90A2B303F0800871A63 /* KJSingleChooseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9092B303F0800871A63 /* KJSingleChooseView.swift */; };
88B5B90D2B304DF800871A63 /* KJChooseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B90B2B304DF800871A63 /* KJChooseTableViewCell.swift */; };
88B5B90E2B304DF800871A63 /* KJChooseTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88B5B90C2B304DF800871A63 /* KJChooseTableViewCell.xib */; };
88B5B9102B317CCF00871A63 /* KJAddBankCodeAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B90F2B317CCF00871A63 /* KJAddBankCodeAlert.swift */; };
88B5B9132B328F2400871A63 /* KJToRechargeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9112B328F2400871A63 /* KJToRechargeViewController.swift */; };
88B5B9142B328F2400871A63 /* KJToRechargeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88B5B9122B328F2400871A63 /* KJToRechargeViewController.xib */; };
88B5B9162B32D5EB00871A63 /* KJRechargeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B5B9152B32D5EB00871A63 /* KJRechargeModel.swift */; };
88BE37D82AFCC15400D04877 /* KJHomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BE37D62AFCC15400D04877 /* KJHomeViewController.swift */; };
88BE37D92AFCC15400D04877 /* KJHomeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88BE37D72AFCC15400D04877 /* KJHomeViewController.xib */; };
88BE37DE2AFCC19F00D04877 /* KJChargeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */; };
......@@ -103,6 +107,10 @@
88B5B9092B303F0800871A63 /* KJSingleChooseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJSingleChooseView.swift; sourceTree = "<group>"; };
88B5B90B2B304DF800871A63 /* KJChooseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJChooseTableViewCell.swift; sourceTree = "<group>"; };
88B5B90C2B304DF800871A63 /* KJChooseTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KJChooseTableViewCell.xib; sourceTree = "<group>"; };
88B5B90F2B317CCF00871A63 /* KJAddBankCodeAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJAddBankCodeAlert.swift; sourceTree = "<group>"; };
88B5B9112B328F2400871A63 /* KJToRechargeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJToRechargeViewController.swift; 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>"; };
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>"; };
88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KJChargeViewController.swift; sourceTree = "<group>"; };
......@@ -192,6 +200,7 @@
children = (
880FF38D2B21A6C600872B34 /* KJAccountModel.swift */,
88276FAC2B284AB0009BAE13 /* KJConfigParamModel.swift */,
88B5B9152B32D5EB00871A63 /* KJRechargeModel.swift */,
);
path = model;
sourceTree = "<group>";
......@@ -290,6 +299,8 @@
88BE381E2B0DD83C00D04877 /* KJWithdrawViewController.xib */,
88BE37DC2AFCC19F00D04877 /* KJChargeViewController.swift */,
88BE37DD2AFCC19F00D04877 /* KJChargeViewController.xib */,
88B5B9112B328F2400871A63 /* KJToRechargeViewController.swift */,
88B5B9122B328F2400871A63 /* KJToRechargeViewController.xib */,
88BE38212B0F307C00D04877 /* KJBigViewController.swift */,
88BE38222B0F307C00D04877 /* KJBigViewController.xib */,
88BE37E42AFCC21300D04877 /* KJTransferViewController.swift */,
......@@ -335,6 +346,7 @@
88B5B9092B303F0800871A63 /* KJSingleChooseView.swift */,
88B5B90B2B304DF800871A63 /* KJChooseTableViewCell.swift */,
88B5B90C2B304DF800871A63 /* KJChooseTableViewCell.xib */,
88B5B90F2B317CCF00871A63 /* KJAddBankCodeAlert.swift */,
);
path = view;
sourceTree = "<group>";
......@@ -488,6 +500,7 @@
88BE37DF2AFCC19F00D04877 /* KJChargeViewController.xib in Resources */,
88BE38182B0CB1B100D04877 /* KJAccountViewController.xib in Resources */,
88BE38202B0DD83D00D04877 /* KJWithdrawViewController.xib in Resources */,
88B5B9142B328F2400871A63 /* KJToRechargeViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -583,8 +596,10 @@
880FF38E2B21A6C600872B34 /* KJAccountModel.swift in Sources */,
88BE37EE2AFCC24900D04877 /* KJPulsaViewController.swift in Sources */,
88BE380F2B0B3EA300D04877 /* KJHomeCollectionViewCell.swift in Sources */,
88B5B9102B317CCF00871A63 /* KJAddBankCodeAlert.swift in Sources */,
88B5B90D2B304DF800871A63 /* KJChooseTableViewCell.swift in Sources */,
88BE381B2B0DCC3000D04877 /* KJAccountTableViewCell.swift in Sources */,
88B5B9162B32D5EB00871A63 /* KJRechargeModel.swift in Sources */,
88BE37F22AFCC26100D04877 /* KJPDAMViewController.swift in Sources */,
88B5B90A2B303F0800871A63 /* KJSingleChooseView.swift in Sources */,
88BE37D82AFCC15400D04877 /* KJHomeViewController.swift in Sources */,
......@@ -597,6 +612,7 @@
88276FAD2B284AB0009BAE13 /* KJConfigParamModel.swift in Sources */,
883B01E82AC16CFC00C3ABBF /* ViewController.swift in Sources */,
88BE37FF2AFCCCB500D04877 /* KJDeviceInfo.swift in Sources */,
88B5B9132B328F2400871A63 /* KJToRechargeViewController.swift in Sources */,
883B01E42AC16CFC00C3ABBF /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "选中@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "选中@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "plus-circle@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "plus-circle@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -19,6 +19,7 @@ class KJConfigParamModel: HandyJSON {
var desc: String?
var type: String?
var verify: String?
var value: String?
var data: [KJConfigDataParamModel]?
var url: String? //下拉框数据,需要请求接口
var param: [String: String]? //请求接口传参数
......
//
// KJRechargeModel.swift
// iOS-2kj
//
// Created by 仁秀逄 on 2023/12/20.
//
import UIKit
import HandyJSON
class KJRechargeModel: HandyJSON {
var basic_data: KJBasicData?
var param_config: [KJConfigParamModel]?
required init() {}
}
class KJBasicData: HandyJSON {
var amount: String?
var business_no: String?
var channel_code: String?
var channel_extr_param: String?
var fee: String?
required init() {}
}
......@@ -117,6 +117,7 @@ class KJAccountViewController: KJBaseViewController {
@IBAction func rechargeAction(_ sender: Any) {
if self.hasCode == true {
let vc = KJChargeViewController()
vc.balance = balanceL.text ?? ""
navigationController?.pushViewController(vc, animated: true)
} else {
let vc = KJZFCodeViewController()
......@@ -125,6 +126,11 @@ class KJAccountViewController: KJBaseViewController {
}
}
@IBAction func withdrawAction(_ sender: Any) {
let vc = KJWithdrawViewController()
navigationController?.pushViewController(vc, animated: true)
}
/*
// MARK: - Navigation
......
......@@ -109,6 +109,9 @@
<state key="normal" title="提现">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="withdrawAction:" destination="-1" eventType="touchUpInside" id="eWu-8o-W4o"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y18-UE-Vs8">
<rect key="frame" x="204" y="741" width="174" height="49"/>
......
......@@ -17,6 +17,13 @@ class KJChargeViewController: KJBaseViewController {
@IBOutlet weak var rechargeNowBtn: UIButton!
var balance: String = ""
var configModel: KJGetConvModel = KJGetConvModel()
var selectedIndex: Int = -1
@IBOutlet weak var payMethodLabel: UILabel!
func obtainData() {
// 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/get_conv_param")!
......@@ -45,6 +52,9 @@ class KJChargeViewController: KJBaseViewController {
let dict = self.getDictionaryFromJSONString(jsonString: dataString!)
print(dict)
if let model = KJGetConvModel.deserialize(from: dict["ret"] as? NSDictionary) {
self.configModel = model
}
}
task.resume()
}
......@@ -68,10 +78,81 @@ class KJChargeViewController: KJBaseViewController {
// Do any additional setup after loading the view.
obtainData()
self.titleL.text = "充值"
balanceL.text = balance
chargeNumTF.delegate = self
self.rechargeNowBtn.isUserInteractionEnabled = false
}
@IBAction func payMethodAction(_ sender: Any) {
let alert = KJSingleChooseView(frame: CGRect(x: 0, y: 0, width: kjWidth, height: kjHeight))
alert.setAccountArray(arr: configModel.param_config?.first?.data ?? [])
alert.setTitle(title: "选择支付方式")
alert.chooseComplete = {model, index in
self.selectedIndex = index
self.payMethodLabel.text = model.name
self.payMethodLabel.textColor = UIColor(hex: "#333333")
if self.chargeNumTF.text?.count ?? 0 > 0 {
if self.selectedIndex > -1 {
self.rechargeNowBtn.isUserInteractionEnabled = true
self.rechargeNowBtn.backgroundColor = UIColor(hex: "#6747CD")
} else {
self.rechargeNowBtn.isUserInteractionEnabled = false
self.rechargeNowBtn.backgroundColor = UIColor(hex: "#E0E0E0")
}
} else {
self.rechargeNowBtn.isUserInteractionEnabled = false
self.rechargeNowBtn.backgroundColor = UIColor(hex: "#E0E0E0")
}
}
alert.selectedInt = selectedIndex
alert.show()
}
@IBAction func rechargeAction(_ sender: Any) {
// 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/apply_conv_recharge")!
// 发送HTTP请求的的session对象
let session = URLSession.shared
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
var param = ["amount": chargeNumTF.text, "prod_code": configModel.param_config?.first?.data?[selectedIndex].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 let model = KJRechargeModel.deserialize(from: dict["ret"] as? NSDictionary) {
DispatchQueue.main.async {
let vc = KJToRechargeViewController()
vc.rechargeModel = model
self.navigationController?.pushViewController(vc, animated: true)
}
} else {
DispatchQueue.main.async {
let hud = MBProgressHUD.showAdded(to: self.view, animated: true)
hud.label.text = dict["msg"] as! String
hud.show(animated: true)
}
}
}
task.resume()
}
/*
// MARK: - Navigation
......@@ -83,3 +164,20 @@ class KJChargeViewController: KJBaseViewController {
*/
}
extension KJChargeViewController: UITextFieldDelegate {
func textFieldDidChangeSelection(_ textField: UITextField) {
if textField.text?.count ?? 0 > 0 {
if selectedIndex > -1 {
self.rechargeNowBtn.isUserInteractionEnabled = true
self.rechargeNowBtn.backgroundColor = UIColor(hex: "#6747CD")
} else {
self.rechargeNowBtn.isUserInteractionEnabled = false
self.rechargeNowBtn.backgroundColor = UIColor(hex: "#E0E0E0")
}
} else {
self.rechargeNowBtn.isUserInteractionEnabled = false
self.rechargeNowBtn.backgroundColor = UIColor(hex: "#E0E0E0")
}
}
}
//
// KJToRechargeViewController.swift
// iOS-2kj
//
// Created by 仁秀逄 on 2023/12/20.
//
import UIKit
class KJToRechargeViewController: KJBaseViewController {
@IBOutlet weak var rechargeAmountL: UILabel!
@IBOutlet weak var tableview: UITableView!
var rechargeModel: KJRechargeModel = KJRechargeModel()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let fee = (rechargeModel.basic_data?.fee as! NSString).floatValue
let amount = (rechargeModel.basic_data?.amount as! NSString).floatValue
let str = String(format: "%.2f", amount + fee)
self.rechargeAmountL.text = str as String
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
<?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="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KJToRechargeViewController" customModule="iOS_2kj" customModuleProvider="target">
<connections>
<outlet property="rechargeAmountL" destination="BSg-TK-5a8" id="TzK-V2-jTU"/>
<outlet property="tableview" destination="xDG-ji-sCB" id="PUx-uN-kMr"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jt4-FN-Beo">
<rect key="frame" x="15" y="113" width="363" height="90"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="充值金额" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ls1-wk-m4n">
<rect key="frame" x="15" y="15.000000000000002" width="65.333333333333329" height="22.666666666666671"/>
<constraints>
<constraint firstAttribute="height" constant="22.5" id="H9O-Nw-l75"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="5000" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BSg-TK-5a8">
<rect key="frame" x="15" y="47.666666666666657" width="46" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="FvM-IL-TFR"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
<color key="textColor" red="0.40392156862745099" green="0.27843137254901962" blue="0.80392156862745101" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="90" id="Nff-9C-puK"/>
<constraint firstItem="BSg-TK-5a8" firstAttribute="leading" secondItem="Jt4-FN-Beo" secondAttribute="leading" constant="15" id="YsC-6B-A5l"/>
<constraint firstItem="ls1-wk-m4n" firstAttribute="leading" secondItem="Jt4-FN-Beo" secondAttribute="leading" constant="15" id="gXx-23-rTe"/>
<constraint firstItem="ls1-wk-m4n" firstAttribute="top" secondItem="Jt4-FN-Beo" secondAttribute="top" constant="15" id="mPp-XX-fAB"/>
<constraint firstItem="BSg-TK-5a8" firstAttribute="top" secondItem="ls1-wk-m4n" secondAttribute="bottom" constant="10" id="njN-19-eGK"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="xDG-ji-sCB">
<rect key="frame" x="15" y="216.66666666666669" width="363" height="531.33333333333326"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" red="0.40392156862745099" green="0.27843137254901962" blue="0.80392156862745101" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Jt4-FN-Beo" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="2mQ-vi-Ctc"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="xDG-ji-sCB" secondAttribute="trailing" constant="15" id="P2i-zI-fur"/>
<constraint firstItem="Jt4-FN-Beo" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="54" id="Tmp-M4-HtG"/>
<constraint firstItem="xDG-ji-sCB" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="UGK-Py-xY8"/>
<constraint firstItem="xDG-ji-sCB" firstAttribute="top" secondItem="Jt4-FN-Beo" secondAttribute="bottom" constant="13.5" id="Xuq-75-4dE"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Jt4-FN-Beo" secondAttribute="trailing" constant="15" id="jFB-45-tQa"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="xDG-ji-sCB" secondAttribute="bottom" constant="70" id="r0P-gj-wlz"/>
</constraints>
<point key="canvasLocation" x="131" y="-11"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
......@@ -13,9 +13,11 @@ class KJWithdrawViewController: KJBaseViewController {
super.viewDidLoad()
// Do any additional setup after loading the view.
obtainData()
self.titleL.text = "提现"
}
func withdrawAction() {
func obtainData() {
// 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/convenience/get_conv_param")!
// 发送HTTP请求的的session对象
......@@ -23,7 +25,14 @@ class KJWithdrawViewController: KJBaseViewController {
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
let params = ["method": "withdraw"]
let param = ["method": "transfer"]
var jsonData = NSData()
do {
jsonData = try JSONSerialization.data(withJSONObject: param, options: .prettyPrinted) as NSData
} catch {
print(error.localizedDescription)
}
request.httpBody = jsonData as Data
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
// 发一个post请求
let task = session.dataTask(with: request as URLRequest) {(
......
......@@ -91,29 +91,76 @@
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="提现银行卡" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sNv-Sb-1oZ">
<rect key="frame" x="29.000000000000007" y="373" width="76.666666666666686" height="19"/>
<constraints>
<constraint firstAttribute="height" constant="19" id="k3e-pT-EzH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="eVs-gj-gSe">
<rect key="frame" x="15" y="408" width="363" height="88"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="88" id="Q1Z-sD-XdS"/>
</constraints>
</tableView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cmT-6V-aTx">
<rect key="frame" x="137.33333333333334" y="516" width="118.66666666666666" height="35"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" image="plus-circle" title=" 添加新卡">
<attributedString key="attributedSubtitle"/>
<color key="baseForegroundColor" red="0.96470588235294119" green="0.63529411764705879" blue="0.10588235294117647" alpha="1" colorSpace="calibratedRGB"/>
</buttonConfiguration>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vuv-J1-XqF">
<rect key="frame" x="17.666666666666657" y="759" width="358" height="49"/>
<color key="backgroundColor" red="0.87843137250000003" green="0.87843137250000003" blue="0.87843137250000003" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="lEQ-hf-lpJ"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="立即提现">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</state>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="sNv-Sb-1oZ" firstAttribute="top" secondItem="dEj-F0-D5C" secondAttribute="bottom" constant="24.5" id="3ca-WT-l8a"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Eeo-aF-ZV0" secondAttribute="trailing" constant="20" id="5zl-dR-51j"/>
<constraint firstItem="IKJ-Xa-4MW" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="7Nx-FN-rYb"/>
<constraint firstItem="sNv-Sb-1oZ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="29" id="8VJ-ha-lTi"/>
<constraint firstItem="u2t-oN-i8m" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="196.5" id="AG8-0S-yWD"/>
<constraint firstItem="Eeo-aF-ZV0" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="25.5" id="GFT-hR-D8H"/>
<constraint firstItem="eVs-gj-gSe" firstAttribute="top" secondItem="sNv-Sb-1oZ" secondAttribute="bottom" constant="16" id="KZG-VF-7cd"/>
<constraint firstItem="dt0-BS-pCc" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="57" id="Ozr-l6-9bI"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="dt0-BS-pCc" secondAttribute="trailing" constant="15" id="Q94-bp-kh1"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="vuv-J1-XqF" secondAttribute="trailing" constant="17.5" id="RDa-P0-9aR"/>
<constraint firstItem="cmT-6V-aTx" firstAttribute="centerX" secondItem="fnl-2z-Ty3" secondAttribute="centerX" id="Ukl-aB-pG7"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="eVs-gj-gSe" secondAttribute="trailing" constant="15" id="YxF-Pi-wuB"/>
<constraint firstAttribute="trailing" secondItem="dEj-F0-D5C" secondAttribute="trailing" constant="15" id="Z4F-0X-Q2q"/>
<constraint firstItem="u2t-oN-i8m" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="29" id="dz1-SY-G0l"/>
<constraint firstItem="dEj-F0-D5C" firstAttribute="top" secondItem="Eeo-aF-ZV0" secondAttribute="bottom" id="eaA-l3-PMr"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="vuv-J1-XqF" secondAttribute="bottom" constant="10" id="gns-88-Hhg"/>
<constraint firstItem="dt0-BS-pCc" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="ht5-ov-Hli"/>
<constraint firstItem="IKJ-Xa-4MW" firstAttribute="top" secondItem="dt0-BS-pCc" secondAttribute="top" constant="100" id="mdc-bt-eUK"/>
<constraint firstItem="IKJ-Xa-4MW" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="mfB-r9-V39"/>
<constraint firstItem="dEj-F0-D5C" firstAttribute="top" secondItem="u2t-oN-i8m" secondAttribute="bottom" constant="73" id="o2x-TL-K4Y"/>
<constraint firstItem="eVs-gj-gSe" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="uLS-cc-dGb"/>
<constraint firstItem="vuv-J1-XqF" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="17.5" id="vaQ-8f-Ipz"/>
<constraint firstItem="cmT-6V-aTx" firstAttribute="top" secondItem="eVs-gj-gSe" secondAttribute="bottom" constant="20" id="whL-ky-Vpm"/>
<constraint firstItem="dEj-F0-D5C" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="zK5-9y-HlG"/>
</constraints>
<point key="canvasLocation" x="132" y="-11"/>
<point key="canvasLocation" x="130.53435114503816" y="-11.267605633802818"/>
</view>
</objects>
<resources>
<image name="plus-circle" width="21" height="21"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
......
//
// KJAddBankCodeAlert.swift
// iOS-2kj
//
// Created by 仁秀逄 on 2023/12/19.
//
import UIKit
class KJAddBankCodeAlert: UIView {
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
let whiteView = UIView(frame: CGRect(x: 25, y: (kjHeight - 287)/2.0, width: kjWidth-50, height: 287))
let titleLabel = UILabel(frame: CGRect(x: 0, y: 26, width: kjWidth - 50, height: 17))
override init(frame: CGRect) {
super.init(frame: CGRect(x: 0, y: 0, width: kjWidth, height: kjHeight))
backgroundColor = UIColor.init(white: 0, alpha: 0.3)
addSubview(whiteView)
whiteView.layer.cornerRadius = 5
whiteView.clipsToBounds = true
whiteView.backgroundColor = .white
whiteView.addSubview(titleLabel)
titleLabel.text = "添加银行卡"
titleLabel.font = .systemFont(ofSize: 16)
let closeBtn = UIButton(type: .custom)
whiteView.addSubview(closeBtn)
closeBtn.frame = CGRect(x: kjWidth - 50 - 41, y: 19, width: 31, height: 31)
closeBtn.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
let chooseBtn = UIButton(type: .custom)
whiteView.addSubview(chooseBtn)
chooseBtn.backgroundColor = UIColor(hex: "#F9F9F9")
chooseBtn.layer.cornerRadius = 5
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func show() {
let window = UIApplication.shared.delegate?.window as! UIView
window.addSubview(self)
}
@objc func dismiss() {
self.removeFromSuperview()
}
}
......@@ -9,6 +9,8 @@ import UIKit
class KJChooseTableViewCell: UITableViewCell {
@IBOutlet weak var titleL: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
......
......@@ -25,8 +25,8 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S8Z-rQ-Hsb">
<rect key="frame" x="20" y="15.666666666666664" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<rect key="frame" x="19.999999999999996" y="16.333333333333336" width="39.666666666666657" height="19.333333333333336"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
......@@ -40,6 +40,9 @@
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="titleL" destination="S8Z-rQ-Hsb" id="LMf-7p-46Z"/>
</connections>
<point key="canvasLocation" x="129.7709923664122" y="-8.4507042253521139"/>
</tableViewCell>
</objects>
......
......@@ -10,8 +10,14 @@ import UIKit
class KJSingleChooseView: UIView {
let whiteView = UIView(frame: CGRect(x: 0, y: kjHeight - 306, width: kjWidth, height: 306))
let whiteView = UIView(frame: CGRect(x: 0, y: kjHeight - 306, width: kjWidth, height: 320))
let tableView = UITableView(frame: CGRect(x: 0, y: 66, width: kjWidth, height: 306-66), style: .plain)
let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: kjWidth, height: 66))
var accountArr: [KJConfigDataParamModel] = []
var chooseComplete: (_ model: KJConfigDataParamModel, _ index: Int) -> Void = {_,_ in}
var selectedInt: Int = -1
/*
// Only override draw() if you perform custom drawing.
......@@ -24,15 +30,44 @@ class KJSingleChooseView: UIView {
super.init(frame: CGRect(x: 0, y: 0, width: kjWidth, height: kjHeight))
backgroundColor = UIColor.init(white: 0, alpha: 0.3)
addSubview(whiteView)
whiteView.layer.cornerRadius = 5
whiteView.clipsToBounds = true
whiteView.backgroundColor = UIColor(hex: "#F2F2F2")
whiteView.addSubview(titleLabel)
titleLabel.textAlignment = .center
titleLabel.font = .systemFont(ofSize: 16)
let closeBtn = UIButton(type: .custom)
whiteView.addSubview(closeBtn)
closeBtn.setImage(UIImage(named: "close"), for: .normal)
closeBtn.frame = CGRect(x: kjWidth - 47, y: 21.8, width: 31, height: 31)
closeBtn.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
whiteView.addSubview(tableView)
tableView.delegate = self
tableView.dataSource = self
tableView.register(UINib(nibName: "KJChooseTableViewCell", bundle: nil), forCellReuseIdentifier: "KJChooseTableViewCell")
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setAccountArray(arr: [KJConfigDataParamModel]) {
accountArr = arr
tableView.reloadData()
}
func setTitle(title: String) {
self.titleLabel.text = title
}
func setSelectedIndex(index: Int) {
selectedInt = index
tableView.reloadData()
}
func show() {
let window = UIApplication.shared.delegate?.window as! UIView
window.addSubview(self)
......@@ -45,12 +80,32 @@ class KJSingleChooseView: UIView {
extension KJSingleChooseView: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
return accountArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
let cell = tableView.dequeueReusableCell(withIdentifier: "KJChooseTableViewCell") as! KJChooseTableViewCell
let model = accountArr[indexPath.row]
cell.titleL.text = model.name
if indexPath.row == selectedInt {
cell.contentView.backgroundColor = UIColor(hex: "#EAE3FF")
} else {
cell.contentView.backgroundColor = .white
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 60
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
selectedInt = indexPath.row
tableView.reloadData()
chooseComplete(accountArr[selectedInt], selectedInt)
dismiss()
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论