<view class="page-container">
  <block wx:if="{{user.phone}}">
  <!-- 头部荣誉区域 -->
  <view class="honor-section" wx:if="{{honors.length > 0}}">
    <view class="section-header">
      <text class="section-title">我的荣誉</text>
      <text class="honor-count">共 {{honors.length}} 项</text>
    </view>
    
    <view class="honor-list">
      <view class="honor-item" wx:for="{{honors}}" wx:key="id" bindtap="showHonorDetail" data-item="{{item}}">
        <image class="honor-image" src="{{item.image}}" mode="aspectFill"></image>
        <view class="honor-info">
          <text class="honor-title">{{item.title}}</text>
          <text class="honor-date">{{item.date}}</text>
        </view>
      </view>
    </view>
  </view>

  <!-- 课程赛事列表 -->
  <view class="course-section">
    <view class="section-header">
      <text class="section-title">我的项目&活动</text>
    </view>
    
    <view class="filter-tabs">
      <view class="tab-item {{currentFilter === 'all' ? 'active' : ''}}" bindtap="setFilter" data-type="all">全部</view>
      <view class="tab-item {{currentFilter === 'enrolled' ? 'active' : ''}}" bindtap="setFilter" data-type="enrolled">进行中</view>
      <view class="tab-item {{currentFilter === 'completed' ? 'active' : ''}}" bindtap="setFilter" data-type="completed">已完成</view>
    </view>

    <view class="project-list" wx:if="{{filteredProjects.length > 0}}">
      <view class="project-card" wx:for="{{filteredProjects}}" wx:key="id">
        <image class="project-image" src="{{item.project_image}}" mode="aspectFill"></image>
        <view class="project-info">
          <view class="project-header">
            <text class="project-title">{{item.project_title}}</text>
            <text class="project-type-tag {{item.project_type}}">{{item.project_type_display}}</text>
          </view>
          <view class="project-meta">
            <text class="status-text {{item.status}}">{{item.status_display}}</text>
            <text class="date-text">报名时间: {{item.enrolled_at_formatted}}</text>
          </view>
        </view>
      </view>
    </view>

    <view class="empty-state" wx:else>
      <text class="empty-text">暂无相关记录</text>
    </view>
  </view>
  </block>
  
  <view class="empty-state-global" wx:else style="display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 200rpx;">
      <image src="/assets/empty-honor.png" mode="aspectFit" style="width: 200rpx; height: 200rpx; margin-bottom: 20rpx; filter: grayscale(100%); opacity: 0.5;"></image>
      <text style="color: #999; font-size: 28rpx;">暂无数据，请先完善个人信息</text>
  </view>

  <!-- 荣誉详情弹窗 -->
  <view class="modal-mask" wx:if="{{showHonorModal}}" bindtap="closeHonorModal">
    <view class="modal-content" catchtap="preventBubble">
      <image class="modal-image" src="{{currentHonor.image}}" mode="widthFix"></image>
      <view class="modal-info">
        <text class="modal-title">{{currentHonor.title}}</text>
        <text class="modal-date">获得时间：{{currentHonor.date}}</text>
        <text class="modal-desc" wx:if="{{currentHonor.description}}">{{currentHonor.description}}</text>
      </view>
      <view class="modal-close" bindtap="closeHonorModal">×</view>
    </view>
  </view>
</view>
