diff --git a/back-end/h5-api/api/work/controllers/Work.js b/back-end/h5-api/api/work/controllers/Work.js index deec9f70..743a1798 100644 --- a/back-end/h5-api/api/work/controllers/Work.js +++ b/back-end/h5-api/api/work/controllers/Work.js @@ -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 }); }, diff --git a/front-end/h5/src/components/core/editor/modals/preview.vue b/front-end/h5/src/components/core/editor/modals/preview.vue index 73637d26..54da02fc 100644 --- a/front-end/h5/src/components/core/editor/modals/preview.vue +++ b/front-end/h5/src/components/core/editor/modals/preview.vue @@ -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 () { diff --git a/front-end/h5/src/engine-entry.js b/front-end/h5/src/engine-entry.js index 6a5e038f..68303edb 100644 --- a/front-end/h5/src/engine-entry.js +++ b/front-end/h5/src/engine-entry.js @@ -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)