Commit 1538ffdbdfaae595cfd2869c4c9c757dd0fc3a96
1 parent
95e1d5e2
set loading if save with cover
Showing
1 changed file
with
6 additions
and
0 deletions
front-end/h5/src/store/modules/work.js
| ... | ... | @@ -6,6 +6,10 @@ import { AxiosWrapper } from '../../utils/http.js' |
| 6 | 6 | import router from '@/router.js' |
| 7 | 7 | import { takeScreenshot } from '../../utils/helper.js' |
| 8 | 8 | |
| 9 | +function setLoading (commit, loadingName, isLoading) { | |
| 10 | + commit('loading/update', { type: loadingName, payload: isLoading }, { root: true }) | |
| 11 | +} | |
| 12 | + | |
| 9 | 13 | export const actions = { |
| 10 | 14 | previewWork ({ commit }, payload = {}) { |
| 11 | 15 | commit('previewWork', payload) |
| ... | ... | @@ -46,8 +50,10 @@ export const actions = { |
| 46 | 50 | } |
| 47 | 51 | return new Promise((resolve, reject) => { |
| 48 | 52 | if (isSaveCover) { |
| 53 | + setLoading(commit, 'uploadWorkCover_loading', true) | |
| 49 | 54 | takeScreenshot().then(file => { |
| 50 | 55 | dispatch('uploadCover', { file }).then(() => { |
| 56 | + setLoading(commit, 'uploadWorkCover_loading', false) | |
| 51 | 57 | fn(resolve) |
| 52 | 58 | }) // uploadCover |
| 53 | 59 | }) // takeScreenshot | ... | ... |