Files
2026-10-26 17:32:47 +08:00

101 lines
5.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<view class="app-shell app-shell--secondary" style="{{layoutStyle}}">
<launch-transition />
<!-- pages/punch/punch.wxml - 情侣打卡 -->
<app-nav title="打卡" back="{{true}}" />
<scroll-view class="page-bg" scroll-y bindscrolltolower="loadMore" lower-threshold="120" show-scrollbar="{{false}}" bounces="{{true}}">
<view class="c-body"><view class="c-heading j-row"><view><text class="j-eyebrow">LITTLE PROMISES</text><text class="j-page-title">把约定变成习惯</text></view><button class="j-button j-button-small" bindtap="showAddModal">+ 添加</button></view>
<page-state wx:if="{{loading}}" kind="loading" title="正在加载" /><page-state wx:elif="{{loadError}}" kind="error" title="加载失败" description="请检查网络后重新加载" action="重试" bind:action="loadData" />
<!-- 顶部 Banner - 卡片式 -->
<view class="punch-banner-card" wx:if="{{!loading && !loadError}}">
<view class="promise-summary-head"><text class="c-small-title">一起坚持的小约定</text><view class="promise-avatars"><view class="banner-avatar-circle"><image wx:if="{{myAvatar}}" src="{{myAvatar}}" mode="aspectFill" /><text wx:else>我</text></view><view class="banner-avatar-circle"><image wx:if="{{partnerAvatar}}" src="{{partnerAvatar}}" mode="aspectFill" /><text wx:else>TA</text></view></view></view>
<view class="banner-stat-grid">
<view class="banner-stat-card">
<text class="stat-num">{{weekBoth}}</text>
<text class="stat-label">本周共同打卡</text>
</view>
<view class="banner-stat-card">
<text class="stat-num">{{todayMy}}</text>
<text class="stat-label">我今天</text>
</view>
<view class="banner-stat-card">
<text class="stat-num">{{todayPartner}}</text>
<text class="stat-label">TA今天</text>
</view>
</view>
</view>
<smoking-card id="smoking" wx:if="{{smokingVisible}}" bind:updated="onSmokingUpdated" />
<!-- 打卡列表 -->
<view class="checkin-cards" wx:if="{{!loading && !loadError && checkins.length > 0}}">
<view class="checkin-card" wx:for="{{checkins}}" wx:key="id" bindtap="openDetail" data-index="{{index}}" bindlongpress="deleteCheckin" data-id="{{item.id}}">
<!-- 主题 -->
<view class="card-row card-theme">
<text class="card-icon" wx:if="{{item.icon && item.icon !== '✅'}}">{{item.icon}}</text><image wx:else class="card-icon" src="/images/check.svg" mode="aspectFit" />
<text class="card-title">{{item.title}}</text>
</view>
<!-- 打卡频率 -->
<view class="card-row">
<text class="card-label">打卡频率</text>
<text class="card-value">{{item.freq_label}}</text>
</view>
<!-- 参与人(双人:双方昵称+头像 / 单人:对应昵称+头像) -->
<view class="card-row" wx:if="{{item.type == 'both'}}">
<text class="card-label">参与人</text>
<view class="card-users">
<view class="user-chip">
<image wx:if="{{myAvatar}}" class="chip-avatar" src="{{myAvatar}}" mode="aspectFill" />
<text wx:else class="chip-avatar-fallback">{{myName ? myName.charAt(0) : '我'}}</text>
<text class="chip-name">{{myName}}</text>
</view>
<text class="chip-sep">·</text>
<view class="user-chip">
<image wx:if="{{partnerAvatar}}" class="chip-avatar" src="{{partnerAvatar}}" mode="aspectFill" />
<text wx:else class="chip-avatar-fallback">{{partnerName ? partnerName.charAt(0) : 'TA'}}</text>
<text class="chip-name">{{partnerName}}</text>
</view>
</view>
</view>
<view class="card-row" wx:elif="{{item.type == 'first' || item.type == 'her'}}">
<text class="card-label">参与人</text>
<view class="card-users">
<view class="user-chip">
<image wx:if="{{item.type == 'first' && myAvatar}}" class="chip-avatar" src="{{myAvatar}}" mode="aspectFill" />
<image wx:elif="{{item.type == 'her' && partnerAvatar}}" class="chip-avatar" src="{{partnerAvatar}}" mode="aspectFill" />
<text wx:else class="chip-avatar-fallback">{{item.type == 'first' ? (myName ? myName.charAt(0) : '我') : (partnerName ? partnerName.charAt(0) : 'TA')}}</text>
<text class="chip-name">{{item.type == 'first' ? myName : partnerName}}</text>
</view>
</view>
</view>
<!-- 创建人 -->
<view class="card-row">
<text class="card-label">创建人</text>
<view class="card-creator-info">
<image wx:if="{{item.creator_avatar_url}}" class="creator-avatar" src="{{item.creator_avatar_url}}" mode="aspectFill" />
<text wx:else class="creator-avatar-fallback">{{item.creator_name ? item.creator_name.charAt(0) : '?'}}</text>
<text class="creator-name">{{item.creator_name || '未知'}}</text>
</view>
</view>
</view>
</view>
<page-state wx:if="{{!loading && !loadError && !checkins.length}}" title="从一个小约定开始" description="一起运动、按时吃饭,也可以成为日常仪式" action="添加打卡" bind:action="showAddModal" />
</view>
<view class="j-pagination" wx:if="{{!loading && !loadError && total > 0}}"><text wx:if="{{loadingMore}}">正在加载…</text><text wx:elif="{{moreError}}" bindtap="loadMore">加载失败,点击重试</text><text wx:elif="{{hasMore}}" bindtap="loadMore">加载更多</text><text wx:else>已加载全部</text></view>
</scroll-view>
<!-- 浮动按钮 -->
</view>