<ion-header>
  <ion-toolbar>
    <ion-title>用户面板</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="dashboard-content">
  <div class="profile-card">
    <div class="profile-buttons">
      <ion-button fill="clear" (click)="goToAIAgent()">
        <ion-icon name="chatbubble-ellipses" slot="icon-only"></ion-icon>
      </ion-button>
      <ion-button fill="clear" (click)="logout()">
        <ion-icon name="Exit" slot="icon-only"></ion-icon>
      </ion-button>
    </div>
    <div class="profile-content">
      <ion-avatar class="user-avatar">
        <img [src]="currentUser?.data?.avatar || 'assets/images/1.jpg'" alt="用户头像"/>
      </ion-avatar>
      <h2 class="username">{{currentUser?.data?.username}}</h2>
      <p class="email">{{currentUser?.data?.email}}</p>
      <ion-button class="profile-btn" expand="block" (click)="goToEditProfile()">个人资料</ion-button>
    </div>
  </div>

  <!-- 添加积分卡片 -->
  <div class="points-container">
    <ion-card class="points-card">
      <ion-card-content>
        <div class="points-content">
          <div class="points-text">
            <h3>我的积分</h3>
            <p class="points-value">1000</p>
          </div>
          <ion-icon name="coin" class="points-icon"></ion-icon>
        </div>
      </ion-card-content>
    </ion-card>
  
    <ion-card class="withdraw-card" (click)="showWithdrawAlert()">
      <ion-card-content>
        <h3>积  分  提  现</h3>
      </ion-card-content>
    </ion-card>
  </div>

  <!-- 添加我的资质框 -->
  <ion-card>
    <ion-card-header>
      <ion-card-title>我的资质</ion-card-title>
    </ion-card-header>
    <ion-card-content>
      <ion-grid>
        <ion-row class="ion-text-center ion-align-items-center">
          <ion-col><strong>资质类型</strong></ion-col>
          <ion-col><strong>上传时间</strong></ion-col>
          <ion-col><strong>证书时间</strong></ion-col>
          <ion-col><strong>状态</strong></ion-col>
        </ion-row>
        <ion-row *ngFor="let qual of qualification" class="ion-text-center ion-align-items-center">
          <ion-col>{{qual.get('type')}}</ion-col>
          <ion-col>{{qual.get('uploadTime')}}</ion-col>
          <ion-col>{{qual.get('certTime')}}</ion-col>
          <ion-col>{{qual.get('status') || '已通过'}}</ion-col>
        </ion-row>
      </ion-grid>
    </ion-card-content>
  </ion-card>

<ion-button expand="block" (click)="goToUploadQualification()">上传资质</ion-button>
