小说小程序前端代码仓库(小程序)
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.

250 lines
6.2 KiB

  1. <template>
  2. <view class="comments-page">
  3. <navbar title="评论详情" leftClick @leftClick="$utils.navigateBack" />
  4. <!-- 书本名称 -->
  5. <view class="book-title-area">
  6. <view class="book-title-label">书本名称</view>
  7. <view class="book-title">{{ bookTitle }}</view>
  8. </view>
  9. <!-- 主评论卡片 -->
  10. <view class="comment-card">
  11. <view class="comment-header">
  12. <image class="avatar" :src="comment.avatar" mode="aspectFill" />
  13. <view class="user-info">
  14. <text class="username">{{ comment.username }}</text>
  15. </view>
  16. </view>
  17. <view class="comment-content">{{ comment.content }}</view>
  18. <view class="comment-footer">
  19. <text class="comment-time">{{ comment.time }}</text>
  20. </view>
  21. </view>
  22. <!-- 全部评论列表 -->
  23. <view class="all-reply-area">
  24. <view class="all-reply-header">全部评论·{{ comment.replyCount }}</view>
  25. <view class="reply-list">
  26. <view class="reply-item" v-for="(item, idx) in replies" :key="idx">
  27. <image class="reply-avatar" :src="item.avatar" mode="aspectFill" />
  28. <view class="reply-main">
  29. <view class="reply-username">{{ item.username }}</view>
  30. <view class="reply-content">{{ item.content }}</view>
  31. <view class="reply-time">{{ item.time }}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 底部回复按钮 -->
  37. <view class="reply-footer">
  38. <button class="submit-btn" @click="goToRespond">回复评论</button>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import navbar from '@/components/base/navbar.vue'
  44. export default {
  45. components: { navbar },
  46. data() {
  47. return {
  48. bookTitle: '这游戏也太真实了',
  49. comment: {
  50. avatar: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  51. username: '方香橙',
  52. content: '我是本书的作者方香橙,这是一本甜文爽文哒!请放心入坑,五星好评!女主又美有个性可爱,绝对不圣母,不傻白!男主身心干净深情独宠媳妇儿一个人...',
  53. time: '2024.07.09',
  54. replyCount: 17
  55. },
  56. replies: [
  57. {
  58. avatar: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  59. username: '方香橙',
  60. content: '我是本书的作者方香橙,这是一本甜文爽文哒!请放心入坑,五星好评!女主又美有个性可爱,绝对不圣母,不傻白!男主身心干净深情独宠媳妇儿一个人...',
  61. time: '2024.07.09'
  62. },
  63. {
  64. avatar: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
  65. username: '战斗世界',
  66. content: '这本书打破了我看甜文套路之前的观念女主真的太可爱太有趣和以往看过的一个NPC介绍有很大不同',
  67. time: '2024.07.09'
  68. }
  69. ]
  70. }
  71. },
  72. methods: {
  73. goToRespond() {
  74. uni.navigateTo({ url: '/pages_order/novel/Respondcomments' })
  75. },
  76. submitReply() {
  77. uni.showToast({ title: '功能开发中', icon: 'none' })
  78. }
  79. }
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. .comments-page {
  84. min-height: 100vh;
  85. background: #f8f8f8;
  86. display: flex;
  87. flex-direction: column;
  88. }
  89. .book-title-area {
  90. background: #fff;
  91. margin: 24rpx 24rpx 0 24rpx;
  92. border-radius: 16rpx;
  93. padding: 24rpx 24rpx 0 24rpx;
  94. }
  95. .book-title-label {
  96. color: #bdbdbd;
  97. font-size: 24rpx;
  98. margin-bottom: 4rpx;
  99. }
  100. .book-title {
  101. font-size: 28rpx;
  102. color: #222;
  103. margin-bottom: 16rpx;
  104. border-bottom: 1px solid #ededed;
  105. padding-bottom: 8rpx;
  106. }
  107. .comment-card {
  108. background: #fff;
  109. margin: 0 24rpx 0 24rpx;
  110. border-radius: 16rpx;
  111. padding: 24rpx 24rpx 0 24rpx;
  112. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  113. margin-bottom: 0;
  114. }
  115. .comment-header {
  116. display: flex;
  117. align-items: center;
  118. margin-bottom: 8rpx;
  119. }
  120. .avatar {
  121. width: 56rpx;
  122. height: 56rpx;
  123. border-radius: 50%;
  124. margin-right: 16rpx;
  125. }
  126. .user-info {
  127. display: flex;
  128. flex-direction: column;
  129. }
  130. .username {
  131. font-size: 26rpx;
  132. color: #222;
  133. font-weight: 500;
  134. }
  135. .comment-content {
  136. font-size: 26rpx;
  137. color: #333;
  138. margin-bottom: 12rpx;
  139. }
  140. .comment-footer {
  141. display: flex;
  142. align-items: center;
  143. font-size: 22rpx;
  144. color: #bdbdbd;
  145. }
  146. .comment-time {
  147. color: #bdbdbd;
  148. margin-top: 18rpx;
  149. }
  150. .all-reply-area {
  151. background: #fff;
  152. margin: 0 24rpx 0 24rpx;
  153. border-radius: 16rpx;
  154. padding: 24rpx 24rpx 16rpx 24rpx;
  155. margin-top: 24rpx;
  156. }
  157. .all-reply-header {
  158. color: #222;
  159. font-size: 28rpx;
  160. font-weight: 500;
  161. margin-bottom: 16rpx;
  162. }
  163. .reply-list {
  164. margin-top: 40rpx;
  165. display: flex;
  166. flex-direction: column;
  167. gap: 50rpx;
  168. }
  169. .reply-item {
  170. display: flex;
  171. align-items: flex-start;
  172. }
  173. .reply-avatar {
  174. width: 44rpx;
  175. height: 44rpx;
  176. border-radius: 50%;
  177. margin-right: 16rpx;
  178. flex-shrink: 0;
  179. }
  180. .reply-main {
  181. flex: 1;
  182. display: flex;
  183. flex-direction: column;
  184. }
  185. .reply-username {
  186. font-size: 24rpx;
  187. color: #222;
  188. font-weight: 500;
  189. margin-bottom: 4rpx;
  190. }
  191. .reply-content {
  192. font-size: 24rpx;
  193. color: #333;
  194. margin-bottom: 6rpx;
  195. word-break: break-all;
  196. }
  197. .reply-time {
  198. font-size: 20rpx;
  199. color: #bdbdbd;
  200. }
  201. .reply-footer {
  202. position: fixed;
  203. left: 0;
  204. right: 0;
  205. bottom: 90rpx;
  206. background: #fff;
  207. padding: 24rpx 32rpx 32rpx 32rpx;
  208. box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.03);
  209. z-index: 10;
  210. }
  211. .submit-btn {
  212. width: 100%;
  213. height: 80rpx;
  214. background: #0a225f;
  215. color: #fff;
  216. font-size: 30rpx;
  217. border-radius: 40rpx;
  218. font-weight: 500;
  219. letter-spacing: 2rpx;
  220. }
  221. </style>