Skip to content

Commit

Permalink
chore: publish config mode -> view_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ly525 committed Aug 25, 2020
1 parent 85b6cf6 commit 66fe3b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions back-end/h5-api/api/work/controllers/Work.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ module.exports = {
// GET /previewOne
// strapi-hook-ejs: https://github.com/strapi/strapi/tree/master/packages/strapi-hook-ejs
previewOne: async (ctx) => {
const { mode } = ctx.request.query
const { view_mode } = ctx.request.query
const work = await strapi.services.work.findOne(ctx.params);
// 非发布状态, 查看不到内容
// 非预览模式, 查看不到内容
const canRender = mode === VIEW_MODE.PREVIEW || work.is_publish
const canRender = view_mode === VIEW_MODE.PREVIEW || work.is_publish
if (!canRender) work.pages = []
return ctx.render('engine', { work });
},
Expand Down
2 changes: 1 addition & 1 deletion front-end/h5/src/components/core/editor/modals/preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
// work: state => state.work
// }),
releaseUrl () {
return `${window.location.origin}/works/preview/${this.work.id}?mode=preview`
return `${window.location.origin}/works/preview/${this.work.id}?view_mode=preview`
}
},
data () {
Expand Down
2 changes: 1 addition & 1 deletion front-end/h5/src/engine-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const Engine = {

// 预览模式 或者 已经发布 的页面可以正常渲染,否则提示用户暂未发布
const query = new URLSearchParams(window.location.search)
const canRender = query.get('mode') === 'preview' || work.is_publish
const canRender = query.get('view_mode') === 'preview' || work.is_publish
if (!canRender) return this.renderUnPublishTip()

const containerStyle = this.getContainerStyle(work)
Expand Down

0 comments on commit 66fe3b0

Please sign in to comment.