mirror of https://github.com/halo-dev/halo
Support attachment query by media type.
parent
d0dfb887d0
commit
bb04664b7e
|
@ -35,6 +35,13 @@ attachmentApi.update = (attachmentId, attachment) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attachmentApi.getMediaTypes = () => {
|
||||||
|
return service({
|
||||||
|
url: `${baseUrl}/mediaTypes`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
attachmentApi.CancelToken = axios.CancelToken
|
attachmentApi.CancelToken = axios.CancelToken
|
||||||
attachmentApi.isCancel = axios.isCancel
|
attachmentApi.isCancel = axios.isCancel
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :md="6" :sm="24">
|
<a-col :md="6" :sm="24">
|
||||||
<a-form-item label="类型">
|
<a-form-item label="类型">
|
||||||
<a-select placeholder="请选择类型">
|
<a-select placeholder="请选择类型" v-model="queryParam.mediaType">
|
||||||
<a-select-option value="image/png">image/png</a-select-option>
|
<a-select-option v-for="(item,index) in mediaTypes" :key="index" :value="item">{{ item }}</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="table-operator">
|
<div class="table-operator">
|
||||||
<a-button type="primary" icon="plus" @click="showUploadModal">上传</a-button>
|
<a-button type="primary" icon="plus" @click="showUploadModal">上传</a-button>
|
||||||
|
<a-button style="margin-left: 8px;" icon="delete">回收站</a-button>
|
||||||
</div>
|
</div>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -104,6 +105,7 @@ export default {
|
||||||
uploadVisible: false,
|
uploadVisible: false,
|
||||||
selectAttachment: {},
|
selectAttachment: {},
|
||||||
attachments: [],
|
attachments: [],
|
||||||
|
mediaTypes: [],
|
||||||
editable: false,
|
editable: false,
|
||||||
pagination: {
|
pagination: {
|
||||||
page: 1,
|
page: 1,
|
||||||
|
@ -114,7 +116,8 @@ export default {
|
||||||
page: 0,
|
page: 0,
|
||||||
size: 18,
|
size: 18,
|
||||||
sort: null,
|
sort: null,
|
||||||
keyword: null
|
keyword: null,
|
||||||
|
mediaType: null
|
||||||
},
|
},
|
||||||
uploadHandler: attachmentApi.upload,
|
uploadHandler: attachmentApi.upload,
|
||||||
drawerVisiable: false
|
drawerVisiable: false
|
||||||
|
@ -122,6 +125,7 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.loadAttachments()
|
this.loadAttachments()
|
||||||
|
this.loadMediaTypes()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadAttachments(isSearch) {
|
loadAttachments(isSearch) {
|
||||||
|
@ -136,6 +140,11 @@ export default {
|
||||||
this.pagination.total = response.data.data.total
|
this.pagination.total = response.data.data.total
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
loadMediaTypes() {
|
||||||
|
attachmentApi.getMediaTypes().then(response => {
|
||||||
|
this.mediaTypes = response.data.data
|
||||||
|
})
|
||||||
|
},
|
||||||
showDetailDrawer(attachment) {
|
showDetailDrawer(attachment) {
|
||||||
this.selectAttachment = attachment
|
this.selectAttachment = attachment
|
||||||
this.drawerVisiable = true
|
this.drawerVisiable = true
|
||||||
|
@ -153,6 +162,7 @@ export default {
|
||||||
},
|
},
|
||||||
handleUploadSuccess() {
|
handleUploadSuccess() {
|
||||||
this.loadAttachments()
|
this.loadAttachments()
|
||||||
|
this.loadMediaTypes()
|
||||||
},
|
},
|
||||||
handlePaginationChange(page, size) {
|
handlePaginationChange(page, size) {
|
||||||
this.$log.debug(`Current: ${page}, PageSize: ${size}`)
|
this.$log.debug(`Current: ${page}, PageSize: ${size}`)
|
||||||
|
@ -162,6 +172,7 @@ export default {
|
||||||
},
|
},
|
||||||
resetParam() {
|
resetParam() {
|
||||||
this.queryParam.keyword = null
|
this.queryParam.keyword = null
|
||||||
|
this.queryParam.mediaType = null
|
||||||
this.loadAttachments()
|
this.loadAttachments()
|
||||||
},
|
},
|
||||||
handleDelete(attachment) {
|
handleDelete(attachment) {
|
||||||
|
|
Loading…
Reference in New Issue