dapaijizhang3/pages/index/index.wxml

106 lines
3.7 KiB
Plaintext

<!--首页-->
<custom-navbar title="打牌记账" show-back="{{false}}" />
<view class="container" style="margin-top: {{navbarHeight}}px;">
<!-- 用户信息卡片 -->
<view class="user-card" >
<!-- 头部:头像+昵称+扫码 -->
<view class="user-header">
<view class="user-basic" bindtap="goToProfile">
<image class="user-avatar" src="{{userInfo.avatar_url || '/images/default-avatar.png'}}" mode="aspectFill" />
<view class="user-info">
<text class="user-nickname">{{userInfo.nickname || '未登录'}}</text>
<text class="login-tip" wx:if="{{!isLogin}}">点击登录</text>
</view>
</view>
<view class="scan-btn guide-scan-btn" bindtap="scanCode" catchtap="scanCode">
<text class="scan-icon">📷</text>
<text class="scan-text">扫码进入</text>
</view>
</view>
<!-- 统计数据行 -->
<view class="user-stats" wx:if="{{isLogin}}">
<view class="stat-item">
<text class="stat-label">场次</text>
<text class="stat-value">{{userInfo.total_games || 0}}</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-label">胜率</text>
<text class="stat-value">{{userInfo.win_rate || 0}}%</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-label">赢</text>
<text class="stat-value win">{{userInfo.total_win || 0}}</text>
</view>
<view class="stat-divider"></view>
<view class="stat-item">
<text class="stat-label">输</text>
<text class="stat-value lose">{{userInfo.total_loss || 0}}</text>
</view>
</view>
</view>
<!-- 快速操作按钮 -->
<view class="action-buttons">
<view class="action-btn primary-btn guide-create-btn" bindtap="createRoom">
<text class="btn-icon">+</text>
<text class="btn-text">创建房间</text>
</view>
<view class="action-btn secondary-btn guide-join-btn" bindtap="joinRoom">
<text class="btn-icon">⇄</text>
<text class="btn-text">加入房间</text>
</view>
</view>
<!-- 进行中的房间 -->
<view class="section" wx:if="{{activeRooms.length > 0}}">
<view class="section-header">
<text class="section-title">进行中的房间</text>
</view>
<view class="room-grid">
<view class="room-card" wx:for="{{activeRooms}}" wx:key="id"
bindtap="goToRoom" data-id="{{item.id}}">
<!-- 房间名称和房主标识 -->
<view class="room-title-row">
<text class="room-name">{{item.room_name}}</text>
<text class="host-badge" wx:if="{{item.is_host}}">房主</text>
</view>
<!-- 状态和人数 -->
<view class="room-info-row">
<view class="room-status-badge status-{{item.status}}">
{{item.status === 'playing' ? '进行中' : '等待中'}}
</view>
<text class="room-players">{{item.current_players}}人</text>
</view>
<!-- 创建时间 -->
<view class="room-time">
<text class="time-text">{{item.create_time}}</text>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty" wx:if="{{isLogin && activeRooms.length === 0}}">
<text class="empty-icon">🎯</text>
<text class="empty-text">暂无房间</text>
<text class="empty-hint">快创建一个房间开始游戏吧</text>
</view>
<jdwx-ad style="margin-top: 20rpx;" type="custom"></jdwx-ad>
</view>
<!-- 自定义TabBar -->
<custom-tabbar selected="{{0}}" />
<!-- 新用户引导 -->
<user-guide
show="{{showGuide}}"
steps="{{guideSteps}}"
bind:complete="onGuideComplete"
/>