Skip to content

Commit

Permalink
fix: redirect to work list page when click my-work
Browse files Browse the repository at this point in the history
  • Loading branch information
ly525 committed Aug 16, 2019
1 parent ab5940e commit a6920bb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
4 changes: 2 additions & 2 deletions front-end/h5/src/engine-entry.js
@@ -1,10 +1,10 @@
/**
* #!zh:
* #!zh:
* engine 页面是 webpack 构建多页面中的其中的一个页面
* entry-entry 是 构建 engine 页面的入口,类似于 src/main.js 的作用
* 作用:作品预览的渲染引擎,其实就是简单遍历 work(作品) 的 pages 以及 elements,显示即可
* 主要在预览弹窗中预览 和 用户在手机上查看作品使用
*
*
*/
import Vue from 'vue'
import Antd from 'ant-design-vue'
Expand Down
55 changes: 29 additions & 26 deletions front-end/h5/src/views/work-manager/index.vue
Expand Up @@ -8,7 +8,8 @@ const sidebarMenus = [
label: '我的作品',
value: 'workManager',
antIcon: 'bars',
key: '1'
key: '1',
routerName: 'work-manager-list'
},
{
label: '数据中心',
Expand All @@ -22,12 +23,6 @@ const sidebarMenus = [
antIcon: 'snippets',
key: '2-1',
routerName: 'form-stat'
},
{
label: '表单统计',
value: 'formData',
antIcon: 'snippets',
key: '2-2'
}
]
},
Expand Down Expand Up @@ -58,6 +53,32 @@ export default {
// PreView,
// Sidebar
},
methods: {
renderSidebar (menus) {
const renderLabel = menu => menu.routerName ? <router-link to={{ name: menu.routerName }} >{menu.label}</router-link> : menu.label
return menus.map(menu => (
menu.children
? (
<a-sub-menu key={menu.key}>
<span slot="title"><a-icon type={menu.antIcon} />{menu.label}</span>
{
(menu.children).map(submenu => (
<a-menu-item key={submenu.key}>{renderLabel(submenu)}</a-menu-item>
))
}
</a-sub-menu>
)
: (
<a-menu-item key={menu.key}>
<a-icon type={menu.antIcon}></a-icon>
{/** 这边有个疑惑,不知是否为 antd-vue 的 bug,需要用 span 包裹,否则不会显示 label */}
<span>{renderLabel(menu)}</span>
</a-menu-item>
)
))
}
},
render (h) {
return (
<a-layout id="luban-work-manager-layout" style={{ height: '100vh' }}>
Expand All @@ -84,25 +105,7 @@ export default {
defaultOpenKeys={['1', '2', '3']}
style="height: 100%"
>
{
sidebarMenus.map(menu => (
menu.children
? <a-sub-menu key={menu.key}>
<span slot="title"><a-icon type={menu.antIcon} />{menu.label}</span>
{
(menu.children).map(submenu => (
<a-menu-item key={submenu.key}>
{ submenu.routerName ? <router-link to={{ name: submenu.routerName }}>{submenu.label}</router-link> : submenu.label }
</a-menu-item>
))
}
</a-sub-menu>
: <a-menu-item key={menu.key}>
<a-icon type={menu.antIcon} />
<span>{menu.label}</span>
</a-menu-item>
))
}
{this.renderSidebar(sidebarMenus)}
</a-menu>
</a-layout-sider>
<a-layout style="padding: 0 24px 24px">
Expand Down
2 changes: 1 addition & 1 deletion front-end/h5/src/views/work-manager/list.vue
Expand Up @@ -46,7 +46,7 @@ const ListItemCard = {
</div>
<template class="ant-card-actions" slot="actions">
<a-tooltip effect="dark" placement="bottom" title="编辑">
<router-link to={{ name: 'editor', params: { workId: this.work.id }}} target="_blank">
<router-link to={{ name: 'editor', params: { workId: this.work.id } }} target="_blank">
<a-icon type="edit" title="编辑"/>
</router-link>
</a-tooltip>
Expand Down

0 comments on commit a6920bb

Please sign in to comment.