112 lines
3.5 KiB
Plaintext
112 lines
3.5 KiB
Plaintext
<!--pages/forum-detail/forum-detail.wxml-->
|
|
<view class="container" wx:if="{{post}}">
|
|
<!-- 帖子内容 -->
|
|
<view class="post-detail">
|
|
<!-- 帖子头部 -->
|
|
<view class="post-header">
|
|
<image class="avatar" src="{{post.avatar || '/images/avatar-default.png'}}" mode="aspectFill"></image>
|
|
<view class="author-info">
|
|
<view class="author-name">{{post.author}}</view>
|
|
<view class="post-time">{{post.time}}</view>
|
|
</view>
|
|
<view class="category-tag">{{post.category}}</view>
|
|
</view>
|
|
|
|
<!-- 帖子标题 -->
|
|
<view class="post-title">{{post.title}}</view>
|
|
|
|
<!-- 帖子正文 -->
|
|
<view class="post-content">{{post.content}}</view>
|
|
|
|
<!-- 帖子图片 -->
|
|
<view class="post-images" wx:if="{{post.images && post.images.length > 0}}">
|
|
<image
|
|
class="post-image"
|
|
wx:for="{{post.images}}"
|
|
wx:key="index"
|
|
wx:for-item="img"
|
|
src="{{img}}"
|
|
mode="aspectFill"
|
|
bindtap="onPreviewImage"
|
|
data-url="{{img}}"
|
|
data-urls="{{post.images}}"
|
|
></image>
|
|
</view>
|
|
|
|
<!-- 统计信息 -->
|
|
<view class="post-stats">
|
|
<view class="stat-item">
|
|
<text class="stat-icon">👀</text>
|
|
<text class="stat-text">{{post.views}}次浏览</text>
|
|
</view>
|
|
<view class="stat-item">
|
|
<text class="stat-icon">❤️</text>
|
|
<text class="stat-text">{{post.likes}}次点赞</text>
|
|
</view>
|
|
<view class="stat-item">
|
|
<text class="stat-icon">💬</text>
|
|
<text class="stat-text">{{comments.length}}条评论</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 评论区 -->
|
|
<view class="comments-section">
|
|
<view class="section-title">
|
|
<text class="title-text">全部评论</text>
|
|
<text class="title-count">({{comments.length}})</text>
|
|
</view>
|
|
|
|
<view class="comments-list">
|
|
<view class="comment-item" wx:for="{{comments}}" wx:key="id">
|
|
<image class="comment-avatar" src="{{item.avatar || '/images/avatar-default.png'}}" mode="aspectFill"></image>
|
|
<view class="comment-content">
|
|
<view class="comment-author">{{item.author}}</view>
|
|
<view class="comment-text">{{item.content}}</view>
|
|
<view class="comment-time">{{item.time}}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="no-comments" wx:if="{{comments.length === 0}}">
|
|
<text class="no-comments-text">暂无评论,快来发表第一条评论吧~</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 底部操作栏 -->
|
|
<view class="action-bar">
|
|
<!-- 评论输入区 -->
|
|
<view class="input-row">
|
|
<input
|
|
class="comment-input"
|
|
placeholder="说点什么..."
|
|
value="{{commentText}}"
|
|
bindinput="onCommentInput"
|
|
/>
|
|
<button class="send-btn" bindtap="onSubmitComment">发送</button>
|
|
</view>
|
|
|
|
<!-- 操作按钮区 -->
|
|
<view class="action-row">
|
|
<view
|
|
class="action-btn {{post.isLiked ? 'liked' : ''}}"
|
|
bindtap="onLike"
|
|
>
|
|
<text class="action-icon">{{post.isLiked ? '❤️' : '🤍'}}</text>
|
|
<text class="action-text">点赞</text>
|
|
</view>
|
|
<button class="action-btn" open-type="share">
|
|
<text class="action-icon">📤</text>
|
|
<text class="action-text">转发</text>
|
|
</button>
|
|
<view
|
|
class="action-btn {{post.isFavorite ? 'favorited' : ''}}"
|
|
bindtap="onFavorite"
|
|
>
|
|
<text class="action-icon">{{post.isFavorite ? '⭐' : '☆'}}</text>
|
|
<text class="action-text">收藏</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|