Skip to content

Commit a6920bb

Browse files
committed
fix: redirect to work list page when click my-work
1 parent ab5940e commit a6920bb

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

front-end/h5/src/engine-entry.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* #!zh:
2+
* #!zh:
33
* engine 页面是 webpack 构建多页面中的其中的一个页面
44
* entry-entry 是 构建 engine 页面的入口,类似于 src/main.js 的作用
55
* 作用:作品预览的渲染引擎,其实就是简单遍历 work(作品) 的 pages 以及 elements,显示即可
66
* 主要在预览弹窗中预览 和 用户在手机上查看作品使用
7-
*
7+
*
88
*/
99
import Vue from 'vue'
1010
import Antd from 'ant-design-vue'

front-end/h5/src/views/work-manager/index.vue

+29-26
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const sidebarMenus = [
88
label: '我的作品',
99
value: 'workManager',
1010
antIcon: 'bars',
11-
key: '1'
11+
key: '1',
12+
routerName: 'work-manager-list'
1213
},
1314
{
1415
label: '数据中心',
@@ -22,12 +23,6 @@ const sidebarMenus = [
2223
antIcon: 'snippets',
2324
key: '2-1',
2425
routerName: 'form-stat'
25-
},
26-
{
27-
label: '表单统计',
28-
value: 'formData',
29-
antIcon: 'snippets',
30-
key: '2-2'
3126
}
3227
]
3328
},
@@ -58,6 +53,32 @@ export default {
5853
// PreView,
5954
// Sidebar
6055
},
56+
methods: {
57+
renderSidebar (menus) {
58+
const renderLabel = menu => menu.routerName ? <router-link to={{ name: menu.routerName }} >{menu.label}</router-link> : menu.label
59+
60+
return menus.map(menu => (
61+
menu.children
62+
? (
63+
<a-sub-menu key={menu.key}>
64+
<span slot="title"><a-icon type={menu.antIcon} />{menu.label}</span>
65+
{
66+
(menu.children).map(submenu => (
67+
<a-menu-item key={submenu.key}>{renderLabel(submenu)}</a-menu-item>
68+
))
69+
}
70+
</a-sub-menu>
71+
)
72+
: (
73+
<a-menu-item key={menu.key}>
74+
<a-icon type={menu.antIcon}></a-icon>
75+
{/** 这边有个疑惑,不知是否为 antd-vue 的 bug,需要用 span 包裹,否则不会显示 label */}
76+
<span>{renderLabel(menu)}</span>
77+
</a-menu-item>
78+
)
79+
))
80+
}
81+
},
6182
render (h) {
6283
return (
6384
<a-layout id="luban-work-manager-layout" style={{ height: '100vh' }}>
@@ -84,25 +105,7 @@ export default {
84105
defaultOpenKeys={['1', '2', '3']}
85106
style="height: 100%"
86107
>
87-
{
88-
sidebarMenus.map(menu => (
89-
menu.children
90-
? <a-sub-menu key={menu.key}>
91-
<span slot="title"><a-icon type={menu.antIcon} />{menu.label}</span>
92-
{
93-
(menu.children).map(submenu => (
94-
<a-menu-item key={submenu.key}>
95-
{ submenu.routerName ? <router-link to={{ name: submenu.routerName }}>{submenu.label}</router-link> : submenu.label }
96-
</a-menu-item>
97-
))
98-
}
99-
</a-sub-menu>
100-
: <a-menu-item key={menu.key}>
101-
<a-icon type={menu.antIcon} />
102-
<span>{menu.label}</span>
103-
</a-menu-item>
104-
))
105-
}
108+
{this.renderSidebar(sidebarMenus)}
106109
</a-menu>
107110
</a-layout-sider>
108111
<a-layout style="padding: 0 24px 24px">

front-end/h5/src/views/work-manager/list.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const ListItemCard = {
4646
</div>
4747
<template class="ant-card-actions" slot="actions">
4848
<a-tooltip effect="dark" placement="bottom" title="编辑">
49-
<router-link to={{ name: 'editor', params: { workId: this.work.id }}} target="_blank">
49+
<router-link to={{ name: 'editor', params: { workId: this.work.id } }} target="_blank">
5050
<a-icon type="edit" title="编辑"/>
5151
</router-link>
5252
</a-tooltip>

0 commit comments

Comments
 (0)