Fixed some error.

pull/9/head
ruibaby 2019-05-01 23:21:02 +08:00
parent c41caba1c0
commit 134858be01
6 changed files with 127 additions and 37 deletions

View File

@ -19,6 +19,20 @@ commentApi.query = params => {
})
}
commentApi.updateStatus = (commentId, status) => {
return service({
url: `${baseUrl}/${commentId}/status/${status}`,
method: 'put'
})
}
commentApi.delete = commentId => {
return service({
url: `${baseUrl}/${commentId}`,
method: 'delete'
})
}
commentApi.commentStatus = {
PUBLISHED: {
color: 'green',

View File

@ -1,7 +1,7 @@
<template>
<div>
<a-drawer
title="选择附件"
:title="title"
:width="isMobile()?'100%':drawerWidth"
closable
:visible="visiable"
@ -99,6 +99,11 @@ export default {
type: Number,
required: false,
default: 580
},
title: {
type: String,
required: false,
default: '选择附件'
}
},
data() {

View File

@ -91,17 +91,38 @@
slot="action"
slot-scope="text, record"
>
<a-popconfirm
:title="'你确定要通过该评论?'"
@confirm="handleEditStatusClick(record.id,'RECYCLE')"
okText="确定"
cancelText="取消"
<a-dropdown
:trigger="['click']"
v-if="record.status === 'AUDITING'"
>
<a href="javascript:;">通过</a>
</a-popconfirm>
<a
href="javascript:void(0);"
class="ant-dropdown-link"
>通过</a>
<a-menu
slot="overlay"
@click="handleMenuClick"
>
<a-menu-item key="1">通过该评论</a-menu-item>
<a-menu-item key="2">回复并通过</a-menu-item>
</a-menu>
</a-dropdown>
<a href="javascript:;" v-if="record.status === 'PUBLISHED'"></a>
<a
href="javascript:;"
v-else-if="record.status === 'PUBLISHED'"
>回复</a>
<a-popconfirm
:title="'你确定要还原该评论?'"
@confirm="handleEditStatusClick(record.id,'PUBLISHED')"
okText="确定"
cancelText="取消"
v-else-if="record.status === 'RECYCLE'"
>
<a href="javascript:;">还原</a>
</a-popconfirm>
<a-divider type="vertical" />
@ -117,7 +138,7 @@
<a-popconfirm
:title="'你确定要永久删除该评论?'"
@confirm="handleDeleteComment(record.id)"
@confirm="handleDeleteClick(record.id)"
okText="确定"
cancelText="取消"
v-else-if="record.status === 'RECYCLE'"
@ -234,8 +255,17 @@ export default {
handleEditComment(id) {
this.$message.success('编辑')
},
handleDeleteComment(id) {
this.$message.success('删除')
handleEditStatusClick(commentId, status) {
commentApi.updateStatus(commentId, status).then(response => {
this.$message.success('操作成功!')
this.loadComments()
})
},
handleDeleteClick(commentId) {
commentApi.delete(commentId).then(response => {
this.$message.success('删除成功!')
this.loadComments()
})
},
handlePaginationChange(page, pageSize) {
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)

View File

@ -215,7 +215,7 @@
<AttachmentDrawer v-model="attachmentDrawerVisible" />
</a-drawer>
<div class="upload-button">
<a-dropdown placement="topLeft" :trigger="['hover','click']">
<a-dropdown placement="topLeft" :trigger="['click']">
<a-button
type="primary"
shape="circle"
@ -359,11 +359,6 @@ export default {
this.$message.success('保存成功!')
})
},
getThemeProperty(themeId) {
themeApi.getProperty(themeId).then(response => {
this.themeProperty = response.data.data
})
},
onClose() {
this.visible = false
this.optionLoading = false

View File

@ -25,13 +25,29 @@
label="LOGO"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_logo" />
<a-input v-model="options.blog_logo">
<a
href="javascript:void(0);"
slot="addonAfter"
@click="handleShowLogoAttachDrawer"
>
<a-icon type="picture" />
</a>
</a-input>
</a-form-item>
<a-form-item
label="Favicon"
:wrapper-col="wrapperCol"
>
<a-input v-model="options.blog_favicon" />
<a-input v-model="options.blog_favicon">
<a
href="javascript:void(0);"
slot="addonAfter"
@click="handleShowFaviconAttachDrawer"
>
<a-icon type="picture" />
</a>
</a-input>
</a-form-item>
<a-form-item
label="页脚信息:"
@ -161,9 +177,7 @@
label="评论者头像:"
:wrapper-col="wrapperCol"
>
<a-select
v-model="options.comment_gavatar_default"
>
<a-select v-model="options.comment_gavatar_default">
<a-select-option value="mm">默认</a-select-option>
<a-select-option value="identicon">抽象几何图形</a-select-option>
<a-select-option value="monsterid">小怪物</a-select-option>
@ -249,11 +263,11 @@
@change="handleAttachChange"
v-model="options.attachment_type"
>
<a-select-option value="local">本地</a-select-option>
<a-select-option value="smms">SM.MS</a-select-option>
<a-select-option value="upyun">又拍云</a-select-option>
<a-select-option value="qnyun">七牛云</a-select-option>
<a-select-option value="aliyun">阿里云</a-select-option>
<a-select-option
v-for="item in Object.keys(attachmentType)"
:key="item"
:value="item"
>{{ attachmentType[item].text }}</a-select-option>
</a-select>
</a-form-item>
<div
@ -314,9 +328,7 @@
label="区域:"
:wrapper-col="wrapperCol"
>
<a-select
v-model="options.oss_qiniu_zone"
>
<a-select v-model="options.oss_qiniu_zone">
<a-select-option value="auto">自动选择</a-select-option>
<a-select-option value="z0">华东</a-select-option>
<a-select-option value="z1">华北</a-select-option>
@ -543,13 +555,30 @@
</div>
</a-col>
</a-row>
<AttachmentSelectDrawer
v-model="logoDrawerVisible"
@listenToSelect="handleSelectLogo"
title="选择 Logo"
/>
<AttachmentSelectDrawer
v-model="faviconDrawerVisible"
@listenToSelect="handleSelectFavicon"
title="选择 Favicon"
/>
</div>
</template>
<script>
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
import optionApi from '@/api/option'
import attachmentApi from '@/api/attachment'
export default {
components: {
AttachmentSelectDrawer
},
data() {
return {
attachmentType: attachmentApi.type,
wrapperCol: {
xl: { span: 8 },
lg: { span: 8 },
@ -559,6 +588,8 @@ export default {
upyunFormHidden: false,
qnyunFormHidden: false,
aliyunFormHidden: false,
logoDrawerVisible: false,
faviconDrawerVisible: false,
options: []
}
},
@ -580,28 +611,42 @@ export default {
},
handleAttachChange(e) {
switch (e) {
case 'local':
case 'smms':
case 'LOCAL':
case 'SMMS':
this.upyunFormHidden = false
this.qnyunFormHidden = false
this.aliyunFormHidden = false
break
case 'upyun':
case 'UPYUN':
this.upyunFormHidden = true
this.qnyunFormHidden = false
this.aliyunFormHidden = false
break
case 'qnyun':
case 'QNYUN':
this.qnyunFormHidden = true
this.upyunFormHidden = false
this.aliyunFormHidden = false
break
case 'aliyun':
case 'ALIYUN':
this.aliyunFormHidden = true
this.qnyunFormHidden = false
this.upyunFormHidden = false
break
}
},
handleShowLogoAttachDrawer() {
this.logoDrawerVisible = true
},
handleSelectLogo(data) {
this.options.blog_logo = data.path
this.logoDrawerVisible = false
},
handleShowFaviconAttachDrawer() {
this.faviconDrawerVisible = true
},
handleSelectFavicon(data) {
this.options.blog_favicon = data.path
this.faviconDrawerVisible = false
}
}
}

View File

@ -144,6 +144,7 @@
<AttachmentSelectDrawer
v-model="attachmentDrawerVisible"
@listenToSelect="handleSelectAvatar"
title="选择头像"
/>
</div>
</template>