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

212 lines
4.7 KiB

  1. <template>
  2. <view class="respond-comments-page">
  3. <!-- 顶部导航栏 -->
  4. <navbar title="回复评论" leftClick @leftClick="$utils.navigateBack" />
  5. <!-- 原评论展示 -->
  6. <view class="origin-comment-card">
  7. <view class="comment-header">
  8. <image class="avatar" :src="comment.avatar" mode="aspectFill" />
  9. <view class="user-info">
  10. <text class="username">{{ comment.username }}</text>
  11. </view>
  12. </view>
  13. <view class="comment-content">{{ comment.content }}</view>
  14. <view class="comment-footer">
  15. <text class="comment-time">{{ comment.time }}</text>
  16. <text class="comment-reply-count">
  17. <text class="emoji-icon">💬</text>
  18. {{ comment.replyCount }}
  19. </text>
  20. </view>
  21. </view>
  22. <!-- 回复输入区 -->
  23. <view class="reply-area">
  24. <view class="form-label-row">
  25. <text class="required-star">*</text>
  26. <text class="form-label">回复内容</text>
  27. </view>
  28. <uv-input
  29. v-model="replyContent"
  30. type="text"
  31. :maxlength="200"
  32. placeholder="请输入回复内容"
  33. border="surround"
  34. clearable
  35. class="reply-input"
  36. />
  37. </view>
  38. <!-- 底部提交按钮 -->
  39. <view class="reply-footer">
  40. <button class="submit-btn" :disabled="!replyContent.trim()" @click="submitReply">发送</button>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import navbar from '@/components/base/navbar.vue'
  46. export default {
  47. components: { navbar },
  48. data() {
  49. return {
  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. replyContent: ''
  58. }
  59. },
  60. methods: {
  61. goBack() {
  62. uni.navigateBack()
  63. },
  64. submitReply() {
  65. if (!this.replyContent.trim()) {
  66. uni.showToast({ title: '请输入回复内容', icon: 'none' })
  67. return
  68. }
  69. // 实际开发中可调用API提交
  70. uni.showToast({ title: '回复成功', icon: 'success' })
  71. this.replyContent = ''
  72. setTimeout(() => {
  73. uni.navigateBack()
  74. }, 1000)
  75. }
  76. }
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. .respond-comments-page {
  81. min-height: 100vh;
  82. background: #f8f8f8;
  83. display: flex;
  84. flex-direction: column;
  85. }
  86. .origin-comment-card {
  87. background: #fff;
  88. margin: 24rpx 24rpx 0 24rpx;
  89. padding: 24rpx 24rpx 0 24rpx;
  90. margin-bottom: 0;
  91. border-radius: 0;
  92. box-shadow: none;
  93. padding-bottom: 0;
  94. }
  95. .comment-header {
  96. display: flex;
  97. align-items: center;
  98. margin-bottom: 8rpx;
  99. }
  100. .avatar {
  101. width: 56rpx;
  102. height: 56rpx;
  103. border-radius: 50%;
  104. margin-right: 16rpx;
  105. }
  106. .user-info {
  107. display: flex;
  108. flex-direction: column;
  109. }
  110. .username {
  111. font-size: 26rpx;
  112. color: #222;
  113. font-weight: 500;
  114. }
  115. .comment-content {
  116. font-size: 26rpx;
  117. color: #333;
  118. margin-bottom: 12rpx;
  119. }
  120. .comment-footer {
  121. display: flex;
  122. align-items: center;
  123. font-size: 22rpx;
  124. color: #bdbdbd;
  125. justify-content: space-between;
  126. }
  127. .comment-time {
  128. color: #bdbdbd;
  129. margin-top: 18rpx;
  130. }
  131. .comment-reply-count {
  132. display: flex;
  133. align-items: center;
  134. font-size: 22rpx;
  135. color: #bdbdbd;
  136. line-height: 1;
  137. }
  138. .emoji-icon {
  139. margin-right: 4rpx;
  140. font-size: 22rpx;
  141. line-height: 1;
  142. display: inline-block;
  143. vertical-align: middle;
  144. }
  145. .reply-area {
  146. background: #fff;
  147. margin: 0 24rpx 0 24rpx;
  148. padding: 0 24rpx 24rpx 24rpx;
  149. display: flex;
  150. flex-direction: column;
  151. border-radius: 0;
  152. box-shadow: none;
  153. margin-top: 0;
  154. }
  155. .form-label-row {
  156. display: flex;
  157. align-items: center;
  158. margin-bottom: 8rpx;
  159. margin-top: 50rpx;
  160. }
  161. .required-star {
  162. color: #e23d3d;
  163. font-size: 22rpx;
  164. margin-right: 4rpx;
  165. line-height: 1;
  166. }
  167. .form-label {
  168. color: #222;
  169. font-size: 26rpx;
  170. font-weight: 400;
  171. }
  172. .reply-input {
  173. margin-top: 12rpx;
  174. border: none !important;
  175. box-shadow: none !important;
  176. }
  177. .reply-footer {
  178. position: fixed;
  179. left: 0;
  180. right: 0;
  181. bottom: 90rpx;
  182. background: #fff;
  183. padding: 24rpx 32rpx 32rpx 32rpx;
  184. box-shadow: 0 -2rpx 12rpx rgba(0,0,0,0.03);
  185. z-index: 10;
  186. }
  187. .submit-btn {
  188. width: 100%;
  189. height: 80rpx;
  190. background: #0a225f !important;
  191. color: #fff !important;
  192. font-size: 30rpx;
  193. border-radius: 40rpx;
  194. font-weight: 500;
  195. letter-spacing: 2rpx;
  196. border: none;
  197. box-shadow: none;
  198. margin: 0 auto;
  199. display: block;
  200. text-align: center;
  201. line-height: 80rpx;
  202. }
  203. .submit-btn:disabled {
  204. background: #bdbdbd;
  205. color: #fff;
  206. }
  207. </style>