Commit 94594a01dc7b27eb0d0b3f064f67801f190fa0c5
1 parent
115893d7
fix(edtor) switch between page
Showing
2 changed files
with
19 additions
and
9 deletions
front-end/h5/src/components/core/editor/index.js
| @@ -108,6 +108,7 @@ export default { | @@ -108,6 +108,7 @@ export default { | ||
| 108 | }), | 108 | }), |
| 109 | computed: { | 109 | computed: { |
| 110 | ...mapState('editor', { | 110 | ...mapState('editor', { |
| 111 | + editingPage: state => state.editingPage, | ||
| 111 | editingElement: state => state.editingElement, | 112 | editingElement: state => state.editingElement, |
| 112 | elements: state => state.editingPage.elements, | 113 | elements: state => state.editingPage.elements, |
| 113 | pages: state => state.work.pages, | 114 | pages: state => state.work.pages, |
| @@ -123,7 +124,8 @@ export default { | @@ -123,7 +124,8 @@ export default { | ||
| 123 | 'createWork', | 124 | 'createWork', |
| 124 | 'fetchWork', | 125 | 'fetchWork', |
| 125 | 'setWorkAsTemplate', | 126 | 'setWorkAsTemplate', |
| 126 | - 'setEditingElement' | 127 | + 'setEditingElement', |
| 128 | + 'setEditingPage' | ||
| 127 | ]), | 129 | ]), |
| 128 | ...mapActions('loading', { | 130 | ...mapActions('loading', { |
| 129 | updateLoading: 'update' | 131 | updateLoading: 'update' |
| @@ -148,7 +150,16 @@ export default { | @@ -148,7 +150,16 @@ export default { | ||
| 148 | case sidebarMenus[1].value: | 150 | case sidebarMenus[1].value: |
| 149 | return ( | 151 | return ( |
| 150 | this.pages.map((page, index) => ( | 152 | this.pages.map((page, index) => ( |
| 151 | - <span style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 0' }}> | 153 | + <span |
| 154 | + style={{ | ||
| 155 | + display: 'flex', | ||
| 156 | + justifyContent: 'space-between', | ||
| 157 | + padding: '12px 0', | ||
| 158 | + color: page.uuid === this.editingPage.uuid ? '#1593ff' : '' | ||
| 159 | + }} | ||
| 160 | + class="cursor-pointer" | ||
| 161 | + onClick={() => { this.setEditingPage(index) }} | ||
| 162 | + > | ||
| 152 | {/* #!en: Page<Index> */} | 163 | {/* #!en: Page<Index> */} |
| 153 | {/* #!zh: 第<Index>页面 */} | 164 | {/* #!zh: 第<Index>页面 */} |
| 154 | <span>{this.$t('editor.pageManager.title', { index })}</span> | 165 | <span>{this.$t('editor.pageManager.title', { index })}</span> |
| @@ -282,7 +293,7 @@ export default { | @@ -282,7 +293,7 @@ export default { | ||
| 282 | <div style={{ fontSize: '12px', textAlign: 'center' }}>{this.scaleRate * 100}%</div> | 293 | <div style={{ fontSize: '12px', textAlign: 'center' }}>{this.scaleRate * 100}%</div> |
| 283 | </a-button-group> | 294 | </a-button-group> |
| 284 | </a-layout-sider> | 295 | </a-layout-sider> |
| 285 | - <a-layout-sider width="340" theme='light' style={{ background: '#fff', padding: '0 12px' }}> | 296 | + <a-layout-sider width="380" theme='light' style={{ background: '#fff', padding: '0 12px' }}> |
| 286 | <a-tabs | 297 | <a-tabs |
| 287 | style="height: 100%;" | 298 | style="height: 100%;" |
| 288 | tabBarGutter={10} | 299 | tabBarGutter={10} |
| @@ -294,7 +305,7 @@ export default { | @@ -294,7 +305,7 @@ export default { | ||
| 294 | ElementUI:label | 305 | ElementUI:label |
| 295 | Ant Design Vue:tab | 306 | Ant Design Vue:tab |
| 296 | */} | 307 | */} |
| 297 | - <a-tab-pane key="属性"><span slot="tab"><a-icon type="apple" />{this.$t('editor.editPanel.tab.prop')}</span><RenderPropsEditor/></a-tab-pane> | 308 | + <a-tab-pane key="属性"><span slot="tab">{this.$t('editor.editPanel.tab.prop')}</span><RenderPropsEditor/></a-tab-pane> |
| 298 | <a-tab-pane label="动画" key='动画' tab={this.$t('editor.editPanel.tab.animation')}><RenderAnimationEditor /></a-tab-pane> | 309 | <a-tab-pane label="动画" key='动画' tab={this.$t('editor.editPanel.tab.animation')}><RenderAnimationEditor /></a-tab-pane> |
| 299 | <a-tab-pane label="动作" key='动作' tab={this.$t('editor.editPanel.tab.action')}>{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> | 310 | <a-tab-pane label="动作" key='动作' tab={this.$t('editor.editPanel.tab.action')}>{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> |
| 300 | <a-tab-pane label="脚本" key='脚本' tab={this.$t('editor.editPanel.tab.script')}><RenderScriptEditor/></a-tab-pane> | 311 | <a-tab-pane label="脚本" key='脚本' tab={this.$t('editor.editPanel.tab.script')}><RenderScriptEditor/></a-tab-pane> |
front-end/h5/src/store/modules/page.js
| @@ -2,8 +2,8 @@ import Page from '../../components/core/models/page' | @@ -2,8 +2,8 @@ import Page from '../../components/core/models/page' | ||
| 2 | 2 | ||
| 3 | // actions | 3 | // actions |
| 4 | export const actions = { | 4 | export const actions = { |
| 5 | - setEditingPage ({ commit }, payload) { | ||
| 6 | - commit('setEditingPage', payload) | 5 | + setEditingPage ({ commit }, pageIndex = 0) { |
| 6 | + commit('setEditingPage', pageIndex) | ||
| 7 | }, | 7 | }, |
| 8 | pageManager ({ commit }, payload) { | 8 | pageManager ({ commit }, payload) { |
| 9 | commit('pageManager', payload) | 9 | commit('pageManager', payload) |
| @@ -12,9 +12,8 @@ export const actions = { | @@ -12,9 +12,8 @@ export const actions = { | ||
| 12 | 12 | ||
| 13 | // mutations | 13 | // mutations |
| 14 | export const mutations = { | 14 | export const mutations = { |
| 15 | - setEditingPage (state, payload) { | ||
| 16 | - payload = payload || state.work.pages[0] | ||
| 17 | - state.editingPage = payload | 15 | + setEditingPage (state, pageIndex = 0) { |
| 16 | + state.editingPage = state.work.pages[pageIndex] | ||
| 18 | }, | 17 | }, |
| 19 | pageManager (state, { type, value }) { | 18 | pageManager (state, { type, value }) { |
| 20 | switch (type) { | 19 | switch (type) { |