mirror of https://github.com/halo-dev/halo
Refactor AttachmentList.
parent
7d444f1cfb
commit
0749ffa696
|
@ -715,26 +715,45 @@ body {
|
||||||
|
|
||||||
.attach-item {
|
.attach-item {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
padding-bottom: 28%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attach-thumb {
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 56%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attach-item,
|
||||||
|
.attach-thumb {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-bottom: 28%;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
float: left;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
img {
|
img,
|
||||||
|
span {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: flex;
|
||||||
|
font-size: 12px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #9b9ea0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card-container {
|
.analysis-card-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.meta {
|
.meta {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -742,6 +761,7 @@ body {
|
||||||
color: rgba(0, 0, 0, 0.45);
|
color: rgba(0, 0, 0, 0.45);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
|
|
||||||
.analysis-card-action {
|
.analysis-card-action {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -749,6 +769,7 @@ body {
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.number {
|
.number {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<a-col
|
<a-col
|
||||||
:span="24"
|
:span="24"
|
||||||
class="search-box"
|
class="search-box"
|
||||||
|
style="padding-bottom: 12px;"
|
||||||
>
|
>
|
||||||
<a-card
|
<a-card
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
|
@ -76,7 +77,7 @@
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-operator">
|
<div class="table-operator" style="margin-bottom: 0;">
|
||||||
<a-button
|
<a-button
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="plus"
|
icon="plus"
|
||||||
|
@ -108,7 +109,7 @@
|
||||||
v-show="handleJudgeMediaType(item)"
|
v-show="handleJudgeMediaType(item)"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<a-card-meta>
|
<a-card-meta style="padding: 0.8rem;">
|
||||||
<ellipsis
|
<ellipsis
|
||||||
:length="isMobile()?12:16"
|
:length="isMobile()?12:16"
|
||||||
tooltip
|
tooltip
|
||||||
|
@ -277,49 +278,4 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
.ant-divider-horizontal {
|
|
||||||
margin: 24px 0 12px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-box {
|
|
||||||
padding-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attach-thumb {
|
|
||||||
width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
position: relative;
|
|
||||||
padding-bottom: 56%;
|
|
||||||
overflow: hidden;
|
|
||||||
img,
|
|
||||||
span {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
display: flex;
|
|
||||||
font-size: 12px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #9b9ea0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-card-meta {
|
|
||||||
padding: 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attach-detail-img img {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-operator {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -19,11 +19,13 @@
|
||||||
>
|
>
|
||||||
<div class="attach-detail-img">
|
<div class="attach-detail-img">
|
||||||
<div v-show="nonsupportPreviewVisible">此文件不支持预览</div>
|
<div v-show="nonsupportPreviewVisible">此文件不支持预览</div>
|
||||||
<img
|
<a :href="attachment.path" target="_blank">
|
||||||
:src="attachment.path"
|
<img
|
||||||
v-show="photoPreviewVisible"
|
:src="attachment.path"
|
||||||
style="width: 100%;"
|
v-show="photoPreviewVisible"
|
||||||
>
|
style="width: 100%;"
|
||||||
|
>
|
||||||
|
</a>
|
||||||
<video-player
|
<video-player
|
||||||
class="video-player-box"
|
class="video-player-box"
|
||||||
v-show="videoPreviewVisible"
|
v-show="videoPreviewVisible"
|
||||||
|
|
|
@ -36,7 +36,11 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="handleShowDetailDrawer(item)"
|
@click="handleShowDetailDrawer(item)"
|
||||||
>
|
>
|
||||||
<img :src="item.thumbPath">
|
<span v-show="!handleJudgeMediaType(item)">当前格式不支持预览</span>
|
||||||
|
<img
|
||||||
|
:src="item.thumbPath"
|
||||||
|
v-show="handleJudgeMediaType(item)"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-skeleton>
|
</a-skeleton>
|
||||||
|
@ -184,6 +188,23 @@ export default {
|
||||||
handleDelete() {
|
handleDelete() {
|
||||||
this.loadAttachments()
|
this.loadAttachments()
|
||||||
},
|
},
|
||||||
|
handleJudgeMediaType(attachment) {
|
||||||
|
var mediaType = attachment.mediaType
|
||||||
|
// 判断文件类型
|
||||||
|
if (mediaType) {
|
||||||
|
var prefix = mediaType.split('/')[0]
|
||||||
|
|
||||||
|
if (prefix === 'image') {
|
||||||
|
// 是图片
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
// 非图片
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 没有获取到文件返回false
|
||||||
|
return false
|
||||||
|
},
|
||||||
onClose() {
|
onClose() {
|
||||||
this.$emit('close', false)
|
this.$emit('close', false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue