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.CancelToken = axios.CancelToken
|
||||||
attachmentApi.isCancel = axios.isCancel
|
attachmentApi.isCancel = axios.isCancel
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col
|
<a-col
|
||||||
class="attachment-item"
|
class="attachment-item"
|
||||||
v-for="attachment in attachments"
|
v-for="attachment in attachments"
|
||||||
|
@ -130,7 +131,7 @@ export default {
|
||||||
this.queryParam.page = this.pagination.page - 1
|
this.queryParam.page = this.pagination.page - 1
|
||||||
this.queryParam.size = this.pagination.size
|
this.queryParam.size = this.pagination.size
|
||||||
this.queryParam.sort = this.pagination.sort
|
this.queryParam.sort = this.pagination.sort
|
||||||
if(isSearch){
|
if (isSearch) {
|
||||||
this.queryParam.page = 0
|
this.queryParam.page = 0
|
||||||
}
|
}
|
||||||
attachmentApi.query(this.queryParam).then(response => {
|
attachmentApi.query(this.queryParam).then(response => {
|
||||||
|
|
|
@ -7,50 +7,27 @@
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
@close="onClose"
|
@close="onClose"
|
||||||
>
|
>
|
||||||
<a-row
|
<a-row type="flex" align="middle">
|
||||||
type="flex"
|
|
||||||
align="middle"
|
|
||||||
>
|
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-skeleton
|
<a-skeleton active :loading="detailLoading" :paragraph="{rows: 8}">
|
||||||
active
|
|
||||||
:loading="detailLoading"
|
|
||||||
:paragraph="{rows: 8}"
|
|
||||||
>
|
|
||||||
<div class="attach-detail-img">
|
<div class="attach-detail-img">
|
||||||
<img :src="attachment.path">
|
<img :src="attachment.path">
|
||||||
</div>
|
</div>
|
||||||
</a-skeleton>
|
</a-skeleton>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-divider />
|
<a-divider/>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-skeleton
|
<a-skeleton active :loading="detailLoading" :paragraph="{rows: 8}">
|
||||||
active
|
|
||||||
:loading="detailLoading"
|
|
||||||
:paragraph="{rows: 8}"
|
|
||||||
>
|
|
||||||
<a-list itemLayout="horizontal">
|
<a-list itemLayout="horizontal">
|
||||||
<a-list-item>
|
<a-list-item>
|
||||||
<a-list-item-meta>
|
<a-list-item-meta>
|
||||||
<template
|
<template slot="description" v-if="editable">
|
||||||
slot="description"
|
<a-input v-model="attachment.name" @blur="updateAttachment"/>
|
||||||
v-if="editable"
|
|
||||||
>
|
|
||||||
<a-input
|
|
||||||
v-model="attachment.name"
|
|
||||||
@blur="updateAttachment"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template slot="description" v-else>{{ attachment.name }}</template>
|
||||||
slot="description"
|
|
||||||
v-else
|
|
||||||
>{{ attachment.name }}</template>
|
|
||||||
<span slot="title">
|
<span slot="title">
|
||||||
附件名:
|
附件名:
|
||||||
<a-icon
|
<a-icon type="edit" @click="handleEditName"/>
|
||||||
type="edit"
|
|
||||||
@click="handleEditName"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
@ -78,10 +55,7 @@
|
||||||
<a-list-item-meta :description="attachment.path">
|
<a-list-item-meta :description="attachment.path">
|
||||||
<span slot="title">
|
<span slot="title">
|
||||||
普通链接:
|
普通链接:
|
||||||
<a-icon
|
<a-icon type="copy" @click="doCopyNormalLink"/>
|
||||||
type="copy"
|
|
||||||
@click="doCopyNormalLink"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
@ -90,10 +64,7 @@
|
||||||
<span slot="description">![{{ attachment.name }}]({{ attachment.path }})</span>
|
<span slot="description">![{{ attachment.name }}]({{ attachment.path }})</span>
|
||||||
<span slot="title">
|
<span slot="title">
|
||||||
Markdown 格式:
|
Markdown 格式:
|
||||||
<a-icon
|
<a-icon type="copy" @click="doCopyMarkdownLink"/>
|
||||||
type="copy"
|
|
||||||
@click="doCopyMarkdownLink"
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
@ -102,12 +73,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<div class="attachment-control">
|
<div class="attachment-control">
|
||||||
<a-popconfirm
|
<a-popconfirm title="你确定要删除该附件?" @confirm="deleteAttachment" okText="确定" cancelText="取消">
|
||||||
title="你确定要删除该附件?"
|
|
||||||
@confirm="deleteAttachment"
|
|
||||||
okText="确定"
|
|
||||||
cancelText="取消"
|
|
||||||
>
|
|
||||||
<a-button type="danger">删除</a-button>
|
<a-button type="danger">删除</a-button>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</div>
|
</div>
|
||||||
|
@ -172,7 +138,10 @@ export default {
|
||||||
this.editable = !this.editable
|
this.editable = !this.editable
|
||||||
},
|
},
|
||||||
updateAttachment() {
|
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
|
this.editable = false
|
||||||
},
|
},
|
||||||
doCopyNormalLink() {
|
doCopyNormalLink() {
|
||||||
|
|
Loading…
Reference in New Issue