<template>
  <view class="respond-comments-page">
    <!-- 顶部导航栏 -->
    <navbar title="回复评论" leftClick @leftClick="$utils.navigateBack" />
    
    <!-- 原评论展示 -->
    <view class="origin-comment-card">
      <view class="comment-header">
        <image class="avatar" :src="comment.avatar" mode="aspectFill" />
        <view class="user-info">
          <text class="username">{{ comment.username }}</text>
        </view>
      </view>
      <view class="comment-content">{{ comment.content }}</view>
      <view class="comment-footer">
        <text class="comment-time">{{ comment.time }}</text>
        <text class="comment-reply-count">
          <text class="emoji-icon">💬</text>
         
          {{ comment.replyCount }}
        </text>
      </view>
    </view>
    <!-- 回复输入区 -->
    <view class="reply-area">
      <view class="form-label-row">
        <text class="required-star">*</text>
        <text class="form-label">回复内容</text>
      </view>
      <uv-input
        v-model="replyContent"
        type="text"
        :maxlength="200"
        placeholder="请输入回复内容"
        border="surround"
        clearable
        class="reply-input"
      />
    </view>
    <!-- 底部提交按钮 -->
    <view class="reply-footer">
      <button class="submit-btn" :disabled="!replyContent.trim()" @click="submitReply">发送</button>
    </view>
  </view>
</template>

<script>
import navbar from '@/components/base/navbar.vue'
export default {
  components: { navbar },
  data() {
    return {
      comment: {
        avatar: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain',
        username: '方香橙',
        content: '我是本书的作者方香橙，这是一本甜文爽文哒！请放心入坑，五星好评！女主又美有个性可爱，绝对不圣母，不傻白！男主身心干净深情独宠媳妇儿一个人...',
        time: '2024.07.09',
        replyCount: 17
      },
      replyContent: ''
    }
  },
  methods: {
    goBack() {
      uni.navigateBack()
    },
    submitReply() {
      if (!this.replyContent.trim()) {
        uni.showToast({ title: '请输入回复内容', icon: 'none' })
        return
      }
      // 实际开发中可调用API提交
      uni.showToast({ title: '回复成功', icon: 'success' })
      this.replyContent = ''
      setTimeout(() => {
        uni.navigateBack()
      }, 1000)
    }
  }
}
</script>

<style scoped lang="scss">
.respond-comments-page {
  min-height: 100vh;
  background: #f8f8f8;
  display: flex;
  flex-direction: column;
}
.origin-comment-card {
  background: #fff;
  margin: 24rpx 24rpx 0 24rpx;
  padding: 24rpx 24rpx 0 24rpx;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  padding-bottom: 0;
}
.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 8rpx;
}
.avatar {
  width: 56rpx;
  height: 56rpx;
  border-radius: 50%;
  margin-right: 16rpx;
}
.user-info {
  display: flex;
  flex-direction: column;
}
.username {
  font-size: 26rpx;
  color: #222;
  font-weight: 500;
}
.comment-content {
  font-size: 26rpx;
  color: #333;
  margin-bottom: 12rpx;
}
.comment-footer {
  display: flex;
  align-items: center;
  font-size: 22rpx;
  color: #bdbdbd;
  justify-content: space-between;
}
.comment-time {
  color: #bdbdbd;
  margin-top: 18rpx;
}
.comment-reply-count {
  display: flex;
  align-items: center; 
  font-size: 22rpx;
  color: #bdbdbd;
  line-height: 1;
}
.emoji-icon {
  margin-right: 4rpx;
  font-size: 22rpx;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}
.reply-area {
  background: #fff;
  
  margin: 0 24rpx 0 24rpx;
  padding: 0 24rpx 24rpx 24rpx;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  box-shadow: none;
  margin-top: 0;
}
.form-label-row {
  display: flex;
  align-items: center;
  margin-bottom: 8rpx;
  margin-top: 50rpx;
}
.required-star {
  color: #e23d3d;
  font-size: 22rpx;
  margin-right: 4rpx;
  line-height: 1;
}
.form-label {
  color: #222;
  font-size: 26rpx;
  font-weight: 400;
}
.reply-input {
  margin-top: 12rpx;
  border: none !important;
  box-shadow: none !important;
}
.reply-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 90rpx;
  background: #fff;
  padding: 24rpx 32rpx 32rpx 32rpx;
  box-shadow: 0 -2rpx 12rpx rgba(0,0,0,0.03);
  z-index: 10;
}
.submit-btn {
  width: 100%;
  height: 80rpx;
  background: #0a225f !important;
  color: #fff !important;
  font-size: 30rpx;
  border-radius: 40rpx;
  font-weight: 500;
  letter-spacing: 2rpx;
  border: none;
  box-shadow: none;
  margin: 0 auto;
  display: block;
  text-align: center;
  line-height: 80rpx;
}
.submit-btn:disabled {
  background: #bdbdbd;
  color: #fff;
}
</style>
