ps.js
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* plus/star页控制器文件
* @author: xuqi(qi.xu@yoho.cn)
* @date: 2015/4/15
*/
var data = require('../../public/js/data'),
ps = data('ps'),
list = data('ps-list'),
path = require('path'),
fs = require('fs'),
tplPath = path.normalize(path.join(__dirname, '../partials/ps/info-item.html'));
exports.show = function(req, res) {
res.render('pages/ps', {
data: ps,
layout: '../layouts/layout',
isPs: true,
isLogin: 'Y'
});
};
exports.readTpl = function(req, res) {
fs.readFile(tplPath, 'utf8', function(err, data) {
if (err) {
res.send({success: false});
}
fs.readFile(
path.normalize(path.join(__dirname, '../partials/common/time-view-like-share.html')),
'utf8', function(err, subData) {
if (err) {
res.send({success: false});
}
data = data.replace('{{> common/time_view_like_share}}', subData); //Note: 后端需将partials目录替换为内容
res.send(data);
});
});
};
exports.list = function(req, res) {
res.render('pages/ps-list', {
data: list,
layout: '../layouts/layout',
isPsList: true
});
};