Authored by zhangxiaoru

editorial

... ... @@ -13,19 +13,23 @@ const brand = require('../models/brand');
* @param res
*/
const index = (req, res, next) => {
let channel = req.yoho.channel || 'men';
let channel = req.cookies._Channel || 'men';
let contentCode = '';
let name = '';
let link = '';
if (channel === 'women') {
contentCode = '527079e6c46d0f125eb46b835968971b';
name = 'WOMEN首页';
link = 'http://www.yohoblk.com';
} else if (channel === 'lifestyle') {
contentCode = '94b5ed607b6d565ffc29c2c04be121dc';
name = 'LIFT STYLE首页';
link = 'http://www.yohoblk.com/women';
} else {
contentCode = '81886aaa5e82e3741bc1ba1e04ec7706';
name = 'MEN首页';
link = 'http://www.yohoblk.com/lifestyle';
}
let appType = 1;
... ... @@ -38,7 +42,7 @@ const index = (req, res, next) => {
brand: {
nav: [
{
link: 'www.yohobuy.com',
link: link,
pathTitle: '首页',
name: name
},
... ...
/**
* 下载
* @author: zxr
* @date: 2016/08/08
*/
'use strict';
const index = (req, res) => {
res.display('index', {
module: 'partial',
page: 'index',
title: 'Yoho!buy有货'
});
};
module.exports = {
index // 下载
};
... ...
/**
* sub app partial
* @author: zhangxiaoru<xiaoru.zhang@yoho.cn>
* @date: 2016/07/8
*/
'use strict';
var express = require('express'),
path = require('path'),
hbs = require('express-handlebars');
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
// var partials = path.join(__dirname, './views'); // parent view root
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.set('views', path.join(__dirname, 'views/action'));
app.engine('.hbs', hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
helpers: global.yoho.helpers
}));
// router
app.use(require('./router'));
module.exports = app;
... ...
/**
* 品牌一览
* @author: zxr
* @date: 2016/07/13
*/
'use strict';
... ...
/**
* router of sub app channel
* @author: zhangxiaoru<xiaoru.zhang@yoho.cn>
* @date: 2016/08/08
*/
'use strict';
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const download = require(cRoot + '/download');
router.get('/', download.index); // 下载页
module.exports = router;
... ...
<div class="download-page blk-page center-content">
<div class="down">
<div class="logo">
<div class="logo-img"></div>
<div class="logo-word">
<h3>YOHO!BLK</h3>
<span>i fancy,you like</span>
</div>
</div>
<div class="inphone"></div>
<div class="android"></div>
<div class="er">
<span>扫描二维码下载</span>
</div>
<div class="phone"></div>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -23,16 +23,20 @@ const index = (req, res, next) => {
let channel = req.cookies._Channel || 'women';
let gender = '';
let name = '';
let link = '';
if (channel === 'men') {
gender = '1,3';
name = 'MEN首页';
link = 'http://www.yohoblk.com';
} else if (channel === 'women') {
gender = '2,3';
name = 'WOMEN首页';
link = 'http://www.yohoblk.com/women';
} else {
gender = '3,3';
name = ' LIFESTYLE首页';
name = 'LIFESTYLE首页';
link = 'http://www.yohoblk.com/lifestyle';
}
editorialModel.getIndexData(pageNum, limit, appType, udid, gender).then((result) => {
... ... @@ -44,7 +48,7 @@ const index = (req, res, next) => {
editorial: {
nav: [
{
link: '/editorial?type=0',
link: link,
pathTitle: '首页',
name: name
},
... ... @@ -84,16 +88,20 @@ const list = (req, res) => {
let channel = req.cookies._Channel || 'men';
let gender = '';
let name = '';
let link = '';
if (channel === 'men') {
gender = '1,3';
name = 'MEN首页';
link = 'http://www.yohoblk.com';
} else if (channel === 'women') {
gender = '2,3';
name = 'WOMEN首页';
link = 'http://www.yohoblk.com/women';
} else {
gender = '3,3';
name = ' LIFESTYLE首页';
name = 'LIFESTYLE首页';
link = 'http://www.yohoblk.com/lifestyle';
}
editorialModel.getListData(pageNum, limit, tag, authorId, udid, gender).then((result) => {
... ... @@ -105,12 +113,12 @@ const list = (req, res) => {
editorialList: {
nav: [
{
link: '/editorial?type=0',
link: link,
pathTitle: '首页',
name: name
},
{
link: '/editorial?type=1',
link: 'http://www.yohoblk.com/editorial',
pathTitle: '资讯',
name: '资讯'
},
... ... @@ -145,21 +153,37 @@ const list = (req, res) => {
const detail = (req, res, next) => {
let id = req.params.id;
let appType = 1;
let uid = req.user.uid;
let udid = md5(req.ip);
let channel = req.cookies._Channel || 'men';
let name = '';
let link = '';
if (channel === 'men') {
name = 'MEN首页';
link = 'http://www.yohoblk.com';
} else if (channel === 'women') {
name = 'WOMEN首页';
link = 'http://www.yohoblk.com/women';
} else {
name = 'LIFESTYLE首页';
link = 'http://www.yohoblk.com/lifestyle';
}
editorialModel.getDetailData(id, appType).then((result) => {
editorialModel.getDetailData(id, uid, udid, appType).then((result) => {
res.display('detail', {
module: 'editorial',
page: 'detail',
title: '资讯详情',
title: result.head.title,
editorialDetail: {
nav: [
{
link: '#',
link: link,
pathTitle: '首页',
name: 'MEN首页'
name: name
},
{
link: '/editorial?type=1',
link: 'http://www.yohoblk.com/editorial',
pathTitle: '资讯',
name: '资讯'
},
... ...
... ... @@ -160,7 +160,7 @@ const _processHeadData = (list) => {
click: data.viewNum,
time: data.publishTime,
isLike: data.isPraise,
isFavor: data.isFavor,
isCollected: data.isFavor,
likeNum: data.praiseNum,
weixinUrl: `http://guang.m.yohobuy.com/info/index?id=${data.id}`
};
... ... @@ -340,9 +340,11 @@ const _processContentData = (list) => {
* @param id
* @returns {*}
*/
const _getHeadData = (id, appType) => {
const _getHeadData = (id, uid, udid, appType) => {
return serviceAPI.get('/guang/api/*/article/getArticleBaseInfo', {
id: id,
uid: uid,
udid: udid,
app_type: appType
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -611,9 +613,9 @@ const shareData = () => {
* @param id
* @returns {*}
*/
const getDetailData = (id, appType) => {
const getDetailData = (id, uid, udid, appType) => {
return co(function *() {
let result = yield Promise.all([_getHeadData(id, appType),
let result = yield Promise.all([_getHeadData(id, uid, udid, appType),
_getArticleData(id),
_getContentData(id),
_getCommentsData(id),
... ...
... ... @@ -20,4 +20,5 @@ module.exports = app => {
app.use('/product', require('./apps/product'));
app.use('/brand', require('./apps/brand')); // 品牌
app.use('/help', require('./apps/help')); // 帮助中心
app.use('/download', require('./apps/download')); // 下载
};
... ...
.download-page {
width: 1150px;
margin: 0 auto;
.down {
margin-top: 10px;
height: 495px;
overflow: hidden;
margin-bottom: 85px;
background-image: resolve('download/down-background.png');
position: relative;
}
.logo {
margin-top: 140px;
overflow: hidden;
}
.logo-img {
width: 146px;
height: 146px;
border-radius: 20px;
float: left;
margin-left: 70px;
background-image: resolve('download/logo.png');
}
.logo-word {
margin-top: 25px;
display: block;
float: left;
margin-left: 15px;
color: #fff;
h3 {
font-size: 29px;
display: block;
height: 50px;
line-height: 50px;
}
span {
font-size: 16px;
display: block;
height: 40px;
line-height: 40px;
}
}
.inphone {
margin-left: 70px;
margin-top: 25px;
width: 153px;
height: 45px;
background-image: resolve('download/iphone.png');
float: left;
}
.android {
margin-left: 15px;
margin-top: 25px;
width: 168px;
height: 45px;
background-image: resolve('download/android.png');
float: left;
}
.er {
width: 167px;
height: 205px;
background: resolve('download/er.png') no-repeat top;
position: absolute;
top: 150px;
left: 450px;
span {
margin-top: 160px;
height: 40px;
line-height: 40px;
background: #fff;
text-align: center;
width: 165px;
display: block;
}
}
.phone {
width: 344px;
height: 458px;
background-image: resolve('download/phone.png');
position: absolute;
top: 34px;
left: 743px;
}
}
... ...
... ... @@ -14,3 +14,4 @@
@import "editorial/index";
@import "brand/brand";
@import "help/index";
@import "download/download";
... ...