Commit 1d37baa495d5251f60b7821be887b378e40ee568
1 parent
4e2e89e3
feat(editor) add shortcut for add page and update page-manager layout
Showing
4 changed files
with
105 additions
and
29 deletions
front-end/h5/src/components/core/editor/index.js
| ... | ... | @@ -13,6 +13,7 @@ import RenderAnimationEditor from './edit-panel/animation' |
| 13 | 13 | import RenderActoionEditor from './edit-panel/action' |
| 14 | 14 | import RenderBackgroundEditor from './edit-panel/background' |
| 15 | 15 | import RenderShortcutsPanel from './shortcuts-panel/index' |
| 16 | +import RenderPageManager from './page-manager/index' | |
| 16 | 17 | import PreviewDialog from './modals/preview.vue' |
| 17 | 18 | |
| 18 | 19 | import LogoOfHeader from '@/components/common/header/logo.js' |
| ... | ... | @@ -147,33 +148,36 @@ export default { |
| 147 | 148 | _renderMenuContent () { |
| 148 | 149 | switch (this.activeMenuKey) { |
| 149 | 150 | case sidebarMenus[0].value: |
| 150 | - return <RenderShortcutsPanel pluginsList={this.pluginsList} handleClickShortcut={this.clone} /> | |
| 151 | + return ( | |
| 152 | + <a-tabs | |
| 153 | + style="height: 100%;" | |
| 154 | + tabBarGutter={10} | |
| 155 | + > | |
| 156 | + <a-tab-pane key="plugin-list" tab={this.$t('editor.sidebar.components')}> | |
| 157 | + <RenderShortcutsPanel pluginsList={this.pluginsList} handleClickShortcut={this.clone} /> | |
| 158 | + </a-tab-pane> | |
| 159 | + <a-tab-pane key='page-manager' tab={this.$t('editor.sidebar.pages')}> | |
| 160 | + <RenderPageManager | |
| 161 | + pages={this.pages} | |
| 162 | + editingPage={this.editingPage} | |
| 163 | + onSelectMenuItem={(menuKey) => { | |
| 164 | + this.pageManager({ type: menuKey }) | |
| 165 | + }} | |
| 166 | + onSelectPage={(pageIndex) => { this.setEditingPage(pageIndex) }} | |
| 167 | + /> | |
| 168 | + </a-tab-pane> | |
| 169 | + </a-tabs> | |
| 170 | + ) | |
| 151 | 171 | case sidebarMenus[1].value: |
| 152 | 172 | return ( |
| 153 | - this.pages.map((page, index) => ( | |
| 154 | - <span | |
| 155 | - style={{ | |
| 156 | - display: 'flex', | |
| 157 | - justifyContent: 'space-between', | |
| 158 | - padding: '12px 0', | |
| 159 | - color: page.uuid === this.editingPage.uuid ? '#1593ff' : '' | |
| 160 | - }} | |
| 161 | - class="cursor-pointer" | |
| 162 | - onClick={() => { this.setEditingPage(index) }} | |
| 163 | - > | |
| 164 | - {/* #!en: Page<Index> */} | |
| 165 | - {/* #!zh: 第<Index>页面 */} | |
| 166 | - <span>{this.$t('editor.pageManager.title', { index })}</span> | |
| 167 | - <a-dropdown trigger={['hover']} placement='bottomCenter'> | |
| 168 | - <a class="ant-dropdown-link" href="#"><a-icon type="down" /></a> | |
| 169 | - <a-menu slot="overlay" onClick={({ key }) => { this.pageManager({ type: key }) }}> | |
| 170 | - <a-menu-item key="add"><a-icon type="user" />{this.$t('editor.pageManager.action.add')}</a-menu-item> | |
| 171 | - <a-menu-item key="copy"><a-icon type="user" />{this.$t('editor.pageManager.action.copy')}</a-menu-item> | |
| 172 | - <a-menu-item key="delete"><a-icon type="user" />{this.$t('editor.pageManager.action.delete')}</a-menu-item> | |
| 173 | - </a-menu> | |
| 174 | - </a-dropdown> | |
| 175 | - </span> | |
| 176 | - )) | |
| 173 | + <RenderPageManager | |
| 174 | + pages={this.pages} | |
| 175 | + editingPage={this.editingPage} | |
| 176 | + onSelectMenuItem={(menuKey) => { | |
| 177 | + this.pageManager({ type: menuKey }) | |
| 178 | + }} | |
| 179 | + onSelectPage={(pageIndex) => { this.setEditingPage(pageIndex) }} | |
| 180 | + /> | |
| 177 | 181 | ) |
| 178 | 182 | default: |
| 179 | 183 | return null |
| ... | ... | @@ -225,7 +229,7 @@ export default { |
| 225 | 229 | <ExternalLinksOfHeader /> |
| 226 | 230 | </a-layout-header> |
| 227 | 231 | <a-layout> |
| 228 | - <a-layout-sider width="160" style="background: #fff" collapsed> | |
| 232 | + {/* <a-layout-sider collapsedWidth={40} style="background: #fff" collapsed> | |
| 229 | 233 | <a-menu |
| 230 | 234 | mode="inline" |
| 231 | 235 | defaultSelectedKeys={['pluginList']} |
| ... | ... | @@ -236,13 +240,12 @@ export default { |
| 236 | 240 | sidebarMenus.map(menu => ( |
| 237 | 241 | <a-menu-item key={menu.value}> |
| 238 | 242 | <a-icon type={menu.antIcon} /> |
| 239 | - {/* <span>{menu.label}</span> */} | |
| 240 | 243 | <span>{this.$t(menu.i18nLabel)}</span> |
| 241 | 244 | </a-menu-item> |
| 242 | 245 | )) |
| 243 | 246 | } |
| 244 | 247 | </a-menu> |
| 245 | - </a-layout-sider> | |
| 248 | + </a-layout-sider> */} | |
| 246 | 249 | <a-layout-sider width="240" theme='light' style={{ background: '#fff', padding: '12px' }}> |
| 247 | 250 | { this._renderMenuContent() } |
| 248 | 251 | </a-layout-sider> | ... | ... |
front-end/h5/src/components/core/editor/page-manager/index.js
0 → 100644
| 1 | +export default { | |
| 2 | + props: { | |
| 3 | + pages: { | |
| 4 | + required: false, | |
| 5 | + type: Array, | |
| 6 | + default: () => [] | |
| 7 | + }, | |
| 8 | + editingPage: { | |
| 9 | + type: Object, | |
| 10 | + default: () => {} | |
| 11 | + } | |
| 12 | + }, | |
| 13 | + methods: { | |
| 14 | + }, | |
| 15 | + render (h) { | |
| 16 | + const addPageText = this.$t('editor.pageManager.action.add') | |
| 17 | + const copyPageText = this.$t('editor.pageManager.action.add') | |
| 18 | + const deletePageText = this.$t('editor.pageManager.action.add') | |
| 19 | + return ( | |
| 20 | + <div class="page-manager-panel"> | |
| 21 | + { | |
| 22 | + this.pages.map((page, index) => ( | |
| 23 | + <span | |
| 24 | + class={[ | |
| 25 | + 'cursor-pointer', | |
| 26 | + 'page-manager-panel__item', | |
| 27 | + page.uuid === this.editingPage.uuid && 'active' | |
| 28 | + ]} | |
| 29 | + onClick={() => { this.$emit('selectPage', index) }} | |
| 30 | + > | |
| 31 | + {/* #!en: Page<Index> */} | |
| 32 | + {/* #!zh: 第<Index>页面 */} | |
| 33 | + <span>{this.$t('editor.pageManager.title', { index })}</span> | |
| 34 | + <a-dropdown trigger={['hover']} placement='bottomCenter'> | |
| 35 | + <a class="ant-dropdown-link" href="#"><a-icon type="down" /></a> | |
| 36 | + <a-menu slot="overlay" onClick={({ key }) => { this.$emit('selectMenuItem', key) }}> | |
| 37 | + <a-menu-item key="add"><a-icon type="user" />{addPageText}</a-menu-item> | |
| 38 | + <a-menu-item key="copy"><a-icon type="user" />{copyPageText}</a-menu-item> | |
| 39 | + <a-menu-item key="delete"><a-icon type="user" />{deletePageText}</a-menu-item> | |
| 40 | + </a-menu> | |
| 41 | + </a-dropdown> | |
| 42 | + </span> | |
| 43 | + )) | |
| 44 | + } | |
| 45 | + <a-button | |
| 46 | + icon="plus" | |
| 47 | + type="dashed" | |
| 48 | + class="footer-actions" | |
| 49 | + onClick={() => { this.$emit('selectMenuItem', 'add') }} | |
| 50 | + >{addPageText}</a-button> | |
| 51 | + </div> | |
| 52 | + ) | |
| 53 | + } | |
| 54 | +} | ... | ... |
front-end/h5/src/components/core/styles/index.scss
| ... | ... | @@ -133,6 +133,26 @@ |
| 133 | 133 | @include shortcut-button; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | +.page-manager-panel { | |
| 137 | + position: relative; | |
| 138 | + | |
| 139 | + &__item { | |
| 140 | + display: flex; | |
| 141 | + justify-content: space-between; | |
| 142 | + padding: 12px 0; | |
| 143 | + height: 60px; | |
| 144 | + border-bottom: 1px solid #f0f4f5; | |
| 145 | + | |
| 146 | + &.active { | |
| 147 | + color: #1593ff; | |
| 148 | + } | |
| 149 | + } | |
| 150 | + | |
| 151 | + .footer-actions { | |
| 152 | + margin-top: 40px; | |
| 153 | + } | |
| 154 | +} | |
| 155 | + | |
| 136 | 156 | // 动画编辑面板定制 |
| 137 | 157 | #animation-edit-panel { |
| 138 | 158 | .ant-collapse-header { | ... | ... |
front-end/h5/src/components/core/support/image-gallery/tabs/personal.js