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
a808934c
Commit
a808934c
authored
Mar 25, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 我的证件
parent
4253395b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
19 deletions
+73
-19
YHCertificateListVC.swift
...ce(服务中心)/MyCertificates(我的证书)/C/YHCertificateListVC.swift
+32
-8
YHCertificateSearchViewController.swift
...tificates(我的证书)/C/YHCertificateSearchViewController.swift
+2
-0
YHCertificateUploadContentListVC.swift
...rtificates(我的证书)/C/YHCertificateUploadContentListVC.swift
+4
-0
YHCertificateUploadSheetView.swift
...MyCertificates(我的证书)/V/YHCertificateUploadSheetView.swift
+31
-7
YHCertificateViewModel.swift
...务中心)/MyCertificates(我的证书)/VM/YHCertificateViewModel.swift
+4
-4
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/C/YHCertificateListVC.swift
View file @
a808934c
...
...
@@ -229,7 +229,7 @@ extension YHCertificateListVC {
}
}
func
uploadImage
(
_
img
:
UIImage
,
supplementInfo
:
YHSupplementInfo
)
{
func
uploadImage
(
_
img
:
UIImage
,
supplementInfo
:
YHSupplementInfo
,
successBlock
:(()
->
())?
)
{
// 先OSS上传得到URL
YHHUD
.
show
(
.
progress
(
message
:
"上传中..."
))
...
...
@@ -251,7 +251,11 @@ extension YHCertificateListVC {
model
.
url
=
url
model
.
suffix
=
suffix
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
model
,
operation
:
"add"
,
rename
:
""
)
{
success
in
self
.
requestList
(
status
:
self
.
status
)
if
success
{
successBlock
?()
}
}
return
}
...
...
@@ -264,7 +268,7 @@ extension YHCertificateListVC {
}
}
func
uploadFile
(
_
fileUrl
:
URL
,
supplementInfo
:
YHSupplementInfo
)
{
func
uploadFile
(
_
fileUrl
:
URL
,
supplementInfo
:
YHSupplementInfo
,
successBlock
:(()
->
())?)
{
if
let
fileData
=
try
?
Data
(
contentsOf
:
fileUrl
)
{
// 将文件数据上传到服务器
let
size
=
String
(
format
:
"%.2fM"
,
Double
(
fileData
.
count
)
/
(
1024.0
*
1024.0
))
...
...
@@ -283,7 +287,11 @@ extension YHCertificateListVC {
model
.
url
=
successUrl
model
.
suffix
=
suffixName
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
model
,
operation
:
"add"
,
rename
:
""
)
{
success
in
self
.
requestList
(
status
:
self
.
status
)
if
success
{
successBlock
?()
}
}
return
}
...
...
@@ -299,10 +307,8 @@ extension YHCertificateListVC {
}
}
func
showUploadSheetView
(
_
supplementInfo
:
YHSupplementInfo
?)
{
guard
let
supplementInfo
=
supplementInfo
else
{
return
}
func
showUploadSheetView
(
_
supplementInfo
:
YHSupplementInfo
)
{
let
sheetView
=
YHCertificateUploadSheetView
.
sheetView
()
sheetView
.
templateInfo
=
supplementInfo
.
templateInfo
sheetView
.
clickTemplateBlock
=
{
...
...
@@ -317,12 +323,30 @@ extension YHCertificateListVC {
[
weak
self
]
fileUrl
in
guard
let
self
=
self
else
{
return
}
print
(
fileUrl
)
uploadFile
(
fileUrl
,
supplementInfo
:
supplementInfo
)
uploadFile
(
fileUrl
,
supplementInfo
:
supplementInfo
)
{
// 非待上传的进入详情
DispatchQueue
.
main
.
async
{
let
vc
=
YHCertificateUploadContentListVC
()
vc
.
orderId
=
self
.
orderId
vc
.
categoryInfo
=
self
.
categoryInfo
vc
.
supplementInfo
=
supplementInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
sheetView
.
uploadImageBlock
=
{
[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
uploadImage
(
image
,
supplementInfo
:
supplementInfo
)
uploadImage
(
image
,
supplementInfo
:
supplementInfo
)
{
// 非待上传的进入详情
DispatchQueue
.
main
.
async
{
let
vc
=
YHCertificateUploadContentListVC
()
vc
.
orderId
=
self
.
orderId
vc
.
categoryInfo
=
self
.
categoryInfo
vc
.
supplementInfo
=
supplementInfo
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
sheetView
.
show
()
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/C/YHCertificateSearchViewController.swift
View file @
a808934c
...
...
@@ -267,6 +267,7 @@ extension YHCertificateSearchViewController {
model
.
url
=
url
model
.
suffix
=
suffix
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
model
,
operation
:
"add"
,
rename
:
""
)
{
success
in
self
.
requestList
(
keyWord
:
self
.
searchBar
.
textField
.
text
)
}
return
...
...
@@ -299,6 +300,7 @@ extension YHCertificateSearchViewController {
model
.
url
=
successUrl
model
.
suffix
=
suffixName
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
model
,
operation
:
"add"
,
rename
:
""
)
{
success
in
self
.
requestList
(
keyWord
:
self
.
searchBar
.
textField
.
text
)
}
return
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/C/YHCertificateUploadContentListVC.swift
View file @
a808934c
...
...
@@ -103,6 +103,7 @@ class YHCertificateUploadContentListVC: YHBaseViewController {
if
let
selectEditItem
=
selectEditItem
,
var
text
=
text
{
text
=
text
+
"."
+
selectEditItem
.
getFileSuffixName
()
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
selectEditItem
,
operation
:
"rename"
,
rename
:
text
)
{
success
in
self
.
requestList
()
}
}
...
...
@@ -225,6 +226,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
YHTwoOptionAlertView
.
showAlertView
(
message
:
msg
)
{
sure
in
if
!
sure
{
return
}
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
self
.
supplementInfo
.
id
,
urlModel
:
contentItem
,
operation
:
"del"
,
rename
:
""
)
{
success
in
self
.
requestList
()
}
}
...
...
@@ -522,6 +524,7 @@ extension YHCertificateUploadContentListVC {
model
.
url
=
url
model
.
suffix
=
suffix
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
model
,
operation
:
"add"
,
rename
:
""
)
{
success
in
self
.
requestList
()
}
return
...
...
@@ -554,6 +557,7 @@ extension YHCertificateUploadContentListVC {
model
.
url
=
successUrl
model
.
suffix
=
suffixName
self
.
viewModel
.
updateCertificateItem
(
supplementId
:
supplementInfo
.
id
,
urlModel
:
model
,
operation
:
"add"
,
rename
:
""
)
{
success
in
self
.
requestList
()
}
return
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/V/YHCertificateUploadSheetView.swift
View file @
a808934c
...
...
@@ -363,7 +363,7 @@ extension YHCertificateUploadSheetView: UITableViewDelegate, UITableViewDataSour
extension
YHCertificateUploadSheetView
:
(
UIImagePickerControllerDelegate
&
UINavigationControllerDelegate
)
{
private
func
getPhotoLibraryAuthorization
(
)
->
Bool
{
private
func
getPhotoLibraryAuthorization
(
notDeterminedBlock
:
(()
->
())?)
->
Bool
?
{
let
authorizationStatus
=
PHPhotoLibrary
.
authorizationStatus
()
switch
authorizationStatus
{
case
.
authorized
:
...
...
@@ -372,7 +372,11 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
case
.
notDetermined
:
print
(
"不确定是否授权"
)
// 请求授权
PHPhotoLibrary
.
requestAuthorization
({
(
status
)
in
})
PHPhotoLibrary
.
requestAuthorization
{
status
in
notDeterminedBlock
?()
}
return
nil
case
.
denied
:
print
(
"拒绝授权"
)
case
.
restricted
:
...
...
@@ -386,11 +390,20 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
}
func
takePhoto
()
{
guard
getPhotoLibraryAuthorization
()
else
{
YHHUD
.
flash
(
message
:
"请打开相册权限"
)
guard
let
authorization
=
getPhotoLibraryAuthorization
(
notDeterminedBlock
:
{
DispatchQueue
.
main
.
async
{
self
.
takePhoto
()
}
})
else
{
return
}
if
!
authorization
{
YHHUD
.
flash
(
message
:
"请在设置中打开相册权限"
)
return
}
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
camera
){
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
camera
){
//创建图片控制器
let
imagePicker
=
UIImagePickerController
()
//设置代理
...
...
@@ -407,10 +420,21 @@ extension YHCertificateUploadSheetView: (UIImagePickerControllerDelegate & UINav
}
func
selectPhoto
()
{
guard
getPhotoLibraryAuthorization
()
else
{
YHHUD
.
flash
(
message
:
"请打开相册权限"
)
guard
let
authorization
=
getPhotoLibraryAuthorization
(
notDeterminedBlock
:
{
DispatchQueue
.
main
.
async
{
self
.
selectPhoto
()
}
})
else
{
return
}
if
!
authorization
{
YHHUD
.
flash
(
message
:
"请在设置中打开相册权限"
)
return
}
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
photoLibrary
){
let
imagePicker
=
UIImagePickerController
()
imagePicker
.
delegate
=
self
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/VM/YHCertificateViewModel.swift
View file @
a808934c
...
...
@@ -208,7 +208,7 @@ class YHCertificateViewModel: YHBaseViewModel {
// 更改证件
// operation参数必填,必须是:add(上传)、del(删除)、rename(重命名)
func
updateCertificateItem
(
supplementId
:
Int
,
urlModel
:
YHContentUrl
,
operation
:
String
,
rename
:
String
,
callBack
:(()
->
())?)
{
func
updateCertificateItem
(
supplementId
:
Int
,
urlModel
:
YHContentUrl
,
operation
:
String
,
rename
:
String
,
callBack
:((
Bool
)
->
())?)
{
var
name
=
urlModel
.
name
if
operation
==
"rename"
{
...
...
@@ -243,7 +243,7 @@ class YHCertificateViewModel: YHBaseViewModel {
}
YHHUD
.
flash
(
message
:
msg
)
}
callBack
?()
callBack
?(
success
)
return
}
...
...
@@ -258,7 +258,7 @@ class YHCertificateViewModel: YHBaseViewModel {
}
YHHUD
.
flash
(
message
:
msg
)
}
callBack
?()
callBack
?(
success
)
return
}
...
...
@@ -273,7 +273,7 @@ class YHCertificateViewModel: YHBaseViewModel {
YHHUD
.
flash
(
message
:
msg
)
YHCertificateUploadFailTipsView
.
tipsView
()
.
show
()
}
callBack
?()
callBack
?(
success
)
return
}
}
...
...
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