Showing
16 changed files
with
22 additions
and
60 deletions
@@ -20,7 +20,6 @@ const favicon = require('serve-favicon'); | @@ -20,7 +20,6 @@ const favicon = require('serve-favicon'); | ||
20 | const yohoLib = require('yoho-node-lib'); | 20 | const yohoLib = require('yoho-node-lib'); |
21 | const session = require('express-session'); | 21 | const session = require('express-session'); |
22 | const memcached = require('connect-memcached'); | 22 | const memcached = require('connect-memcached'); |
23 | -const hbs = require('express-handlebars'); | ||
24 | const pkg = require('./package.json'); | 23 | const pkg = require('./package.json'); |
25 | const devtools = require('./doraemon/middleware/devtools'); | 24 | const devtools = require('./doraemon/middleware/devtools'); |
26 | 25 | ||
@@ -45,13 +44,12 @@ if (app.locals.devEnv) { | @@ -45,13 +44,12 @@ if (app.locals.devEnv) { | ||
45 | app.use(devtools()); | 44 | app.use(devtools()); |
46 | } | 45 | } |
47 | 46 | ||
48 | -app.set('view engine', '.hbs'); | ||
49 | -app.set('views', './doraemon/views'); | ||
50 | -app.engine('.hbs', hbs({ | 47 | +app.use(global.yoho.hbs({ |
51 | extname: '.hbs', | 48 | extname: '.hbs', |
52 | defaultLayout: 'layout', | 49 | defaultLayout: 'layout', |
53 | - layoutsDir: './doraemon/views', | ||
54 | - partialsDir: './doraemon/views/partial', | 50 | + layoutsDir: path.join(__dirname, 'doraemon/views'), |
51 | + partialsDir: path.join(__dirname, 'doraemon/views/partial'), | ||
52 | + views: path.join(__dirname, 'doraemon/views'), | ||
55 | helpers: global.yoho.helpers | 53 | helpers: global.yoho.helpers |
56 | })); | 54 | })); |
57 | 55 |
@@ -13,7 +13,7 @@ module.exports = { | @@ -13,7 +13,7 @@ module.exports = { | ||
13 | index(req, res) { | 13 | index(req, res) { |
14 | let channel = req.path.split('/')[1] || req.yoho.channel; | 14 | let channel = req.path.split('/')[1] || req.yoho.channel; |
15 | 15 | ||
16 | - res.render('index', { | 16 | + res.render('cindex', { |
17 | module: 'channel', | 17 | module: 'channel', |
18 | page: 'home', | 18 | page: 'home', |
19 | channel: channel | 19 | channel: channel |
apps/channel/controllers/index.js
deleted
100644 → 0
1 | -/** | ||
2 | - * 主页 | ||
3 | - * @author: Bi Kai<kai.bi@yoho.cn> | ||
4 | - * @date: 2016/05/09 | ||
5 | - */ | ||
6 | -'use strict'; | ||
7 | - | ||
8 | -/** | ||
9 | - * 频道选择页 | ||
10 | - */ | ||
11 | -const component = { | ||
12 | - index: (req, res) => { | ||
13 | - res.render('index', { | ||
14 | - module: 'example', | ||
15 | - page: 'home' | ||
16 | - }); | ||
17 | - } | ||
18 | -}; | ||
19 | - | ||
20 | -module.exports = component; |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | const express = require('express'); | 7 | const express = require('express'); |
8 | const path = require('path'); | 8 | const path = require('path'); |
9 | -const hbs = require('express-handlebars'); | ||
10 | 9 | ||
11 | const app = express(); | 10 | const app = express(); |
12 | 11 | ||
@@ -18,12 +17,12 @@ app.on('mount', function(parent) { | @@ -18,12 +17,12 @@ app.on('mount', function(parent) { | ||
18 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
19 | }); | 18 | }); |
20 | 19 | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | -app.engine('.hbs', hbs({ | 20 | +app.use(global.yoho.hbs({ |
23 | extname: '.hbs', | 21 | extname: '.hbs', |
24 | defaultLayout: 'layout', | 22 | defaultLayout: 'layout', |
25 | layoutsDir: doraemon, | 23 | layoutsDir: doraemon, |
26 | - partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 24 | + partialsDir: [`${doraemon}/partial`], |
25 | + views: path.join(__dirname, 'views/action'), | ||
27 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
28 | })); | 27 | })); |
29 | 28 |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | const express = require('express'); | 7 | const express = require('express'); |
8 | const path = require('path'); | 8 | const path = require('path'); |
9 | -const hbs = require('express-handlebars'); | ||
10 | 9 | ||
11 | const app = express(); | 10 | const app = express(); |
12 | 11 | ||
@@ -18,13 +17,12 @@ app.on('mount', function(parent) { | @@ -18,13 +17,12 @@ app.on('mount', function(parent) { | ||
18 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
19 | }); | 18 | }); |
20 | 19 | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | - | ||
23 | -app.engine('.hbs', hbs({ | 20 | +app.use(global.yoho.hbs({ |
24 | extname: '.hbs', | 21 | extname: '.hbs', |
25 | defaultLayout: 'layout', | 22 | defaultLayout: 'layout', |
26 | layoutsDir: doraemon, | 23 | layoutsDir: doraemon, |
27 | - partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 24 | + partialsDir: [`${doraemon}/partial`], |
25 | + views: path.join(__dirname, 'views/action'), | ||
28 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
29 | })); | 27 | })); |
30 | 28 |
@@ -11,7 +11,7 @@ const example = { | @@ -11,7 +11,7 @@ const example = { | ||
11 | * 示例页面 | 11 | * 示例页面 |
12 | */ | 12 | */ |
13 | index: (req, res) => { | 13 | index: (req, res) => { |
14 | - res.render('index', { | 14 | + res.render('eindex', { |
15 | module: 'example', | 15 | module: 'example', |
16 | page: 'home' | 16 | page: 'home' |
17 | }); | 17 | }); |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | const express = require('express'); | 7 | const express = require('express'); |
8 | const path = require('path'); | 8 | const path = require('path'); |
9 | -const hbs = require('express-handlebars'); | ||
10 | 9 | ||
11 | const app = express(); | 10 | const app = express(); |
12 | 11 | ||
@@ -18,12 +17,12 @@ app.on('mount', function(parent) { | @@ -18,12 +17,12 @@ app.on('mount', function(parent) { | ||
18 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
19 | }); | 18 | }); |
20 | 19 | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | -app.engine('.hbs', hbs({ | 20 | +app.use(global.yoho.hbs({ |
23 | extname: '.hbs', | 21 | extname: '.hbs', |
24 | defaultLayout: 'layout', | 22 | defaultLayout: 'layout', |
25 | layoutsDir: doraemon, | 23 | layoutsDir: doraemon, |
26 | - partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 24 | + partialsDir: [`${doraemon}/partial`], |
25 | + views: path.join(__dirname, 'views/action'), | ||
27 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
28 | })); | 27 | })); |
29 | 28 |
@@ -12,16 +12,7 @@ const helpers = global.yoho.helpers; | @@ -12,16 +12,7 @@ const helpers = global.yoho.helpers; | ||
12 | */ | 12 | */ |
13 | const component = { | 13 | const component = { |
14 | index: (req, res) => { | 14 | index: (req, res) => { |
15 | - const uid = req.user.uid; | ||
16 | - | ||
17 | - if (!uid && req.xhr) { | ||
18 | - return res.json({ | ||
19 | - code: 400, | ||
20 | - message: '抱歉,您暂未登录!' | ||
21 | - }); | ||
22 | - } | ||
23 | - | ||
24 | - res.render('index', { | 15 | + res.render('mindex', { |
25 | module: 'me', | 16 | module: 'me', |
26 | page: 'index' | 17 | page: 'index' |
27 | }); | 18 | }); |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | const express = require('express'); | 7 | const express = require('express'); |
8 | const path = require('path'); | 8 | const path = require('path'); |
9 | -const hbs = require('express-handlebars'); | ||
10 | 9 | ||
11 | const app = express(); | 10 | const app = express(); |
12 | 11 | ||
@@ -18,12 +17,12 @@ app.on('mount', function(parent) { | @@ -18,12 +17,12 @@ app.on('mount', function(parent) { | ||
18 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
19 | }); | 18 | }); |
20 | 19 | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | -app.engine('.hbs', hbs({ | 20 | +app.use(global.yoho.hbs({ |
23 | extname: '.hbs', | 21 | extname: '.hbs', |
24 | defaultLayout: 'layout', | 22 | defaultLayout: 'layout', |
25 | layoutsDir: doraemon, | 23 | layoutsDir: doraemon, |
26 | partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 24 | partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], |
25 | + views: path.join(__dirname, 'views/action'), | ||
27 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
28 | })); | 27 | })); |
29 | 28 |
@@ -22,7 +22,7 @@ const component = { | @@ -22,7 +22,7 @@ const component = { | ||
22 | goodsId = req.params[1], | 22 | goodsId = req.params[1], |
23 | cnAlphabet = req.params[2]; | 23 | cnAlphabet = req.params[2]; |
24 | 24 | ||
25 | - res.render('detail', { | 25 | + res.render('pdetail', { |
26 | module: 'product', | 26 | module: 'product', |
27 | page: 'detail', | 27 | page: 'detail', |
28 | pid: pid, | 28 | pid: pid, |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | const express = require('express'); | 7 | const express = require('express'); |
8 | const path = require('path'); | 8 | const path = require('path'); |
9 | -const hbs = require('express-handlebars'); | ||
10 | 9 | ||
11 | const app = express(); | 10 | const app = express(); |
12 | 11 | ||
@@ -18,12 +17,12 @@ app.on('mount', function(parent) { | @@ -18,12 +17,12 @@ app.on('mount', function(parent) { | ||
18 | Object.assign(app.locals, parent.locals); | 17 | Object.assign(app.locals, parent.locals); |
19 | }); | 18 | }); |
20 | 19 | ||
21 | -app.set('views', path.join(__dirname, 'views/action')); | ||
22 | -app.engine('.hbs', hbs({ | 20 | +app.use(global.yoho.hbs({ |
23 | extname: '.hbs', | 21 | extname: '.hbs', |
24 | defaultLayout: 'layout', | 22 | defaultLayout: 'layout', |
25 | layoutsDir: doraemon, | 23 | layoutsDir: doraemon, |
26 | - partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 24 | + partialsDir: [`${doraemon}/partial`], |
25 | + views: path.join(__dirname, 'views/action'), | ||
27 | helpers: global.yoho.helpers | 26 | helpers: global.yoho.helpers |
28 | })); | 27 | })); |
29 | 28 |
@@ -25,7 +25,6 @@ | @@ -25,7 +25,6 @@ | ||
25 | "connect-multiparty": "^2.0.0", | 25 | "connect-multiparty": "^2.0.0", |
26 | "cookie-parser": "^1.4.3", | 26 | "cookie-parser": "^1.4.3", |
27 | "express": "^4.14.0", | 27 | "express": "^4.14.0", |
28 | - "express-handlebars": "^3.0.0", | ||
29 | "express-session": "^1.14.1", | 28 | "express-session": "^1.14.1", |
30 | "influxdb-winston": "^1.0.1", | 29 | "influxdb-winston": "^1.0.1", |
31 | "lodash": "^4.15.0", | 30 | "lodash": "^4.15.0", |
-
Please register or login to post a comment