<template>
  <div class="user-page-container">
    <!-- 左侧内容 -->
    <div class="left-container">
      <!-- 用户信息卡片 -->
      <div class="user-info-card">
        <div class="user-avatar">
          <img src="@/assets/default-avatar/boy_4.png" alt="用户头像" />
        </div>
        <div class="user-details">
          <h2 class="username">cp3</h2>
          <p class="user-status">ONLINE</p>
          <p class="user-motto">不经巨大的困难，不会有伟大的事业</p>
        </div>
      </div>

      <!-- 帖子列表 -->
      <div class="user-posts">
        <h3>你的帖子</h3>
        <div class="post-item" v-for="(post, index) in posts" :key="index">
          <h4 class="post-title">{{ post.title }}</h4>
          <p class="post-summary">{{ post.summary }}</p>
          <div class="post-stats">
            <span>热度 {{ post.likes }}</span>
            <span>评论 {{ post.comments }}</span>
            <span>赞 {{ post.favorites }}</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 右侧内容 -->
    <div class="right-container">
      <!-- 个人统计信息卡片 -->
      <div class="user-stats-card">
        <h3>cp3 个人信息</h3>
        <div class="stats">
          <div class="stat-item">
            <span>发帖数</span>
            <span>5</span>
          </div>
          <div class="stat-item">
            <span>粉丝</span>
            <span>123</span>
          </div>
          <div class="stat-item">
            <span>你关注的人数</span>
            <span>456K</span>
          </div>
          <div class="stat-item">
            <span>获赞数</span>
            <span>789</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { ref } from 'vue';

export default {
  name: 'UserPage',
  setup() {
    const posts = ref([
      {
        title: '雷霆连续两场或20分钟逆转什么水平',
        summary: '今天保罗带领雷霆完成逆转',
        likes: 1200,
        comments: 10,
        favorites: 100,
      },
      {
        title: '一个普通人需要多大努力才能考上985',
        summary: 'mmmmmmmm',
        likes: 2200,
        comments: 20,
        favorites: 200,
      },
    ]);

    return {
      posts,
    };
  },
};
</script>

<style scoped>
/* 页面整体布局 */
.user-page-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  background-color: #f5f5f5;
  max-width: 1200px; /* 设置最大宽度 */
  margin: 0 auto; /* 居中并在两边留白 */
  box-sizing: border-box;
}

/* 左侧内容 */
.left-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 3;
}

/* 右侧内容 */
.right-container {
  flex: 1;
}

/* 用户信息卡片样式 */
.user-info-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-avatar img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 24px;
  margin: 0;
}

.user-status {
  color: green;
  font-weight: bold;
}

.user-motto {
  color: #666;
  font-size: 14px;
}

/* 个人统计信息卡片样式 */
.user-stats-card {
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

/* 帖子列表样式 */
.user-posts {
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-item {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.post-item:last-child {
  border-bottom: none;
}

.post-title {
  font-size: 18px;
  margin: 0;
}

.post-summary {
  color: #666;
  font-size: 14px;
}

.post-stats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #999;
}
</style>