parent
ad017f44b5
commit
e0d4039c9d
@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<el-image
|
||||
:src="
|
||||
document.attachment && document.attachment.hash
|
||||
? `/view/cover/${document.attachment.hash}`
|
||||
: ''
|
||||
"
|
||||
:alt="document.title"
|
||||
:style="{ height: height }"
|
||||
>
|
||||
<div slot="error" class="image-slot">
|
||||
<img src="/static/images/default-cover.png" />
|
||||
</div>
|
||||
</el-image>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'DocumentCover',
|
||||
props: {
|
||||
document: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-image {
|
||||
border: 2px solid #efefef;
|
||||
border-radius: 5px;
|
||||
}
|
||||
img {
|
||||
width: 100%;
|
||||
transition: transform 0.3s ease 0s;
|
||||
&:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<div class="com-document-list">
|
||||
<ul>
|
||||
<li v-for="doc in documents" :key="'doc-' + doc.id">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="4" class="doc-cover">
|
||||
<nuxt-link :to="`/document/${doc.id}`">
|
||||
<document-cover :document="doc" />
|
||||
</nuxt-link>
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<h3>
|
||||
<nuxt-link
|
||||
:to="`/document/${doc.id}`"
|
||||
class="el-link el-link--primary"
|
||||
><img
|
||||
:src="`/static/images/${doc.ext}_24.png`"
|
||||
:alt="`${doc.ext} 文档`"
|
||||
/>
|
||||
{{ doc.title }}</nuxt-link
|
||||
>
|
||||
</h3>
|
||||
<div class="doc-info">
|
||||
<el-rate
|
||||
v-model="doc.score"
|
||||
disabled
|
||||
show-score
|
||||
text-color="#ff9900"
|
||||
score-template="{value}"
|
||||
>
|
||||
</el-rate>
|
||||
<span class="float-right">
|
||||
{{ doc.price || 0 }} 魔豆 <span class="line">|</span>
|
||||
{{ doc.pages || '-' }} 页 <span class="line">|</span>
|
||||
{{ formatBytes(doc.size) || '-' }}
|
||||
<span class="hidden-xs-only"
|
||||
><span class="line">|</span>
|
||||
{{ formatDatetime(doc.created_at) }}</span
|
||||
></span
|
||||
>
|
||||
</div>
|
||||
<div class="doc-desc">
|
||||
{{ doc.description }}
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import DocumentCover from './DocumentCover.vue'
|
||||
import { formatBytes, formatDatetime } from '~/utils/utils'
|
||||
export default {
|
||||
name: 'DocumentList',
|
||||
components: { DocumentCover },
|
||||
props: {
|
||||
documents: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
formatBytes,
|
||||
formatDatetime,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.com-document-list {
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
li {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 18px;
|
||||
border-bottom: 1px dashed #ddd;
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
a {
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
img {
|
||||
height: 18px;
|
||||
position: relative;
|
||||
top: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.doc-cover {
|
||||
.el-image {
|
||||
width: 100%;
|
||||
border: 3px solid #efefef;
|
||||
border-radius: 5px;
|
||||
&:hover img {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
.doc-info {
|
||||
margin: 10px 0;
|
||||
font-size: 13px;
|
||||
color: #888;
|
||||
.line {
|
||||
color: #ddd;
|
||||
margin: 0 5px;
|
||||
}
|
||||
}
|
||||
.doc-desc {
|
||||
font-size: 15px;
|
||||
color: #888;
|
||||
line-height: 180%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
max-height: 81px;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue