mirror of https://github.com/halo-dev/halo-admin
feat: add buttons that update journal type directly (#610)
parent
3bdecc30dd
commit
1b225858bb
|
@ -49,10 +49,16 @@
|
|||
<a-icon type="message" />
|
||||
{{ item.commentCount }}
|
||||
</a-button>
|
||||
<a-button v-if="item.type === 'INTIMATE'" class="!p-0" disabled type="link">
|
||||
<a-button
|
||||
v-if="item.type === 'INTIMATE'"
|
||||
class="!p-0"
|
||||
type="link"
|
||||
@click="handleJournalTypeUpdate(item)"
|
||||
style="color: grey"
|
||||
>
|
||||
<a-icon type="lock" />
|
||||
</a-button>
|
||||
<a-button v-else class="!p-0" type="link">
|
||||
<a-button v-else class="!p-0" type="link" @click="handleJournalTypeUpdate(item)">
|
||||
<a-icon type="unlock" />
|
||||
</a-button>
|
||||
</template>
|
||||
|
@ -321,6 +327,18 @@ export default {
|
|||
this.form.model.content = renderContent
|
||||
},
|
||||
|
||||
handleJournalTypeUpdate(item) {
|
||||
this.form.model = deepClone(item)
|
||||
this.form.model.type = item.type === 'PUBLIC' ? 'INTIMATE' : 'PUBLIC'
|
||||
apiClient.journal
|
||||
.update(this.form.model.id, this.form.model)
|
||||
.catch(e => {
|
||||
this.$log.error(e)
|
||||
})
|
||||
.finally(() => {
|
||||
this.handleListJournals()
|
||||
})
|
||||
},
|
||||
handleSaveOrUpdate() {
|
||||
const _this = this
|
||||
_this.$refs.journalForm.validate(valid => {
|
||||
|
|
Loading…
Reference in New Issue