<import src="/pages/templates/competitionCard/competitionCard.wxml"></import>
<import src="/pages/templates/loadmore/loadmore.wxml"></import>
<block wx:if="{{userOpenid=='oRnCI5JYWT9dmVycOnBjYaX1Yx7k'||userOpenid=='oRnCI5GgJ8Kc3sGye-ungAdL7r4U'}}">
    <view class="{{inputShowed?'topFixedContainer':''}}">
        <view class="weui-search-bar">
            <view class="weui-search-bar__form">
                <view class="weui-search-bar__box">
                    <icon class="weui-icon-search_in-box" color="#d5d5d5" size="28rpx" type="search"></icon>
                    <input bindconfirm="inputFinish" bindinput="inputTyping" class="weui-search-bar__input" confirmType="search" focus="{{inputShowed}}" maxlength="20" placeholder="" placeholderClass="input-placeholder-text" type="text" value="{{inputVal}}"></input>
                    <view bindtap="clearInput" class="weui-icon-clear" wx:if="{{inputVal}}">
                        <icon color="#d5d5d5" size="28rpx" type="clear"></icon>
                    </view>
                </view>
                <label bindtap="showInput" class="weui-search-bar__label" hidden="{{inputShowed}}">
                    <icon class="weui-icon-search" color="#d5d5d5" size="28rpx" type="search"></icon>
                    <view class="weui-search-bar__text"></view>
                </label>
            </view>
            <view bindtap="hideInput" class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}">取消</view>
        </view>
    </view>
    <view style="height:88rpx;background-color:#f4f4f4;" wx:if="{{inputShowed}}"></view>
</block>
<view>
    <block wx:for="{{competitions}}" wx:for-item="competition" wx:key="index">
        <navigator url="/pages/competition/competition?id={{competition._id}}">
            <view class="competitionContainer" hoverClass="navigatorHover" style="border-radius: 10rpx;">
                <view class="titleStartTime" style="border-radius: 10rpx;">
                    <text class="title">{{competition.title}}</text>
                    <text class="startTime">{{competition.startTimeStr}}<text class="startTime">{{competition.site}}</text>
                    </text>
                    <view class="avatarSponsor">
                        <image class="user-card-avatar" src="{{competition.avatarUrl}}"></image>
                        <text space="nbsp" style="font-size: 32rpx;">{{competition.vipExpiryTime?competition.vipExpiryTime:competition.proExpiryTime?competition.proExpiryTime:'创建者: '}} </text>
                        <text style="font-size: 32rpx;">{{competition.nickName}}</text>
                    </view>
                    <view class="visitTotalView" style="{{competition.rechargeable?' border-top:2rpx dashed #ff5a5f;':'border-top:2rpx dashed #d5d5d5;'}}" wx:if="{{inputShowed||competition.workerVisitTotal||competition.juryVisitTotal||competition.audienceVisitTotal}}">
                        <text>主办{{competition.workerVisitTotal}}</text>
                        <text>评委{{competition.juryVisitTotal}}</text>
                        <text>观众{{competition.audienceVisitTotal}}</text>
                        <text>{{competition.status}}</text>
                        <text>{{competition.scoringRate}}</text>
                        <text>{{competition.note=='宝职'?'宝职':competition.note==''?'开放':'不开放'}}</text>
                    </view>
                </view>
            </view>
        </navigator>
        <view class="buttonsView">
            <view catchtap="searchCreator" data-nickName="{{competition.nickName}}" data-openid="{{competition.creator}}" hoverClass="navigatorHover" style="{{competition.vipExpiryTime?' border: 2rpx solid #ff5a5f;':' border: 0rpx solid #f4f4f4;'}}">
                <text>Creator</text>
            </view>
            <view catchtap="copyID" data-id="{{competition._id}}" hoverClass="navigatorHover">
                <text>ID</text>
            </view>
            <view catchtap="vipActionSheet" data-competition="{{competition}}" data-openid="{{competition.creator}}" hoverClass="navigatorHover">
                <text>P&V</text>
            </view>
            <view catchtap="showActionSheet" data-competition="{{competition}}" hoverClass="navigatorHover">
                <text>More</text>
            </view>
        </view>
    </block>
    <template is="loadmore" data="{{loadmore:loadmore,backgroundColor:'#f4f4f4'}}"></template>
    <view style="height:64rpx;background-color: #f4f4f4" wx:if="{{competitions.length>0}}"></view>
</view>
<view class="button-fixed-bottom" style="z-index: 110;" wx:if="{{competitions.length>=1}}">
    <view class="buttonContainer">
        <view class="small-button displayFlexCenter" style="width:240rpx;">
            <text catchtap="refresh" space="ensp" style="font-size: 24rpx;font-weight: 300;color: #fff;">刷新 | </text>
            <text catchtap="changeOrderBy" style="font-size: 24rpx;font-weight: 300;color: #fff;">切换排序</text>
        </view>
    </view>
</view>
<view style="height:64rpx"></view>
