feat(新闻列表): 添加概念和行业标签展示并更新API端点
在RankList组件中添加概念标签和行业标签的展示区域,使用不同样式区分两种标签。同时更新新闻API端点从"/top_news_h5_d"改为"/top_news_release_h5_all"以获取更多数据。 修改watch逻辑,将返回数据中的concept_label和industry_label字段解析为数组格式并合并到列表项中。
This commit is contained in:
parent
cabde71e62
commit
f9bd02af3c
|
|
@ -17,7 +17,8 @@ export const getConceptCount = (data: any) => {
|
||||||
|
|
||||||
// 概念标签贴标
|
// 概念标签贴标
|
||||||
export const getTopNews = (data: any) => {
|
export const getTopNews = (data: any) => {
|
||||||
return request.get("/top_news_h5_d", data);
|
// return request.get("/top_news_h5_d", data);
|
||||||
|
return request.get("/top_news_release_h5_all", data);
|
||||||
};
|
};
|
||||||
// 概念标签贴标
|
// 概念标签贴标
|
||||||
export const getTopNewsAll = (data: any) => {
|
export const getTopNewsAll = (data: any) => {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,27 @@
|
||||||
<view class="news-content" :style="{ filter: Session.get('token') ? '' : 'blur(5px)' }">
|
<view class="news-content" :style="{ filter: Session.get('token') ? '' : 'blur(5px)' }">
|
||||||
<text class="news-title">{{ item.title }}</text>
|
<text class="news-title">{{ item.title }}</text>
|
||||||
<text class="news-desc">{{ item.summary }}</text>
|
<text class="news-desc">{{ item.summary }}</text>
|
||||||
|
|
||||||
|
<!-- 两个标签 start -->
|
||||||
|
<view class="r_r_tags">
|
||||||
|
<view style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 95vw">
|
||||||
|
<view class="r_tags">
|
||||||
|
<view class="tag" style="background-color: #fff9ec; color: #ffb100" v-for="(item, index) in item.conceptLabels" :key="index">{{
|
||||||
|
item
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="display: flex; margin-top: 20rpx; overflow-x: auto; width: 100vw">
|
||||||
|
<view class="r_tags">
|
||||||
|
<view class="tag" style="background-color: #f5f8fe; color: #007aff" v-for="(item, index) in item.industryLabels" :key="index">{{
|
||||||
|
item
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 两个标签 end -->
|
||||||
|
|
||||||
<view class="news-meta">
|
<view class="news-meta">
|
||||||
<view>
|
<view>
|
||||||
<text class="source">{{ item.source }}</text>
|
<text class="source">{{ item.source }}</text>
|
||||||
|
|
@ -67,7 +88,11 @@ watch(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rankListLocal.value.push(item);
|
rankListLocal.value.push({
|
||||||
|
...item,
|
||||||
|
conceptLabels: JSON.parse(item.concept_label),
|
||||||
|
industryLabels: JSON.parse(item.industry_label),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|
@ -86,7 +111,11 @@ watch(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rankListLocal.value.push(item);
|
rankListLocal.value.push({
|
||||||
|
...item,
|
||||||
|
conceptLabels: JSON.parse(item.concept_label),
|
||||||
|
industryLabels: JSON.parse(item.industry_label),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
@ -267,4 +296,27 @@ const handlePopupErrorCallback = () => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10rpx;
|
gap: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.r_r_tags {
|
||||||
|
// margin-left: 20rpx;
|
||||||
|
width: 85vw;
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.r_tags {
|
||||||
|
display: flex;
|
||||||
|
gap: 10rpx;
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
font-family: PingFangSC, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #3f80fa;
|
||||||
|
|
||||||
|
padding: 5rpx 20rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue