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
250f8732
Commit
250f8732
authored
Aug 09, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
原则批
parent
de28f7d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
149 additions
and
7 deletions
+149
-7
YHPrincipleUploadListVC.swift
...rvice/PrincipleBatch(原则批)/C/YHPrincipleUploadListVC.swift
+61
-0
YHPrincipleUploadModel.swift
...ervice/PrincipleBatch(原则批)/M/YHPrincipleUploadModel.swift
+13
-0
YHPrincipleUploadFileCell.swift
...ice/PrincipleBatch(原则批)/V/YHPrincipleUploadFileCell.swift
+53
-6
YHPrincipleUploadStatusCell.swift
...e/PrincipleBatch(原则批)/V/YHPrincipleUploadStatusCell.swift
+22
-1
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/C/YHPrincipleUploadListVC.swift
View file @
250f8732
...
...
@@ -9,6 +9,7 @@
import
UIKit
import
SmartCodable
import
AttributedString
import
IQKeyboardManagerSwift
class
YHPrincipleUploadListVC
:
YHBaseViewController
{
...
...
@@ -66,6 +67,11 @@ class YHPrincipleUploadListVC: YHBaseViewController {
requestData
()
}
lazy
var
previewFileTool
:
YHFilePreviewTool
=
{
let
tool
=
YHFilePreviewTool
(
targetVC
:
UIViewController
.
current
)
return
tool
}()
func
createUI
()
{
view
.
addSubview
(
bgView
)
view
.
addSubview
(
tableView
)
...
...
@@ -170,6 +176,55 @@ extension YHPrincipleUploadListVC {
@objc
func
didUploadBtnClicked
()
{
}
func
showFileOperationAlertView
(
_
model
:
YHPrincipleContentUrlModel
,
itemModel
:
YHPrincipleAgreementModel
)
{
var
arr
=
[
YHCertificateEditItem
(
type
:
.
rename
,
title
:
"重命名"
),
YHCertificateEditItem
(
type
:
.
preview
,
title
:
"预览"
),
YHCertificateEditItem
(
type
:
.
delete
,
title
:
"删除"
),
YHCertificateEditItem
(
type
:
.
cancel
,
title
:
"取消"
)]
YHCertificateEditSheetView
.
sheetView
(
items
:
arr
)
{
[
weak
self
]
editType
in
guard
let
self
=
self
else
{
return
}
print
(
"editType:
\(
editType
.
rawValue
)
"
)
if
editType
==
.
rename
{
// 重命名
IQKeyboardManager
.
shared
.
enable
=
false
// var name = contentItem.getFileNameWithoutSuffix()
// if name.count > 30 {
// name = name[safe: ..<30]!
// }
// renameInputView.textField.text = name
// renameInputView.textField.becomeFirstResponder()
}
else
if
editType
==
.
delete
{
// 删除
let
msg
=
"您确定要删除文档
\(
model
.
name
)
吗?"
YHTwoOptionAlertView
.
showAlertView
(
message
:
msg
)
{
sure
in
if
!
sure
{
return
}
// 删除
var
targetIndex
:
Int
=
-
1
for
(
index
,
m
)
in
itemModel
.
content_url
.
enumerated
()
{
if
m
.
url
==
model
.
url
{
targetIndex
=
index
break
}
}
itemModel
.
content_url
.
remove
(
at
:
targetIndex
)
self
.
tableView
.
reloadData
()
}
}
else
if
editType
==
.
preview
{
// 预览
print
(
model
.
url
)
self
.
viewModel
.
getPublicImageUrl
(
model
.
url
)
{
success
,
error
in
if
let
success
=
success
{
self
.
previewFileTool
.
openXLSXRemoteFile
(
urlString
:
success
,
fileName
:
model
.
name
)
}
}
}
}
.
show
()
}
}
extension
YHPrincipleUploadListVC
:
UITableViewDelegate
,
UITableViewDataSource
{
...
...
@@ -224,6 +279,12 @@ extension YHPrincipleUploadListVC: UITableViewDelegate, UITableViewDataSource {
model
.
isUnfold
=
isUnfold
self
.
tableView
.
reloadData
()
}
// 文件操作
cell
.
fileEditBlock
=
{
[
weak
self
]
fileModel
in
guard
let
self
=
self
else
{
return
}
self
.
showFileOperationAlertView
(
fileModel
,
itemModel
:
model
)
}
return
cell
}
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/M/YHPrincipleUploadModel.swift
View file @
250f8732
...
...
@@ -66,6 +66,19 @@ class YHPrincipleContentUrlModel: SmartCodable {
var
fileUrl
:
String
=
""
var
updated_at
:
String
=
""
// 获取文件后缀名 eg:123.pdf -> pdf
func
getFileSuffixName
()
->
String
{
let
res1
=
name
.
pathExtension
.
lowercased
()
if
!
res1
.
isEmpty
{
return
res1
}
let
res2
=
url
.
pathExtension
.
lowercased
()
if
!
res2
.
isEmpty
{
return
res2
}
return
""
}
required
init
()
{
}
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/V/YHPrincipleUploadFileCell.swift
View file @
250f8732
...
...
@@ -11,12 +11,20 @@ import UIKit
class
YHPrincipleUploadFileCell
:
UITableViewCell
{
static
let
cellReuseIdentifier
=
"YHPrincipleUploadFileCell"
static
let
height
=
55.0
var
fileModel
=
YHPrincipleContentUrlModel
()
var
iconImgV
:
UIImageView
!
var
titleLabel
:
UILabel
!
var
timeLabel
:
UILabel
!
var
editBtn
:
UIButton
!
var
editBlock
:
((
YHPrincipleContentUrlModel
)
->
())?
var
isShowEditBtn
:
Bool
=
false
{
didSet
{
editBtn
.
isHidden
=
!
isShowEditBtn
}
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
...
...
@@ -27,32 +35,71 @@ class YHPrincipleUploadFileCell: UITableViewCell {
super
.
init
(
coder
:
coder
)
}
@objc
func
didEditBtnClicked
()
{
editBlock
?(
fileModel
)
}
func
updateModel
(
_
model
:
YHPrincipleContentUrlModel
)
{
fileModel
=
model
titleLabel
.
text
=
model
.
name
timeLabel
.
text
=
model
.
updated_at
timeLabel
.
text
=
"上传于"
+
model
.
updated_at
let
suffix
=
model
.
getFileSuffixName
()
var
iconImgName
=
""
if
suffix
==
"jpeg"
{
iconImgName
=
"my_cer_type_jpg"
}
else
if
suffix
==
"jpg"
{
iconImgName
=
"my_cer_type_jpg"
}
else
if
suffix
==
"png"
{
iconImgName
=
"my_cer_type_png"
}
else
if
suffix
==
"pdf"
{
iconImgName
=
"my_cer_type_pdf"
}
else
if
suffix
==
"doc"
||
suffix
==
"docx"
{
iconImgName
=
"my_cer_type_word"
}
else
if
suffix
==
"ppt"
||
suffix
==
"pptx"
{
iconImgName
=
"my_cer_type_ppt"
}
else
if
suffix
==
"bmp"
{
iconImgName
=
"my_cer_type_bmp"
}
else
if
suffix
==
"tiff"
{
iconImgName
=
"my_cer_type_tiff"
}
iconImgV
.
image
=
UIImage
(
named
:
iconImgName
)
}
func
setupUI
()
{
self
.
selectionStyle
=
.
none
iconImgV
=
UIImageView
(
image
:
UIImage
(
named
:
"my_cer_type_pdf"
))
self
.
addSubview
(
iconImgV
)
contentView
.
addSubview
(
iconImgV
)
titleLabel
=
UILabel
()
titleLabel
.
font
=
UIFont
.
PFSC_M
(
ofSize
:
14
)
titleLabel
.
textColor
=
UIColor
.
mainTextColor
titleLabel
.
text
=
"文件名称"
self
.
addSubview
(
titleLabel
)
contentView
.
addSubview
(
titleLabel
)
timeLabel
=
UILabel
()
timeLabel
.
font
=
UIFont
.
PFSC_R
(
ofSize
:
11
)
timeLabel
.
textColor
=
UIColor
.
labelTextColor2
timeLabel
.
text
=
"上传于0000.00.00"
self
.
addSubview
(
timeLabel
)
contentView
.
addSubview
(
timeLabel
)
editBtn
=
UIButton
()
editBtn
.
isHidden
=
true
editBtn
.
setImage
(
UIImage
(
named
:
"my_cer_btn_edit"
),
for
:
.
normal
)
self
.
addSubview
(
editBtn
)
editBtn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
20
,
left
:
20
,
bottom
:
20
,
right
:
20
)
editBtn
.
addTarget
(
self
,
action
:
#selector(
didEditBtnClicked
)
,
for
:
.
touchUpInside
)
contentView
.
addSubview
(
editBtn
)
iconImgV
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
16
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/CustomerService/PrincipleBatch(原则批)/V/YHPrincipleUploadStatusCell.swift
View file @
250f8732
...
...
@@ -8,6 +8,7 @@
import
UIKit
import
AttributedString
import
IQKeyboardManagerSwift
enum
YHPrincipleUploadStatus
:
Int
{
// 审核中
...
...
@@ -29,8 +30,10 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
var
itemModel
:
YHPrincipleAgreementModel
?
var
items
:
[
YHPrincipleContentUrlModel
]
=
[]
var
expandClick
:((
Bool
)
->
())?
var
fileEditBlock
:((
YHPrincipleContentUrlModel
)
->
())?
var
status
:
YHPrincipleUploadStatus
=
.
preUpload
// var status: YHPrincipleUploadStatus = .preUpload
let
viewModel
=
YHPrincleViewModel
()
lazy
var
whiteView
:
UIView
=
{
let
view
=
UIView
()
...
...
@@ -425,10 +428,22 @@ extension YHPrincipleUploadStatusCell: UITableViewDataSource, UITableViewDelegat
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
YHPrincipleUploadFileCell
.
cellReuseIdentifier
,
for
:
indexPath
)
as!
YHPrincipleUploadFileCell
if
0
<=
indexPath
.
row
,
indexPath
.
row
<
items
.
count
{
let
model
:
YHPrincipleContentUrlModel
=
items
[
indexPath
.
row
]
cell
.
updateModel
(
model
)
if
let
itemModel
=
self
.
itemModel
{
cell
.
isShowEditBtn
=
(
itemModel
.
check_status
==
YHPrincipleUploadStatus
.
preUpload
.
rawValue
||
itemModel
.
check_status
==
YHPrincipleUploadStatus
.
rejected
.
rawValue
)
}
else
{
cell
.
isShowEditBtn
=
false
}
cell
.
editBlock
=
{
[
weak
self
]
model
in
guard
let
self
=
self
else
{
return
}
self
.
fileEditBlock
?(
model
)
}
}
return
cell
}
...
...
@@ -457,3 +472,9 @@ extension YHPrincipleUploadStatusCell: UITableViewDataSource, UITableViewDelegat
return
UIView
()
}
}
extension
YHPrincipleUploadStatusCell
{
}
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