Authored by zhangxiaoru

微信公众号

... ... @@ -55,6 +55,10 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
contents.push(build);
joinContentFunc(++i, len);
} else if (art.weixinPublic) {
build.weixinPublic = art.weixinPublic;
contents.push(build);
joinContentFunc(++i, len);
} else if (art.goods && art.goods.data) { // 相关推荐
let reco = [],
skns = [],
... ... @@ -155,6 +159,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
joinContentFunc(0, articleContent.length);
});
}
/**
* [处理品牌数据]
* @param {[array]} getBrand [品牌原数据]
... ... @@ -285,6 +290,7 @@ const index = (req, res, next) => {
//生成内容部分
return _pageArticleContent(detail.getArticleContent, isApp, gender).then((contents) => {
guang.detail.content = contents;
// 相关品牌
if (detail.getBrand && detail.getBrand.length) {
guang.relatedBrand = _relatedBrand(detail.getBrand);
... ...
... ... @@ -5,6 +5,8 @@
*/
'use strict';
const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const _ = require('lodash');
const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/';
const URI_PACKAGE_AUTHOR = 'guang/service/v1/author/';
... ... @@ -82,6 +84,14 @@ const packageData = (id, isApp) => {
cache: true
}));
if (isApp) {
promises.push(api.get('', {
method: 'app.resources.getSingleTemplate',
module: 'wechat',
key: 'guang_detail_wechat'
}));
}
// 获取资讯相关的其它资讯
if (typeof article.tag !== 'undefined') {
param = {
... ... @@ -99,11 +109,29 @@ const packageData = (id, isApp) => {
}));
}
return Promise.all(promises).then(datas => {
let getArticleContent = datas[1].data;
if (datas[3].data) {
let preCount = 0;
let frontData = [];
let backData = [];
let i;
for(i = 0; i < getArticleContent.length; i++) {
if (getArticleContent[i].singleImage || getArticleContent[i].text || getArticleContent[i].smallPic) {
preCount++;
}
}
getArticleContent.splice(preCount, 0, {weixinPublic: datas[3].data});
}
result.getAuthor = datas[0].data;
result.getArticleContent = datas[1].data;
result.getArticleContent = getArticleContent;
result.getBrand = datas[2].data;
if (datas.length === 4) {
result.getOtherArticle = datas[3].data;
if (datas.length === 5) {
result.getOtherArticle = datas[4].data;
}
return result;
});
... ...
... ... @@ -39,6 +39,16 @@
</div>
{{/if}}
{{#if weixinPublic}}
<div class="weixin post-block">
{{#each weixinPublic}}
<a href='//m.yohobuy.com/?openby:yohobuy={"action":"go.copy","params":{"text":"{{wechat_id}}"}}' class="ems-cnpl">
<img class="weixin-img" src="{{image src 280 210 1}}">
</a>
{{/each}}
</div>
{{/if}}
{{#if collocation}}
<div class="post-block collocation-block">
<ul class="thumb-container">
... ...
... ... @@ -491,4 +491,27 @@
}
}
}
.weixin {
margin: 20px 0;
text-align: center;
padding: 0 20px;
.ems-cnpl {
width: 47.3%;
display: inline-block;
background: #ededed;
position: relative;
overflow: hidden;
.weixin-img {
width: 100%;
height: 100%;
}
}
a:nth-child(1) {
margin-right: 20px;
}
}
}
... ...