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
cb6b23db
Commit
cb6b23db
authored
Mar 20, 2024
by
Steven杜宇
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 证件上传
parent
c33c2ab7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
25 deletions
+31
-25
YHUploadContentVC.swift
...vice(服务中心)/MyCertificates(我的证书)/C/YHUploadContentVC.swift
+15
-6
YHCertificateUploadSheetView.swift
...MyCertificates(我的证书)/V/YHCertificateUploadSheetView.swift
+16
-19
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/C/YHUploadContentVC.swift
View file @
cb6b23db
...
...
@@ -93,11 +93,22 @@ class YHUploadContentVC: YHBaseViewController {
}
@objc
func
didClickUploadBtn
()
{
YHCertificateUploadSheetView
.
sheetView
.
show
{
[
weak
self
]
actionType
in
guard
let
self
=
self
else
{
return
}
print
(
"%d"
,
actionType
.
rawValue
)
let
sheetView
=
YHCertificateUploadSheetView
.
sheetView
sheetView
.
uploadFilesBlock
=
{
[
weak
self
]
fileUrl
in
guard
let
self
=
self
else
{
return
}
print
(
fileUrl
)
if
let
fileData
=
try
?
Data
(
contentsOf
:
fileUrl
)
{
// 将文件数据上传到服务器
let
size
=
String
(
format
:
"%.2fM"
,
Double
(
fileData
.
count
)
/
(
1024.0
*
1024.0
))
print
(
"
\(
size
)
"
)
}
}
sheetView
.
uploadImageBlock
=
{
[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
}
sheetView
.
show
()
}
func
createUI
()
{
...
...
@@ -396,7 +407,5 @@ extension YHUploadContentVC {
}
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/V/YHCertificateUploadSheetView.swift
View file @
cb6b23db
...
...
@@ -182,7 +182,11 @@ class YHCertificateUploadSheetView: UIView {
static
let
sheetView
=
YHCertificateUploadSheetView
(
frame
:
UIScreen
.
main
.
bounds
)
var
action
:((
YHCertificateUploadType
)
->
())?
// var action:((YHCertificateUploadType)->())?
// 上传文件
var
uploadFilesBlock
:((
URL
)
->
())?
// 上传图片
var
uploadImageBlock
:((
UIImage
)
->
())?
lazy
var
blackMaskView
:
UIView
=
{
let
view
=
UIView
()
...
...
@@ -359,8 +363,7 @@ class YHCertificateUploadSheetView: UIView {
extension
YHCertificateUploadSheetView
{
func
show
(
_
action
:((
YHCertificateUploadType
)
->
())?)
{
self
.
action
=
action
func
show
()
{
UIApplication
.
shared
.
yhKeyWindow
()?
.
addSubview
(
self
)
}
...
...
@@ -372,7 +375,7 @@ extension YHCertificateUploadSheetView {
if
let
targetView
=
sender
.
view
{
let
tag
=
targetView
.
tag
if
let
type
=
YHCertificateUploadType
(
rawValue
:
tag
)
,
let
action
=
action
{
if
let
type
=
YHCertificateUploadType
(
rawValue
:
tag
)
{
if
type
==
.
photo
{
selectPhoto
()
...
...
@@ -382,6 +385,9 @@ extension YHCertificateUploadSheetView {
}
else
if
type
==
.
phoneFile
{
selectFile
()
}
else
if
type
==
.
cancel
{
dismiss
()
}
}
}
...
...
@@ -445,10 +451,9 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
func
imagePickerController
(
_
picker
:
UIImagePickerController
,
didFinishPickingMediaWithInfo
info
:
[
UIImagePickerController
.
InfoKey
:
Any
])
{
if
let
image
=
info
[
UIImagePickerController
.
InfoKey
.
originalImage
]
as?
UIImage
{
// if let block = backImage {
// block(image)
uploadImageBlock
?(
image
)
self
.
dismiss
()
// }
}
else
{
printLog
(
"pick image wrong"
)
}
...
...
@@ -482,9 +487,10 @@ extension YHCertificateUploadSheetView: UIDocumentPickerDelegate {
let
fileCoordinator
=
NSFileCoordinator
()
var
error
:
NSError
?
fileCoordinator
.
coordinate
(
readingItemAt
:
url
,
options
:[
.
forUploading
],
error
:
&
error
)
{
newFileUrl
in
uploadFile
(
newFileUrl
)
dismiss
()
fileUrl
in
uploadFilesBlock
?(
fileUrl
)
dismiss
()
}
url
.
stopAccessingSecurityScopedResource
()
if
let
error
=
error
{
...
...
@@ -499,13 +505,4 @@ extension YHCertificateUploadSheetView: UIDocumentPickerDelegate {
func
documentPickerWasCancelled
(
_
controller
:
UIDocumentPickerViewController
)
{
}
func
uploadFile
(
_
fileUrl
:
URL
)
{
if
let
fileData
=
try
?
Data
(
contentsOf
:
fileUrl
)
{
// 将文件数据上传到服务器
let
size
=
String
(
format
:
"%.2fM"
,
Double
(
fileData
.
count
)
/
(
1024.0
*
1024.0
))
print
(
"
\(
size
)
"
)
}
}
}
David黄金龙
@david.hjl
mentioned in commit
604019a2
·
Mar 20, 2024
mentioned in commit
604019a2
mentioned in commit 604019a25e5ad14605907b3ca9c3c18ff970c631
Toggle commit list
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