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

接口50%

上级 414496fd
......@@ -20,6 +20,9 @@
883B02052AC16CFD00C3ABBF /* iOS_2kjUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 883B02042AC16CFD00C3ABBF /* iOS_2kjUITests.swift */; };
883B02072AC16CFD00C3ABBF /* iOS_2kjUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 883B02062AC16CFD00C3ABBF /* iOS_2kjUITestsLaunchTests.swift */; };
883B02142AC1735A00C3ABBF /* podfile in Resources */ = {isa = PBXBuildFile; fileRef = 883B02132AC1735A00C3ABBF /* podfile */; };
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 */; };
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 */; };
......@@ -97,6 +100,9 @@
883B02042AC16CFD00C3ABBF /* iOS_2kjUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOS_2kjUITests.swift; sourceTree = "<group>"; };
883B02062AC16CFD00C3ABBF /* iOS_2kjUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOS_2kjUITestsLaunchTests.swift; sourceTree = "<group>"; };
883B02132AC1735A00C3ABBF /* podfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = podfile; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
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>"; };
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>"; };
......@@ -326,6 +332,9 @@
88BE380E2B0B3EA300D04877 /* KJHomeCollectionViewCell.xib */,
88BE38192B0DCC3000D04877 /* KJAccountTableViewCell.swift */,
88BE381A2B0DCC3000D04877 /* KJAccountTableViewCell.xib */,
88B5B9092B303F0800871A63 /* KJSingleChooseView.swift */,
88B5B90B2B304DF800871A63 /* KJChooseTableViewCell.swift */,
88B5B90C2B304DF800871A63 /* KJChooseTableViewCell.xib */,
);
path = view;
sourceTree = "<group>";
......@@ -456,6 +465,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
88B5B90E2B304DF800871A63 /* KJChooseTableViewCell.xib in Resources */,
88BE38072B074D1900D04877 /* KJLoginPhoneViewController.xib in Resources */,
883B01F02AC16CFD00C3ABBF /* LaunchScreen.storyboard in Resources */,
88BE38102B0B3EA300D04877 /* KJHomeCollectionViewCell.xib in Resources */,
......@@ -573,8 +583,10 @@
880FF38E2B21A6C600872B34 /* KJAccountModel.swift in Sources */,
88BE37EE2AFCC24900D04877 /* KJPulsaViewController.swift in Sources */,
88BE380F2B0B3EA300D04877 /* KJHomeCollectionViewCell.swift in Sources */,
88B5B90D2B304DF800871A63 /* KJChooseTableViewCell.swift in Sources */,
88BE381B2B0DCC3000D04877 /* KJAccountTableViewCell.swift in Sources */,
88BE37F22AFCC26100D04877 /* KJPDAMViewController.swift in Sources */,
88B5B90A2B303F0800871A63 /* KJSingleChooseView.swift in Sources */,
88BE37D82AFCC15400D04877 /* KJHomeViewController.swift in Sources */,
88BE382A2B1894F600D04877 /* KJPersonalViewController.swift in Sources */,
88BE380B2B0B2AC000D04877 /* KJHomeHeaderCell.swift in Sources */,
......@@ -767,11 +779,12 @@
DEVELOPMENT_TEAM = 6QKPM88RAB;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "iOS-2kj/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "Easy Pay";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
......@@ -780,11 +793,14 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "kpss.iOS-2kj";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "iOS-2kj/iOS-2kj-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
......@@ -800,11 +816,12 @@
DEVELOPMENT_TEAM = 6QKPM88RAB;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "iOS-2kj/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "Easy Pay";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
......@@ -813,10 +830,13 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "kpss.iOS-2kj";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "iOS-2kj/iOS-2kj-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
......
......@@ -3,100 +3,4 @@
uuid = "083033CE-6D7A-4E6A-9037-453F99AE79A1"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A3F2D383-8D8C-4BF2-A40E-79CD7585E802"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "iOS-2kj/home/subC/KJZFCodeViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "71"
endingLineNumber = "71"
landmarkName = "sureAction(_:)"
landmarkType = "7">
<Locations>
<Location
uuid = "A3F2D383-8D8C-4BF2-A40E-79CD7585E802 - 1729e58bb36ec9d6"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "closure #1 @Sendable (Swift.Optional&lt;Foundation.Data&gt;, Swift.Optional&lt;__C.NSURLResponse&gt;, Swift.Optional&lt;Swift.Error&gt;) -&gt; () in iOS_2kj.KJZFCodeViewController.sureAction(Any) -&gt; ()"
moduleName = "iOS-2kj"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/renxiupang/Documents/iOS-2kj/iOS-2kj/home/subC/KJZFCodeViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "71"
endingLineNumber = "71"
offsetFromSymbolStart = "1848">
</Location>
<Location
uuid = "A3F2D383-8D8C-4BF2-A40E-79CD7585E802 - bb346ffbd1b3ec00"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "closure #1 @Swift.MainActor () -&gt; () in closure #1 @Sendable (Swift.Optional&lt;Foundation.Data&gt;, Swift.Optional&lt;__C.NSURLResponse&gt;, Swift.Optional&lt;Swift.Error&gt;) -&gt; () in iOS_2kj.KJZFCodeViewController.sureAction(Any) -&gt; ()"
moduleName = "iOS-2kj"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/renxiupang/Documents/iOS-2kj/iOS-2kj/home/subC/KJZFCodeViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "72"
endingLineNumber = "72"
offsetFromSymbolStart = "36">
</Location>
<Location
uuid = "A3F2D383-8D8C-4BF2-A40E-79CD7585E802 - 93c36718f4600576"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "closure #1 @Sendable (Swift.Optional&lt;Foundation.Data&gt;, Swift.Optional&lt;__C.NSURLResponse&gt;, Swift.Optional&lt;Swift.Error&gt;) -&gt; () in iOS_2kj.KJZFCodeViewController.sureAction(Any) -&gt; ()"
moduleName = "iOS-2kj"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/renxiupang/Documents/rire-tool/iOS-2kj/home/subC/KJZFCodeViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "71"
endingLineNumber = "71"
offsetFromSymbolStart = "1848">
</Location>
<Location
uuid = "A3F2D383-8D8C-4BF2-A40E-79CD7585E802 - 3fdeed6896bd20e0"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "closure #1 @Swift.MainActor () -&gt; () in closure #1 @Sendable (Swift.Optional&lt;Foundation.Data&gt;, Swift.Optional&lt;__C.NSURLResponse&gt;, Swift.Optional&lt;Swift.Error&gt;) -&gt; () in iOS_2kj.KJZFCodeViewController.sureAction(Any) -&gt; ()"
moduleName = "iOS-2kj"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/renxiupang/Documents/rire-tool/iOS-2kj/home/subC/KJZFCodeViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "72"
endingLineNumber = "72"
offsetFromSymbolStart = "36">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "9DE4A382-1AF3-431B-AB5B-1CE72F6EC327"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "iOS-2kj/home/subC/KJElectricityViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "42"
endingLineNumber = "42"
landmarkName = "obtainData()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
{
"images" : [
{
"filename" : "1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "tab_icon_back_black@2x.png",
"filename" : "icon_back2@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tab_icon_back_black@3x.png",
"filename" : "icon_back2@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"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" : "关闭@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" : "编组 4@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "编组 4@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "路径 + 矩形 蒙版@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "路径 + 矩形 蒙版@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "登录后头像@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "登录后头像@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "箭头_拷贝_4@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "箭头_拷贝_4@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "路径 + 矩形 蒙版@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "路径 + 矩形 蒙版@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -33,6 +33,7 @@ class KJBaseViewController: UIViewController {
backBtn.frame = CGRect(x: 10, y: 0 + StatusBar_Heigh, width: 30, height: 44)
view.addSubview(backBtn)
backBtn.setImage(UIImage(named: "icon_back_black"), for: .normal)
backBtn.addTarget(self, action: #selector(backAction), for: .touchUpInside)
}
......
......@@ -25,16 +25,31 @@ class KJHomeViewController: KJBaseViewController {
self.collectionView.contentInsetAdjustmentBehavior = .never
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
collectionView.reloadData()
}
@objc func accountAction() {
let vc = KJAccountViewController()
navigationController?.pushViewController(vc, animated: true)
if UserDefaults.standard.string(forKey: "token")?.count ?? 0 > 1 {
let vc = KJAccountViewController()
navigationController?.pushViewController(vc, animated: true)
} else {
let vc = KJLoginPhoneViewController()
navigationController?.pushViewController(vc, animated: true)
}
}
@objc func userAction() {
let vc = KJLoginPhoneViewController()
navigationController?.pushViewController(vc, animated: true)
if UserDefaults.standard.string(forKey: "token")?.count ?? 0 > 1 {
let vc = KJPersonalViewController()
navigationController?.pushViewController(vc, animated: true)
} else {
let vc = KJLoginPhoneViewController()
navigationController?.pushViewController(vc, animated: true)
}
}
/*
......@@ -66,6 +81,11 @@ extension KJHomeViewController: UICollectionViewDelegate, UICollectionViewDataSo
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "KJHomeHeaderCell", for: indexPath) as! KJHomeHeaderCell
cell.accountBtn.addTarget(self, action: #selector(accountAction), for: .touchUpInside)
cell.userBtn.addTarget(self, action: #selector(userAction), for: .touchUpInside)
if UserDefaults.standard.string(forKey: "phone")?.count ?? 0 > 1 {
cell.phoneL.text = UserDefaults.standard.string(forKey: "phone") ?? "登录"
} else {
cell.phoneL.text = "登录"
}
return cell
}
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "KJHomeCollectionViewCell", for: indexPath) as! KJHomeCollectionViewCell
......@@ -113,16 +133,21 @@ extension KJHomeViewController: UICollectionViewDelegate, UICollectionViewDataSo
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.section == 1 {
let vc = KJBigViewController()
vc.index = indexPath.row
if indexPath.row == 0 {
vc.titleText = "Pembayaran Pulsa & Paket Data"
} else if indexPath.row == 1 {
vc.titleText = "Pembayaran Listrik"
} else if indexPath.row == 3 {
vc.titleText = "Pembayaran PDAM"
if UserDefaults.standard.string(forKey: "token")?.count ?? 0 > 1 {
let vc = KJBigViewController()
vc.index = indexPath.row
if indexPath.row == 0 {
vc.titleText = "Pembayaran Pulsa & Paket Data"
} else if indexPath.row == 1 {
vc.titleText = "Pembayaran Listrik"
} else if indexPath.row == 3 {
vc.titleText = "Pembayaran PDAM"
}
navigationController?.pushViewController(vc, animated: true)
} else {
let vc = KJLoginPhoneViewController()
navigationController?.pushViewController(vc, animated: true)
}
navigationController?.pushViewController(vc, animated: true)
}
}
}
......@@ -9,6 +9,8 @@ import UIKit
import HandyJSON
class KJGetConvModel: HandyJSON {
var param_config: [KJConfigParamModel]?
var req_method: String?
required init() {}
}
......
......@@ -29,7 +29,7 @@ class KJAccountViewController: KJBaseViewController {
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInZlcnNpb24iOjF9.eyJwaG9uZSI6Im5HU2NtR21abW1hWFkyVm8iLCJpZCI6IjMxOSIsImV4cCI6MTcxNDYzNjk1MSwiZXh0Ijp7InNlc3Npb25faWQiOjQ3NzAyfSwiaXNzIjoiaW5kb25lc2lhIiwiaWF0IjoxNzAxNjc2OTUxfQ.xzikFbX-fP47D1AF51FEKdM9dm4dPU6CFlTFQkQV3XU", forHTTPHeaderField: "Token")
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
// 发一个post请求
let task = session.dataTask(with: request as URLRequest) {(
data, response, error) in
......@@ -60,7 +60,8 @@ class KJAccountViewController: KJBaseViewController {
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInZlcnNpb24iOjF9.eyJwaG9uZSI6Im5HU2NtR21abW1hWFkyVm8iLCJpZCI6IjMxOSIsImV4cCI6MTcxNDYzNjk1MSwiZXh0Ijp7InNlc3Npb25faWQiOjQ3NzAyfSwiaXNzIjoiaW5kb25lc2lhIiwiaWF0IjoxNzAxNjc2OTUxfQ.xzikFbX-fP47D1AF51FEKdM9dm4dPU6CFlTFQkQV3XU", forHTTPHeaderField: "Token")
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
print(UserDefaults.standard.string(forKey: "token") ?? "")
var param = ["method": "exist"]
var jsonData = NSData()
do {
......
......@@ -15,6 +15,7 @@ class KJAngsuranViewController: KJBaseViewController {
// Do any additional setup after loading the view.
navBack.isHidden = true
statusView.isHidden = true
backBtn.isHidden = true
}
......
......@@ -35,7 +35,7 @@ class KJBigViewController: KJBaseViewController {
statusView.backgroundColor = .clear
titleL.text = titleText ?? ""
titleL.textColor = .white
backBtn.setImage(UIImage(named: "tab_icon_back_black"), for: .normal)
backBtn.setImage(UIImage(named: "icon_back_white"), for: .normal)
headerScroll.contentSize = CGSize(width: kjWidth, height: 65.5)
......
......@@ -25,7 +25,7 @@ class KJChargeViewController: KJBaseViewController {
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInZlcnNpb24iOjF9.eyJwaG9uZSI6Im5HU2NtR21abW1hWFkyVm8iLCJpZCI6IjMxOSIsImV4cCI6MTcxNDYzNjk1MSwiZXh0Ijp7InNlc3Npb25faWQiOjQ3NzAyfSwiaXNzIjoiaW5kb25lc2lhIiwiaWF0IjoxNzAxNjc2OTUxfQ.xzikFbX-fP47D1AF51FEKdM9dm4dPU6CFlTFQkQV3XU", forHTTPHeaderField: "Token")
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
var param = ["method": "recharge"]
var jsonData = NSData()
do {
......
......@@ -21,7 +21,7 @@ class KJElectricityViewController: KJBaseViewController {
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInZlcnNpb24iOjF9.eyJwaG9uZSI6Im5HU2NtR21abW1hWFkyVm8iLCJpZCI6IjMxOSIsImV4cCI6MTcxNDYzNjk1MSwiZXh0Ijp7InNlc3Npb25faWQiOjQ3NzAyfSwiaXNzIjoiaW5kb25lc2lhIiwiaWF0IjoxNzAxNjc2OTUxfQ.xzikFbX-fP47D1AF51FEKdM9dm4dPU6CFlTFQkQV3XU", forHTTPHeaderField: "Token")
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
var param = ["method": "electric"]
var jsonData = NSData()
do {
......@@ -64,6 +64,7 @@ class KJElectricityViewController: KJBaseViewController {
// Do any additional setup after loading the view.
navBack.isHidden = true
statusView.isHidden = true
backBtn.isHidden = true
}
......
......@@ -13,6 +13,9 @@ class KJEmoneyViewController: KJBaseViewController {
super.viewDidLoad()
// Do any additional setup after loading the view.
navBack.isHidden = true
statusView.isHidden = true
backBtn.isHidden = true
}
......
......@@ -15,6 +15,7 @@ class KJPDAMViewController: KJBaseViewController {
// Do any additional setup after loading the view.
navBack.isHidden = true
statusView.isHidden = true
backBtn.isHidden = true
}
......
......@@ -15,6 +15,7 @@ class KJPulsaViewController: KJBaseViewController {
// Do any additional setup after loading the view.
navBack.isHidden = true
statusView.isHidden = true
backBtn.isHidden = true
}
......
......@@ -20,6 +20,7 @@ class KJTransferViewController: KJBaseViewController {
// Do any additional setup after loading the view.
navBack.isHidden = true
statusView.isHidden = true
backBtn.isHidden = true
}
......
......@@ -24,7 +24,7 @@ class KJWithdrawViewController: KJBaseViewController {
var request = URLRequest(url: url)
request.httpMethod = "POST"
let params = ["method": "withdraw"]
request.setValue("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInZlcnNpb24iOjF9.eyJwaG9uZSI6Im5HU2NtR21abW1hWFkyVm8iLCJpZCI6IjMxOSIsImV4cCI6MTcxNDYzNjk1MSwiZXh0Ijp7InNlc3Npb25faWQiOjQ3NzAyfSwiaXNzIjoiaW5kb25lc2lhIiwiaWF0IjoxNzAxNjc2OTUxfQ.xzikFbX-fP47D1AF51FEKdM9dm4dPU6CFlTFQkQV3XU", forHTTPHeaderField: "Token")
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
// 发一个post请求
let task = session.dataTask(with: request as URLRequest) {(
data, response, error) in
......
......@@ -46,7 +46,7 @@ class KJZFCodeViewController: KJBaseViewController {
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInZlcnNpb24iOjF9.eyJwaG9uZSI6Im5HU2NtR21abW1hWFkyVm8iLCJpZCI6IjMxOSIsImV4cCI6MTcxNDYzNjk1MSwiZXh0Ijp7InNlc3Npb25faWQiOjQ3NzAyfSwiaXNzIjoiaW5kb25lc2lhIiwiaWF0IjoxNzAxNjc2OTUxfQ.xzikFbX-fP47D1AF51FEKdM9dm4dPU6CFlTFQkQV3XU", forHTTPHeaderField: "Token")
request.setValue(UserDefaults.standard.string(forKey: "token") ?? "", forHTTPHeaderField: "Token")
var param = ["method": "add", "pwd": pwd]
var jsonData = NSData()
do {
......
//
// KJChooseTableViewCell.swift
// iOS-2kj
//
// Created by 仁秀逄 on 2023/12/18.
//
import UIKit
class KJChooseTableViewCell: UITableViewCell {
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="52" id="KGk-i7-Jjw" customClass="KJChooseTableViewCell" customModule="iOS_2kj" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="52"/>
<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="52"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Kr-Tx-HuE">
<rect key="frame" x="0.0" y="51" width="320" height="1"/>
<color key="backgroundColor" red="0.91764705882352937" green="0.91764705882352937" blue="0.91764705882352937" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="pIF-jj-pGh"/>
</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"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="6Kr-Tx-HuE" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="5su-gi-VQ5"/>
<constraint firstAttribute="trailing" secondItem="6Kr-Tx-HuE" secondAttribute="trailing" id="DvR-XC-uoJ"/>
<constraint firstAttribute="bottom" secondItem="6Kr-Tx-HuE" secondAttribute="bottom" id="UVI-TE-bTo"/>
<constraint firstItem="S8Z-rQ-Hsb" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="qHo-qY-HV9"/>
<constraint firstItem="S8Z-rQ-Hsb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="20" id="xHa-y4-HqI"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="129.7709923664122" y="-8.4507042253521139"/>
</tableViewCell>
</objects>
</document>
......@@ -15,6 +15,9 @@ class KJHomeHeaderCell: UICollectionViewCell {
@IBOutlet weak var cardManagerBtn: UIButton!
@IBOutlet weak var userBtn: UIButton!
@IBOutlet weak var phoneL: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
......
......@@ -154,6 +154,7 @@
<connections>
<outlet property="accountBtn" destination="jsx-fR-l9y" id="Awo-Bf-d40"/>
<outlet property="cardManagerBtn" destination="tPP-U6-2bl" id="cL3-eo-sNO"/>
<outlet property="phoneL" destination="yTU-AM-EWm" id="2Gb-lb-rNk"/>
<outlet property="qrcodeBtn" destination="bSs-G8-8iO" id="JCK-pd-5zV"/>
<outlet property="userBtn" destination="A3K-aS-MS2" id="04h-pt-zeA"/>
</connections>
......
//
// KJSingleChooseView.swift
// iOS-2kj
//
// Created by 仁秀逄 on 2023/12/18.
//
import UIKit
class KJSingleChooseView: UIView {
let whiteView = UIView(frame: CGRect(x: 0, y: kjHeight - 306, width: kjWidth, height: 306))
let tableView = UITableView(frame: CGRect(x: 0, y: 66, width: kjWidth, height: 306-66), style: .plain)
/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/
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.addSubview(tableView)
tableView.delegate = self
tableView.dataSource = self
}
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()
}
}
extension KJSingleChooseView: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
}
......@@ -10,16 +10,149 @@ import UIKit
class KJLoginPhoneViewController: KJBaseViewController {
@IBOutlet weak var textfield: UITextField!
@IBOutlet weak var getVerificationBtn: UIButton!
@IBOutlet weak var mainL: UILabel!
@IBOutlet weak var subL: UILabel!
@IBOutlet weak var verificationBackView: UIView!
@IBOutlet weak var firstTF: UITextField!
@IBOutlet weak var secTF: UITextField!
@IBOutlet weak var thirdTF: UITextField!
@IBOutlet weak var forthTF: UITextField!
@IBOutlet weak var fifthTF: UITextField!
@IBOutlet weak var sixTF: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.navBack.isHidden = true
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
getVerificationBtn.isUserInteractionEnabled = false
textfield.delegate = self
firstTF.delegate = self
secTF.delegate = self
thirdTF.delegate = self
forthTF.delegate = self
fifthTF.delegate = self
sixTF.delegate = self
getVerificationBtn.addTarget(self, action: #selector(getVerification), for: .touchUpInside)
}
@objc func getVerification() {
if verificationBackView.isHidden == true {
// 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/user/get_validate_code")!
// 发送HTTP请求的的session对象
let session = URLSession.shared
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("id", forHTTPHeaderField: "language")
request.setValue("1.0", forHTTPHeaderField: "version")
request.setValue("IOS", forHTTPHeaderField: "device-type")
request.setValue("1.2", forHTTPHeaderField: "api-version")
request.setValue("danamudah", forHTTPHeaderField: "app-name")
request.setValue("AppStore", forHTTPHeaderField: "place")
var param = ["phone": "62" + (textfield.text ?? "")]
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!)
if (dict.allKeys as NSArray).contains("success") == true {
DispatchQueue.main.async {
self.firstTF.becomeFirstResponder()
self.verificationBackView.isHidden = false
self.mainL.text = "输入验证码"
self.subL.text = "已发送验证码至+62 " + (self.textfield.text ?? "")
self.getVerificationBtn.setTitle("登录", for: .normal)
}
}
}
task.resume()
} else {
//登录
let pwd = firstTF.text! + secTF.text! + thirdTF.text! + forthTF.text! + fifthTF.text! + sixTF.text!
// 构建URL
let url:URL = URL(string: "https://www.danamudah.fun/kopisusu_server/user/login")!
// 发送HTTP请求的的session对象
let session = URLSession.shared
// 构建请求request
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("id", forHTTPHeaderField: "language")
request.setValue("1.0", forHTTPHeaderField: "version")
request.setValue("IOS", forHTTPHeaderField: "device-type")
request.setValue("1.2", forHTTPHeaderField: "api-version")
request.setValue("danamudah", forHTTPHeaderField: "app-name")
request.setValue("AppStore", forHTTPHeaderField: "place")
var param = ["phone": "62" + (textfield.text ?? ""), "valid_code": pwd]
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!)
if (dict.allKeys as NSArray).contains("success") == true {
DispatchQueue.main.async {
UserDefaults.standard.set((dict["ret"] as! NSDictionary)["token"], forKey: "token")
UserDefaults.standard.set(self.textfield.text, forKey: "phone")
self.navigationController?.popViewController(animated: true)
}
}
}
task.resume()
}
}
func getDictionaryFromJSONString(jsonString: String) -> NSDictionary {
// 将传入的 JSON 字符串 jsonString 使用 data(using:) 方法转换为 Data 类型
let jsonData:Data = jsonString.data(using: .utf8)!
// 通过 JSONSerialization.jsonObject(with:options:) 方法将 jsonData 进行 JSON 解析,并将解析结果存储在 dict 变量中。这里使用的选项是 .mutableContainers,表示可以修改容器对象
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
// 使用条件语句判断 dict 是否为 nil。如果不为 nil,表示 JSON 解析成功,将 dict 强制转换为 NSDictionary 类型,并返回。
// 如果 dict 为 nil,表示 JSON 解析失败,返回一个空的 NSDictionary 对象。
if dict != nil {
return dict as! NSDictionary
}
return NSDictionary()
}
@IBAction func closeAction(_ sender: Any) {
self.navigationController?.popViewController(animated: true)
}
/*
// MARK: - Navigation
......@@ -34,6 +167,52 @@ class KJLoginPhoneViewController: KJBaseViewController {
extension KJLoginPhoneViewController: UITextFieldDelegate {
func textFieldDidChangeSelection(_ textField: UITextField) {
if textField == textfield {
if textField.text?.count ?? 0 >= 11 {
getVerificationBtn.isUserInteractionEnabled = true
getVerificationBtn.backgroundColor = UIColor(hex: "#6747CD")
} else {
getVerificationBtn.isUserInteractionEnabled = false
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
}
} else {
if textField == firstTF {
if textField.text?.count ?? 0 >= 1 {
secTF.becomeFirstResponder()
getVerificationBtn.isUserInteractionEnabled = false
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
}
} else if textField == secTF {
if textField.text?.count ?? 0 >= 1 {
thirdTF.becomeFirstResponder()
getVerificationBtn.isUserInteractionEnabled = false
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
}
} else if textField == thirdTF {
if textField.text?.count ?? 0 >= 1 {
forthTF.becomeFirstResponder()
getVerificationBtn.isUserInteractionEnabled = false
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
}
} else if textField == forthTF {
if textField.text?.count ?? 0 >= 1 {
fifthTF.becomeFirstResponder()
getVerificationBtn.isUserInteractionEnabled = false
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
}
} else if textField == fifthTF {
if textField.text?.count ?? 0 >= 1 {
sixTF.becomeFirstResponder()
getVerificationBtn.isUserInteractionEnabled = false
getVerificationBtn.backgroundColor = UIColor(hex: "#D6D5D6")
}
} else if textField == sixTF {
if textField.text?.count ?? 0 >= 1 {
getVerificationBtn.isHidden = false
getVerificationBtn.isUserInteractionEnabled = true
getVerificationBtn.backgroundColor = UIColor(hex: "#6747CD")
}
}
}
}
}
......@@ -9,13 +9,33 @@ import UIKit
class KJPersonalViewController: KJBaseViewController {
@IBOutlet weak var phoneL: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.navBack.backgroundColor = .clear
self.statusView.backgroundColor = .clear
}
@IBAction func accountAction(_ sender: Any) {
}
@IBAction func yinsiAction(_ sender: Any) {
}
@IBAction func aboutAction(_ sender: Any) {
}
@IBAction func logoutAction(_ sender: Any) {
UserDefaults.standard.set("", forKey: "token")
UserDefaults.standard.set("", forKey: "phone")
navigationController?.popViewController(animated: true)
let vc = KJLoginPhoneViewController()
navigationController?.pushViewController(vc, animated: true)
}
/*
// MARK: - Navigation
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论