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
5571143a
Commit
5571143a
authored
Mar 17, 2024
by
Steven杜宇
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 文件上传
parent
ce9c4382
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
6 deletions
+154
-6
YHCertificateResourceUploadVC.swift
...yCertificates(我的证书)/C/YHCertificateResourceUploadVC.swift
+79
-0
YHCertificateModel.swift
...ice(服务中心)/MyCertificates(我的证书)/M/YHCertificateModel.swift
+1
-1
YHMyViewController.swift
...alaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
+6
-5
Info.plist
galaxy/galaxy/Res/Info.plist
+68
-0
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/C/YHCertificateResourceUploadVC.swift
View file @
5571143a
...
...
@@ -8,6 +8,7 @@
import
UIKit
import
JXSegmentedView
import
UniformTypeIdentifiers
class
YHCertificateResourceUploadVC
:
YHBaseViewController
{
...
...
@@ -32,6 +33,30 @@ class YHCertificateResourceUploadVC: YHBaseViewController {
return
tableView
}()
lazy
var
documentPickerVC
:
UIDocumentPickerViewController
=
{
let
docTypes
=
[
"public.image"
,
"com.adobe.pdf"
,
"com.microsoft.word.doc"
,
"com.microsoft.powerpoint.ppt"
]
if
#available(iOS 14.0, *)
{
var
arr
:[
UTType
]
=
[]
for
docStr
in
docTypes
{
if
let
type
=
UTType
(
docStr
)
{
arr
.
append
(
type
)
}
}
let
docPickerVC
=
UIDocumentPickerViewController
(
forOpeningContentTypes
:
arr
)
docPickerVC
.
delegate
=
self
return
docPickerVC
}
let
docPickerVC
=
UIDocumentPickerViewController
(
documentTypes
:
docTypes
,
in
:
.
open
)
docPickerVC
.
delegate
=
self
return
docPickerVC
}()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
self
.
view
.
backgroundColor
=
.
white
...
...
@@ -71,6 +96,12 @@ extension YHCertificateResourceUploadVC: UITableViewDelegate, UITableViewDataSou
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
true
{
selectUploadFileFromICouldDrive
()
return
}
YHCertificateFilterView
.
sheetView
.
show
()
return
...
...
@@ -104,3 +135,51 @@ extension YHCertificateResourceUploadVC: JXSegmentedListContainerViewListDelegat
return
view
}
}
extension
YHCertificateResourceUploadVC
:
UIDocumentPickerDelegate
{
private
func
selectUploadFileFromICouldDrive
()
{
present
(
documentPickerVC
,
animated
:
true
)
}
func
documentPicker
(
_
controller
:
UIDocumentPickerViewController
,
didPickDocumentsAt
urls
:
[
URL
])
{
guard
let
url
=
urls
.
first
,
let
fileName
=
url
.
lastPathComponent
.
removingPercentEncoding
else
{
return
}
print
(
"
\(
url
)
"
)
// 读取文件数据
// 获取授权
let
fileUrlAuthozied
=
url
.
startAccessingSecurityScopedResource
()
if
fileUrlAuthozied
{
// 通过文件协调工具来得到新的文件地址,以此得到文件保护功能
let
fileCoordinator
=
NSFileCoordinator
()
var
error
:
NSError
?
fileCoordinator
.
coordinate
(
readingItemAt
:
url
,
options
:[
.
forUploading
],
error
:
&
error
)
{
newFileUrl
in
if
let
fileData
=
try
?
Data
(
contentsOf
:
newFileUrl
)
{
// 将文件数据上传到服务器
uploadFile
(
fileData
)
}
}
url
.
stopAccessingSecurityScopedResource
()
if
let
error
=
error
{
}
}
else
{
print
(
"授权失败"
)
}
}
func
documentPickerWasCancelled
(
_
controller
:
UIDocumentPickerViewController
)
{
}
func
uploadFile
(
_
data
:
Data
)
{
let
format
=
String
(
format
:
"%.2fM"
,
Double
(
data
.
count
)
/
(
1024.0
*
1024.0
))
print
(
"
\(
format
)
"
)
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/M/YHCertificateModel.swift
View file @
5571143a
...
...
@@ -15,7 +15,7 @@ class YHUploadCertificateInfo: SmartCodable {
enum
CodingKeys
:
String
,
CodingKey
{
case
categoryData
=
"category_data"
case
supplementList
=
"
YHSupplementInfo
"
case
supplementList
=
"
supplement_list
"
}
required
init
()
{
...
...
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
View file @
5571143a
...
...
@@ -160,7 +160,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if
(
indexPath
.
row
>=
items
.
count
)
{
return
}
//
if true {
if
true
{
// YHCertificateUploadFailTipsView.tipsView().show()
...
...
@@ -168,10 +168,11 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
// let vc = YHUploadContentVC()
// self.navigationController?.pushViewController(vc)
// let vc = YHCertificateResourceUploadVC()
// self.navigationController?.pushViewController(vc)
// return
// }
let
vc
=
YHMaterialListViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
return
}
...
...
galaxy/galaxy/Res/Info.plist
View file @
5571143a
...
...
@@ -15,5 +15,73 @@
<
string
>
cameraDesciption
<
/string
>
<
k
e
y
>
NSPhotoLibraryUsageDescription
<
/k
e
y
>
<
string
>
photoLibraryDesciption
<
/string
>
<
k
e
y
>
NSFileProviderDomainUsageDescription
<
/k
e
y
>
<
string
>
需要访问您的文件以选择和上传
<
/string
>
<
k
e
y
>
UIFileSharingEnabled
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
LSSupportsOpeningDocumentsInPlace
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
CFBundleDocumentTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleTypeName
<
/k
e
y
>
<
string
>
PDF
Document
<
/string
>
<
k
e
y
>
LSItemContentTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
com.adobe.pdf
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSHandlerRank
<
/k
e
y
>
<
string
>
Default
<
/string
>
<
/
d
i
c
t
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleTypeName
<
/k
e
y
>
<
string
>
JPEG
Image
<
/string
>
<
k
e
y
>
LSItemContentTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
public.jpeg
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSHandlerRank
<
/k
e
y
>
<
string
>
Default
<
/string
>
<
/
d
i
c
t
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleTypeName
<
/k
e
y
>
<
string
>
PNG
Image
<
/string
>
<
k
e
y
>
LSItemContentTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
public.png
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSHandlerRank
<
/k
e
y
>
<
string
>
Default
<
/string
>
<
/
d
i
c
t
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleTypeName
<
/k
e
y
>
<
string
>
Microsoft
Word
Document
<
/string
>
<
k
e
y
>
LSItemContentTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
org.openxmlformats.wordprocessingml.document
<
/string
>
<
string
>
com.microsoft.word.doc
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSHandlerRank
<
/k
e
y
>
<
string
>
Default
<
/string
>
<
/
d
i
c
t
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleTypeName
<
/k
e
y
>
<
string
>
Microsoft
PowerPoint
Presentation
<
/string
>
<
k
e
y
>
LSItemContentTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
string
>
org.openxmlformats.presentationml.presentation
<
/string
>
<
string
>
com.microsoft.powerpoint.ppt
<
/string
>
<
/
a
rr
a
y
>
<
k
e
y
>
LSHandlerRank
<
/k
e
y
>
<
string
>
Default
<
/string
>
<
/
d
i
c
t
>
<
/
a
rr
a
y
>
<
/
d
i
c
t
>
<
/plist
>
David黄金龙
@david.hjl
mentioned in commit
9f1c8544
·
Mar 17, 2024
mentioned in commit
9f1c8544
mentioned in commit 9f1c8544c73aaf7509bec4c5225f62b5531d54c1
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