Delete useless code line.

pull/3445/head
ruibaby 2019-04-20 00:26:01 +08:00
parent 0f06588987
commit 828c8ad624
4 changed files with 24 additions and 119 deletions

View File

@ -1,7 +1,7 @@
<template>
<a-drawer
title="附件详情"
:width="isMobile()?'100%':'560'"
:width="isMobile()?'100%':'460'"
closable
:visible="visiable"
destroyOnClose
@ -86,7 +86,8 @@
</a-list-item-meta>
</a-list-item>
<a-list-item>
<a-list-item-meta :description="'!['+attachment.name+']('+attachment.path+')'">
<a-list-item-meta>
<span slot="description">![{{ attachment.name }}]({{ attachment.path }})</span>
<span slot="title">
Markdown 格式
<a-icon
@ -196,4 +197,15 @@ export default {
.attach-detail-img img {
width: 100%;
}
.attachment-control {
position: absolute;
bottom: 0px;
width: 100%;
border-top: 1px solid rgb(232, 232, 232);
padding: 10px 16px;
text-align: right;
left: 0px;
background: rgb(255, 255, 255);
border-radius: 0px 0px 4px 4px;
}
</style>

View File

@ -158,7 +158,6 @@ export default {
</script>
<style>
.post-control,
.attachment-control {
position: absolute;
bottom: 0px;

View File

@ -70,18 +70,19 @@
</a-drawer>
</a-col>
</a-row>
<AttachmentDrawer v-model="attachmentDrawerVisible"/>
<footer-tool-bar
:style="{ width: isSideMenu() && isDesktop() ? `calc(100% - ${sidebarOpened ? 256 : 80}px)` : '100%'}"
>
<a-button type="primary" @click="showDrawer"></a-button>
<a-button type="dashed" style="margin-left: 8px;">附件库</a-button>
<a-button type="dashed" style="margin-left: 8px;" @click="showAttachDrawer"></a-button>
</footer-tool-bar>
</div>
</template>
<script>
import { mavonEditor } from 'mavon-editor'
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
import FooterToolBar from '@/components/FooterToolbar'
import { mixin, mixinDevice } from '@/utils/mixin.js'
import 'mavon-editor/dist/css/index.css'
@ -92,7 +93,8 @@ export default {
name: 'Editor',
components: {
mavonEditor,
FooterToolBar
FooterToolBar,
AttachmentDrawer
},
mixins: [mixin, mixinDevice],
data() {
@ -102,6 +104,7 @@ export default {
sm: { span: 24 },
xs: { span: 24 }
},
attachmentDrawerVisible: false,
visible: false,
postUrl: 'hello-world',
customTpls: [],
@ -140,6 +143,9 @@ export default {
this.customTpls = response.data.data
})
},
showAttachDrawer() {
this.attachmentDrawerVisible = true
},
showDrawer() {
this.visible = true
},

View File

@ -166,7 +166,6 @@ import 'mavon-editor/dist/css/index.css'
import tagApi from '@/api/tag'
import categoryApi from '@/api/category'
import postApi from '@/api/post'
import attachmentApi from '@/api/attachment'
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
const toolbars = {
@ -206,8 +205,6 @@ export default {
xs: { span: 24 }
},
attachmentDrawerVisible: false,
selectAttachmentDrawerVisible: false,
uploadVisible: false,
visible: false,
childDrawerVisible: false,
tags: [],
@ -215,16 +212,7 @@ export default {
selectedCategoryIds: [],
selectedTagIds: [],
markdownOption: toolbars,
postToStage: {},
attachments: [],
selectAttachment: {},
detailLoading: false,
pagination: {
page: 1,
size: 8,
sort: ''
},
attachmentUploadHandler: attachmentApi.upload
postToStage: {}
}
},
computed: {
@ -265,14 +253,6 @@ export default {
this.categories = response.data.data
})
},
loadAttachments() {
const pagination = Object.assign({}, this.pagination)
pagination.page--
attachmentApi.query(pagination).then(response => {
this.attachments = response.data.data.content
this.pagination.total = response.data.data.total
})
},
createOrUpdatePost() {
// Set category ids
this.postToStage.categoryIds = this.selectedCategoryIds
@ -299,15 +279,6 @@ export default {
},
showAttachDrawer() {
this.attachmentDrawerVisible = true
this.loadAttachments()
},
showDetailDrawer(attachment) {
this.selectAttachmentDrawerVisible = true
this.detailLoading = true
this.selectAttachment = attachment
setTimeout(() => {
this.detailLoading = false
}, 500)
},
showThumbDrawer() {
this.childDrawerVisible = true
@ -325,55 +296,6 @@ export default {
},
onChildClose() {
this.childDrawerVisible = false
},
onAttachmentClose() {
this.attachmentDrawerVisible = false
},
onSelectAttachmentClose() {
this.selectAttachmentDrawerVisible = false
},
doCopyNormalLink() {
const text = `${this.selectAttachment.path}`
this.$copyText(text)
.then(message => {
console.log('copy', message)
this.$message.success('复制成功')
})
.catch(err => {
console.log('copy.err', err)
this.$message.error('复制失败')
})
},
doCopyMarkdownLink() {
const text = `![${this.selectAttachment.name}](${this.selectAttachment.path})`
this.$copyText(text)
.then(message => {
console.log('copy', message)
this.$message.success('复制成功')
})
.catch(err => {
console.log('copy.err', err)
this.$message.error('复制失败')
})
},
handlePaginationChange(page, pageSize) {
this.pagination.page = page
this.pagination.size = pageSize
this.loadAttachments()
},
handleChange(info) {
const status = info.file.status
if (status === 'done') {
this.$message.success(`${info.file.name} 文件上传成功`)
} else if (status === 'error') {
this.$message.error(`${info.file.name} 文件上传失败`)
}
},
handleAttachmentUploadSuccess() {
this.$message.success('上传成功')
},
showUploadModal() {
this.uploadVisible = true
}
}
}
@ -389,19 +311,6 @@ export default {
padding-bottom: 0;
}
.post-control,
.attachment-control {
position: absolute;
bottom: 0px;
width: 100%;
border-top: 1px solid rgb(232, 232, 232);
padding: 10px 16px;
text-align: right;
left: 0px;
background: rgb(255, 255, 255);
border-radius: 0px 0px 4px 4px;
}
.ant-form-vertical .ant-form-item {
padding-bottom: 0;
}
@ -410,25 +319,4 @@ export default {
width: 100%;
cursor: pointer;
}
.attach-item {
width: 50%;
margin: 0 auto;
position: relative;
padding-bottom: 28%;
overflow: hidden;
float: left;
}
.attach-item > img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.attach-detail-img img {
width: 100%;
}
</style>