Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
fd9eb38b
Commit
fd9eb38b
authored
Feb 29, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传接口
parent
7872c88c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
20 deletions
+140
-20
YHMainApplicantInformationViewController.swift
...(主申请人信息)/C/YHMainApplicantInformationViewController.swift
+6
-3
YHImagePickerView.swift
...ainApplicantInformation(主申请人信息)/V/YHImagePickerView.swift
+4
-1
YHMainInformationCardTableViewCell.swift
...mation(主申请人信息)/V/YHMainInformationCardTableViewCell.swift
+35
-13
YHMainApplicantInformationViewModel.swift
...tion(主申请人信息)/VM/YHMainApplicantInformationViewModel.swift
+89
-1
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+4
-0
YHNetRequest.swift
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
+2
-2
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation(主申请人信息)/C/YHMainApplicantInformationViewController.swift
View file @
fd9eb38b
...
...
@@ -9,7 +9,6 @@
import
UIKit
class
YHMainApplicantInformationViewController
:
YHBaseViewController
{
var
stepView
:
YHStepView
!
var
bottomView
:
YHBottomNextView
!
var
tableView
:
UITableView
!
...
...
@@ -135,8 +134,12 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
stepView
.
currentIndex
==
1
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHMainInformationCardTableViewCell
.
self
)
cell
.
dataSource
=
dataSource
?[
indexPath
.
row
]
cell
.
type
=
YHCardType
(
rawValue
:
indexPath
.
row
)
cell
.
type
=
YHCardType
(
rawValue
:
indexPath
.
row
)
??
.
identity
cell
.
viewModel
=
viewModel
cell
.
informationBlock
=
{[
weak
self
]
type
,
image
,
isLeft
in
guard
let
self
=
self
else
{
return
}
}
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHMainInformationTableViewCell
.
self
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation(主申请人信息)/V/YHImagePickerView.swift
View file @
fd9eb38b
...
...
@@ -207,7 +207,10 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
func
imagePickerController
(
_
picker
:
UIImagePickerController
,
didFinishPickingMediaWithInfo
info
:
[
UIImagePickerController
.
InfoKey
:
Any
])
{
if
let
image
=
info
[
UIImagePickerController
.
InfoKey
.
originalImage
]
as?
UIImage
{
uploadImage
(
image
:
image
)
self
.
dismiss
()
if
let
block
=
backImage
{
block
(
image
)
self
.
dismiss
()
}
}
else
{
printLog
(
"pick image wrong"
)
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation(主申请人信息)/V/YHMainInformationCardTableViewCell.swift
View file @
fd9eb38b
...
...
@@ -15,7 +15,8 @@ enum YHCardType: Int {
}
class
YHMainInformationCardTableViewCell
:
UITableViewCell
{
typealias
InformationBlock
=
(
_
type
:
YHCardType
,
_
image
:
UIImage
,
_
isleft
:
Bool
)
->
()
var
informationBlock
:
InformationBlock
?
var
centerView
:
UIView
!
var
titleLabel
:
UILabel
!
var
exampleButton
:
UIButton
!
...
...
@@ -23,9 +24,9 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
var
backSurfaceLabel
:
UILabel
!
var
frontImageButton
:
UIButton
!
var
backSurfaceImageButton
:
UIButton
!
var
type
:
YHCardType
?
{
var
viewModel
:
YHMainApplicantInformationViewModel
!
var
type
:
YHCardType
=
.
identity
{
didSet
{
guard
let
type
=
type
else
{
return
}
switch
type
{
case
.
identity
:
titleLabel
.
text
=
"中国身份证(选填)"
...
...
@@ -39,12 +40,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
}
}
}
var
dataSource
:
YHSectionItemModel
?{
didSet
{
updataData
()
}
}
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
...
...
@@ -197,14 +193,40 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
}
@objc
func
frontImageClick
()
{
YHImagePickerView
.
show
()
{
image
in
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
self
.
frontImageButton
.
setBackgroundImage
(
image
,
for
:
.
normal
)
self
.
viewModel
.
uploadImage
(
image
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
viewModel
.
updateModel
(
self
.
type
,
isFront
:
true
,
url
:
url
)
self
.
viewModel
.
getPublicImageUrl
(
url
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
}
}
// if let block = self.informationBlock {
// block(self.type, image, false)
// }
}
}
@objc
func
backSurfaceImageClick
()
{
YHImagePickerView
.
show
()
{
image
in
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
self
.
backSurfaceImageButton
.
setBackgroundImage
(
image
,
for
:
.
normal
)
self
.
viewModel
.
uploadImage
(
image
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
guard
let
url
=
success
else
{
return
}
self
.
viewModel
.
updateModel
(
self
.
type
,
isFront
:
false
,
url
:
url
)
self
.
viewModel
.
getPublicImageUrl
(
url
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
}
}
// if let block = self.informationBlock {
// block(self.type, image, true)
// }
}
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation(主申请人信息)/VM/YHMainApplicantInformationViewModel.swift
View file @
fd9eb38b
...
...
@@ -8,6 +8,7 @@
import
UIKit
import
SmartCodable
import
Alamofire
enum
YHSaveType
:
Int
{
case
save
=
0
...
...
@@ -205,9 +206,24 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
}
}
func
updateModel
(
_
type
:
YHCardType
,
isFront
:
Bool
,
url
:
String
)
{
switch
type
{
case
.
identity
:
if
isFront
{
mainModel
.
certificates
.
cn_identity_card
.
img_front
=
url
}
else
{
mainModel
.
certificates
.
cn_identity_card
.
img_back
=
url
}
case
.
passport
:
if
isFront
{
mainModel
.
certificates
.
hk_macao_pass
.
img_front
=
url
}
else
{
mainModel
.
certificates
.
hk_macao_pass
.
img_back
=
url
}
}
}
func
requestMainInformation
(
_
orderID
:
String
,
callBackBlock
:
@escaping
(
_
success
:
YHMainInformationModel
?,
_
error
:
YHErrorModel
?)
->
())
{
// /infoflow/order-information/get_information?order_id=9402
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
OrderInformation
.
getInformation
+
"?order_id=
\(
orderID
)
"
// let strUrl = "http://192.168.25.48:18088/" + YHAllApiName.OrderInformation.getInformation + "?order_id=\(orderID)"
// let params: [String : Any] = ["order_id": orderID]
...
...
@@ -301,6 +317,78 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
}
}
// 上传方法
func
uploadImage
(
_
image
:
UIImage
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
"https://test-comserver.galaxy-immi.com/oss/upload/storage"
let
boundary
=
UUID
()
.
uuidString
let
headers
:
HTTPHeaders
=
[
"Content-type"
:
"multipart/form-data; boundary=
\(
boundary
)
"
,
"businessCode"
:
"4001001"
]
let
_
=
YHNetRequest
.
uplaodRequest
(
url
:
strUrl
,
headers
:
headers
,
image
:
image
)
{
[
weak
self
]
json
,
code
in
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
json
.
data
as?
String
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
nil
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
nil
,
err
)
}
}
func
getPublicImageUrl
(
_
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
"https://test-comserver.galaxy-immi.com/oss/storage/convertToPublicURL"
+
"?fileUrl=
\(
url
)
"
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
json
.
data
as?
String
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
nil
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
nil
,
err
)
}
}
func
requestCnIDCardMessage
(
_
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
OrderInformation
.
cnIdCard
let
params
:
[
String
:
Any
]
=
[
"url"
:
url
]
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
// callBackBlock(json.data as? String, nil)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
nil
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
nil
,
err
)
}
}
func
requestHkIDCardMessage
(
_
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
OrderInformation
.
hkIdCard
let
params
:
[
String
:
Any
]
=
[
"url"
:
url
]
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
// callBackBlock(json.data as? String, nil)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
nil
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
nil
,
err
)
}
}
func
isCanNext
(
_
step
:
Int
)
->
Bool
{
if
step
==
0
{
let
nationality
=
mainModel
.
nationality
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
fd9eb38b
...
...
@@ -115,6 +115,10 @@ class YHAllApiName {
static
let
updateInformation
=
"infoflow/order-information/update_information"
// 主申请人国家信息
static
let
countryInformation
=
"infoflow/country"
// 主申请人中国
static
let
cnIdCard
=
"infoflow/order-information/get_id_card"
// 主申请人港澳通行证
static
let
hkIdCard
=
"infoflow/order-information/get_hk_macao_pass"
}
struct
WorkExperience
{
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
View file @
fd9eb38b
...
...
@@ -174,13 +174,13 @@ class YHNetRequest: NSObject {
return
httpRequest
}
guard
let
imageData
=
image
.
jpegData
(
compressionQuality
:
1
)
else
{
return
httpRequest
}
var
multipartFormData
=
MultipartFormData
()
let
multipartFormData
=
MultipartFormData
()
// 将图片添加到multipartFormData中
multipartFormData
.
append
(
imageData
,
withName
:
"file"
,
fileName
:
"image.jpg"
,
mimeType
:
"image/jpeg"
)
// 发送POST请求
let
uploadRequest
=
AF
.
upload
(
multipartFormData
:
multipartFormData
,
to
:
"https://test-comserver.galaxy-immi.com/oss/upload/storage"
,
headers
:
headers
)
let
uploadRequest
=
AF
.
upload
(
multipartFormData
:
multipartFormData
,
to
:
self
.
url
!
,
headers
:
headers
)
uploadRequest
.
responseString
(
completionHandler
:
{
string
in
#if DEBUG
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment