73 lines
2.5 KiB
Plaintext
73 lines
2.5 KiB
Plaintext
<view class="post-card" bindtap="onCardTap">
|
|
<!-- 作者头部 -->
|
|
<view class="post-header">
|
|
<view class="post-avatar" style="background: {{avatarGradient}}" bindtap="onAuthorTap" catchtap="onAuthorTap">
|
|
<text>{{post.author.nickName[0] || '?'}}</text>
|
|
</view>
|
|
<view class="post-meta">
|
|
<text class="post-username">{{post.author.nickName}}</text>
|
|
<view class="post-loc" wx:if="{{post.location}}">
|
|
<text class="loc-icon">📍</text>
|
|
<text class="loc-text">{{post.location.name}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="post-time">{{timeText}}</view>
|
|
</view>
|
|
|
|
<!-- 图片 -->
|
|
<view wx:if="{{post.images && post.images.length > 0}}" class="post-images-wrap">
|
|
<!-- 单图全宽 -->
|
|
<view wx:if="{{post.images.length === 1}}" class="post-img-single">
|
|
<image
|
|
class="img-single"
|
|
src="{{post.images[0]}}"
|
|
mode="aspectFill"
|
|
lazy-load="true"
|
|
bindtap="onImageTap"
|
|
data-idx="0"
|
|
/>
|
|
<view wx:if="{{post.mood}}" class="post-tag-chip">{{post.mood}}</view>
|
|
</view>
|
|
<!-- 多图网格 -->
|
|
<view wx:else class="post-img-grid post-img-grid-{{post.images.length > 3 ? 'multi' : post.images.length}}">
|
|
<image
|
|
wx:for="{{post.images}}"
|
|
wx:key="index"
|
|
wx:if="{{index < 9}}"
|
|
class="img-grid-item"
|
|
src="{{item}}"
|
|
mode="aspectFill"
|
|
lazy-load="true"
|
|
bindtap="onImageTap"
|
|
data-idx="{{index}}"
|
|
/>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 正文 -->
|
|
<view class="post-body">
|
|
<text class="post-caption" decode="{{true}}">{{post.content}}</text>
|
|
|
|
<!-- hashtags -->
|
|
<view wx:if="{{post.hashtags && post.hashtags.length > 0}}" class="post-tags">
|
|
<text wx:for="{{post.hashtags}}" wx:key="index" class="hashtag">{{item}}</text>
|
|
</view>
|
|
|
|
<!-- 操作栏 -->
|
|
<view class="post-actions">
|
|
<view class="action-btn {{post.isLiked ? 'liked' : ''}}" bindtap="onLike" catchtap="onLike">
|
|
<text class="action-icon">{{post.isLiked ? '❤️' : '🤍'}}</text>
|
|
<text class="action-count">{{likeCount}}</text>
|
|
</view>
|
|
<view class="action-btn" bindtap="onComment" catchtap="onComment">
|
|
<text class="action-icon">💬</text>
|
|
<text class="action-count">{{post.commentCount}}</text>
|
|
</view>
|
|
<view class="action-btn" bindtap="onShare" catchtap="onShare">
|
|
<text class="action-icon">↗</text>
|
|
<text class="action-count">转发</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|