Refactor ThemeEdit.vue.

pull/9/head
ruibaby 2019-05-16 17:19:59 +08:00
parent 85f5114499
commit 8cda3bc740
3 changed files with 5 additions and 22 deletions

View File

@ -4,12 +4,7 @@ const baseUrl = '/api/admin'
const commentApi = {} const commentApi = {}
/** commentApi.latestComment = (target, top, status) => {
* Lists comment.
* @param {String} target
* @param {Object} view
*/
function latestComment(target, top, status) {
return service({ return service({
url: `${baseUrl}/${target}/comments/latest`, url: `${baseUrl}/${target}/comments/latest`,
params: { params: {
@ -63,18 +58,6 @@ function createComment(target, comment) {
}) })
} }
// List latest comment
commentApi.latestPostComment = (top, status) => {
return latestComment('posts', top, status)
}
commentApi.latestSheetComment = (top, status) => {
return latestComment('sheets', top, status)
}
commentApi.latestJournalComment = (top, status) => {
return latestComment('journals', top, status)
}
// Creation api // Creation api
commentApi.createPostComment = comment => { commentApi.createPostComment = comment => {

View File

@ -170,15 +170,15 @@ export default {
this.visible = !this.visible this.visible = !this.visible
}, },
getComment() { getComment() {
commentApi.latestPostComment(5, 'AUDITING').then(response => { commentApi.latestComment('posts', 5, 'AUDITING').then(response => {
this.postComments = response.data.data this.postComments = response.data.data
this.loadding = false this.loadding = false
}) })
commentApi.latestSheetComment(5, 'AUDITING').then(response => { commentApi.latestComment('sheets', 5, 'AUDITING').then(response => {
this.sheetComments = response.data.data this.sheetComments = response.data.data
this.loadding = false this.loadding = false
}) })
commentApi.latestJournalComment(5, 'AUDITING').then(response => { commentApi.latestComment('journals', 5, 'AUDITING').then(response => {
this.journalComments = response.data.data this.journalComments = response.data.data
this.loadding = false this.loadding = false
}) })

View File

@ -95,7 +95,7 @@ export default {
this.buttonDisabled = true this.buttonDisabled = true
return return
} }
if (file.name === 'options.yaml' || file.name === 'options.yml') { if (file.name === 'settings.yaml' || file.name === 'settings.yml' || file.name === 'theme.yaml' || file.name === 'theme.yml') {
this.$confirm({ this.$confirm({
title: '警告:请谨慎修改该配置文件', title: '警告:请谨慎修改该配置文件',
content: '修改之后可能会产生不可预料的问题', content: '修改之后可能会产生不可预料的问题',