2025-08-10 16:44:02 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="news-rank-list">
|
2025-09-04 16:22:13 +08:00
|
|
|
|
<u-skeleton rows="5" title loading style="margin-bottom: 30rpx" v-if="loading"></u-skeleton>
|
2025-08-10 16:44:02 +08:00
|
|
|
|
<view class="list" v-else>
|
2025-09-04 16:22:13 +08:00
|
|
|
|
<view v-for="(item, index) in rankListLocal" :key="index" class="news-item" @click="goDetail(item, 0)">
|
2025-08-10 16:44:02 +08:00
|
|
|
|
<view class="rank-tag">
|
|
|
|
|
|
<view v-if="index == 0" class="rank-text-top3">
|
|
|
|
|
|
<img src="@/assets/zixun/ranking_icon_1.png" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else-if="index == 1" class="rank-text-top3">
|
|
|
|
|
|
<img src="@/assets/zixun/ranking_icon_2.png" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else-if="index == 2" class="rank-text-top3">
|
|
|
|
|
|
<img src="@/assets/zixun/ranking_icon_3.png" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<text class="rank-text" v-else>{{ index + 1 }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-04 16:22:13 +08:00
|
|
|
|
<view class="news-content" :style="{ filter: Session.get('token') ? '' : 'blur(5px)' }">
|
2025-08-10 16:44:02 +08:00
|
|
|
|
<text class="news-title">{{ item.title }}</text>
|
|
|
|
|
|
<text class="news-desc">{{ item.summary }}</text>
|
2025-09-12 10:40:08 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 两个标签 start -->
|
2025-09-13 15:05:05 +08:00
|
|
|
|
<view class="r_r_tags" v-if="hasTag">
|
2025-09-12 10:40:08 +08:00
|
|
|
|
<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 -->
|
|
|
|
|
|
|
2025-08-10 16:44:02 +08:00
|
|
|
|
<view class="news-meta">
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<text class="source">{{ item.source }}</text>
|
2025-09-04 16:22:13 +08:00
|
|
|
|
<text class="time">{{ dayjs(item.publish_time).format("YYYY-MM-DD HH:MM:ss") }}</text>
|
2025-08-10 16:44:02 +08:00
|
|
|
|
</view>
|
2025-09-04 17:35:10 +08:00
|
|
|
|
<text class="score" v-if="needExp">
|
2025-08-10 16:44:02 +08:00
|
|
|
|
<text v-if="index < 3">资讯评分:</text>
|
|
|
|
|
|
{{ item.news_score }}</text
|
|
|
|
|
|
>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
2025-09-04 16:22:13 +08:00
|
|
|
|
<view @click="isExp = !isExp" class="r_exp" v-if="needExp">
|
2025-08-10 16:44:02 +08:00
|
|
|
|
<text v-if="isExp">收起</text>
|
|
|
|
|
|
<text v-else>展开全部</text>
|
|
|
|
|
|
<img src="@/assets/zixun/up_icon.png" class="exp_up" v-if="isExp" />
|
|
|
|
|
|
<img src="@/assets/zixun/down_icon.png" class="exp_up" v-else />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<LoginPopup
|
|
|
|
|
|
:show="LoginShow"
|
|
|
|
|
|
@handlePopupClose="handlePopupClose"
|
|
|
|
|
|
@handlePopupSuccessCallback="handlePopupSuccessCallback"
|
2025-09-04 16:22:13 +08:00
|
|
|
|
@handlePopupErrorCallback="handlePopupErrorCallback" />
|
2025-08-10 16:44:02 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { ref, watch } from "vue";
|
|
|
|
|
|
import dayjs from "dayjs/esm/index";
|
|
|
|
|
|
import LoginPopup from "@/components/loginPopup/index.vue";
|
|
|
|
|
|
import { Session } from "@/utils/storage";
|
|
|
|
|
|
|
|
|
|
|
|
const isExp = ref(false);
|
|
|
|
|
|
const rankListLocal = ref([]);
|
|
|
|
|
|
const loading = ref(true);
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => isExp.value,
|
|
|
|
|
|
(newValue, oldValue) => {
|
|
|
|
|
|
rankListLocal.value = [];
|
|
|
|
|
|
props.newsList.forEach((item, index) => {
|
|
|
|
|
|
if (!isExp.value && index > 9) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-12 10:40:08 +08:00
|
|
|
|
rankListLocal.value.push({
|
|
|
|
|
|
...item,
|
|
|
|
|
|
conceptLabels: JSON.parse(item.concept_label),
|
|
|
|
|
|
industryLabels: JSON.parse(item.industry_label),
|
|
|
|
|
|
});
|
2025-08-10 16:44:02 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => props.newsList,
|
|
|
|
|
|
(newValue, oldValue) => {
|
2025-09-04 17:35:10 +08:00
|
|
|
|
if (!props.needExp) {
|
|
|
|
|
|
isExp.value = true;
|
|
|
|
|
|
}
|
2025-08-10 16:44:02 +08:00
|
|
|
|
rankListLocal.value = [];
|
|
|
|
|
|
props.newsList.forEach((item, index) => {
|
|
|
|
|
|
if (!isExp.value && index > 9) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-12 10:40:08 +08:00
|
|
|
|
rankListLocal.value.push({
|
|
|
|
|
|
...item,
|
|
|
|
|
|
conceptLabels: JSON.parse(item.concept_label),
|
|
|
|
|
|
industryLabels: JSON.parse(item.industry_label),
|
|
|
|
|
|
});
|
2025-08-10 16:44:02 +08:00
|
|
|
|
});
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// 接收父组件传入的新闻列表
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
newsList: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
default: () => [],
|
|
|
|
|
|
},
|
2025-09-04 16:22:13 +08:00
|
|
|
|
needExp: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: true,
|
|
|
|
|
|
},
|
2025-09-13 15:05:05 +08:00
|
|
|
|
hasTag: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: false,
|
|
|
|
|
|
},
|
2025-08-10 16:44:02 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const clickItem = ref({});
|
|
|
|
|
|
function goDetail(item) {
|
|
|
|
|
|
if (Session.get("token")) {
|
|
|
|
|
|
clickItem.value = item;
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/detail/indexNewsInfo?id=${item.news_id}`,
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
LoginShow.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const LoginShow = ref(false);
|
|
|
|
|
|
const isLoginStatus = ref();
|
|
|
|
|
|
// 关闭弹框
|
|
|
|
|
|
const handlePopupClose = () => {
|
|
|
|
|
|
LoginShow.value = false;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 登录成功之后的回调
|
|
|
|
|
|
const handlePopupSuccessCallback = () => {
|
|
|
|
|
|
isLoginStatus.value = true;
|
|
|
|
|
|
|
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
|
// url: `/pages/detail/indexNewsInfo?id=${clickItem.value.news_id}`,
|
|
|
|
|
|
// });
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 登录失败之后的回调
|
|
|
|
|
|
const handlePopupErrorCallback = () => {
|
|
|
|
|
|
console.log("登录失败");
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.news-rank-list {
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.list {
|
|
|
|
|
|
min-height: 700rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.news-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
|
border-bottom: 1px solid #f2f2f2;
|
|
|
|
|
|
padding-bottom: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rank-tag {
|
|
|
|
|
|
width: 30px;
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rank-text-top3 {
|
|
|
|
|
|
font-family: PingFangSC, PingFang SC;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
line-height: 33rpx;
|
|
|
|
|
|
text-shadow: 0px 0px 2px #deb72b;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
|
width: 33rpx;
|
|
|
|
|
|
height: 41rpx;
|
|
|
|
|
|
margin-top: -10rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rank-text {
|
|
|
|
|
|
font-family: PingFangSC, PingFang SC;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #e98254;
|
|
|
|
|
|
margin-top: -20rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.news-content {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.news-title {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
margin-bottom: 5px;
|
|
|
|
|
|
line-height: 1.2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.news-desc {
|
|
|
|
|
|
font-family: PingFangSC, PingFang SC;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #333333;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
|
|
|
|
|
|
display: -webkit-box; /* 设置为WebKit内核的弹性盒子模型 */
|
|
|
|
|
|
-webkit-box-orient: vertical; /* 垂直排列 */
|
|
|
|
|
|
-webkit-line-clamp: 2; /* 限制显示三行 */
|
|
|
|
|
|
overflow: hidden; /* 隐藏超出范围的内容 */
|
|
|
|
|
|
text-overflow: ellipsis; /* 使用省略号 */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.news-meta {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.source,
|
|
|
|
|
|
.time,
|
|
|
|
|
|
.score {
|
|
|
|
|
|
// opacity: 0.8;
|
|
|
|
|
|
font-family: PingFangSC, PingFang SC;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
|
color: #999999;
|
|
|
|
|
|
line-height: 30rpx;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.time {
|
|
|
|
|
|
margin-left: 10rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.score {
|
|
|
|
|
|
font-family: PingFangSC, PingFang SC;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
|
color: #ffa800;
|
|
|
|
|
|
line-height: 30rpx;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.exp_up {
|
|
|
|
|
|
width: 21rpx;
|
|
|
|
|
|
height: 20rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.r_exp {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10rpx;
|
|
|
|
|
|
}
|
2025-09-12 10:40:08 +08:00
|
|
|
|
|
|
|
|
|
|
.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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-10 16:44:02 +08:00
|
|
|
|
</style>
|