<view class="page-container">
  <!-- 背景网格（保留机甲风格） -->
  <view class="grid-bg"></view>
  <view class="mech-line line-h"></view>
  <view class="mech-line line-v"></view>

  <view class="content">
    <!-- 标题区域 -->
    <view class="title-section">
      <text class="title">⚡ 推广海报 ⚡</text>
      <text class="subtitle">邀请打手扫码注册，自动填充邀请码</text>
    </view>

    <!-- 二维码展示区域（原有） -->
    <view class="qrcode-section">
      <view class="qrcode-wrapper" wx:if="{{qrcodeUrl}}">
        <image class="qrcode-img" src="{{qrcodeUrl}}" mode="widthFix" />
        <view class="qrcode-glow"></view>
      </view>
      <view class="empty-qrcode" wx:else>
        <text class="empty-icon">⚡</text>
        <text class="empty-text">点击下方按钮生成您的专属二维码</text>
      </view>
    </view>

    <!-- 按钮区域（第一行：保存/刷新/生成海报） -->
    <view class="button-section">
      <view class="btn-group">
        <view class="btn save-btn" bindtap="saveToAlbum" wx:if="{{qrcodeUrl}}">
          <text class="btn-icon">📥</text>
          <text class="btn-text">保存二维码</text>
        </view>
        <view class="btn refresh-btn" bindtap="refreshQRCode" wx:if="{{!isLoading}}">
          <text class="btn-icon">⟳</text>
          <text class="btn-text">{{qrcodeUrl ? '重新获取' : '获取二维码'}}</text>
        </view>
        <view class="btn loading-btn" wx:else>
          <view class="loading-spinner-small"></view>
          <text class="btn-text">生成中...</text>
        </view>
        <!-- 🔥【新增】生成我的专属海报按钮 -->
        <view class="btn poster-btn" bindtap="generateMyPoster" wx:if="{{qrcodeUrl && !showPosterCanvas}}">
          <text class="btn-icon">🎨</text>
          <text class="btn-text">生成我的专属海报</text>
        </view>
      </view>
    </view>

    <!-- 🔥【新增】专属海报展示区（当 showPosterCanvas 为 true 时显示） -->
    <view class="poster-section" wx:if="{{showPosterCanvas}}">
      <canvas canvas-id="posterCanvas" class="poster-canvas"></canvas>
      <view class="poster-actions">
        <view class="btn save-poster-btn" bindtap="savePoster">
          <text class="btn-icon">📥</text>
          <text class="btn-text">保存海报</text>
        </view>
        <view class="btn back-btn" bindtap="hidePoster">
          <text class="btn-icon">↩️</text>
          <text class="btn-text">返回</text>
        </view>
      </view>
    </view>

    <!-- 使用说明（保留） -->
    <view class="instruction">
      <text class="instruction-text">* 打手扫码后自动进入注册页面，邀请码将自动填充</text>
    </view>
  </view>

  <global-notification id="global-notification" />
</view>