mirror of https://github.com/halo-dev/halo-admin
feat: support markdown for journal.
parent
bd682745bc
commit
75b5ea43ce
|
@ -874,4 +874,11 @@ body {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.journal-list-content,
|
||||||
|
.comment-drawer-content {
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,10 @@
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-list itemLayout="horizontal">
|
<a-list itemLayout="horizontal">
|
||||||
<a-list-item>
|
<a-list-item>
|
||||||
<a-list-item-meta :description="description">
|
<a-list-item-meta>
|
||||||
|
<template slot="description">
|
||||||
|
<p v-html="description" class="comment-drawer-content"></p>
|
||||||
|
</template>
|
||||||
<h3 slot="title">{{ title }}</h3>
|
<h3 slot="title">{{ title }}</h3>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
|
|
|
@ -203,7 +203,7 @@
|
||||||
<a-input
|
<a-input
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:autosize="{ minRows: 8 }"
|
:autosize="{ minRows: 8 }"
|
||||||
v-model="journal.content"
|
v-model="journal.sourceContent"
|
||||||
placeholder="写点什么吧..."
|
placeholder="写点什么吧..."
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
@ -446,7 +446,7 @@ export default {
|
||||||
this.$router.push({ name: 'PostEdit', query: { postId: post.id } })
|
this.$router.push({ name: 'PostEdit', query: { postId: post.id } })
|
||||||
},
|
},
|
||||||
handleCreateJournalClick() {
|
handleCreateJournalClick() {
|
||||||
if (!this.journal.content) {
|
if (!this.journal.sourceContent) {
|
||||||
this.$notification['error']({
|
this.$notification['error']({
|
||||||
message: '提示',
|
message: '提示',
|
||||||
description: '内容不能为空!'
|
description: '内容不能为空!'
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
:sm="24"
|
:sm="24"
|
||||||
>
|
>
|
||||||
<a-form-item label="关键词">
|
<a-form-item label="关键词">
|
||||||
<a-input v-model="queryParam.keyword" @keyup.enter="handleQuery()"/>
|
<a-input
|
||||||
|
v-model="queryParam.keyword"
|
||||||
|
@keyup.enter="handleQuery()"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col
|
<a-col
|
||||||
|
@ -121,7 +124,10 @@
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<a-list-item-meta :description="item.content">
|
<a-list-item-meta>
|
||||||
|
<template slot="description">
|
||||||
|
<p v-html="item.content" class="journal-list-content"></p>
|
||||||
|
</template>
|
||||||
<span slot="title">{{ item.createTime | moment }}</span>
|
<span slot="title">{{ item.createTime | moment }}</span>
|
||||||
<a-avatar
|
<a-avatar
|
||||||
slot="avatar"
|
slot="avatar"
|
||||||
|
@ -160,6 +166,10 @@
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<template slot="footer">
|
<template slot="footer">
|
||||||
|
<a-button
|
||||||
|
type="dashed"
|
||||||
|
@click="()=>this.attachmentDrawerVisible = true"
|
||||||
|
>附件库</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
key="submit"
|
key="submit"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -171,7 +181,7 @@
|
||||||
<a-input
|
<a-input
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:autosize="{ minRows: 8 }"
|
:autosize="{ minRows: 8 }"
|
||||||
v-model="journal.content"
|
v-model="journal.sourceContent"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
|
@ -185,49 +195,29 @@
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<!-- 评论回复弹窗 -->
|
|
||||||
<a-modal
|
|
||||||
v-if="selectComment"
|
|
||||||
:title="'回复给:'+selectComment.author"
|
|
||||||
v-model="selectCommentVisible"
|
|
||||||
>
|
|
||||||
<template slot="footer">
|
|
||||||
<a-button
|
|
||||||
key="submit"
|
|
||||||
type="primary"
|
|
||||||
@click="handleReplyComment"
|
|
||||||
>回复</a-button>
|
|
||||||
</template>
|
|
||||||
<a-form layout="vertical">
|
|
||||||
<a-form-item>
|
|
||||||
<a-input
|
|
||||||
type="textarea"
|
|
||||||
:autosize="{ minRows: 8 }"
|
|
||||||
v-model="replyComment.content"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</a-modal>
|
|
||||||
<TargetCommentDrawer
|
<TargetCommentDrawer
|
||||||
:visible="journalCommentVisible"
|
:visible="journalCommentVisible"
|
||||||
:title="journal.content"
|
:title="journal.title"
|
||||||
:description="``"
|
:description="journal.content"
|
||||||
:target="`journals`"
|
:target="`journals`"
|
||||||
:id="journal.id"
|
:id="journal.id"
|
||||||
@close="onJournalCommentsClose"
|
@close="onJournalCommentsClose"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AttachmentDrawer v-model="attachmentDrawerVisible" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TargetCommentDrawer from '../../comment/components/TargetCommentDrawer'
|
import TargetCommentDrawer from '../../comment/components/TargetCommentDrawer'
|
||||||
|
import AttachmentDrawer from '../../attachment/components/AttachmentDrawer'
|
||||||
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import journalApi from '@/api/journal'
|
import journalApi from '@/api/journal'
|
||||||
import journalCommentApi from '@/api/journalComment'
|
import journalCommentApi from '@/api/journalComment'
|
||||||
export default {
|
export default {
|
||||||
mixins: [mixin, mixinDevice],
|
mixins: [mixin, mixinDevice],
|
||||||
components: { TargetCommentDrawer },
|
components: { TargetCommentDrawer, AttachmentDrawer },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
journalType: journalApi.journalType,
|
journalType: journalApi.journalType,
|
||||||
|
@ -235,7 +225,7 @@ export default {
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
visible: false,
|
visible: false,
|
||||||
journalCommentVisible: false,
|
journalCommentVisible: false,
|
||||||
selectCommentVisible: false,
|
attachmentDrawerVisible: false,
|
||||||
pagination: {
|
pagination: {
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
|
@ -252,7 +242,6 @@ export default {
|
||||||
comments: [],
|
comments: [],
|
||||||
journal: {},
|
journal: {},
|
||||||
isPublic: true,
|
isPublic: true,
|
||||||
selectComment: null,
|
|
||||||
replyComment: {}
|
replyComment: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -298,21 +287,6 @@ export default {
|
||||||
this.journal = journal
|
this.journal = journal
|
||||||
this.journalCommentVisible = true
|
this.journalCommentVisible = true
|
||||||
},
|
},
|
||||||
handleCommentReplyClick(comment) {
|
|
||||||
this.selectComment = comment
|
|
||||||
this.selectCommentVisible = true
|
|
||||||
this.replyComment.parentId = comment.id
|
|
||||||
this.replyComment.postId = this.journal.id
|
|
||||||
},
|
|
||||||
handleReplyComment() {
|
|
||||||
journalCommentApi.create(this.replyComment).then(response => {
|
|
||||||
this.$message.success('回复成功!')
|
|
||||||
this.replyComment = {}
|
|
||||||
this.selectComment = {}
|
|
||||||
this.selectCommentVisible = false
|
|
||||||
this.handleCommentShow(this.journal)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleCommentDelete(comment) {
|
handleCommentDelete(comment) {
|
||||||
journalCommentApi.delete(comment.id).then(response => {
|
journalCommentApi.delete(comment.id).then(response => {
|
||||||
this.$message.success('删除成功!')
|
this.$message.success('删除成功!')
|
||||||
|
@ -322,7 +296,7 @@ export default {
|
||||||
createOrUpdateJournal() {
|
createOrUpdateJournal() {
|
||||||
this.journal.type = this.isPublic ? 'PUBLIC' : 'INTIMATE'
|
this.journal.type = this.isPublic ? 'PUBLIC' : 'INTIMATE'
|
||||||
|
|
||||||
if (!this.journal.content) {
|
if (!this.journal.sourceContent) {
|
||||||
this.$notification['error']({
|
this.$notification['error']({
|
||||||
message: '提示',
|
message: '提示',
|
||||||
description: '发布内容不能为空!'
|
description: '发布内容不能为空!'
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
@click="handleBackupClick"
|
@click="handleBackupClick"
|
||||||
>备份</a-button>
|
>备份</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
type="dash"
|
type="dashed"
|
||||||
icon="reload"
|
icon="reload"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@click="handleBAckupRefreshClick"
|
@click="handleBAckupRefreshClick"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
style="margin-right: 8px;"
|
style="margin-right: 8px;"
|
||||||
@click="()=>this.loadLogs()"
|
@click="()=>this.loadLogs()"
|
||||||
>刷新</a-button>
|
>刷新</a-button>
|
||||||
<a-button type="dash" @click="handleDownloadLogFile()">下载</a-button>
|
<a-button type="dashed" @click="handleDownloadLogFile()">下载</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue