@@ -57,59 +57,42 @@
-
- 回复
-
+ @click="handleReplyClick"
+ @callback="handleReplyCallback"
+ :loading="replyModal.saving"
+ :errored="replyModal.saveErrored"
+ text="回复"
+ loadedText="回复成功"
+ erroredText="回复失败"
+ >
-
-
+
+
-
-
-
-
-
-
- 回复
-
-
-
-
-
-
-
+
+
@@ -123,111 +106,130 @@ export default {
components: { TargetCommentTree },
data() {
return {
- comments: [],
- loading: false,
- selectedComment: {},
- replyComment: {},
- replyCommentVisible: false,
- commentVisible: false,
- pagination: {
- page: 1,
- size: 10,
- sort: null,
- total: 1
+ list: {
+ data: [],
+ loading: false,
+ selected: {},
+ pagination: {
+ page: 1,
+ size: 10,
+ sort: null,
+ total: 1,
+ },
+ queryParam: {
+ page: 0,
+ size: 10,
+ sort: null,
+ keyword: null,
+ },
+ },
+ replyModal: {
+ model: {},
+ visible: false,
+ saving: false,
+ saveErrored: false,
+ rules: {
+ content: [{ required: true, message: '* 内容不能为空', trigger: ['change'] }],
+ },
},
- queryParam: {
- page: 0,
- size: 10,
- sort: null,
- keyword: null
- }
}
},
props: {
visible: {
type: Boolean,
required: false,
- default: false
+ default: false,
},
title: {
type: String,
required: false,
- default: ''
+ default: '',
},
description: {
type: String,
required: false,
- default: ''
+ default: '',
},
target: {
type: String,
required: false,
- default: ''
+ default: '',
},
id: {
type: Number,
required: false,
- default: 0
- }
+ default: 0,
+ },
+ },
+ computed: {
+ replyModalTitle() {
+ return this.list.selected.id ? `回复给:${this.list.selected.author}` : '评论'
+ },
},
methods: {
handleListComments() {
- this.loading = true
- this.queryParam.page = this.pagination.page - 1
- this.queryParam.size = this.pagination.size
- this.queryParam.sort = this.pagination.sort
+ this.list.loading = true
+ this.list.queryParam.page = this.list.pagination.page - 1
+ this.list.queryParam.size = this.list.pagination.size
+ this.list.queryParam.sort = this.list.pagination.sort
commentApi
- .commentTree(this.target, this.id, this.queryParam)
- .then(response => {
- this.comments = response.data.data.content
- this.pagination.total = response.data.data.total
+ .commentTree(this.target, this.id, this.list.queryParam)
+ .then((response) => {
+ this.list.data = response.data.data.content
+ this.list.pagination.total = response.data.data.total
})
.finally(() => {
setTimeout(() => {
- this.loading = false
+ this.list.loading = false
}, 200)
})
},
handlePaginationChange(page, pageSize) {
- this.pagination.page = page
- this.pagination.size = pageSize
+ this.list.pagination.page = page
+ this.list.pagination.size = pageSize
this.handleListComments()
},
handleCommentReply(comment) {
- this.selectedComment = comment
- this.replyCommentVisible = true
- this.replyComment.parentId = comment.id
- this.replyComment.postId = this.id
+ this.list.selected = comment
+ this.replyModal.visible = true
+ this.replyModal.model.parentId = comment.id
+ this.replyModal.model.postId = this.id
+ this.$nextTick(() => {
+ this.$refs.contentInput.focus()
+ })
},
- handleComment() {
- this.replyComment.postId = this.id
- this.commentVisible = true
+ handleReplyClick() {
+ const _this = this
+ _this.$refs.replyCommentForm.validate((valid) => {
+ if (valid) {
+ _this.replyModal.saving = true
+ commentApi
+ .create(_this.target, _this.replyModal.model)
+ .catch(() => {
+ _this.replyModal.saveErrored = true
+ })
+ .finally(() => {
+ setTimeout(() => {
+ _this.replyModal.saving = false
+ }, 400)
+ })
+ }
+ })
},
- handleCreateClick() {
- if (!this.replyComment.content) {
- this.$notification['error']({
- message: '提示',
- description: '评论内容不能为空!'
- })
- return
+ handleReplyCallback() {
+ if (this.replyModal.saveErrored) {
+ this.replyModal.saveErrored = false
+ } else {
+ this.replyModal.model = {}
+ this.list.selected = {}
+ this.replyModal.visible = false
+ this.handleListComments()
}
- commentApi
- .create(this.target, this.replyComment)
- .then(response => {
- this.$message.success('回复成功!')
- this.replyComment = {}
- this.selectedComment = {}
- this.replyCommentVisible = false
- this.commentVisible = false
- })
- .finally(() => {
- this.handleListComments()
- })
},
handleEditStatusClick(comment, status) {
commentApi
.updateStatus(this.target, comment.id, status)
- .then(response => {
+ .then((response) => {
this.$message.success('操作成功!')
})
.finally(() => {
@@ -237,28 +239,24 @@ export default {
handleCommentDelete(comment) {
commentApi
.delete(this.target, comment.id)
- .then(response => {
+ .then((response) => {
this.$message.success('删除成功!')
})
.finally(() => {
this.handleListComments()
})
},
- onReplyClose() {
- this.replyComment = {}
- this.selectedComment = {}
- this.replyCommentVisible = false
- },
- onCommentClose() {
- this.replyComment = {}
- this.commentVisible = false
+ onReplyModalClose() {
+ this.replyModal.model = {}
+ this.list.selected = {}
+ this.replyModal.visible = false
},
onClose() {
- this.comments = []
- this.pagination = {
+ this.list.data = []
+ this.list.pagination = {
page: 1,
size: 10,
- sort: ''
+ sort: '',
}
this.$emit('close', false)
},
@@ -266,7 +264,7 @@ export default {
if (visible) {
this.handleListComments()
}
- }
- }
+ },
+ },
}
diff --git a/src/views/interface/ThemeList.vue b/src/views/interface/ThemeList.vue
index c480559ff..89bad3e8d 100644
--- a/src/views/interface/ThemeList.vue
+++ b/src/views/interface/ThemeList.vue
@@ -5,7 +5,6 @@
>
{
+ this.$refs.sourceContentInput.focus()
+ })
},
handleOpenEditModal(item) {
this.form.model = item
this.form.isPublic = item.type !== 'INTIMATE'
this.form.visible = true
+ this.$nextTick(() => {
+ this.$refs.sourceContentInput.focus()
+ })
},
handleDelete(id) {
journalApi.delete(id).finally(() => {
diff --git a/src/views/system/About.vue b/src/views/system/About.vue
index 963c4a955..ef65bd20c 100644
--- a/src/views/system/About.vue
+++ b/src/views/system/About.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/views/system/SystemOptions.vue b/src/views/system/SystemOptions.vue
index dbdc550d3..2bfbb9d3b 100644
--- a/src/views/system/SystemOptions.vue
+++ b/src/views/system/SystemOptions.vue
@@ -1,5 +1,13 @@
-
+
+
+
+ 切换到{{ advancedOptions?'基础选项':'高级选项' }}
+
+
@@ -149,24 +157,10 @@
-
-
-
-
- {{ advancedOptions?'基础选项':'高级选项' }}
-
-
-
-
-
+
diff --git a/src/views/system/ToolList.vue b/src/views/system/ToolList.vue
index ed429fd01..5fa96f648 100644
--- a/src/views/system/ToolList.vue
+++ b/src/views/system/ToolList.vue
@@ -1,32 +1,31 @@
-
-
-
-
+
+
+
-
-
- 点击进入开发者选项页面
- 进入
-
-
-
-
-
-
- 支持备份全站数据和数据导出,支持下载到本地
-
-
-
-
- 整站备份
-
-
- 数据导出
-
-
- 备份
-
-
-
-
-
-
-
-
- 支持 Hexo/Jekyll 文章导入并解析元数据
- 导入
-
-
-
-
-
-
-
-
-
-
+
+
+ 支持备份全站数据和数据导出,支持下载到本地
+
+
+
+
+ 整站备份
+
+
+ 数据导出
+
+
+ 备份
+
+
+
+
+
+
+
+
+ 支持 Hexo/Jekyll 文章导入并解析元数据
+ 导入
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/developer/DeveloperOptions.vue b/src/views/system/developer/DeveloperOptions.vue
index 5e335be33..55db4e720 100644
--- a/src/views/system/developer/DeveloperOptions.vue
+++ b/src/views/system/developer/DeveloperOptions.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/src/views/system/developer/tabs/OptionsList.vue b/src/views/system/developer/tabs/OptionsList.vue
index 04617e80b..539b8b69f 100644
--- a/src/views/system/developer/tabs/OptionsList.vue
+++ b/src/views/system/developer/tabs/OptionsList.vue
@@ -59,7 +59,7 @@
新增