pull/35/head
ruibaby 2019-07-19 22:26:26 +08:00
parent 1268cafde7
commit cbe48c5481
3 changed files with 76 additions and 13 deletions

View File

@ -290,6 +290,7 @@ export default {
this.photo['takeTime'] = new Date().getTime()
photoApi.create(this.photo).then(response => {
this.$message.success('添加成功!')
this.photo = {}
})
},
onClose() {

View File

@ -92,14 +92,34 @@
@click="handleEditCategory(record)"
>编辑</a>
<a-divider type="vertical" />
<a-dropdown :trigger="['click']">
<a
href="javascript:void(0);"
class="ant-dropdown-link"
>更多</a>
<a-menu slot="overlay">
<a-menu-item key="1">
<a-popconfirm
:title="'你确定要添加【' + record.name + '】到菜单?'"
@confirm="handleCategoryToMenu(record)"
okText="确定"
cancelText="取消"
>
<a href="javascript:void(0);">添加到菜单</a>
</a-popconfirm>
</a-menu-item>
<a-menu-item key="2">
<a-popconfirm
:title="'你确定要删除【' + record.name + '】分类?'"
@confirm="handleDeleteCategory(record.id)"
okText="确定"
cancelText="取消"
>
<a href="javascript:;">删除</a>
<a href="javascript:void(0);">删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</a-card>
@ -111,6 +131,7 @@
<script>
import CategorySelectTree from './components/CategorySelectTree'
import categoryApi from '@/api/category'
import menuApi from '@/api/menu'
const columns = [
{
@ -142,6 +163,7 @@ export default {
formType: 'create',
categories: [],
categoryToCreate: {},
menu: {},
loading: false,
columns
}
@ -198,6 +220,14 @@ export default {
})
}
this.handleAddCategory()
},
handleCategoryToMenu(category) {
this.menu['name'] = category.name
this.menu['url'] = `/categories/${category.slugName}`
menuApi.create(this.menu).then(response => {
this.$message.success('添加到菜单成功!')
this.menu = {}
})
}
}
}

View File

@ -105,7 +105,10 @@
:href="options.blog_url+'/s/'+record.url"
target="_blank"
>
<a-tooltip placement="topLeft" :title="'点击预览 '+text">{{ text }}</a-tooltip>
<a-tooltip
placement="topLeft"
:title="'点击预览 '+text"
>{{ text }}</a-tooltip>
</a>
</span>
<span
@ -161,7 +164,25 @@
>
<a href="javascript:;">删除</a>
</a-popconfirm>
<a-divider type="vertical" />
<a-dropdown :trigger="['click']">
<a
href="javascript:void(0);"
class="ant-dropdown-link"
>更多</a>
<a-menu slot="overlay">
<a-menu-item key="1">
<a-popconfirm
:title="'你确定要添加【' + sheet.title + '】到菜单?'"
@confirm="handleSheetToMenu(sheet)"
okText="确定"
cancelText="取消"
>
<a href="javascript:void(0);">添加到菜单</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</a-tab-pane>
@ -176,6 +197,8 @@
import { mixin, mixinDevice } from '@/utils/mixin.js'
import sheetApi from '@/api/sheet'
import optionApi from '@/api/option'
import menuApi from '@/api/menu'
const internalColumns = [
{
title: '页面名称',
@ -224,7 +247,7 @@ const customColumns = [
},
{
title: '操作',
width: '150px',
width: '180px',
scopedSlots: { customRender: 'action' }
}
]
@ -238,6 +261,7 @@ export default {
internalSheets: [],
sheets: [],
options: [],
menu: {},
keys: ['blog_url']
}
},
@ -284,15 +308,23 @@ export default {
this.$message.success('删除成功!')
this.loadSheets()
})
},
handleSheetToMenu(sheet) {
this.menu['name'] = sheet.title
this.menu['url'] = `/s/${sheet.url}`
menuApi.create(this.menu).then(response => {
this.$message.success('添加到菜单成功!')
this.menu = {}
})
}
}
}
</script>
<style scoped>
a{
a {
text-decoration: none;
}
.sheet-title{
.sheet-title {
max-width: 300px;
display: block;
white-space: nowrap;