fix(minihome): 调整页面间距和新闻列表样式

- 修改minihome页面的margin间距
- 替换新闻列表API调用为getTopNews
- 调整RankListMini组件的样式和间距
- 修复Domestic组件导航跳转功能
- 优化indexDomestic组件的字体样式和布局
This commit is contained in:
34701892@qq.com 2026-01-06 12:32:19 +08:00
parent d4f9d76688
commit 64db654c41
3 changed files with 51 additions and 40 deletions

View File

@ -22,7 +22,9 @@
<text class="news-title">{{ item.title.slice(0, 3) }}</text> <text class="news-title">{{ item.title.slice(0, 3) }}</text>
<text :class="['news-title', isLogin ? '' : 'mohu']">{{ item.title.slice(3, item.title.length) }}</text> <text :class="['news-title', isLogin ? '' : 'mohu']">{{ item.title.slice(3, item.title.length) }}</text>
</text> </text>
<text :class="['news-desc', isLogin ? '' : 'mohu']">{{ item.summary }}</text> <text :class="['news-desc', isLogin ? '' : 'mohu']" style="margin-top: 20rpx; text-indent: 40rpx">{{
item.summary
}}</text>
<view :class="['news-meta', isLogin ? '' : 'mohu']"> <view :class="['news-meta', isLogin ? '' : 'mohu']">
<view style="display: flex; justify-content: space-between; width: 100%"> <view style="display: flex; justify-content: space-between; width: 100%">
@ -160,9 +162,9 @@ function goDetail(item) {
let userType = props.userParams.userType || ""; let userType = props.userParams.userType || "";
console.log("🚀 ~ goDetail ~ userType:", userType); console.log("🚀 ~ goDetail ~ userType:", userType);
// uni.navigateTo({ uni.navigateTo({
// url: `/pages/detail/indexNewsInfo?id=${item.news_id}&phone=${phone}&userType=${userType}`, url: `/pages/detail/indexNewsInfo?id=${item.news_id}&phone=${phone}&userType=${userType}`,
// }); });
// if (judgeRuntimeEnv().isWxMiniWebview) { // if (judgeRuntimeEnv().isWxMiniWebview) {
let shareUrl = let shareUrl =
@ -223,7 +225,7 @@ const handlePopupErrorCallback = () => {
align-items: flex-start; align-items: flex-start;
margin-bottom: 15px; margin-bottom: 15px;
border-bottom: 1px solid #f2f2f2; border-bottom: 1px solid #f2f2f2;
padding-bottom: 30px; padding-bottom: 10px;
position: relative; position: relative;
} }

View File

@ -1,27 +1,11 @@
<template> <template>
<view class="list" v-if="data.length"> <view class="list" v-if="data.length">
<view <view class="listItem" v-for="item in props.data" :key="item.id" @click="handleClick(item)">
class="listItem"
v-for="item in props.data"
:key="item.id"
@click="handleClick(item)"
>
<view class="listItemHeader"> <view class="listItemHeader">
<view class="ListItemImg" v-if="item.picture"> <view class="ListItemImg" v-if="item.picture">
<image <image :src="item.picture" class="ListItemImage" mode="widthFix" style="width: 204rpx" />
:src="item.picture" <image class="ListItemBg" :src="item.picture" style="width: 100%; height: 100%" />
class="ListItemImage" <view class="tag" v-if="item.newType !== 'search'">{{ item.tag }}</view>
mode="widthFix"
style="width: 204rpx"
/>
<image
class="ListItemBg"
:src="item.picture"
style="width: 100%; height: 100%"
/>
<view class="tag" v-if="item.newType !== 'search'">{{
item.tag
}}</view>
</view> </view>
<view class="listItemHeaderContent"> <view class="listItemHeaderContent">
<view v-if="!isLogin"> <view v-if="!isLogin">
@ -51,11 +35,9 @@
</view> --> </view> -->
<view :class="['listItemContent', isLogin ? '' : 'mohu']"> <view :class="['listItemContent', isLogin ? '' : 'mohu']">
<view style="display: flex"> <view style="display: flex" class="r_time">
<view class="tag">中国证券报</view> <view class="tag">中国证券报</view>
<view class="listItemTime" style="margin-left: 10rpx">{{ <view class="listItemTime" style="margin-left: 10rpx">{{ item.publishTime }}</view>
item.publishTime
}}</view>
</view> </view>
</view> </view>
@ -139,7 +121,7 @@ const handleClick = (item: any) => {
border-radius: 4rpx; border-radius: 4rpx;
background-color: #e7303f; background-color: #e7303f;
// font-size: 20rpx; // font-size: 20rpx;
font-size: var(--h6-font-size); // font-size: var(--h6-font-size);
color: #fff; color: #fff;
z-index: 9; z-index: 9;
} }
@ -164,13 +146,19 @@ const handleClick = (item: any) => {
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
font-family: PingFangSC, PingFang SC; // font-family: PingFangSC, PingFang SC;
// font-weight: bold;
// font-size: 32rpx;
// color: #192236;
// line-height: 45rpx;
// text-align: left;
// font-style: normal;
font-size: 16px;
font-weight: bold; font-weight: bold;
font-size: 32rpx; color: #333;
color: #192236; margin-bottom: 5px;
line-height: 45rpx; line-height: 1.2;
text-align: left;
font-style: normal;
} }
.listItemTitle { .listItemTitle {
// font-size: 32rpx; // font-size: 32rpx;
@ -192,6 +180,12 @@ const handleClick = (item: any) => {
text-align: left; text-align: left;
font-style: normal; font-style: normal;
font-size: 16px;
font-weight: bold;
color: #333;
margin-bottom: 5px;
line-height: 1.2;
// text-align: left; // text-align: left;
&.noAbstract { &.noAbstract {
-webkit-line-clamp: 4; -webkit-line-clamp: 4;
@ -332,4 +326,17 @@ const handleClick = (item: any) => {
.mohu { .mohu {
filter: blur(7rpx); filter: blur(7rpx);
} }
.r_time {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 22rpx;
color: #999999;
line-height: 30rpx;
text-align: left;
font-style: normal;
display: flex;
align-items: center;
}
</style> </style>

View File

@ -82,11 +82,11 @@
</view> </view>
</view> </view>
<view style="margin-top: 30rpx" v-if="tabIndex == 0"> <view style="margin: 0rpx 20rpx; margin-top: 40rpx" v-if="tabIndex == 0">
<RankListMini :newsList="newsList" :userParams="userParams"></RankListMini> <RankListMini :newsList="newsList" :userParams="userParams"></RankListMini>
</view> </view>
<!-- 列表区域 --> <!-- 列表区域 -->
<view style="margin-top: 50rpx" v-if="tabIndex == 2"> <view style="margin-top: 20rpx" v-if="tabIndex == 2">
<Domestic /> <Domestic />
</view> </view>
@ -105,7 +105,7 @@ import RankListMini from "@/components/RankListMini.vue";
// const Mine = defineAsyncComponent(() => import("@/components/mine.vue")); // const Mine = defineAsyncComponent(() => import("@/components/mine.vue"));
import MineMini from "@/components/mineMini.vue"; import MineMini from "@/components/mineMini.vue";
import Tabs from "@/components/mini/Tabs.vue"; import Tabs from "@/components/mini/Tabs.vue";
import { getTopNewsAll } from "@/api/newsInfo"; import { getTopNewsAll, getTopNews } from "@/api/newsInfo";
import { onLoad, onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app"; import { onLoad, onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app";
import { getNavHeight } from "@/utils/util"; import { getNavHeight } from "@/utils/util";
import Domestic from "@/components/domesticMini.vue"; import Domestic from "@/components/domesticMini.vue";
@ -119,7 +119,9 @@ const list1 = reactive([
const newsList = ref([]); const newsList = ref([]);
// //
async function getNewsList() { async function getNewsList() {
newsList.value = await getTopNewsAll({}); // newsList.value = await getTopNewsAll({});
newsList.value = await getTopNews({});
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
} }