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

213 lines
4.7 KiB

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