Commit ed253a169701571f7a77cd2fb68814acea2aa210
1 parent
86513572
refactor create work
Showing
7 changed files
with
9 additions
and
7 deletions
back-end/h5-api/public/engine-libs/flexible.js renamed to back-end/h5-api/public/third-libs/flexible.js
back-end/h5-api/public/engine-libs/swiper.min.css renamed to back-end/h5-api/public/third-libs/swiper.min.css
back-end/h5-api/public/engine-libs/swiper.min.js renamed to back-end/h5-api/public/third-libs/swiper.min.js
back-end/h5-api/public/engine-libs/vue.js renamed to back-end/h5-api/public/third-libs/vue.js
back-end/h5-api/views/engine.ejs
| ... | ... | @@ -8,10 +8,10 @@ |
| 8 | 8 | <meta content="black" name="apple-mobile-web-app-status-bar-style"> |
| 9 | 9 | <meta content="telephone=no" name="format-detection"> |
| 10 | 10 | <meta content="email=no" name="format-detection"> |
| 11 | - <script src="/engine-libs/vue.js"></script> | |
| 12 | - <script type="text/javascript" src="/engine-libs/flexible.js"></script> | |
| 13 | - <link rel="stylesheet" href="/engine-libs/swiper.min.css"> | |
| 14 | - <script src="/engine-libs/swiper.min.js"></script> | |
| 11 | + <script src="/third-libs/vue.js"></script> | |
| 12 | + <script type="text/javascript" src="/third-libs/flexible.js"></script> | |
| 13 | + <link rel="stylesheet" href="/third-libs/swiper.min.css"> | |
| 14 | + <script src="/third-libs/swiper.min.js"></script> | |
| 15 | 15 | <!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> --> |
| 16 | 16 | <!-- <script type="text/javascript" src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/flexible.js"></script> --> |
| 17 | 17 | <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/css/swiper.min.css"> --> | ... | ... |
front-end/h5/src/components/core/models/work.js
| ... | ... | @@ -2,7 +2,7 @@ class Work { |
| 2 | 2 | constructor (work = {}) { |
| 3 | 3 | this.title = work.title || '标题' |
| 4 | 4 | this.description = work.description || '描述' |
| 5 | - this.pages = work.pages || [] | |
| 5 | + this.pages = work.pages || [{ elements: [] }] | |
| 6 | 6 | |
| 7 | 7 | // this.id = this.id |
| 8 | 8 | // TODO 用id 并不是一个好办法,有心人会得知整个系统中共有多少作品等额外信息,尽量防止信息泄漏 |
| ... | ... | @@ -10,9 +10,10 @@ class Work { |
| 10 | 10 | this.cover_image_url = '' |
| 11 | 11 | // TODO 后期可以添加一个类似项目组的概念,每个项目组下可以有多个作品 |
| 12 | 12 | // this.project_id = 1 |
| 13 | - this.is_publish = false | |
| 14 | 13 | this.create_time = new Date() |
| 15 | 14 | this.update_time = new Date() |
| 15 | + this.is_publish = false | |
| 16 | + this.is_template = false | |
| 16 | 17 | } |
| 17 | 18 | } |
| 18 | 19 | ... | ... |
front-end/h5/src/store/modules/work.js
| 1 | 1 | import Element from '../../components/core/models/element' |
| 2 | 2 | import strapi from '../../utils/strapi' |
| 3 | 3 | import Page from '../../components/core/models/page' |
| 4 | +import Work from '../../components/core/models/work' | |
| 4 | 5 | import { AxiosWrapper } from '../../utils/http.js' |
| 5 | 6 | import router from '@/router.js' |
| 6 | 7 | |
| ... | ... | @@ -12,7 +13,7 @@ export const actions = { |
| 12 | 13 | commit('previewWork', payload) |
| 13 | 14 | }, |
| 14 | 15 | createWork ({ commit }, payload) { |
| 15 | - strapi.createEntry('works').then(entry => { | |
| 16 | + strapi.createEntry('works', new Work()).then(entry => { | |
| 16 | 17 | commit('setWork', entry) |
| 17 | 18 | router.replace({ name: 'editor', params: { workId: entry.id } }) |
| 18 | 19 | // window.location = `${window.location.origin}/#/editor/${entry.id}` | ... | ... |