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

232 lines
5.6 KiB

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