mirror of https://github.com/halo-dev/halo-admin
Support attachment update method.
parent
76af6ed35e
commit
a5ee519382
|
@ -27,6 +27,14 @@ attachmentApi.delete = attachmentId => {
|
|||
})
|
||||
}
|
||||
|
||||
attachmentApi.update = (attachmentId, attachment) => {
|
||||
return service({
|
||||
url: `${baseUrl}/${attachmentId}`,
|
||||
method: 'put',
|
||||
data: attachment
|
||||
})
|
||||
}
|
||||
|
||||
attachmentApi.CancelToken = axios.CancelToken
|
||||
attachmentApi.isCancel = axios.isCancel
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
|
||||
<a-col
|
||||
class="attachment-item"
|
||||
v-for="attachment in attachments"
|
||||
|
@ -130,7 +131,7 @@ export default {
|
|||
this.queryParam.page = this.pagination.page - 1
|
||||
this.queryParam.size = this.pagination.size
|
||||
this.queryParam.sort = this.pagination.sort
|
||||
if(isSearch){
|
||||
if (isSearch) {
|
||||
this.queryParam.page = 0
|
||||
}
|
||||
attachmentApi.query(this.queryParam).then(response => {
|
||||
|
|
|
@ -7,50 +7,27 @@
|
|||
destroyOnClose
|
||||
@close="onClose"
|
||||
>
|
||||
<a-row
|
||||
type="flex"
|
||||
align="middle"
|
||||
>
|
||||
<a-row type="flex" align="middle">
|
||||
<a-col :span="24">
|
||||
<a-skeleton
|
||||
active
|
||||
:loading="detailLoading"
|
||||
:paragraph="{rows: 8}"
|
||||
>
|
||||
<a-skeleton active :loading="detailLoading" :paragraph="{rows: 8}">
|
||||
<div class="attach-detail-img">
|
||||
<img :src="attachment.path">
|
||||
</div>
|
||||
</a-skeleton>
|
||||
</a-col>
|
||||
<a-divider />
|
||||
<a-divider/>
|
||||
<a-col :span="24">
|
||||
<a-skeleton
|
||||
active
|
||||
:loading="detailLoading"
|
||||
:paragraph="{rows: 8}"
|
||||
>
|
||||
<a-skeleton active :loading="detailLoading" :paragraph="{rows: 8}">
|
||||
<a-list itemLayout="horizontal">
|
||||
<a-list-item>
|
||||
<a-list-item-meta>
|
||||
<template
|
||||
slot="description"
|
||||
v-if="editable"
|
||||
>
|
||||
<a-input
|
||||
v-model="attachment.name"
|
||||
@blur="updateAttachment"
|
||||
/>
|
||||
<template slot="description" v-if="editable">
|
||||
<a-input v-model="attachment.name" @blur="updateAttachment"/>
|
||||
</template>
|
||||
<template
|
||||
slot="description"
|
||||
v-else
|
||||
>{{ attachment.name }}</template>
|
||||
<template slot="description" v-else>{{ attachment.name }}</template>
|
||||
<span slot="title">
|
||||
附件名:
|
||||
<a-icon
|
||||
type="edit"
|
||||
@click="handleEditName"
|
||||
/>
|
||||
<a-icon type="edit" @click="handleEditName"/>
|
||||
</span>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
|
@ -78,10 +55,7 @@
|
|||
<a-list-item-meta :description="attachment.path">
|
||||
<span slot="title">
|
||||
普通链接:
|
||||
<a-icon
|
||||
type="copy"
|
||||
@click="doCopyNormalLink"
|
||||
/>
|
||||
<a-icon type="copy" @click="doCopyNormalLink"/>
|
||||
</span>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
|
@ -90,10 +64,7 @@
|
|||
<span slot="description">![{{ attachment.name }}]({{ attachment.path }})</span>
|
||||
<span slot="title">
|
||||
Markdown 格式:
|
||||
<a-icon
|
||||
type="copy"
|
||||
@click="doCopyMarkdownLink"
|
||||
/>
|
||||
<a-icon type="copy" @click="doCopyMarkdownLink"/>
|
||||
</span>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
|
@ -102,12 +73,7 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
<div class="attachment-control">
|
||||
<a-popconfirm
|
||||
title="你确定要删除该附件?"
|
||||
@confirm="deleteAttachment"
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a-popconfirm title="你确定要删除该附件?" @confirm="deleteAttachment" okText="确定" cancelText="取消">
|
||||
<a-button type="danger">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
|
@ -172,7 +138,10 @@ export default {
|
|||
this.editable = !this.editable
|
||||
},
|
||||
updateAttachment() {
|
||||
this.$message.success('修改')
|
||||
attachmentApi.update(this.attachment.id, this.attachment).then(response => {
|
||||
this.$log.debug('Updated attachment', response.data.data)
|
||||
this.$message.success('附件修改成功')
|
||||
})
|
||||
this.editable = false
|
||||
},
|
||||
doCopyNormalLink() {
|
||||
|
|
Loading…
Reference in New Issue