Commit cf953c20db54838ec01432b85da45da05ea51a03
1 parent
1dcef065
fix: replace router.place with window.open new tab to aviod could not save and p…
…review the work when create the work zh: 用 window.open new tab 替换 router.replace,避免最创建作品保存和预览无效的情况
Showing
3 changed files
with
4 additions
and
17 deletions
front-end/h5/src/store/modules/work.js
| @@ -19,13 +19,9 @@ export const actions = { | @@ -19,13 +19,9 @@ export const actions = { | ||
| 19 | }, | 19 | }, |
| 20 | createWork ({ commit }, payload) { | 20 | createWork ({ commit }, payload) { |
| 21 | strapi.createEntry('works', new Work()).then(entry => { | 21 | strapi.createEntry('works', new Work()).then(entry => { |
| 22 | - commit('setWork', entry) | ||
| 23 | - router.replace({ name: 'editor', params: { workId: entry.id } }) | ||
| 24 | - // window.location = `${window.location.origin}/#/editor/${entry.id}` | 22 | + const routeData = router.resolve({ name: 'editor', params: { workId: entry.id } }) |
| 23 | + window.open(routeData.href, '_blank') | ||
| 25 | }) | 24 | }) |
| 26 | - // commit('createWork') | ||
| 27 | - // commit('pageManager', { type: 'add' }) | ||
| 28 | - // commit('setEditingPage') | ||
| 29 | }, | 25 | }, |
| 30 | updateWork ({ commit, state }, payload = {}) { | 26 | updateWork ({ commit, state }, payload = {}) { |
| 31 | // update work with strapi | 27 | // update work with strapi |
| @@ -248,9 +244,6 @@ export const mutations = { | @@ -248,9 +244,6 @@ export const mutations = { | ||
| 248 | }) | 244 | }) |
| 249 | state.work = work | 245 | state.work = work |
| 250 | }, | 246 | }, |
| 251 | - // createWork (state) { | ||
| 252 | - // state.work = new Work() | ||
| 253 | - // }, | ||
| 254 | previewWork (state, { type, value }) {}, | 247 | previewWork (state, { type, value }) {}, |
| 255 | deployWork (state, { type, value }) {}, | 248 | deployWork (state, { type, value }) {}, |
| 256 | formDetailOfWork (state, { type, value }) { | 249 | formDetailOfWork (state, { type, value }) { |
front-end/h5/src/views/work-manager/list.vue
| @@ -112,13 +112,11 @@ export default { | @@ -112,13 +112,11 @@ export default { | ||
| 112 | }, | 112 | }, |
| 113 | methods: { | 113 | methods: { |
| 114 | ...mapActions('editor', [ | 114 | ...mapActions('editor', [ |
| 115 | - 'fetchWorks' | 115 | + 'fetchWorks', |
| 116 | + 'createWork' | ||
| 116 | ]), | 117 | ]), |
| 117 | deleteWork (item) { | 118 | deleteWork (item) { |
| 118 | // TODO delete work from work list | 119 | // TODO delete work from work list |
| 119 | - }, | ||
| 120 | - createWork () { | ||
| 121 | - this.$router.push({ name: 'editor' }) | ||
| 122 | } | 120 | } |
| 123 | }, | 121 | }, |
| 124 | render (h) { | 122 | render (h) { |
front-end/h5/src/views/work-manager/templates.vue
| @@ -104,10 +104,6 @@ export default { | @@ -104,10 +104,6 @@ export default { | ||
| 104 | ]), | 104 | ]), |
| 105 | deleteWork (item) { | 105 | deleteWork (item) { |
| 106 | // TODO delete work from work list | 106 | // TODO delete work from work list |
| 107 | - }, | ||
| 108 | - createWork () { | ||
| 109 | - this.$router.push({ name: 'editor' }) | ||
| 110 | - // window.open('#/editor', '_blank') | ||
| 111 | } | 107 | } |
| 112 | }, | 108 | }, |
| 113 | render (h) { | 109 | render (h) { |