feat: 实现动态详情页及相关功能
- 在MePage和MomentListHomePage中新增动态点击事件,支持打开动态详情页。 - 创建MomentDetailPage视图,展示动态详细信息,包括用户信息、动态内容和互动按钮。 - 实现MomentDetailViewModel,管理动态详情页的状态和点赞逻辑。 - 更新MomentListItem组件,添加整体点击回调,提升用户交互体验。 - 优化背景视图组件,确保一致的视觉效果。
This commit is contained in:
@@ -9,10 +9,13 @@ struct MePage: View {
|
||||
@State private var previewItem: PreviewItem? = nil
|
||||
@State private var previewCurrentIndex: Int = 0
|
||||
|
||||
// 详情页状态
|
||||
@State private var selectedMoment: MomentsInfo? = nil
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
// 背景
|
||||
MomentListBackgroundView()
|
||||
// MomentListBackgroundView()
|
||||
|
||||
VStack(spacing: 0) {
|
||||
// 顶部:大头像 + 姓名 + ID + 右上角设置
|
||||
@@ -73,6 +76,10 @@ struct MePage: View {
|
||||
onImageTap: { images, tappedIndex in
|
||||
previewCurrentIndex = tappedIndex
|
||||
previewItem = PreviewItem(images: images, index: tappedIndex)
|
||||
},
|
||||
onMomentTap: { tapped in
|
||||
selectedMoment = tapped
|
||||
debugInfoSync("➡️ MePage: 动态被点击 - ID: \(tapped.dynamicId)")
|
||||
}
|
||||
)
|
||||
.padding(.horizontal, 16)
|
||||
@@ -163,6 +170,16 @@ struct MePage: View {
|
||||
previewItem = nil
|
||||
}
|
||||
}
|
||||
// 详情页
|
||||
.sheet(item: $selectedMoment) { moment in
|
||||
MomentDetailPage(moment: moment) {
|
||||
selectedMoment = nil
|
||||
debugInfoSync("📱 MePage: 详情页已关闭")
|
||||
}
|
||||
.navigationBarHidden(true)
|
||||
.presentationDetents([.large])
|
||||
.presentationDragIndicator(.visible)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user