<!--pages/contest/ranking/ranking.wxml-->
<wxs src="../../../utils/util.wxs" module="format" />
<view bindtap="closeShow" style="min-height:100vh">
  <image src="../../../imgs/contest/ranking/bg.png" class="bg" mode="widthFix"></image>
  <image src="../../../imgs/contest/ranking/home.png" class="home" style="top:{{statusBar}}px" bindtap="goHome"></image>
  <view class="page-title" style="padding-top:{{statusBar}}px">排行榜</view>
  <view class="content">
    <view class="navList">
      <view class="{{page==1&&'active'}}" bindtap="togglePage" data-index="1">个人排名</view>
      <view class="{{page==2&&'active'}}" bindtap="togglePage" data-index="2">区排名</view>
      <view class="{{page==3&&'active'}}" bindtap="togglePage" data-index="3">学校排名</view>
    </view>
    <view style="height:430rpx"></view>
    <view class="ranking-list">
      <view class="ranking-item" wx:for="{{dataList}}" wx:key="index">
        <view class="order-num" wx:if="{{index>2}}">{{index+1}}</view>
        <image class="top-three" wx:else src="../../../imgs/contest/ranking/top-{{index+1}}.png"></image>
        <image class="avatar" src="{{item.avatar}}" wx:if="{{page===1}}"></image>
        <image class="page-icon-2" src="../../../imgs/contest/ranking/page-2.png" wx:elif="{{page===2}}"></image>
        <image class="page-icon-3" src="../../../imgs/contest/ranking/page-3.png" wx:else></image>
        <view class="nickname">{{item.nickname||item.areaName||item.schoolName||''}}
          <view wx:if="{{page===1}}">
            <text class="school-tag">{{item.schoolName||''}}</text>
          </view>  
        </view>
        <view class="fraction">{{format.toFixed(item.score||item.avgScore||0,1)}}分</view>
      </view>
    </view>
  </view>
  <view class="help">
    <image class="help-icon" src="../../../imgs/contest/ranking/help-icon.png" catchtap="clickHelp"></image>
    <view class="help-message" wx:if="{{helpState}}">
      <image src="../../../imgs/contest/ranking/test-area.png"></image>
      <view class="message">
        <view class="message-title">{{['','个人','区','学校'][page]}}排名说明</view> 
        <view class="message-test">以竞赛时间范围内个人最好成绩排序高低，如分数并列，则按照答题时间的快慢平均值排序；</view>
      </view>
    </view>
  </view>
</view>
