与牧同行-小程序用户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
6.3 KiB

  1. <view class="forum-page">
  2. <!-- 帖子详情 -->
  3. <scroll-view
  4. class="post-detail-container"
  5. scroll-y
  6. scroll-with-animation
  7. scroll-into-view="{{scrollToId}}"
  8. bindscroll="onScroll"
  9. >
  10. <!-- 帖子主体 -->
  11. <view class="post-main" id="post-main">
  12. <!-- 帖子头部 -->
  13. <view class="post-header">
  14. <view class="user-info">
  15. <image class="avatar" src="{{post.avatar}}" mode="aspectFill"></image>
  16. <view class="user-detail">
  17. <view class="username">{{post.username}}</view>
  18. <view class="post-time">{{post.time}}</view>
  19. </view>
  20. </view>
  21. <view class="post-status" wx:if="{{post.solved}}">
  22. <text class="solved-badge">已解决</text>
  23. </view>
  24. </view>
  25. <!-- 帖子内容 -->
  26. <view class="post-content">
  27. <view class="post-title">{{post.title}}</view>
  28. <view class="post-desc">{{post.content}}</view>
  29. <!-- 帖子图片 -->
  30. <view class="post-images" wx:if="{{post.images && post.images.length > 0}}">
  31. <view class="images-container">
  32. <block wx:for="{{post.images}}" wx:for-item="image" wx:for-index="imgIndex" wx:key="index">
  33. <image
  34. class="post-image"
  35. src="{{image}}"
  36. mode="aspectFill"
  37. data-img-index="{{imgIndex}}"
  38. bindtap="previewImage"
  39. ></image>
  40. </block>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 回复列表 -->
  46. <view class="replies-section" id="replies-section">
  47. <view class="section-title">
  48. <text class="title-text">全部回复</text>
  49. <text class="reply-count">{{post.replyCount}}条</text>
  50. </view>
  51. <view class="reply-list" wx:if="{{post.replies && post.replies.length > 0}}">
  52. <block wx:for="{{post.replies}}" wx:key="replyId" wx:for-index="replyIndex">
  53. <view class="reply-item" id="reply-{{item.replyId}}">
  54. <view class="reply-user">
  55. <image class="reply-avatar" src="{{item.avatar}}" mode="aspectFill"></image>
  56. <view class="reply-user-info">
  57. <view class="reply-username">{{item.username}}</view>
  58. <view class="reply-time">{{item.time}}</view>
  59. </view>
  60. </view>
  61. <view class="reply-content">{{item.content}}</view>
  62. <!-- 回复操作 -->
  63. <view class="reply-actions">
  64. <view class="reply-action" bindtap="replyToUser" data-type="reply" data-index="{{replyIndex}}" data-username="{{item.username}}">
  65. <image class="reply-action-icon" src="/pagesB/images/hf.png" mode="aspectFit"></image>
  66. <text class="reply-action-text">回复</text>
  67. </view>
  68. </view>
  69. <!-- 评论列表 -->
  70. <view class="comment-list" wx:if="{{item.comments && item.comments.length > 0}}">
  71. <block wx:for="{{item.comments}}" wx:key="commentId">
  72. <view class="comment-item">
  73. <view class="comment-user">
  74. <image class="comment-avatar" src="{{item.avatar}}" mode="aspectFill"></image>
  75. <view class="comment-user-info">
  76. <view class="comment-username">{{item.username}}</view>
  77. <view class="comment-time">{{item.time}}</view>
  78. </view>
  79. </view>
  80. <view class="comment-content">
  81. <text class="comment-to" wx:if="{{item.toUsername}}">@{{item.toUsername}} </text>
  82. {{item.content}}
  83. </view>
  84. <!-- 评论操作 -->
  85. <view class="comment-actions">
  86. <view class="comment-action" bindtap="replyToUser"
  87. data-type="comment"
  88. data-reply-index="{{replyIndex}}"
  89. data-comment-index="{{index}}"
  90. data-username="{{item.username}}">
  91. <text>回复</text>
  92. </view>
  93. </view>
  94. </view>
  95. </block>
  96. </view>
  97. </view>
  98. </block>
  99. </view>
  100. <!-- 空回复状态 -->
  101. <view class="empty-replies" wx:else>
  102. <view class="empty-reply-text">还没有回复,快来第一个回复吧!</view>
  103. </view>
  104. </view>
  105. <!-- 底部占位 -->
  106. <view class="bottom-placeholder" style="height: 160rpx;"></view>
  107. </scroll-view>
  108. <!-- 底部回复输入栏 -->
  109. <view class="bottom-input-container" style="transform: translateY({{inputTransformY}});">
  110. <view class="input-wrapper">
  111. <input
  112. class="reply-input"
  113. placeholder="{{replyPlaceholder}}"
  114. value="{{replyContent}}"
  115. bindinput="onReplyInput"
  116. bindfocus="onInputFocus"
  117. bindblur="onInputBlur"
  118. bindconfirm="submitReply"
  119. adjust-position="{{false}}"
  120. focus="{{isInputFocused}}"
  121. maxlength="500"
  122. />
  123. <button
  124. class="send-btn"
  125. bindtap="submitReply"
  126. disabled="{{!replyContent}}"
  127. >
  128. {{isSubmitting ? '发送中' : '发送'}}
  129. </button>
  130. </view>
  131. <!-- 回复对象显示 -->
  132. <view class="reply-target" wx:if="{{replyTarget.username}}">
  133. <text class="target-text">回复 {{replyTarget.username}}</text>
  134. <text class="clear-target" bindtap="clearReplyTarget">×</text>
  135. </view>
  136. </view>
  137. <!-- 图片预览模态框 -->
  138. <view class="preview-overlay" wx:if="{{showPreview}}" catchtap="hidePreview">
  139. <swiper class="preview-swiper" current="{{previewIndex}}" bindchange="onSwiperChange">
  140. <block wx:for="{{previewImages}}" wx:key="index">
  141. <swiper-item>
  142. <image class="preview-image" src="{{item}}" mode="aspectFit"></image>
  143. </swiper-item>
  144. </block>
  145. </swiper>
  146. <view class="preview-indicator">{{previewIndex + 1}}/{{previewImages.length}}</view>
  147. </view>
  148. <!-- 加载提示 -->
  149. <view class="loading" wx:if="{{loading}}">
  150. <image class="loading-icon" src="/images/loading.png" mode="aspectFit"></image>
  151. 加载中...
  152. </view>
  153. </view>