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
441e6bcd
Commit
441e6bcd
authored
Aug 14, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 原则批
parent
289d2ce3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
16 deletions
+83
-16
YHBaseViewModel.swift
galaxy/galaxy/Classes/Base/C/YHBaseViewModel.swift
+57
-0
YHPrincipleUploadListVC.swift
...rvice/PrincipleBatch(原则批)/C/YHPrincipleUploadListVC.swift
+13
-8
YHPrincipleEnvelopeCell.swift
...rvice/PrincipleBatch(原则批)/V/YHPrincipleEnvelopeCell.swift
+7
-2
YHPrincipleProfileListCell.swift
...ce/PrincipleBatch(原则批)/V/YHPrincipleProfileListCell.swift
+6
-6
No files found.
galaxy/galaxy/Classes/Base/C/YHBaseViewModel.swift
View file @
441e6bcd
...
@@ -146,4 +146,61 @@ class YHBaseViewModel {
...
@@ -146,4 +146,61 @@ class YHBaseViewModel {
})
})
}
}
}
}
// 验证url是否可直接访问
func
checkUrlIsDirectAccess
(
_
url
:
String
,
callback
:((
Bool
)
->
())?)
{
let
task
=
URLSession
.
shared
.
dataTask
(
with
:
URL
(
string
:
url
)
!
)
{
(
data
,
response
,
error
)
in
if
error
!=
nil
{
// url 不可用
callback
?(
false
)
return
}
guard
let
httpResponse
=
response
as?
HTTPURLResponse
else
{
// url 不可用
callback
?(
false
)
return
}
if
httpResponse
.
statusCode
==
200
{
// url可用
callback
?(
true
)
}
else
{
// url 不可用
callback
?(
false
)
}
}
task
.
resume
()
}
// 传入的url无论是公链还是私链 最后返回一个可用链(私转公失败会返回空)
func
getRealUsefulUrl
(
_
url
:
String
,
callback
:((
String
)
->
())?)
{
// 判断url是否可以直接访问
self
.
checkUrlIsDirectAccess
(
url
)
{
isAccess
in
if
isAccess
{
// url能直接访问
DispatchQueue
.
main
.
async
{
callback
?(
url
)
}
return
}
// url不能直接访问
// 进行私链转公链处理
self
.
getPublicImageUrl
(
url
)
{
success
,
error
in
if
let
successUrl
=
success
{
DispatchQueue
.
main
.
async
{
callback
?(
successUrl
)
}
}
else
{
// 私链转公链失败
DispatchQueue
.
main
.
async
{
callback
?(
""
)
}
}
}
}
}
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/C/YHPrincipleUploadListVC.swift
View file @
441e6bcd
...
@@ -326,10 +326,12 @@ extension YHPrincipleUploadListVC {
...
@@ -326,10 +326,12 @@ extension YHPrincipleUploadListVC {
}
else
if
editType
==
.
preview
{
// 预览
}
else
if
editType
==
.
preview
{
// 预览
print
(
model
.
url
)
print
(
model
.
url
)
let
fileUrl
=
!
model
.
url
.
isEmpty
?
model
.
url
:
model
.
fileUrl
let
fileUrl
=
!
model
.
url
.
isEmpty
?
model
.
url
:
model
.
fileUrl
self
.
viewModel
.
getPublicImageUrl
(
fileUrl
)
{
success
,
error
in
YHHUD
.
show
(
.
progress
(
message
:
"加载中..."
))
if
let
success
=
success
{
self
.
viewModel
.
getRealUsefulUrl
(
fileUrl
)
{
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
success
,
fileName
:
model
.
name
)
[
weak
self
]
resultUrl
in
}
YHHUD
.
hide
()
guard
let
self
=
self
else
{
return
}
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
resultUrl
,
fileName
:
model
.
name
)
}
}
}
}
}
.
show
()
}
.
show
()
...
@@ -403,15 +405,18 @@ extension YHPrincipleUploadListVC: UITableViewDelegate, UITableViewDataSource {
...
@@ -403,15 +405,18 @@ extension YHPrincipleUploadListVC: UITableViewDelegate, UITableViewDataSource {
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
showFileOperationAlertView
(
index
,
itemModel
:
model
)
self
.
showFileOperationAlertView
(
index
,
itemModel
:
model
)
}
}
// 点击文件直接预览
cell
.
fileClickBlock
=
{
cell
.
fileClickBlock
=
{
[
weak
self
]
fileModel
,
index
in
[
weak
self
]
fileModel
,
index
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
// 直接点击文件所在行进行预览
// 直接点击文件所在行进行预览
let
fileUrl
=
!
fileModel
.
url
.
isEmpty
?
fileModel
.
url
:
fileModel
.
fileUrl
let
fileUrl
=
!
fileModel
.
url
.
isEmpty
?
fileModel
.
url
:
fileModel
.
fileUrl
self
.
viewModel
.
getPublicImageUrl
(
fileUrl
)
{
success
,
error
in
YHHUD
.
show
(
.
progress
(
message
:
"加载中..."
))
if
let
success
=
success
{
self
.
viewModel
.
getRealUsefulUrl
(
fileUrl
)
{
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
success
,
fileName
:
model
.
name
)
[
weak
self
]
resultUrl
in
}
YHHUD
.
hide
()
guard
let
self
=
self
else
{
return
}
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
resultUrl
,
fileName
:
model
.
name
)
}
}
}
}
// 上传文件点击
// 上传文件点击
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/V/YHPrincipleEnvelopeCell.swift
View file @
441e6bcd
...
@@ -89,8 +89,13 @@ class YHPrincipleEnvelopeCell: UITableViewCell {
...
@@ -89,8 +89,13 @@ class YHPrincipleEnvelopeCell: UITableViewCell {
@objc
func
didWatchClicked
()
{
@objc
func
didWatchClicked
()
{
guard
let
model
=
itemModel
else
{
return
}
guard
let
model
=
itemModel
else
{
return
}
if
!
model
.
url
.
isEmpty
{
if
!
model
.
url
.
isEmpty
{
YHHUD
.
show
(
.
progress
(
message
:
"加载中..."
))
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
model
.
url
,
fileName
:
model
.
name
)
self
.
viewModel
.
getRealUsefulUrl
(
model
.
url
)
{
[
weak
self
]
resultUrl
in
YHHUD
.
hide
()
guard
let
self
=
self
else
{
return
}
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
resultUrl
,
fileName
:
model
.
name
)
}
let
key
=
self
.
getUrlKey
(
model
)
let
key
=
self
.
getUrlKey
(
model
)
UserDefaults
.
standard
.
set
(
true
,
forKey
:
key
)
UserDefaults
.
standard
.
set
(
true
,
forKey
:
key
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/V/YHPrincipleProfileListCell.swift
View file @
441e6bcd
...
@@ -208,12 +208,12 @@ class YHPrincipleProfileListCell: UITableViewCell {
...
@@ -208,12 +208,12 @@ class YHPrincipleProfileListCell: UITableViewCell {
itemView
.
updateModel
(
item
)
itemView
.
updateModel
(
item
)
if
model
.
type
==
.
entry
{
if
model
.
type
==
.
entry
{
itemView
.
btnClick
=
{
itemView
.
btnClick
=
{
YHHUD
.
flash
(
message
:
"查看文件"
)
YHHUD
.
show
(
.
progress
(
message
:
"加载中..."
)
)
// 私链转公链
self
.
viewModel
.
getRealUsefulUrl
(
item
.
value
)
{
self
.
viewModel
.
getPublicImageUrl
(
item
.
value
)
{
success
,
error
in
[
weak
self
]
resultUrl
in
if
let
success
=
success
{
YHHUD
.
hide
()
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
success
,
fileName
:
"申请确认通知书"
)
guard
let
self
=
self
else
{
return
}
}
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
resultUrl
,
fileName
:
"申请确认通知书"
)
}
}
}
}
...
...
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