feat(资讯排行): 添加按日获取头条资讯功能并优化列表展示
- 在newsInfo.ts中新增getTopNewsDay接口用于获取每日头条资讯 - 修改rank.vue使用新接口并简化模板代码 - 移除冗余的模板逻辑,保持代码简洁
This commit is contained in:
parent
f91fc47e2a
commit
69fffec976
|
|
@ -15,6 +15,12 @@ export const getConceptCount = (data: any) => {
|
|||
return request.get("/news_info/concept/count", data);
|
||||
};
|
||||
|
||||
// 概念标签贴标
|
||||
export const getTopNewsDay = (data: any) => {
|
||||
// return request.get("/top_news_h5_period?start_date=" + data.start_date + "&end_date=" + data.end_date + "&limit_num=" + data.limit_num, data);
|
||||
return request.get("/top_news_h5_d", data);
|
||||
};
|
||||
|
||||
// 概念标签贴标
|
||||
export const getTopNews = (data: any) => {
|
||||
return request.get("/top_news_h5_period?start_date=" + data.start_date + "&end_date=" + data.end_date + "&limit_num=" + data.limit_num, data);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@
|
|||
<view class="pc_all">
|
||||
<PageTop></PageTop>
|
||||
|
||||
<view
|
||||
class="content"
|
||||
:style="{ filter: Session.get('token') ? '' : 'blur(5px)' }"
|
||||
>
|
||||
<view class="content" :style="{ filter: Session.get('token') ? '' : 'blur(5px)' }">
|
||||
<view class="top_title">
|
||||
<text class="pageTitle">资讯头条榜</text>
|
||||
<image src="@/assets/zixun/top20_icon.png" class="title_icon"></image>
|
||||
|
|
@ -16,34 +13,20 @@
|
|||
<view class="r_list">
|
||||
<view class="list_item" v-for="(item, index) in newsList" :key="index">
|
||||
<view class="r_list_item_num">
|
||||
<view class="list_item_num num1" v-if="index < 3 && index == 0">{{
|
||||
index + 1
|
||||
}}</view>
|
||||
<view
|
||||
class="list_item_num num2"
|
||||
v-else-if="index < 3 && index == 1"
|
||||
>{{ index + 1 }}</view
|
||||
>
|
||||
<view
|
||||
class="list_item_num num3"
|
||||
v-else-if="index < 3 && index == 2"
|
||||
>{{ index + 1 }}</view
|
||||
>
|
||||
<view class="list_item_num num1" v-if="index < 3 && index == 0">{{ index + 1 }}</view>
|
||||
<view class="list_item_num num2" v-else-if="index < 3 && index == 1">{{ index + 1 }}</view>
|
||||
<view class="list_item_num num3" v-else-if="index < 3 && index == 2">{{ index + 1 }}</view>
|
||||
<view class="list_item_num nol_num" v-else>{{ index + 1 }}</view>
|
||||
</view>
|
||||
|
||||
<view class="list_item_content">
|
||||
<text class="item_title" @click="goDetail(item)">{{
|
||||
item.title
|
||||
}}</text>
|
||||
<text class="item_title" @click="goDetail(item)">{{ item.title }}</text>
|
||||
<text class="item_summary">{{ item.summary }}</text>
|
||||
|
||||
<view class="item_bottom">
|
||||
<view>
|
||||
<text class="time">{{ item.source }}</text>
|
||||
<text class="time" style="margin-left: 30rpx">{{
|
||||
dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss")
|
||||
}}</text>
|
||||
<text class="time" style="margin-left: 30rpx">{{ dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss") }}</text>
|
||||
</view>
|
||||
|
||||
<text class="score">{{ item.news_score }}</text>
|
||||
|
|
@ -57,15 +40,14 @@
|
|||
mode="center"
|
||||
@handlePopupClose="handlePopupClose"
|
||||
@handlePopupSuccessCallback="handlePopupSuccessCallback"
|
||||
@handlePopupErrorCallback="handlePopupErrorCallback"
|
||||
/>
|
||||
@handlePopupErrorCallback="handlePopupErrorCallback" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, reactive } from "vue";
|
||||
import PageTop from "@/pages/realtimeInfo/pc/components/PageTop.vue";
|
||||
import { getTopNews } from "@/api/newsInfo";
|
||||
import { getTopNews, getTopNewsDay } from "@/api/newsInfo";
|
||||
import dayjs from "dayjs/esm/index";
|
||||
import LoginPopup from "@/components/loginPopup/index.vue";
|
||||
import { Session } from "@/utils/storage";
|
||||
|
|
@ -74,7 +56,7 @@ const newsList = ref([]);
|
|||
|
||||
// 概念标签贴标
|
||||
async function getNewsList() {
|
||||
newsList.value = await getTopNews({});
|
||||
newsList.value = await getTopNewsDay({});
|
||||
}
|
||||
|
||||
function goDetail(item) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue