Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
Overview
Details
Activity
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
platform
hg-smart
Commits
74a6fdc5
Commit
74a6fdc5
authored
Oct 17, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.文件预览调整为在线预览
parent
b60489f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
17 deletions
+36
-17
HGWD002A1.js
src/main/webapp/HG/WD/HGWD002A1.js
+15
-2
common.js
src/main/webapp/common/js/common.js
+21
-15
No files found.
src/main/webapp/HG/WD/HGWD002A1.js
View file @
74a6fdc5
...
...
@@ -40,7 +40,9 @@ function addRecord(fileId, docId, docType){
function
previewFile
(
docId
,
docType
)
{
// 隐藏文本描述
$
(
"#descDiv"
).
css
(
'display'
,
'none'
);
if
(
isText
(
docType
))
{
if
(
true
)
{
previewOnline
(
docId
,
"xxxxx."
+
docType
);
}
else
if
(
isText
(
docType
))
{
previewText
(
docId
);
}
else
if
(
isXml
(
docType
))
{
previewXml
(
docId
);
...
...
@@ -265,6 +267,17 @@ function previewFrame(docId) {
}
/**
* 在线预览
*
* @param docId
* @param fileName
*/
function
previewOnline
(
docId
,
fileName
)
{
$
(
"#previewFrame"
).
css
(
'display'
,
''
);
$
(
"#previewFrame"
).
attr
(
"src"
,
CommonUtils
.
previewFile
(
docId
,
fileName
));
}
/**
* 监听iframe
*/
function
iframeLoad
()
{
...
...
@@ -330,7 +343,7 @@ let realImage = null;
let
bigImage
=
null
;
window
.
onload
=
function
()
{
// 监听iframe
iframeLoad
();
//
iframeLoad();
imageOuterDiv
=
document
.
querySelector
(
"#imageOuterDiv"
);
realImage
=
document
.
querySelector
(
"#image"
);
bigImage
=
document
.
querySelector
(
"#bigImage"
);
...
...
src/main/webapp/common/js/common.js
View file @
74a6fdc5
...
...
@@ -109,21 +109,6 @@ function downloadHref(docId, isPreview) {
}
/**
* 预览
*
* @param 文件类型,例如:jpg/docx/pdf
* @param 文件ID
*/
function
previewDoc
(
fileType
,
docId
)
{
if
(
!
isBlank
(
fileType
)
&&
fileType
.
toLowerCase
()
==
"docx"
)
{
let
url
=
"HGWD098?inqu_status-0-docId="
+
docId
;
window
.
open
(
url
,
'_blank'
);
}
else
{
window
.
open
(
downloadHref
(
docId
,
true
),
'_blank'
);
}
}
/**
* 获取窗口宽度
*
* @returns {number}
...
...
@@ -664,10 +649,31 @@ function loadChange(grid,e,field) {
});
}
/**
* 预览
*
* @param docId 文件ID
* @param fileName 文件名称必须带后缀
*/
function
previewFile
(
docId
,
fileName
)
{
let
hostname
=
window
.
location
.
hostname
;
let
domain
=
hostname
===
"localhost"
?
"http://129.211.46.84:8085"
:
window
.
location
.
origin
;
let
url
=
domain
+
IPLATUI
.
CONTEXT_PATH
+
'/file/download/preview/'
+
docId
+
"?fullfilename="
+
fileName
;
// Base64转码
let
urlEncode
=
encodeURIComponent
(
btoa
(
url
));
if
(
PROJECT_ENV
===
"run"
||
PROJECT_ENV
===
"RUN"
)
{
return
"https://www.eis-paas.com/preview/onlinePreview?url="
+
urlEncode
}
else
{
return
"http://139.224.202.156:8012/preview/onlinePreview?url="
+
urlEncode
;
}
}
// export 到全局作用域 window对象
$
.
extend
(
window
,
{
CommonUtils
:
{
uploadFile
:
uploadFile
,
previewFile
:
previewFile
,
}
});
})(
window
.
jQuery
);
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