Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
yaru
fgqyxxlr
Commits
8dfa1834
Commit
8dfa1834
authored
Jul 11, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表格图片预览支持设置宽高
parent
d01f35de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
+19
-12
ruoyi-admin/src/main/resources/templates/demo/table/image.html
+4
-5
No files found.
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
View file @
8dfa1834
...
...
@@ -154,6 +154,8 @@
$
.
btTable
.
on
(
'click'
,
'.img-circle'
,
function
()
{
var
src
=
$
(
this
).
attr
(
'src'
);
var
target
=
$
(
this
).
data
(
'target'
);
var
height
=
$
(
this
).
data
(
'height'
);
var
width
=
$
(
this
).
data
(
'width'
);
if
(
$
.
common
.
equals
(
"self"
,
target
))
{
layer
.
open
({
title
:
false
,
...
...
@@ -161,7 +163,7 @@
closeBtn
:
true
,
shadeClose
:
true
,
area
:
[
'auto'
,
'auto'
],
content
:
"<img src='"
+
src
+
"' />"
content
:
"<img src='"
+
src
+
"'
height='"
+
height
+
"' width='"
+
width
+
"'
/>"
});
}
else
if
(
$
.
common
.
equals
(
"blank"
,
target
))
{
window
.
open
(
src
);
...
...
@@ -214,12 +216,17 @@
return
actions
.
join
(
''
);
},
// 图片预览
imageView
:
function
(
value
,
path
,
target
)
{
var
_path
=
$
.
common
.
isEmpty
(
path
)
?
'/profile/upload'
:
path
;
imageView
:
function
(
value
,
height
,
width
,
target
)
{
if
(
$
.
common
.
isEmpty
(
width
))
{
width
=
'auto'
;
}
if
(
$
.
common
.
isEmpty
(
height
))
{
height
=
'auto'
;
}
// blank or self
var
_target
=
$
.
common
.
isEmpty
(
target
)
?
'self'
:
target
;
if
(
$
.
common
.
isNotEmpty
(
value
))
{
return
$
.
common
.
sprintf
(
"<img class='img-circle img-xs' data-
target='%s' src='%s/%s'/>"
,
_target
,
_path
,
value
);
return
$
.
common
.
sprintf
(
"<img class='img-circle img-xs' data-
height='%s' data-width='%s' data-target='%s' src='%s'/>"
,
width
,
height
,
_target
,
value
);
}
else
{
return
$
.
common
.
nullToStr
(
value
);
}
...
...
@@ -574,16 +581,16 @@
}
if
(
$
.
common
.
isEmpty
(
title
))
{
title
=
false
;
}
;
}
if
(
$
.
common
.
isEmpty
(
url
))
{
url
=
"/404.html"
;
}
;
}
if
(
$
.
common
.
isEmpty
(
width
))
{
width
=
800
;
}
;
}
if
(
$
.
common
.
isEmpty
(
height
))
{
height
=
(
$
(
window
).
height
()
-
50
);
}
;
}
if
(
$
.
common
.
isEmpty
(
callback
))
{
callback
=
function
(
index
,
layero
)
{
var
iframeWin
=
layero
.
find
(
'iframe'
)[
0
];
...
...
@@ -646,16 +653,16 @@
}
if
(
$
.
common
.
isEmpty
(
title
))
{
title
=
false
;
}
;
}
if
(
$
.
common
.
isEmpty
(
url
))
{
url
=
"/404.html"
;
}
;
}
if
(
$
.
common
.
isEmpty
(
width
))
{
width
=
800
;
}
;
}
if
(
$
.
common
.
isEmpty
(
height
))
{
height
=
(
$
(
window
).
height
()
-
50
);
}
;
}
var
index
=
layer
.
open
({
type
:
2
,
area
:
[
width
+
'px'
,
height
+
'px'
],
...
...
ruoyi-admin/src/main/resources/templates/demo/table/image.html
View file @
8dfa1834
...
...
@@ -40,13 +40,12 @@
{
title
:
'图片'
,
formatter
:
function
(
value
,
row
,
index
)
{
// 图片自由组合
// 'img/profile.jpg' - 'http://ruoyi.vip/' 变成 http://ruoyi.vip/img/profile.jpg
// 'ruoyi.png' - 'http://ruoyi.vip/' 变成 http://ruoyi.vip/ruoyi.jpg
// 图片自由组合(注意:如存储在本地需要带上 '/profile/upload' + 数据库路径)
// 如:/profile/upload/2019/08/08/3b7a839aced67397bac694d77611ce72.png
if
(
index
%
2
==
0
){
return
$
.
table
.
imageView
(
'
img/profile.jpg'
,
'http://demo.ruoyi.vip/
'
);
return
$
.
table
.
imageView
(
'
http://demo.ruoyi.vip/img/profile.jpg
'
);
}
else
{
return
$
.
table
.
imageView
(
'
ruoyi.png'
,
'http://demo.ruoyi.vip/
'
);
return
$
.
table
.
imageView
(
'
http://demo.ruoyi.vip/ruoyi.png
'
);
}
}
},
...
...
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