feat:优化推文详情页面

This commit is contained in:
amos
2025-12-30 14:19:21 +08:00
parent 0d433a0fa5
commit c9389e4caa
3 changed files with 595 additions and 40 deletions

View File

@@ -13,11 +13,11 @@ android {
applicationId = "com.memory.app"
minSdk = 26
targetSdk = 35
versionCode = 28
versionName = "1.4.4"
versionCode = 30
versionName = "1.4.6"
buildConfigField("String", "API_BASE_URL", "\"https://x.amos.us.kg/api/\"")
buildConfigField("int", "VERSION_CODE", "28")
buildConfigField("int", "VERSION_CODE", "30")
}
signingConfigs {

View File

@@ -213,44 +213,46 @@ fun PostDetailScreen(
onClick = { }
)
}
}
Spacer(modifier = Modifier.height(16.dp))
// Stats Row
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "${post.likeCount}",
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurface
)
Text(
text = " 获赞",
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "${comments.size}",
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurface
)
Text(
text = " 评论",
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
// Stats Row with dividers
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant, thickness = 1.dp)
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp, vertical = 12.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "${post.likeCount}",
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurface
)
Text(
text = " 获赞",
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "${comments.size}",
fontWeight = FontWeight.Bold,
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurface
)
Text(
text = " 评论",
fontSize = 15.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
HorizontalDivider(color = MaterialTheme.colorScheme.surfaceVariant, thickness = 8.dp)
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant, thickness = 1.dp)
}
// Comments
@@ -264,12 +266,18 @@ fun PostDetailScreen(
if (comments.isEmpty()) {
item {
Box(
Column(
modifier = Modifier
.fillMaxWidth()
.padding(32.dp),
contentAlignment = Alignment.Center
.padding(vertical = 48.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
// 沙发 + 落地灯图标
Text(
text = "🛋️🪔",
fontSize = 48.sp
)
Spacer(modifier = Modifier.height(12.dp))
Text(
text = "还没有评论,快来抢沙发吧!",
color = MaterialTheme.colorScheme.onSurfaceVariant,

547
post-detail-redesign.html Normal file
View File

@@ -0,0 +1,547 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Memory - Post Detail Redesign</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #0b0e14;
--card-bg: #161a23;
--accent-color: #1d9bf0;
--text-primary: #f0f3f5;
--text-secondary: #8b98a5;
--border-color: #2f3336;
--glass-bg: rgba(22, 26, 35, 0.7);
--glass-border: rgba(255, 255, 255, 0.1);
--danger: #f4212e;
--success: #00ba7c;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background-color: #000;
color: var(--text-primary);
display: flex;
justify-content: center;
align-items: flex-start;
gap: 40px;
padding: 40px 20px;
min-height: 100vh;
flex-wrap: wrap;
}
/* Phone Frame */
.phone {
width: 375px;
height: 812px;
background: var(--bg-color);
border-radius: 40px;
position: relative;
overflow: hidden;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 8px #1f232b;
display: flex;
flex-direction: column;
}
.phone::before {
content: '';
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 150px;
height: 30px;
background: #1f232b;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
z-index: 100;
}
/* Header */
header {
padding: 40px 20px 10px 20px;
display: flex;
align-items: center;
justify-content: space-between;
background: var(--glass-bg);
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--glass-border);
z-index: 10;
}
header .title {
font-family: 'Outfit', sans-serif;
font-size: 17px;
font-weight: 600;
}
.btn-icon {
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
cursor: pointer;
transition: all 0.2s;
color: var(--text-primary);
}
.btn-icon:hover {
background: rgba(255, 255, 255, 0.1);
}
.btn-icon.delete:hover {
color: var(--danger);
background: rgba(244, 33, 46, 0.1);
}
/* Main Content */
.scroll-area {
flex: 1;
overflow-y: auto;
padding: 20px;
padding-bottom: 100px;
}
.scroll-area::-webkit-scrollbar {
width: 0;
}
/* Author Section */
.post-author {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 16px;
}
.avatar {
width: 48px;
height: 48px;
border-radius: 14px;
background: linear-gradient(135deg, #1d9bf0, #00ba7c);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 20px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.author-info .name-row {
display: flex;
align-items: center;
gap: 4px;
}
.author-info .name {
font-weight: 700;
font-size: 16px;
}
.verified-badge {
color: var(--accent-color);
width: 16px;
height: 16px;
}
.author-info .meta {
font-size: 13px;
color: var(--text-secondary);
margin-top: 2px;
}
/* Post Content */
.post-text {
font-size: 16px;
line-height: 1.6;
margin-bottom: 20px;
color: var(--text-primary);
}
/* Music Card */
.music-card {
background: linear-gradient(135deg, rgba(29, 155, 240, 0.1), rgba(0, 186, 124, 0.1));
border: 1px solid var(--glass-border);
border-radius: 20px;
padding: 16px;
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 20px;
position: relative;
overflow: hidden;
}
.music-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--glass-bg);
z-index: -1;
}
.music-cover {
width: 64px;
height: 64px;
border-radius: 12px;
background: #333;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.play-overlay {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
background: rgba(0, 0, 0, 0.2);
border-radius: 12px;
}
.music-info {
flex: 1;
}
.music-info .song-title {
font-weight: 600;
font-size: 15px;
margin-bottom: 4px;
}
.music-info .artist {
font-size: 13px;
color: var(--text-secondary);
}
.music-chevron {
color: var(--text-secondary);
}
/* Image Content */
.post-image {
width: 100%;
border-radius: 20px;
aspect-ratio: 16/10;
background: #232730;
margin-bottom: 20px;
object-fit: cover;
border: 1px solid var(--glass-border);
}
/* Interaction Stats */
.post-stats {
display: flex;
gap: 20px;
padding: 16px 0;
border-top: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
margin-bottom: 20px;
}
.stat-item {
font-size: 14px;
color: var(--text-secondary);
}
.stat-item b {
color: var(--text-primary);
margin-right: 4px;
}
/* Empty State */
.empty-comments {
text-align: center;
padding: 60px 20px;
color: var(--text-secondary);
}
.empty-icon {
font-size: 40px;
margin-bottom: 12px;
opacity: 0.5;
}
.empty-text {
font-size: 14px;
}
/* Bottom Bar */
.comment-bar {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 16px 20px 34px 20px;
background: var(--glass-bg);
backdrop-filter: blur(20px);
border-top: 1px solid var(--glass-border);
display: flex;
align-items: center;
gap: 12px;
}
.input-wrapper {
flex: 1;
background: #232730;
border-radius: 24px;
padding: 10px 16px;
display: flex;
align-items: center;
}
.input-wrapper input {
background: transparent;
border: none;
color: #fff;
width: 100%;
outline: none;
font-size: 15px;
}
.send-btn {
color: var(--accent-color);
font-weight: 600;
font-size: 15px;
cursor: pointer;
}
/* Post Label */
.demo-label {
position: absolute;
top: -45px;
left: 50%;
transform: translateX(-50%);
background: var(--accent-color);
color: white;
padding: 6px 16px;
border-radius: 20px;
font-size: 13px;
font-weight: 600;
white-space: nowrap;
}
.container {
position: relative;
margin-top: 45px;
}
/* Animations */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.scroll-area > * {
animation: fadeIn 0.5s ease forwards;
}
</style>
</head>
<body>
<!-- Case 1: Music/Media Post (Same as screenshot) -->
<div class="container">
<div class="demo-label">方案 1: 带卡片媒体(如音乐)</div>
<div class="phone">
<header>
<div class="btn-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
</div>
<div class="title">帖子详情</div>
<div class="btn-icon delete">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
</div>
</header>
<div class="scroll-area">
<div class="post-author">
<div class="avatar" style="background: linear-gradient(135deg, #FF6B6B, #FFD93D);">
<img src="https://api.dicebear.com/7.x/avataaars/svg?seed=amos" alt="avatar" style="width: 100%; height: 100%;">
</div>
<div class="author-info">
<div class="name-row">
<span class="name">amos</span>
<svg class="verified-badge" viewBox="0 0 24 24" fill="currentColor">
<path d="M22.5 12.5c0-1.58-.88-2.95-2.18-3.66.26-1.51-.21-3.11-1.32-4.22s-2.71-1.58-4.22-1.32c-.71-1.3-2.08-2.18-3.66-2.18s-2.95.88-3.66 2.18c-1.51-.26-3.11.21-4.22 1.32s-1.58 2.71-1.32 4.22c-1.3.71-2.18 2.08-2.18 3.66s.88 2.95 2.18 3.66c-.26 1.51.21 3.11 1.32 4.22s2.71 1.58 4.22 1.32c.71 1.3 2.08 2.18 3.66 2.18s2.95-.88 3.66-2.18c1.51.26 3.11-.21 4.22-1.32s1.58-2.71 1.32-4.22c1.3-.71 2.18-2.08 2.18-3.66zm-12.6 5.86l-4.73-4.73 1.41-1.41 3.32 3.32 6.78-6.78 1.41 1.41-8.19 8.19z"></path>
</svg>
</div>
<div class="meta">@amos · 2小时前</div>
</div>
</div>
<div class="post-text">
app功能更新增加分享音乐功能 🎧
</div>
<div class="music-card">
<div class="music-cover" style="background: linear-gradient(45deg, #1d9bf0, #8e44ad);">
<svg width="24" height="24" viewBox="0 0 24 24" fill="#fff"><path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/></svg>
<div class="play-overlay">
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
</div>
</div>
<div class="music-info">
<div class="song-title">我们的明天</div>
<div class="artist">鹿晗</div>
</div>
<div class="music-chevron">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>
</div>
</div>
<div class="post-stats">
<div class="stat-item"><b>1</b> 获赞</div>
<div class="stat-item"><b>0</b> 评论</div>
</div>
<div class="empty-comments">
<div class="empty-icon">🛋️</div>
<div class="empty-text">还没有评论,快来抢沙发吧!</div>
</div>
</div>
<div class="comment-bar">
<div class="input-wrapper">
<input type="text" placeholder="写下你的评论...">
</div>
<div class="send-btn">发送</div>
</div>
</div>
</div>
<!-- Case 2: Simple Post / Image Post -->
<div class="container">
<div class="demo-label">方案 2: 带图片帖子</div>
<div class="phone">
<header>
<div class="btn-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
</div>
<div class="title">帖子详情</div>
<div class="btn-icon delete">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
</div>
</header>
<div class="scroll-area">
<div class="post-author">
<div class="avatar" style="background: linear-gradient(135deg, #4facfe, #00f2fe);">
<img src="https://api.dicebear.com/7.x/avataaars/svg?seed=jessica" alt="avatar" style="width: 100%; height: 100%;">
</div>
<div class="author-info">
<div class="name-row">
<span class="name">Jessica</span>
</div>
<div class="meta">@jessica_v · 30分钟前</div>
</div>
</div>
<div class="post-text">
今天去海边散步,拍到了绝美的日落!夕阳的余晖洒在海面上,波光粼粼,真的很治愈。✨
</div>
<div class="post-image" style="background: linear-gradient(to bottom, #fceabb, #f8b500); display: flex; align-items: center; justify-content: center; overflow: hidden;">
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&w=600&q=80" alt="sunset" style="width: 100%; height: 100%; object-fit: cover;">
</div>
<div class="post-stats">
<div class="stat-item"><b>128</b> 获赞</div>
<div class="stat-item"><b>12</b> 评论</div>
</div>
<!-- Example Comment -->
<style>
.comment-item {
display: flex;
gap: 12px;
margin-bottom: 20px;
}
.comment-avatar {
width: 32px;
height: 32px;
border-radius: 10px;
background: #333;
}
.comment-content {
flex: 1;
}
.comment-name {
font-weight: 600;
font-size: 14px;
margin-bottom: 2px;
}
.comment-body {
font-size: 14px;
line-height: 1.5;
color: var(--text-primary);
}
.comment-meta {
font-size: 11px;
color: var(--text-secondary);
margin-top: 4px;
display: flex;
gap: 12px;
}
</style>
<div class="comment-item">
<div class="comment-avatar">
<img src="https://api.dicebear.com/7.x/avataaars/svg?seed=bob" alt="avatar" style="width:100%; height:100%; border-radius:10px;">
</div>
<div class="comment-content">
<div class="comment-name">小明</div>
<div class="comment-body">这也太美了吧!求原图!😍</div>
<div class="comment-meta">
<span>15分钟前</span>
<span>回复</span>
</div>
</div>
</div>
<div class="comment-item">
<div class="comment-avatar">
<img src="https://api.dicebear.com/7.x/avataaars/svg?seed=sarah" alt="avatar" style="width:100%; height:100%; border-radius:10px;">
</div>
<div class="comment-content">
<div class="comment-name">Sarah</div>
<div class="comment-body">羡慕可以住在海边的人~</div>
<div class="comment-meta">
<span>5分钟前</span>
<span>回复</span>
</div>
</div>
</div>
</div>
<div class="comment-bar">
<div class="input-wrapper">
<input type="text" placeholder="写下你的评论...">
</div>
<div class="send-btn">发送</div>
</div>
</div>
</div>
</body>
</html>