Commit cf953c20db54838ec01432b85da45da05ea51a03

Authored by ly525
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,避免最创建作品保存和预览无效的情况
front-end/h5/src/store/modules/work.js
... ... @@ -19,13 +19,9 @@ export const actions = {
19 19 },
20 20 createWork ({ commit }, payload) {
21 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 26 updateWork ({ commit, state }, payload = {}) {
31 27 // update work with strapi
... ... @@ -248,9 +244,6 @@ export const mutations = {
248 244 })
249 245 state.work = work
250 246 },
251   - // createWork (state) {
252   - // state.work = new Work()
253   - // },
254 247 previewWork (state, { type, value }) {},
255 248 deployWork (state, { type, value }) {},
256 249 formDetailOfWork (state, { type, value }) {
... ...
front-end/h5/src/views/work-manager/list.vue
... ... @@ -112,13 +112,11 @@ export default {
112 112 },
113 113 methods: {
114 114 ...mapActions('editor', [
115   - 'fetchWorks'
  115 + 'fetchWorks',
  116 + 'createWork'
116 117 ]),
117 118 deleteWork (item) {
118 119 // TODO delete work from work list
119   - },
120   - createWork () {
121   - this.$router.push({ name: 'editor' })
122 120 }
123 121 },
124 122 render (h) {
... ...
front-end/h5/src/views/work-manager/templates.vue
... ... @@ -104,10 +104,6 @@ export default {
104 104 ]),
105 105 deleteWork (item) {
106 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 109 render (h) {
... ...