<!-- 微信小程序签到页面 -->
<view class="container">
  <!-- 页面标题 -->
  <view class="page-title">
    <text>每日签到</text>
  </view>

  <!-- 签到信息展示 -->
  <view class="signin-info">
    <view class="info-card">
      <view class="info-item">
        <text class="label">连续签到天数</text>
        <text class="value">{{continuousDays}}天</text>
      </view>
      <view class="info-item">
        <text class="label">总积分</text>
        <text class="value">{{totalPoints}}</text>
      </view>
      <view class="info-item">
        <text class="label">最后签到</text>
        <text class="value">{{lastSignInDate || '暂无'}}</text>
      </view>
    </view>
  </view>

  <!-- 签到按钮 -->
  <view class="signin-button-container">
    <button 
      class="signin-button {{isTodaySigned ? 'signed' : 'unsigned'}}" 
      bindtap="doSignin"
      disabled="{{isTodaySigned}}"
    >
      {{isTodaySigned ? '今日已签到' : '立即签到'}}
    </button>
  </view>

  <!-- 本周签到日历 -->
  <view class="week-calendar">
    <view class="calendar-title">
      <text>本周签到</text>
    </view>
    <view class="calendar-grid">
      <block wx:for="{{['日', '一', '二', '三', '四', '五', '六']}}" wx:key="index">
        <view class="weekday">{{item}}</view>
      </block>
      <block wx:for="{{weekSigned}}" wx:key="day">
        <view class="calendar-day {{item.signed ? 'signed' : 'unsigned'}}">
          <text class="day-text">{{item.day}}</text>
        </view>
      </block>
    </view>
  </view>

  <!-- 签到奖励说明 -->
  <view class="reward-rules">
    <view class="rules-title" bindtap="showRule">
      <text>签到奖励规则</text>
      <text class="icon">></text>
    </view>
    <view class="rules-content">
      <view class="rule-item">第1天: 5积分</view>
      <view class="rule-item">第2天: 10积分</view>
      <view class="rule-item">第3天: 15积分</view>
      <view class="rule-item">第4天: 20积分</view>
      <view class="rule-item">第5天: 25积分</view>
      <view class="rule-item">第6天: 30积分</view>
      <view class="rule-item">第7天: 50积分(额外奖励)</view>
      <view class="rule-desc">连续7天签到后，重新开始计算周期。中间断签也会重置计数。</view>
    </view>
  </view>

  <!-- 签到成功弹窗 -->
  <view class="signin-success-modal" wx:if="{{rewardPoints > 0}}">
    <view class="modal-content">
      <view class="modal-icon">✓</view>
      <view class="modal-title">签到成功</view>
      <view class="modal-reward">获得{{rewardPoints}}积分</view>
      <button class="modal-close" bindtap="closeSuccessModal">确定</button>
    </view>
  </view>
</view>