Authored by ccbikai

live 增加资源位

@@ -10,7 +10,8 @@ exports.index = (req, res, next) => { @@ -10,7 +10,8 @@ exports.index = (req, res, next) => {
10 best: result[0].data, 10 best: result[0].data,
11 living: result[1].data, 11 living: result[1].data,
12 pre: result[2].data, 12 pre: result[2].data,
13 - record: result[3].data 13 + record: result[3].data,
  14 + constent: result[4]
14 }); 15 });
15 }).catch(next); 16 }).catch(next);
16 }; 17 };
@@ -21,7 +22,7 @@ const status = { @@ -21,7 +22,7 @@ const status = {
21 end: 2 22 end: 2
22 }; 23 };
23 24
24 -exports.main = (req, res, next) => { 25 +exports.main = (req, res) => {
25 res.locals.module = 'activity'; 26 res.locals.module = 'activity';
26 res.locals.page = 'live-play'; 27 res.locals.page = 'live-play';
27 28
1 'use strict'; 1 'use strict';
2 -var api = global.yoho.ServiceAPI; 2 +const api = global.yoho.ServiceAPI;
  3 +const contentCodeConfig = require('../../../config/content-code');
  4 +const resourcesProcess = require(`${global.utils}/resources-process`);
3 5
4 // 格式化时间戳,b用来区别两种不同的显示 6 // 格式化时间戳,b用来区别两种不同的显示
5 const _formatTime = (a, b) => { 7 const _formatTime = (a, b) => {
@@ -42,6 +44,18 @@ const _getBestList = () => { @@ -42,6 +44,18 @@ const _getBestList = () => {
42 }); 44 });
43 }; 45 };
44 46
  47 +// 获取顶部bannel
  48 +let _getBannerData = () => {
  49 + return api.get('operations/api/v5/resource/get', {
  50 + content_code: contentCodeConfig.live.index
  51 + }, {
  52 + code: 200,
  53 + cache: true
  54 + }).then((result) => {
  55 + return result.data ? resourcesProcess(result.data) : [];
  56 + });
  57 +};
  58 +
45 // 获取直播中所有视频 59 // 获取直播中所有视频
46 const _getLivingList = () => { 60 const _getLivingList = () => {
47 return api.get('v1/living/listing', {}, true); 61 return api.get('v1/living/listing', {}, true);
@@ -66,7 +80,7 @@ const _getRecordList = () => { @@ -66,7 +80,7 @@ const _getRecordList = () => {
66 80
67 // 返回所有数据 81 // 返回所有数据
68 const getAllList = () => { 82 const getAllList = () => {
69 - return Promise.all([_getBestList(), _getLivingList(), _getPrelivingList(), _getRecordList()]); 83 + return Promise.all([_getBestList(), _getLivingList(), _getPrelivingList(), _getRecordList(), _getBannerData()]);
70 }; 84 };
71 85
72 // 处理直播时间 86 // 处理直播时间
1 -<div class="yoho-live"> 1 +<div class="yoho-live yoho-page">
  2 + {{#content}}
  3 + {{! 头部banner}}
  4 + {{> resources/banner-top}}
  5 + {{/content}}
  6 +
2 <div class="live-rec"> 7 <div class="live-rec">
3 {{#best}} 8 {{#best}}
4 <div class="rec-child"> 9 <div class="rec-child">
@@ -19,7 +24,7 @@ @@ -19,7 +24,7 @@
19 <p class="rec-tag">{{title}}</p> 24 <p class="rec-tag">{{title}}</p>
20 </div> 25 </div>
21 </div> 26 </div>
22 - 27 +
23 </div> 28 </div>
24 {{/best}} 29 {{/best}}
25 </div> 30 </div>
@@ -47,7 +52,7 @@ @@ -47,7 +52,7 @@
47 </section> 52 </section>
48 </div> 53 </div>
49 {{/living}} 54 {{/living}}
50 - 55 +
51 {{#if pre}} 56 {{#if pre}}
52 <div class="live-list"> 57 <div class="live-list">
53 <h2 class="title">直播预告</h2> 58 <h2 class="title">直播预告</h2>
@@ -77,4 +77,4 @@ @@ -77,4 +77,4 @@
77 77
78 <div class="share-tag"><img src="//static.yohobuy.com/m/v1/img/invite/yd_share.png"></div> 78 <div class="share-tag"><img src="//static.yohobuy.com/m/v1/img/invite/yd_share.png"></div>
79 </div> 79 </div>
80 -</div><!--/invite-page-->  
  80 +</div><!--/invite-page-->
@@ -48,10 +48,15 @@ const bottomBannerContentCode = { @@ -48,10 +48,15 @@ const bottomBannerContentCode = {
48 48
49 const outletContentCode = 'c19ffa03f053f4cac3690b22c8da26b7'; 49 const outletContentCode = 'c19ffa03f053f4cac3690b22c8da26b7';
50 50
  51 +const liveContentCode = {
  52 + index: 'ed0c21df811e4d0cb9993815646df482'
  53 +};
  54 +
51 module.exports = { 55 module.exports = {
52 sale: saleContentCode, 56 sale: saleContentCode,
53 outlet: outletContentCode, 57 outlet: outletContentCode,
54 channel: channelContentCode, 58 channel: channelContentCode,
55 bottom: bottomBannerContentCode, 59 bottom: bottomBannerContentCode,
56 - guang: guangContentCode 60 + guang: guangContentCode,
  61 + live: liveContentCode
57 }; 62 };
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 }, 60 },
61 "devDependencies": { 61 "devDependencies": {
62 "autoprefixer": "^6.3.7", 62 "autoprefixer": "^6.3.7",
63 - "ava": "^0.15.2", 63 + "ava": "^0.16.0",
64 "babel-preset-es2015": "^6.9.0", 64 "babel-preset-es2015": "^6.9.0",
65 "babel-register": "^6.9.0", 65 "babel-register": "^6.9.0",
66 "eslint": "^3.0.1", 66 "eslint": "^3.0.1",
@@ -72,8 +72,8 @@ @@ -72,8 +72,8 @@
72 "gulp-sourcemaps": "^2.0.0-alpha", 72 "gulp-sourcemaps": "^2.0.0-alpha",
73 "gulp-util": "^3.0.7", 73 "gulp-util": "^3.0.7",
74 "husky": "^0.11.4", 74 "husky": "^0.11.4",
75 - "nodemon": "1.9.2",  
76 - "nyc": "^6.6.1", 75 + "nodemon": "^1.10.0",
  76 + "nyc": "^8.1.0",
77 "postcss-assets": "^4.0.1", 77 "postcss-assets": "^4.0.1",
78 "postcss-cachebuster": "^0.1.3", 78 "postcss-cachebuster": "^0.1.3",
79 "postcss-calc": "^5.2.1", 79 "postcss-calc": "^5.2.1",
@@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
89 "rewire": "^2.5.2", 89 "rewire": "^2.5.2",
90 "shelljs": "^0.7.0", 90 "shelljs": "^0.7.0",
91 "stylelint": "^7.1.0", 91 "stylelint": "^7.1.0",
92 - "stylelint-config-yoho": "^1.2.6", 92 + "stylelint-config-yoho": "^1.2.7",
93 "webpack": "^1.13.1", 93 "webpack": "^1.13.1",
94 "webpack-dev-server": "^1.14.1", 94 "webpack-dev-server": "^1.14.1",
95 "webpack-stream": "^3.1.0", 95 "webpack-stream": "^3.1.0",
@@ -100,7 +100,6 @@ @@ -100,7 +100,6 @@
100 "yoho-jquery": "^2.2.4", 100 "yoho-jquery": "^2.2.4",
101 "yoho-jquery-lazyload": "^1.9.7", 101 "yoho-jquery-lazyload": "^1.9.7",
102 "yoho-mlellipsis": "0.0.3", 102 "yoho-mlellipsis": "0.0.3",
103 - "yoho-node-lib": "0.0.32",  
104 "yoho-swiper": "^3.3.1" 103 "yoho-swiper": "^3.3.1"
105 } 104 }
106 } 105 }