Commit e8e01175087f43fa1a4191374bbee975c98866b0

Authored by ly525
1 parent 91525f0b

feat(preview): set page title for released page; (zh) 为发布的作品设置页面标题

back-end/h5-api/api/work/controllers/Work.js
  1 +/*
  2 + * @Author: ly525
  3 + * @Date: 2019-12-04 19:55:24
  4 + * @LastEditors: ly525
  5 + * @LastEditTime: 2019-12-14 21:34:57
  6 + * @FilePath: /luban-h5/back-end/h5-api/api/work/controllers/Work.js
  7 + * @Github: https://github.com/ly525/luban-h5
  8 + * @Description:
  9 + * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
  10 + */
1 11 'use strict';
2 12 const request = require('request');
3 13  
... ... @@ -10,7 +20,8 @@ module.exports = {
10 20 // GET /previewOne
11 21 // strapi-hook-ejs: https://github.com/strapi/strapi/tree/master/packages/strapi-hook-ejs
12 22 previewOne: async (ctx) => {
13   - const work = await strapi.services.work.findOne(ctx.params);
  23 + let work = await strapi.services.work.findOne(ctx.params);
  24 + work = work.toJSON();
14 25 return ctx.render('engine', { work });
15 26 },
16 27 submitForm: async (ctx) => {
... ...
back-end/h5-api/views/engine.ejs
... ... @@ -2,7 +2,7 @@
2 2 * @Author: ly525
3 3 * @Date: 2019-12-04 20:24:04
4 4 * @LastEditors: ly525
5   - * @LastEditTime: 2019-12-14 21:46:01
  5 + * @LastEditTime: 2019-12-14 21:46:23
6 6 * @FilePath: /luban-h5/back-end/h5-api/views/engine.ejs
7 7 * @Github: https://github.com/ly525/luban-h5
8 8 * @Description: 手机端预览模板
... ... @@ -13,7 +13,7 @@
13 13  
14 14 <head>
15 15 <meta charset="UTF-8">
16   - <title>work.html</title>
  16 + <title><%= work.title %></title>
17 17 <meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
18 18 <meta content="yes" name="apple-mobile-web-app-capable">
19 19 <meta content="black" name="apple-mobile-web-app-status-bar-style">
... ...