<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="6" :xs="24">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <span>个人信息</span>
            </div>
          </template>
          <div>
            <div class="text-center">
              <userAvatar :user="user" />
            </div>
            <ul class="list-group list-group-striped">
              <li class="list-group-item">
                <user :user="user" />
              </li>
              <li class="list-group-item">
                <span>手机号码</span>
                <div>{{ user.phonenumber }}</div>
              </li>
              <li class="list-group-item">
                <span>邮箱</span>
                <div>{{ user.email }}</div>
              </li>
              <li class="list-group-item">
                <span>创建时间</span>
                <div>{{ user.createTime }}</div>
              </li>
            </ul>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="18" :xs="24">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>基本资料</span>
            </div>
          </template>
          <el-tabs v-model="activeTab">
            <el-tab-pane label="基本资料" name="userinfo">
              <userInfo :user="user" />
            </el-tab-pane>
            <el-tab-pane label="修改密码" name="resetPwd">
              <resetPwd :user="user" />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup name="Profile">
import { ref } from 'vue'
import userAvatar from './userAvatar.vue'
import userInfo from './userInfo.vue'
import resetPwd from './resetPwd.vue'

const activeTab = ref("userinfo")
const user = ref({
  userId: 1,
  deptId: 103,
  userName: "admin",
  nickName: "管理员",
  email: "admin@163.com",
  phonenumber: "15888888888",
  sex: "1",
  avatar: "",
  status: "0",
  loginIp: "127.0.0.1",
  createTime: "2024-03-15 10:00:00"
})
</script>

<style lang="scss" scoped>
.box-card {
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .list-group-striped {
    padding: 0;
    list-style: none;
    
    .list-group-item {
      border-bottom: 1px solid #eee;
      padding: 10px 0;
      
      &:last-child {
        border-bottom: none;
      }
      
      span {
        color: #666;
        display: inline-block;
        width: 100px;
      }
    }
  }
}
</style> 