Authored by zhangxiaoru

editorial

@@ -13,19 +13,23 @@ const brand = require('../models/brand'); @@ -13,19 +13,23 @@ const brand = require('../models/brand');
13 * @param res 13 * @param res
14 */ 14 */
15 const index = (req, res, next) => { 15 const index = (req, res, next) => {
16 - let channel = req.yoho.channel || 'men'; 16 + let channel = req.cookies._Channel || 'men';
17 let contentCode = ''; 17 let contentCode = '';
18 let name = ''; 18 let name = '';
  19 + let link = '';
19 20
20 if (channel === 'women') { 21 if (channel === 'women') {
21 contentCode = '527079e6c46d0f125eb46b835968971b'; 22 contentCode = '527079e6c46d0f125eb46b835968971b';
22 name = 'WOMEN首页'; 23 name = 'WOMEN首页';
  24 + link = 'http://www.yohoblk.com';
23 } else if (channel === 'lifestyle') { 25 } else if (channel === 'lifestyle') {
24 contentCode = '94b5ed607b6d565ffc29c2c04be121dc'; 26 contentCode = '94b5ed607b6d565ffc29c2c04be121dc';
25 name = 'LIFT STYLE首页'; 27 name = 'LIFT STYLE首页';
  28 + link = 'http://www.yohoblk.com/women';
26 } else { 29 } else {
27 contentCode = '81886aaa5e82e3741bc1ba1e04ec7706'; 30 contentCode = '81886aaa5e82e3741bc1ba1e04ec7706';
28 name = 'MEN首页'; 31 name = 'MEN首页';
  32 + link = 'http://www.yohoblk.com/lifestyle';
29 } 33 }
30 34
31 let appType = 1; 35 let appType = 1;
@@ -38,7 +42,7 @@ const index = (req, res, next) => { @@ -38,7 +42,7 @@ const index = (req, res, next) => {
38 brand: { 42 brand: {
39 nav: [ 43 nav: [
40 { 44 {
41 - link: 'www.yohobuy.com', 45 + link: link,
42 pathTitle: '首页', 46 pathTitle: '首页',
43 name: name 47 name: name
44 }, 48 },
  1 +/**
  2 + * 下载
  3 + * @author: zxr
  4 + * @date: 2016/08/08
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +const index = (req, res) => {
  10 +
  11 + res.display('index', {
  12 + module: 'partial',
  13 + page: 'index',
  14 + title: 'Yoho!buy有货'
  15 + });
  16 +};
  17 +
  18 +module.exports = {
  19 + index // 下载
  20 +};
  1 +/**
  2 + * sub app partial
  3 + * @author: zhangxiaoru<xiaoru.zhang@yoho.cn>
  4 + * @date: 2016/07/8
  5 + */
  6 +'use strict';
  7 +var express = require('express'),
  8 + path = require('path'),
  9 + hbs = require('express-handlebars');
  10 +
  11 +var app = express();
  12 +
  13 +// set view engin
  14 +var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
  15 +// var partials = path.join(__dirname, './views'); // parent view root
  16 +
  17 +app.on('mount', function(parent) {
  18 + delete parent.locals.settings; // 不继承父 App 的设置
  19 + Object.assign(app.locals, parent.locals);
  20 +});
  21 +
  22 +app.set('views', path.join(__dirname, 'views/action'));
  23 +app.engine('.hbs', hbs({
  24 + extname: '.hbs',
  25 + defaultLayout: 'layout',
  26 + layoutsDir: doraemon,
  27 + partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
  28 + helpers: global.yoho.helpers
  29 +}));
  30 +
  31 +// router
  32 +app.use(require('./router'));
  33 +
  34 +module.exports = app;
  1 +/**
  2 + * 品牌一览
  3 + * @author: zxr
  4 + * @date: 2016/07/13
  5 + */
  6 +
  7 +'use strict';
  8 +
  1 +/**
  2 + * router of sub app channel
  3 + * @author: zhangxiaoru<xiaoru.zhang@yoho.cn>
  4 + * @date: 2016/08/08
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +const router = require('express').Router(); // eslint-disable-line
  10 +const cRoot = './controllers';
  11 +const download = require(cRoot + '/download');
  12 +
  13 +router.get('/', download.index); // 下载页
  14 +
  15 +module.exports = router;
  1 +<div class="download-page blk-page center-content">
  2 +
  3 + <div class="down">
  4 + <div class="logo">
  5 + <div class="logo-img"></div>
  6 + <div class="logo-word">
  7 + <h3>YOHO!BLK</h3>
  8 + <span>i fancy,you like</span>
  9 + </div>
  10 + </div>
  11 +
  12 + <div class="inphone"></div>
  13 + <div class="android"></div>
  14 +
  15 + <div class="er">
  16 + <span>扫描二维码下载</span>
  17 + </div>
  18 +
  19 + <div class="phone"></div>
  20 +
  21 + </div>
  22 +
  23 +</div>
@@ -23,16 +23,20 @@ const index = (req, res, next) => { @@ -23,16 +23,20 @@ const index = (req, res, next) => {
23 let channel = req.cookies._Channel || 'women'; 23 let channel = req.cookies._Channel || 'women';
24 let gender = ''; 24 let gender = '';
25 let name = ''; 25 let name = '';
  26 + let link = '';
26 27
27 if (channel === 'men') { 28 if (channel === 'men') {
28 gender = '1,3'; 29 gender = '1,3';
29 name = 'MEN首页'; 30 name = 'MEN首页';
  31 + link = 'http://www.yohoblk.com';
30 } else if (channel === 'women') { 32 } else if (channel === 'women') {
31 gender = '2,3'; 33 gender = '2,3';
32 name = 'WOMEN首页'; 34 name = 'WOMEN首页';
  35 + link = 'http://www.yohoblk.com/women';
33 } else { 36 } else {
34 gender = '3,3'; 37 gender = '3,3';
35 - name = ' LIFESTYLE首页'; 38 + name = 'LIFESTYLE首页';
  39 + link = 'http://www.yohoblk.com/lifestyle';
36 } 40 }
37 41
38 editorialModel.getIndexData(pageNum, limit, appType, udid, gender).then((result) => { 42 editorialModel.getIndexData(pageNum, limit, appType, udid, gender).then((result) => {
@@ -44,7 +48,7 @@ const index = (req, res, next) => { @@ -44,7 +48,7 @@ const index = (req, res, next) => {
44 editorial: { 48 editorial: {
45 nav: [ 49 nav: [
46 { 50 {
47 - link: '/editorial?type=0', 51 + link: link,
48 pathTitle: '首页', 52 pathTitle: '首页',
49 name: name 53 name: name
50 }, 54 },
@@ -84,16 +88,20 @@ const list = (req, res) => { @@ -84,16 +88,20 @@ const list = (req, res) => {
84 let channel = req.cookies._Channel || 'men'; 88 let channel = req.cookies._Channel || 'men';
85 let gender = ''; 89 let gender = '';
86 let name = ''; 90 let name = '';
  91 + let link = '';
87 92
88 if (channel === 'men') { 93 if (channel === 'men') {
89 gender = '1,3'; 94 gender = '1,3';
90 name = 'MEN首页'; 95 name = 'MEN首页';
  96 + link = 'http://www.yohoblk.com';
91 } else if (channel === 'women') { 97 } else if (channel === 'women') {
92 gender = '2,3'; 98 gender = '2,3';
93 name = 'WOMEN首页'; 99 name = 'WOMEN首页';
  100 + link = 'http://www.yohoblk.com/women';
94 } else { 101 } else {
95 gender = '3,3'; 102 gender = '3,3';
96 - name = ' LIFESTYLE首页'; 103 + name = 'LIFESTYLE首页';
  104 + link = 'http://www.yohoblk.com/lifestyle';
97 } 105 }
98 106
99 editorialModel.getListData(pageNum, limit, tag, authorId, udid, gender).then((result) => { 107 editorialModel.getListData(pageNum, limit, tag, authorId, udid, gender).then((result) => {
@@ -105,12 +113,12 @@ const list = (req, res) => { @@ -105,12 +113,12 @@ const list = (req, res) => {
105 editorialList: { 113 editorialList: {
106 nav: [ 114 nav: [
107 { 115 {
108 - link: '/editorial?type=0', 116 + link: link,
109 pathTitle: '首页', 117 pathTitle: '首页',
110 name: name 118 name: name
111 }, 119 },
112 { 120 {
113 - link: '/editorial?type=1', 121 + link: 'http://www.yohoblk.com/editorial',
114 pathTitle: '资讯', 122 pathTitle: '资讯',
115 name: '资讯' 123 name: '资讯'
116 }, 124 },
@@ -145,21 +153,37 @@ const list = (req, res) => { @@ -145,21 +153,37 @@ const list = (req, res) => {
145 const detail = (req, res, next) => { 153 const detail = (req, res, next) => {
146 let id = req.params.id; 154 let id = req.params.id;
147 let appType = 1; 155 let appType = 1;
  156 + let uid = req.user.uid;
  157 + let udid = md5(req.ip);
  158 + let channel = req.cookies._Channel || 'men';
  159 + let name = '';
  160 + let link = '';
  161 +
  162 + if (channel === 'men') {
  163 + name = 'MEN首页';
  164 + link = 'http://www.yohoblk.com';
  165 + } else if (channel === 'women') {
  166 + name = 'WOMEN首页';
  167 + link = 'http://www.yohoblk.com/women';
  168 + } else {
  169 + name = 'LIFESTYLE首页';
  170 + link = 'http://www.yohoblk.com/lifestyle';
  171 + }
148 172
149 - editorialModel.getDetailData(id, appType).then((result) => { 173 + editorialModel.getDetailData(id, uid, udid, appType).then((result) => {
150 res.display('detail', { 174 res.display('detail', {
151 module: 'editorial', 175 module: 'editorial',
152 page: 'detail', 176 page: 'detail',
153 - title: '资讯详情', 177 + title: result.head.title,
154 editorialDetail: { 178 editorialDetail: {
155 nav: [ 179 nav: [
156 { 180 {
157 - link: '#', 181 + link: link,
158 pathTitle: '首页', 182 pathTitle: '首页',
159 - name: 'MEN首页' 183 + name: name
160 }, 184 },
161 { 185 {
162 - link: '/editorial?type=1', 186 + link: 'http://www.yohoblk.com/editorial',
163 pathTitle: '资讯', 187 pathTitle: '资讯',
164 name: '资讯' 188 name: '资讯'
165 }, 189 },
@@ -160,7 +160,7 @@ const _processHeadData = (list) => { @@ -160,7 +160,7 @@ const _processHeadData = (list) => {
160 click: data.viewNum, 160 click: data.viewNum,
161 time: data.publishTime, 161 time: data.publishTime,
162 isLike: data.isPraise, 162 isLike: data.isPraise,
163 - isFavor: data.isFavor, 163 + isCollected: data.isFavor,
164 likeNum: data.praiseNum, 164 likeNum: data.praiseNum,
165 weixinUrl: `http://guang.m.yohobuy.com/info/index?id=${data.id}` 165 weixinUrl: `http://guang.m.yohobuy.com/info/index?id=${data.id}`
166 }; 166 };
@@ -340,9 +340,11 @@ const _processContentData = (list) => { @@ -340,9 +340,11 @@ const _processContentData = (list) => {
340 * @param id 340 * @param id
341 * @returns {*} 341 * @returns {*}
342 */ 342 */
343 -const _getHeadData = (id, appType) => { 343 +const _getHeadData = (id, uid, udid, appType) => {
344 return serviceAPI.get('/guang/api/*/article/getArticleBaseInfo', { 344 return serviceAPI.get('/guang/api/*/article/getArticleBaseInfo', {
345 id: id, 345 id: id,
  346 + uid: uid,
  347 + udid: udid,
346 app_type: appType 348 app_type: appType
347 }).then((result) => { 349 }).then((result) => {
348 if (result && result.code === 200) { 350 if (result && result.code === 200) {
@@ -611,9 +613,9 @@ const shareData = () => { @@ -611,9 +613,9 @@ const shareData = () => {
611 * @param id 613 * @param id
612 * @returns {*} 614 * @returns {*}
613 */ 615 */
614 -const getDetailData = (id, appType) => { 616 +const getDetailData = (id, uid, udid, appType) => {
615 return co(function *() { 617 return co(function *() {
616 - let result = yield Promise.all([_getHeadData(id, appType), 618 + let result = yield Promise.all([_getHeadData(id, uid, udid, appType),
617 _getArticleData(id), 619 _getArticleData(id),
618 _getContentData(id), 620 _getContentData(id),
619 _getCommentsData(id), 621 _getCommentsData(id),
@@ -20,4 +20,5 @@ module.exports = app => { @@ -20,4 +20,5 @@ module.exports = app => {
20 app.use('/product', require('./apps/product')); 20 app.use('/product', require('./apps/product'));
21 app.use('/brand', require('./apps/brand')); // 品牌 21 app.use('/brand', require('./apps/brand')); // 品牌
22 app.use('/help', require('./apps/help')); // 帮助中心 22 app.use('/help', require('./apps/help')); // 帮助中心
  23 + app.use('/download', require('./apps/download')); // 下载
23 }; 24 };
  1 +.download-page {
  2 + width: 1150px;
  3 + margin: 0 auto;
  4 +
  5 + .down {
  6 + margin-top: 10px;
  7 + height: 495px;
  8 + overflow: hidden;
  9 + margin-bottom: 85px;
  10 + background-image: resolve('download/down-background.png');
  11 + position: relative;
  12 + }
  13 +
  14 + .logo {
  15 + margin-top: 140px;
  16 + overflow: hidden;
  17 + }
  18 +
  19 + .logo-img {
  20 + width: 146px;
  21 + height: 146px;
  22 + border-radius: 20px;
  23 + float: left;
  24 + margin-left: 70px;
  25 + background-image: resolve('download/logo.png');
  26 + }
  27 +
  28 + .logo-word {
  29 + margin-top: 25px;
  30 + display: block;
  31 + float: left;
  32 + margin-left: 15px;
  33 + color: #fff;
  34 +
  35 + h3 {
  36 + font-size: 29px;
  37 + display: block;
  38 + height: 50px;
  39 + line-height: 50px;
  40 + }
  41 +
  42 + span {
  43 + font-size: 16px;
  44 + display: block;
  45 + height: 40px;
  46 + line-height: 40px;
  47 + }
  48 + }
  49 +
  50 + .inphone {
  51 + margin-left: 70px;
  52 + margin-top: 25px;
  53 + width: 153px;
  54 + height: 45px;
  55 + background-image: resolve('download/iphone.png');
  56 + float: left;
  57 + }
  58 +
  59 + .android {
  60 + margin-left: 15px;
  61 + margin-top: 25px;
  62 + width: 168px;
  63 + height: 45px;
  64 + background-image: resolve('download/android.png');
  65 + float: left;
  66 + }
  67 +
  68 + .er {
  69 + width: 167px;
  70 + height: 205px;
  71 + background: resolve('download/er.png') no-repeat top;
  72 + position: absolute;
  73 + top: 150px;
  74 + left: 450px;
  75 +
  76 + span {
  77 + margin-top: 160px;
  78 + height: 40px;
  79 + line-height: 40px;
  80 + background: #fff;
  81 + text-align: center;
  82 + width: 165px;
  83 + display: block;
  84 + }
  85 + }
  86 +
  87 + .phone {
  88 + width: 344px;
  89 + height: 458px;
  90 + background-image: resolve('download/phone.png');
  91 + position: absolute;
  92 + top: 34px;
  93 + left: 743px;
  94 + }
  95 +}
@@ -14,3 +14,4 @@ @@ -14,3 +14,4 @@
14 @import "editorial/index"; 14 @import "editorial/index";
15 @import "brand/brand"; 15 @import "brand/brand";
16 @import "help/index"; 16 @import "help/index";
  17 +@import "download/download";