Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
d0267b07
Commit
d0267b07
authored
Oct 07, 2021
by
linlinjava
Browse files
feat[litemall-admin]: 图片支持缩略图和点击放大
parent
27bf4fae
Changes
4
Hide whitespace changes
Inline
Side-by-side
litemall-admin/src/utils/index.js
View file @
d0267b07
...
...
@@ -35,6 +35,17 @@ export function parseTime(time, cFormat) {
return
time_str
}
// NOTE: 这里的缩略图只用于阿里云存储。
// 开发者可以参考其他云存储的缩略图参数。
export
function
thumbnail
(
src
)
{
return
src
+
'
?x-oss-process=image/resize,m_lfit,h_250,w_250
'
}
export
function
toPreview
(
item
,
url
)
{
item
.
preview
=
[
url
]
return
item
.
preview
}
export
function
formatTime
(
time
,
option
)
{
time
=
+
time
*
1000
const
d
=
new
Date
(
time
)
...
...
litemall-admin/src/views/goods/list.vue
View file @
d0267b07
...
...
@@ -49,7 +49,7 @@
<el-table-column
align=
"center"
property=
"iconUrl"
label=
"图片"
>
<
template
slot-scope=
"scope"
>
<
img
:src=
"
scope.row.picUrl"
width=
"40"
>
<
el-image
:src=
"thumbnail(
scope.row.picUrl
)
"
:preview-src-list=
"toPreview(scope.row, scope.row.picUrl)"
style=
"width: 40px; height: 40px"
/
>
</
template
>
</el-table-column>
...
...
@@ -132,12 +132,15 @@
import
{
listGoods
,
deleteGoods
}
from
'
@/api/goods
'
import
BackToTop
from
'
@/components/BackToTop
'
import
Pagination
from
'
@/components/Pagination
'
// Secondary package based on el-pagination
import
{
thumbnail
,
toPreview
}
from
'
@/utils/index
'
export
default
{
name
:
'
GoodsList
'
,
components
:
{
BackToTop
,
Pagination
},
data
()
{
return
{
thumbnail
,
toPreview
,
list
:
[],
total
:
0
,
listLoading
:
true
,
...
...
litemall-admin/src/views/mall/brand.vue
View file @
d0267b07
...
...
@@ -19,7 +19,7 @@
<el-table-column
align=
"center"
property=
"picUrl"
label=
"品牌商图片"
>
<template
slot-scope=
"scope"
>
<
img
v-if=
"
scope.row.picUrl"
:
src=
"
scope.row.picUrl"
width=
"80"
>
<
el-image
:src=
"thumbnail(
scope.row.picUrl
)
"
:
preview-src-list=
"toPreview(scope.row,
scope.row.picUrl
)
"
style=
"width: 40px; height: 40px"
/
>
</
template
>
</el-table-column>
...
...
@@ -104,12 +104,15 @@ import { listBrand, createBrand, updateBrand, deleteBrand } from '@/api/brand'
import
{
uploadPath
}
from
'
@/api/storage
'
import
{
getToken
}
from
'
@/utils/auth
'
import
Pagination
from
'
@/components/Pagination
'
// Secondary package based on el-pagination
import
{
thumbnail
,
toPreview
}
from
'
@/utils/index
'
export
default
{
name
:
'
Brand
'
,
components
:
{
Pagination
},
data
()
{
return
{
thumbnail
,
toPreview
,
uploadPath
,
list
:
[],
total
:
0
,
...
...
litemall-admin/src/views/promotion/topic.vue
View file @
d0267b07
...
...
@@ -27,7 +27,7 @@
<el-table-column
align=
"center"
property=
"picUrl"
label=
"图片"
>
<template
slot-scope=
"scope"
>
<
img
:src=
"
scope.row.picUrl"
width=
"80"
>
<
el-image
:src=
"thumbnail(
scope.row.picUrl
)
"
:preview-src-list=
"toPreview(scope.row, scope.row.picUrl)"
style=
"width: 40px; height: 40px"
/
>
</
template
>
</el-table-column>
...
...
@@ -95,12 +95,15 @@ import { listTopic, deleteTopic, batchDeleteTopic } from '@/api/topic'
import
BackToTop
from
'
@/components/BackToTop
'
import
Pagination
from
'
@/components/Pagination
'
// Secondary package based on el-pagination
import
_
from
'
lodash
'
import
{
thumbnail
,
toPreview
}
from
'
@/utils/index
'
export
default
{
name
:
'
Topic
'
,
components
:
{
BackToTop
,
Pagination
},
data
()
{
return
{
thumbnail
,
toPreview
,
list
:
[],
total
:
0
,
listLoading
:
true
,
...
...
Write
Preview
Supports
Markdown
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