Authored by 郭成尧

top-fixed-tag

... ... @@ -205,21 +205,20 @@ class IndexModel extends global.yoho.BaseModel {
}
let infoList = _.get(result && result[2], 'data.list.artList', []);
let inf = []; // 资讯列表
let topList = _.get(result && result[2], 'data.list.artList', []); // 置顶文章
if (result && result[1] && result[1].data && result[1].data.list && result[1].data.list.artList) {
let inf = [];
infoList = _.concat(infoList, result[1].data.list.artList);
_.forEach(topList, value => {
inf.push(guangProcess.formatArticle(value, true, false, true, false, true));
});
infoList.forEach(val => {
inf.push(guangProcess.formatArticle(val, true, false, true));
});
let infoList = _.get(result && result[1], 'data.list.artList', []); // 普通文章
resu.guang.infos[curIndex].info = inf;
infoList.forEach(val => {
inf.push(guangProcess.formatArticle(val, true, false, true));
});
}
resu.guang.infos[curIndex].info = inf;
return resu;
... ...
... ... @@ -57,7 +57,7 @@
<div class="info-deps">
<a class="info-title-container" href="{{url}}">
<h2 class="info-title">{{title}}</h2>
<div class="title">{{#if top}}<span class="top-tag">置顶</span>{{/if}}{{title}}</div>
</a>
<p class="info-text">{{text}}</p>
{{> index/tvls}}
... ...
... ... @@ -113,11 +113,20 @@
color: #000;
}
.info-title {
.title {
line-height: 44px;
color: #000;
font-size: 20PX;
font-weight: bold;
.top-tag {
font-size: 18px;
color: #d0021b;
padding: 4px 16px;
border: 1px solid #d0021b;
border-radius: 4px;
margin-right: 20px;
}
}
.info-text {
... ...
... ... @@ -71,9 +71,10 @@ const getFilterUrl = (url) => {
* @param {Boolean} isApp [是否显示分享,在APP客户端里嵌入需要传url链接]
* @param {[Boolean]} showAuthor [控制是否显示作者信息]
* @param {[int]} uid [当前登录的用户ID]
* @param {[int]} top [是否是列表置顶文章]
* @return {[array | false]}
*/
const formatArticle = (articleData, showTag, isApp, showAuthor, uid) => {
const formatArticle = (articleData, showTag, isApp, showAuthor, uid, top) => {
// 资讯ID不存在,则不显示
if (!articleData.id) {
return false;
... ... @@ -186,6 +187,11 @@ const formatArticle = (articleData, showTag, isApp, showAuthor, uid) => {
});
}
// 170609 置顶
if (top) {
result.top = true;
}
return result;
};
... ...