mirror of https://github.com/halo-dev/halo
Complete attachment list show
parent
d41b27c3b0
commit
03010a6fad
|
@ -0,0 +1,15 @@
|
||||||
|
import service from '@/utils/service'
|
||||||
|
|
||||||
|
const baseUrl = '/admin/api/attachments'
|
||||||
|
|
||||||
|
const attachmentApi = {}
|
||||||
|
|
||||||
|
attachmentApi.list = pagination => {
|
||||||
|
return service({
|
||||||
|
url: baseUrl,
|
||||||
|
method: 'get',
|
||||||
|
params: pagination
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default attachmentApi
|
|
@ -1,107 +1,77 @@
|
||||||
<template>
|
<template>
|
||||||
<page-view>
|
<page-view>
|
||||||
<a-row :gutter="12" type="flex" align="middle">
|
<a-row
|
||||||
|
:gutter="12"
|
||||||
|
type="flex"
|
||||||
|
align="middle"
|
||||||
|
>
|
||||||
<a-col
|
<a-col
|
||||||
class="attachment-item"
|
class="attachment-item"
|
||||||
|
v-for="attachment in attachments"
|
||||||
|
:key="attachment.id"
|
||||||
:xl="4"
|
:xl="4"
|
||||||
:lg="4"
|
:lg="4"
|
||||||
:md="12"
|
:md="12"
|
||||||
:sm="12"
|
:sm="12"
|
||||||
:xs="24">
|
:xs="24"
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
>
|
||||||
<img :src="src" slot="cover">
|
<a-card
|
||||||
</a-card>
|
:bodyStyle="{ padding: '1rem' , width: '240px' }"
|
||||||
</a-col>
|
hoverable
|
||||||
<a-col
|
>
|
||||||
class="attachment-item"
|
<img
|
||||||
:xl="4"
|
:src="attachment.thumbPath"
|
||||||
:lg="4"
|
:alt="attachment.name"
|
||||||
:md="12"
|
slot="cover"
|
||||||
:sm="12"
|
>
|
||||||
:xs="24">
|
<a-card-meta>
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
<template slot="description">{{ attachment.name }}</template>
|
||||||
<img :src="src" slot="cover">
|
</a-card-meta>
|
||||||
</a-card>
|
|
||||||
</a-col>
|
|
||||||
<a-col
|
|
||||||
class="attachment-item"
|
|
||||||
:xl="4"
|
|
||||||
:lg="4"
|
|
||||||
:md="12"
|
|
||||||
:sm="12"
|
|
||||||
:xs="24">
|
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
|
||||||
<img :src="src" slot="cover">
|
|
||||||
</a-card>
|
|
||||||
</a-col>
|
|
||||||
<a-col
|
|
||||||
class="attachment-item"
|
|
||||||
:xl="4"
|
|
||||||
:lg="4"
|
|
||||||
:md="12"
|
|
||||||
:sm="12"
|
|
||||||
:xs="24">
|
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
|
||||||
<img :src="src" slot="cover">
|
|
||||||
</a-card>
|
|
||||||
</a-col>
|
|
||||||
<a-col
|
|
||||||
class="attachment-item"
|
|
||||||
:xl="4"
|
|
||||||
:lg="4"
|
|
||||||
:md="12"
|
|
||||||
:sm="12"
|
|
||||||
:xs="24">
|
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
|
||||||
<img :src="src" slot="cover">
|
|
||||||
</a-card>
|
|
||||||
</a-col>
|
|
||||||
<a-col
|
|
||||||
class="attachment-item"
|
|
||||||
:xl="4"
|
|
||||||
:lg="4"
|
|
||||||
:md="12"
|
|
||||||
:sm="12"
|
|
||||||
:xs="24">
|
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
|
||||||
<img :src="src" slot="cover">
|
|
||||||
</a-card>
|
|
||||||
</a-col>
|
|
||||||
<a-col
|
|
||||||
class="attachment-item"
|
|
||||||
:xl="4"
|
|
||||||
:lg="4"
|
|
||||||
:md="12"
|
|
||||||
:sm="12"
|
|
||||||
:xs="24">
|
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
|
||||||
<img :src="src" slot="cover">
|
|
||||||
</a-card>
|
|
||||||
</a-col>
|
|
||||||
<a-col
|
|
||||||
class="attachment-item"
|
|
||||||
:xl="4"
|
|
||||||
:lg="4"
|
|
||||||
:md="12"
|
|
||||||
:sm="12"
|
|
||||||
:xs="24">
|
|
||||||
<a-card :bodyStyle="{ padding: '14px' }">
|
|
||||||
<img :src="src" slot="cover">
|
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
<a-row
|
||||||
|
type="flex"
|
||||||
|
justify="end"
|
||||||
|
:gutter="12"
|
||||||
|
>
|
||||||
|
<a-pagination
|
||||||
|
v-model="pagination.page"
|
||||||
|
:defaultPageSize="pagination.size"
|
||||||
|
:total="pagination.total"
|
||||||
|
></a-pagination>
|
||||||
|
</a-row>
|
||||||
</page-view>
|
</page-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { PageView } from '@/layouts'
|
import { PageView } from '@/layouts'
|
||||||
|
import attachmentApi from '@/api/attachment'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
PageView
|
PageView
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
src: 'https://cdn.ryanc.cc/img/blog/thumbnails/c86b59623c4a9bfeac403824dec3a789.jpg'
|
attachments: [],
|
||||||
|
pagination: {
|
||||||
|
page: 1,
|
||||||
|
size: 16,
|
||||||
|
sort: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.loadAttachments()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadAttachments() {
|
||||||
|
const pagination = Object.assign({}, this.pagination)
|
||||||
|
pagination.page--
|
||||||
|
attachmentApi.list(pagination).then(response => {
|
||||||
|
this.attachments = response.data.data.content
|
||||||
|
this.pagination.total = response.data.data.total
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
publishText() {
|
publishText() {
|
||||||
if (this.postToStage.id) {
|
if (this.postToStage.id) {
|
||||||
return '更新'
|
return '更新并发布'
|
||||||
}
|
}
|
||||||
return '创建并发布'
|
return '创建并发布'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue