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

254 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. <commentItem :item="comment" noClick/>
  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. <textarea v-model="replyContent" class="review-textarea custom-placeholder full-textarea"
  30. placeholder="请输入书评内容" />
  31. </view>
  32. <!-- 底部提交按钮 -->
  33. <view class="reply-footer">
  34. <button class="submit-btn" :disabled="!replyContent.trim()" @click="submitReview">发送</button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import commentItem from '../components/comment/commentItem.vue'
  40. export default {
  41. components: {
  42. commentItem,
  43. },
  44. data() {
  45. return {
  46. comment: {},
  47. replyContent: '',
  48. id : 0,
  49. }
  50. },
  51. onLoad({id}) {
  52. this.id = id
  53. this.getData()
  54. },
  55. methods: {
  56. async getData(){
  57. this.comment = await this.$fetch('getCommentDetail', {
  58. commentId : this.id,
  59. })
  60. },
  61. async submitReview() {
  62. if (!this.replyContent.trim()) {
  63. uni.showToast({
  64. title: '请输入回复内容',
  65. icon: 'none'
  66. })
  67. return
  68. }
  69. await this.$fetch('replyComment', {
  70. commentId : this.id,
  71. content : this.replyContent,
  72. })
  73. uni.showToast({
  74. title: '回复成功',
  75. icon: 'none'
  76. })
  77. setTimeout(() => {
  78. uni.navigateBack()
  79. }, 1000)
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .respond-comments-page {
  86. min-height: 100vh;
  87. background: #f8f8f8;
  88. display: flex;
  89. flex-direction: column;
  90. }
  91. .origin-comment-card {
  92. background: #fff;
  93. margin: 24rpx 24rpx 0 24rpx;
  94. padding: 24rpx 24rpx 0 24rpx;
  95. margin-bottom: 0;
  96. border-radius: 0;
  97. box-shadow: none;
  98. padding-bottom: 0;
  99. }
  100. .comment-header {
  101. display: flex;
  102. align-items: center;
  103. margin-bottom: 8rpx;
  104. }
  105. .avatar {
  106. width: 56rpx;
  107. height: 56rpx;
  108. border-radius: 50%;
  109. margin-right: 16rpx;
  110. }
  111. .user-info {
  112. display: flex;
  113. flex-direction: column;
  114. }
  115. .username {
  116. font-size: 26rpx;
  117. color: #222;
  118. font-weight: 500;
  119. }
  120. .comment-content {
  121. font-size: 26rpx;
  122. color: #333;
  123. margin-bottom: 12rpx;
  124. }
  125. .comment-footer {
  126. display: flex;
  127. align-items: center;
  128. font-size: 22rpx;
  129. color: #bdbdbd;
  130. justify-content: space-between;
  131. }
  132. .comment-time {
  133. color: #bdbdbd;
  134. margin-top: 18rpx;
  135. }
  136. .comment-reply-count {
  137. display: flex;
  138. align-items: center;
  139. font-size: 22rpx;
  140. color: #bdbdbd;
  141. line-height: 1;
  142. }
  143. .emoji-icon {
  144. margin-right: 4rpx;
  145. font-size: 22rpx;
  146. line-height: 1;
  147. display: inline-block;
  148. vertical-align: middle;
  149. }
  150. .reply-area {
  151. background: #fff;
  152. margin: 0 24rpx 0 24rpx;
  153. padding: 0 24rpx 24rpx 24rpx;
  154. display: flex;
  155. flex-direction: column;
  156. border-radius: 0;
  157. box-shadow: none;
  158. margin-top: 0;
  159. .review-textarea {
  160. width: 100%;
  161. min-height: 320rpx;
  162. border: none;
  163. background: transparent;
  164. font-size: 28rpx;
  165. color: #333;
  166. resize: none;
  167. outline: none;
  168. margin-top: 20rpx;
  169. }
  170. .review-textarea.custom-placeholder::placeholder {
  171. color: #d2d2d2;
  172. font-size: 26rpx;
  173. }
  174. }
  175. .form-label-row {
  176. display: flex;
  177. align-items: center;
  178. margin-bottom: 8rpx;
  179. margin-top: 50rpx;
  180. }
  181. .required-star {
  182. color: #e23d3d;
  183. font-size: 22rpx;
  184. margin-right: 4rpx;
  185. line-height: 1;
  186. }
  187. .form-label {
  188. color: #222;
  189. font-size: 26rpx;
  190. font-weight: 400;
  191. }
  192. .reply-input {
  193. margin-top: 12rpx;
  194. border: none !important;
  195. box-shadow: none !important;
  196. }
  197. .reply-footer {
  198. position: fixed;
  199. left: 0;
  200. right: 0;
  201. bottom: 90rpx;
  202. background: #fff;
  203. padding: 24rpx 32rpx 32rpx 32rpx;
  204. box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.03);
  205. z-index: 10;
  206. }
  207. .submit-btn {
  208. width: 100%;
  209. height: 80rpx;
  210. background: #0a225f !important;
  211. color: #fff !important;
  212. font-size: 30rpx;
  213. border-radius: 40rpx;
  214. font-weight: 500;
  215. letter-spacing: 2rpx;
  216. border: none;
  217. box-shadow: none;
  218. margin: 0 auto;
  219. display: block;
  220. text-align: center;
  221. line-height: 80rpx;
  222. }
  223. .submit-btn:disabled {
  224. background: #bdbdbd;
  225. color: #fff;
  226. }
  227. </style>