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() this.photo['takeTime'] = new Date().getTime()
photoApi.create(this.photo).then(response => { photoApi.create(this.photo).then(response => {
this.$message.success('添加成功!') this.$message.success('添加成功!')
this.photo = {}
}) })
}, },
onClose() { onClose() {

View File

@ -92,14 +92,34 @@
@click="handleEditCategory(record)" @click="handleEditCategory(record)"
>编辑</a> >编辑</a>
<a-divider type="vertical" /> <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 <a-popconfirm
:title="'你确定要删除【' + record.name + '】分类?'" :title="'你确定要删除【' + record.name + '】分类?'"
@confirm="handleDeleteCategory(record.id)" @confirm="handleDeleteCategory(record.id)"
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
> >
<a href="javascript:;">删除</a> <a href="javascript:void(0);">删除</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span> </span>
</a-table> </a-table>
</a-card> </a-card>
@ -111,6 +131,7 @@
<script> <script>
import CategorySelectTree from './components/CategorySelectTree' import CategorySelectTree from './components/CategorySelectTree'
import categoryApi from '@/api/category' import categoryApi from '@/api/category'
import menuApi from '@/api/menu'
const columns = [ const columns = [
{ {
@ -142,6 +163,7 @@ export default {
formType: 'create', formType: 'create',
categories: [], categories: [],
categoryToCreate: {}, categoryToCreate: {},
menu: {},
loading: false, loading: false,
columns columns
} }
@ -198,6 +220,14 @@ export default {
}) })
} }
this.handleAddCategory() 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" :href="options.blog_url+'/s/'+record.url"
target="_blank" target="_blank"
> >
<a-tooltip placement="topLeft" :title="'点击预览 '+text">{{ text }}</a-tooltip> <a-tooltip
placement="topLeft"
:title="'点击预览 '+text"
>{{ text }}</a-tooltip>
</a> </a>
</span> </span>
<span <span
@ -161,7 +164,25 @@
> >
<a href="javascript:;">删除</a> <a href="javascript:;">删除</a>
</a-popconfirm> </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> </span>
</a-table> </a-table>
</a-tab-pane> </a-tab-pane>
@ -176,6 +197,8 @@
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import sheetApi from '@/api/sheet' import sheetApi from '@/api/sheet'
import optionApi from '@/api/option' import optionApi from '@/api/option'
import menuApi from '@/api/menu'
const internalColumns = [ const internalColumns = [
{ {
title: '页面名称', title: '页面名称',
@ -224,7 +247,7 @@ const customColumns = [
}, },
{ {
title: '操作', title: '操作',
width: '150px', width: '180px',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' }
} }
] ]
@ -238,6 +261,7 @@ export default {
internalSheets: [], internalSheets: [],
sheets: [], sheets: [],
options: [], options: [],
menu: {},
keys: ['blog_url'] keys: ['blog_url']
} }
}, },
@ -284,15 +308,23 @@ export default {
this.$message.success('删除成功!') this.$message.success('删除成功!')
this.loadSheets() 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> </script>
<style scoped> <style scoped>
a{ a {
text-decoration: none; text-decoration: none;
} }
.sheet-title{ .sheet-title {
max-width: 300px; max-width: 300px;
display: block; display: block;
white-space: nowrap; white-space: nowrap;