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" />
|
<a-icon type="message" />
|
||||||
{{ item.commentCount }}
|
{{ item.commentCount }}
|
||||||
</a-button>
|
</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-icon type="lock" />
|
||||||
</a-button>
|
</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-icon type="unlock" />
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -321,6 +327,18 @@ export default {
|
||||||
this.form.model.content = renderContent
|
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() {
|
handleSaveOrUpdate() {
|
||||||
const _this = this
|
const _this = this
|
||||||
_this.$refs.journalForm.validate(valid => {
|
_this.$refs.journalForm.validate(valid => {
|
||||||
|
|
Loading…
Reference in New Issue