Authored by 郝肖肖

'news-样式调整'

... ... @@ -54,6 +54,34 @@ module.exports = class extends global.yoho.BaseModel {
return {pathNav: pathNav};
}
_formatArticle(rdata) {
let list = _.get(rdata, 'data.content', []);
let total = _.get(rdata, 'data.total', 0);
let lresult = {};
let width = 360;
let height = 240;
let result = _.map(list, (articleData) => {
articleData.image += '?imageView2/{mode}/w/{width}/h/{height}';
lresult = {
id: articleData.id,
classification: _.get(articleData, 'min_category_name', '') || _.get(articleData, 'category_name', ''),
url: helpers.urlFormat(`/news/${articleData.id}_${articleData.cid}.html`),
img: helpers.image(articleData.image, width, height, 1),
title: articleData.title,
pTime: articleData.update_time,
pView: articleData.views_num,
content: articleData.summary,
isVideo: articleData.videoUrl ? true : false
};
return lresult;
});
return {msgs: result, total: total};
}
getIndexList(channel, param) {
let params = {
type: 'wechat',
... ... @@ -68,6 +96,9 @@ module.exports = class extends global.yoho.BaseModel {
return Promise.all(apiMethod).then(result => {
let responseData = {};
// 列表数据
Object.assign(responseData, this._formatArticle(result[1]));
// 导航pathNav
Object.assign(responseData, this.getPathNav(channel));
... ...
<div class="msg-content clearfix" data-id="{{id}}">
<div class="msg-img">
<div class="classification">
{{classification}}
</div>
<div class="type-icon fashion-man"></div>
{{#if classification}}
<div class="classification">
{{classification}}
</div>
<div class="type-icon fashion-man"></div>
{{/if}}
<a href="{{url}}" target="_blank">
<img class="lazy{{#if isSquareImg}} square{{/if}}" data-original="{{image2 img}}">
{{#if isVideo}}<i class="video-icon"></i>{{/if}}
... ... @@ -25,6 +27,7 @@
</span>
</p>
<p class="content">{{content}}</p>
{{!----
<div class="footer">
<div class="tags">
{{# tags}}
... ... @@ -44,5 +47,6 @@
</span>
</div>
</div>
----}}
</div>
</div>
... ...
... ... @@ -141,8 +141,9 @@
position: relative;
.content {
height: 80px;
height: 125px;
line-height: 24px;
overflow: hidden;
}
.iconfont {
... ...