From 70ea0911ce7519ca802266078624e9fed3559a2c Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期五, 18 九月 2026 14:05:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/main'

---
 rencaika/pages/news/news.uvue |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/rencaika/pages/news/news.uvue b/rencaika/pages/news/news.uvue
index 5b7656b..6701588 100644
--- a/rencaika/pages/news/news.uvue
+++ b/rencaika/pages/news/news.uvue
@@ -92,7 +92,15 @@
 	const contentPreview = (value: any): string => {
 		if (value == null) return ''
 		const plain = (value as string).replace(/\s+/g, ' ').trim()
-		return plain.length > 64 ? plain.substring(0, 64) + '...' : plain
+		// 摘要区固定 3 行:按 3 行能放下的字数截断并补省略号,
+		// 避免文字被容器高度从中间切断(只露出半行、又没有省略号)。
+		return plain.length > 54 ? plain.substring(0, 54) + '...' : plain
+	}
+	// 标签只占一行:压掉换行/连续空格(text 组件会把 \n 渲染成换行),
+	// 放不下时由样式的单行省略号收尾。
+	const newsTagText = (value: any): string => {
+		if (value == null) return ''
+		return ('' + value).replace(/\s+/g, ' ').trim()
 	}
 	const mapNewsRecords = (records: any[]): any[] => {
 		const mapped: any[] = []
@@ -102,7 +110,7 @@
 				id: '' + item.id,
 				title: item.title != null ? item.title as string : '人才资讯',
 				summary: contentPreview(item.contentPreview),
-				tag: item.summary != null ? item.summary as string : '',
+				tag: newsTagText(item.summary),
 				time: formatNewsTime(item.publishTime)
 			})
 		}
@@ -209,10 +217,14 @@
 	.news-title { display: block; color: #252525; font-size: 30rpx; font-weight: 700; line-height: 41rpx; }
 	.news-body { display: flex; height: 174rpx; margin-top: 13rpx; flex-direction: row; }
 	.news-copy { display: flex; flex: 1; min-width: 0; padding-right: 18rpx; flex-direction: column; justify-content: space-between; }
-	.news-summary { display: block; height: 105rpx; overflow: hidden; color: #8E9299; font-size: 23rpx; line-height: 34rpx; }
-	.news-meta { display: flex; height: 42rpx; flex-direction: row; align-items: center; }
-	.news-tag { padding: 5rpx 9rpx; border-radius: 6rpx; background-color: #FFF8EA; color: #F1A32D; font-size: 19rpx; }
-	.news-time { margin-left: 13rpx; color: #A5A8AE; font-size: 20rpx; }
+	/* 摘要固定 3 行(3×34rpx=102rpx),超出用省略号,不再从文字中间截断。 */
+	.news-summary { display: -webkit-box; height: 102rpx; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; color: #8E9299; font-size: 23rpx; line-height: 34rpx; }
+	.news-meta { display: flex; height: 42rpx; min-width: 0; flex-direction: row; align-items: center; }
+	/* 来源/摘要这行可能很长:按内容宽度排,放不下时收缩并省略,不去挤右侧时间。
+	   flex-shrink 必须显式写 1:uni-app x 的全局样式给 view/text 默认 flex-shrink: 0,
+	   不覆盖的话标签不会收缩,只会顶出卡片、把时间挤没(省略号也不会出现)。 */
+	.news-tag { display: block; flex: 0 1 auto; flex-grow: 0; flex-shrink: 1; flex-basis: auto; min-width: 0; padding: 5rpx 9rpx; border-radius: 6rpx; background-color: #FFF8EA; color: #F1A32D; font-size: 19rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+	.news-time { margin-left: 13rpx; color: #A5A8AE; font-size: 20rpx; flex-shrink: 0; }
 	.news-thumb { width: 236rpx; height: 168rpx; border-radius: 7rpx; flex-shrink: 0; }
 	.bottom-space { height: calc(28rpx + env(safe-area-inset-bottom)); }
 </style>

--
Gitblit v1.7.1