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
eeb298aa
Commit
eeb298aa
authored
Mar 21, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件预览预研
parent
2d579f64
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
48 deletions
+80
-48
YHMyViewController.swift
...alaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
+80
-48
No files found.
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
View file @
eeb298aa
...
...
@@ -137,6 +137,45 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
logoutSuccess
)
,
name
:
YhConstant
.
YhNotification
.
didLogoutSuccessNotifiction
,
object
:
nil
)
}
func
openXLSXRemoteFile
(
urlString
:
String
)
{
guard
let
url
=
URL
(
string
:
urlString
)
else
{
return
}
let
configuration
=
URLSessionConfiguration
.
default
let
session
=
URLSession
(
configuration
:
configuration
)
let
task
=
session
.
downloadTask
(
with
:
url
)
{
(
tempLocalUrl
,
response
,
error
)
in
if
let
tempLocalUrl
=
tempLocalUrl
,
error
==
nil
{
// 下载完成,尝试打开文件
let
fileManager
=
FileManager
.
default
let
destination
=
URL
(
fileURLWithPath
:
NSTemporaryDirectory
())
.
appendingPathComponent
(
response
?
.
suggestedFilename
??
UUID
()
.
uuidString
)
try
?
fileManager
.
moveItem
(
at
:
tempLocalUrl
,
to
:
destination
)
// 打开文件
self
.
openXLSXFile
(
at
:
destination
)
}
else
{
print
(
"Error downloading the file:
\(
error
?
.
localizedDescription
??
"Unknown error"
)
"
)
}
}
task
.
resume
()
}
func
openXLSXFile
(
at
fileURL
:
URL
)
{
let
controller
=
UIDocumentInteractionController
(
url
:
fileURL
)
controller
.
delegate
=
self
DispatchQueue
.
main
.
async
{
controller
.
presentPreview
(
animated
:
true
)
}
}
}
extension
YHMyViewController
:
UIDocumentInteractionControllerDelegate
{
func
documentInteractionControllerViewControllerForPreview
(
_
controller
:
UIDocumentInteractionController
)
->
UIViewController
{
return
self
}
}
extension
YHMyViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
...
...
@@ -164,65 +203,58 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
let
vc
=
UINavigationController
(
rootVC
:
YHPhoneLoginViewController
())
vc
.
modalPresentationStyle
=
.
custom
self
.
navigationController
?
.
present
(
vc
,
animated
:
true
)
return
}
else
{
YHHUD
.
flash
(
message
:
"已登录: 功能完善中..."
)
}
let
vc
=
YHWebViewViewController
()
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//for test hjl
return
// let url = URL(string: "https://docs.qq.com/openapi/drive/v2/files/embed/temporary?timestamp=1710298232&id=6bcaa379b0e5488abbaff85d51ee2fab&clientID=2aebc2da4f0b4883bf33ef20836f2e2d")!
//
// let tmpVC = SFSafariViewController(url: url)
// navigationController?.pushViewController(tmpVC)
//
//
// return
// if indexPath.row == 0 {
//
//
// let vc = YHWebViewViewController()
// navigationController?.pushViewController(vc, animated: true)
// } else {
// let vc = YHWebViewViewController()
// navigationController?.pushViewController(vc, animated: true)
// }
//
// return
let
item
:
PersonalModuleItem
=
items
[
indexPath
.
row
];
if
item
.
title
==
"关于我们"
{
let
vc
=
YHAboutUsViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
}
else
if
item
.
title
==
"我的设置"
{
// 预览文件预研 杜宇todo
if
item
.
title
==
"我的消息"
{
YHHUD
.
flash
(
message
:
"预览image"
)
self
.
openXLSXRemoteFile
(
urlString
:
"https://upload-cdn.galaxy-immi.com/crm/production/1620280305822.jpg"
)
}
else
if
item
.
title
==
"我的进度"
{
YHHUD
.
flash
(
message
:
"预览pdf"
)
self
.
openXLSXRemoteFile
(
urlString
:
"https://upload-cdn.galaxy-immi.com/crm/production/1620271660487.pdf"
)
}
else
if
item
.
title
==
"积分中心"
{
YHHUD
.
flash
(
message
:
"预览xlsx"
)
self
.
openXLSXRemoteFile
(
urlString
:
"https://test-cdn.galaxy-immi.com/4001001/8979989729091623170120240321152216.xlsx?Expires=1711007546&OSSAccessKeyId=LTAI5tNFvK2xGRrBeJ2z8R2j&Signature=UfM6tRcws5ObN4rp/3ZESEWbM2E%3D&v=1711005746"
)
}
else
if
item
.
title
==
"推荐有理"
{
let
account
=
"duyu"
let
token
=
"123456"
let
vc
=
ConversationController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
IMKitClient
.
instance
.
loginIM
(
account
,
token
)
{
error
in
if
let
err
=
error
{
print
(
"login error in app : "
,
err
.
localizedDescription
)
}
else
{
let
_
=
NEAtMessageManager
.
instance
}
}
}
else
if
item
.
title
==
"我的海报"
{
}
else
if
item
.
title
==
"我的测评码"
{
}
else
{
}
// if item.title == "关于我们" {
// let vc = YHAboutUsViewController()
// self.navigationController?.pushViewController(vc)
//
// } else if item.title == "我的设置" {
//
// let account = "duyu"
// let token = "123456"
// let vc = ConversationController()
// self.navigationController?.pushViewController(vc)
//
// IMKitClient.instance.loginIM(account, token) { error in
// if let err = error {
// print("login error in app : ", err.localizedDescription)
// }else {
// let _ = NEAtMessageManager.instance
//
// }
// }
//
//
//
// } else {
// let vc = YHLoginViewController()
// self.navigationController?.pushViewController(vc)
}
//
}
}
}
...
...
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