<!-- home -->
<wxs src="../../utils/util.wxs" module="format" />
<view class="home fg" wx:if="{{curNav == 0}}">
  <view style="overflow:hidden">
    <view class="swiperContainer">
      <swiper indicator-dots indicator-active-color="#eee" autoplay interval="3000" circular>
        <swiper-item wx:for="{{home.banners}}" wx:key>
          <image src="{{imgUrl + item.bannerImage}}" class="full" mode="scaleFill"></image>
        </swiper-item>
      </swiper>
    </view>
  </view>

  <view class="home-nav-list">
    <image src="../../imgs/home/nav-bg.png"></image>
    <view class="home-nav-select">
      <view class="contest" bindtap="toLinkR">
        <image mode="widthFix" src="../../imgs/home/contest.png"></image>
        <view>参加竞赛</view>
      </view>
      <view class="ranking" bindtap="toLink" data-url="/pages/contest/ranking/ranking">
        <image mode="widthFix" src="../../imgs/home/ranking.png"></image>
        <view>排行榜</view>
      </view>
      <!-- <view class="study" bindtap="toLink" data-url="/pages/contest/answer/answer"> -->
      <view class="study" bindtap="clickStudy">
        <image mode="widthFix" src="../../imgs/home/study.png"></image>
        <view>在线学习</view>
      </view>
    </view>
  </view>

  <!-- <view class="hotNews fg">
    <view class="title">
      <view class="row crosscenter">
        <view class="bar"></view>
        <text class="txtpro txtbold" style="color: #002063">热点头条</text>
      </view>
      <view class="cuIcon-more" bindtap="clickHotnewsMore"></view>
    </view>
    <view>

      <view class="article" bindtap="clickArticle" wx:for="{{home.hotnews}}" wx:key data-i="{{index}}" data-id="{{item.id}}">
        <view class="imgbox">
          <image class="fullx" src="{{imgUrl + item.coverImage}}" mode="widthFix"></image>
        </view>
        <view class="content">
          <text style="color: #002063" class="txtbold">{{item.headlineTitle}}</text>
          <view class="imgsmr attr">
            <image src="../../imgs/clock-attr.png"></image>
            <text>{{item.releaseTime}}</text>
          </view>
          <view class="p">{{item.summary}}</view>
        </view>
      </view>

    </view>
  </view> -->

  <view class="news-list">
    <view class="hot-title">
      <view class="title">热点头条</view>
      <view class="more" bindtap="clickHotnewsMore">
      <view>更多</view>
      <image mode="widthFix" src="../../imgs/home/arrow.png"></image></view>
    </view>
    <view class="news-list-content">
      <view class="news-list-item" bindtap="clickArticle" wx:for="{{home.hotnews}}" wx:key data-i="{{index}}" data-id="{{item.id}}">
        <image mode="widthFix" src="../../imgs/home/list-bg.png"></image>
        <view class="content">
          <image src="{{imgUrl + item.coverImage}}" class="left"></image>
          <view class="right">
            <view class="title">{{item.headlineTitle}}</view>
            <view class="introduce">{{item.summary}}</view>
            <view class="bottom">
              <view class="tagR">赛事</view>
              <view class="time">{{item.releaseTime}}</view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
  <!-- <view class="partners">
    <view class="title">
      <view class="row crosscenter">
        <view class="bar"></view>
        <text class="txtpro txtbold" style="color: #002063">合作伙伴</text>
      </view>
    </view>

    <view class="partnersContainer">

      <view class="level" wx:for="{{home.partners}}" wx:key>
        <view class="levelTitle">
          <view>{{item.title}}</view>
        </view>
        <view class="row around wrap">
          <view class="bor" style="margin-bottom: 1em">
            <image src="{{imgUrl + item.brandImage}}" mode="scaleToFill"></image>
          </view>
        </view>
      </view>

    </view>
  </view> -->
  <view class="sponsor">
    <view class="sponsor-title">合作伙伴</view>
    <view class="sponsor-list">
      <view class="sponsor-item" wx:for="{{home.partners}}" wx:key="index">
        <image mode="widthFix" src="{{imgUrl + item.brandImage}}"></image>
      </view>
    </view>
  </view>
  <!-- <view class="authorization">
    <button open-type="getUserInfo" bindgetuserinfo="getUserinfo">点击授权</button>
  </view> -->
</view>

<!-- activity -->

<view class="activities fg" wx:if="{{curNav == 1}}">
  <view class="searchContainer">
    <view class="row center search" bindtap="clickSearch">
      <input focus wx:if="{{searchOn}}" bindblur="blurSearch" bindinput="inputSearch"></input>
      <text class="cuIcon-search" wx:if="{{!searchOn}}"> 请输入活动关键字查询</text>
    </view>
  </view>
  <view class="activityContainer">
    <view class="activity" bindtap="clickActivity" wx:for="{{activity.list}}" wx:key data-i="{{index}}" data-id="{{item.id}}">
      <image src="{{imgUrl + item.coverImage}}"></image>
      <!-- <view class="tag {{item.status_attend=='已结束'?'finished':item.status_attend=='未开始'?'ready':'signing'}}" wx:if="{{item.status_attend}}">{{item.status_attend}}</view> -->
       <view class="tag {{(format.valueOf(item.applyEndTime)<format.valueOf())?'finished':(format.valueOf(item.applyStartTime)>format.valueOf())?'ready':'signing'}}" wx:if="{{item}}">
        <!-- {{format.valueOf(item.applyEndTime)<format.valueOf()?'已结束':format.valueOf(item.applyStartTime)>format.valueOf()?'报名中':'未开始'}} -->
        {{(format.valueOf(item.applyEndTime)<format.valueOf())?'已结束':(format.valueOf(item.applyStartTime)>format.valueOf())?'未开始':'报名中'}}
       </view>
      <view class="skiing">{{item.activityTitle}}</view>
    </view>

  </view>
</view>

<!-- community -->

<view class="community fg" wx:if="{{curNav==2}}">
  <view class="searchContainer">
    <view class="row center search" bindtap="clickSearch">
      <input focus wx:if="{{searchOn}}" bindblur="blurSearch" bindinput="inputSearch"></input>
      <text class="cuIcon-search" wx:if="{{!searchOn}}"> 请输入活动关键字查询</text>
    </view>
    <view class="release-button" bindtap="clickAddtidings">发布</view>
  </view>
  <view class="bfc">
    <!-- item -->
    <view wx:for="{{community.list}}" wx:key>
      <view class="imgtxt" bindtap="clickCommunityArticle" data-item="{{item}}">
        <view class="img">
          <!-- <image mode="aspectFill" src="{{imgUrl + item.avatar}}"></image> -->
          <image mode="aspectFill" src="{{imgUrl + item.coverImage}}"></image>
          <image mode="scaleToFill" src="../../imgs/video-play.png" class="videoPlay" wx:if="{{item.fileType ==2}}"></image>
        </view>
        <view class="text">
          <view class="textcontent">
            <text class="txtelldup">{{item.articleTitle||''}}</text>
          </view>
          <view class="row between more subtxt">
            <view class="row crosscenter avatar flexible noscroll">
              <view class="circle">
                <image src="{{item.avatar}}" class="full"></image>
              </view>
              <view class="flexible noscroll nowrap-ell">
                <text>{{item.nickname||''}}</text>
              </view>
            </view>
            <view class="row crosscenter favor" catchtap="clickFavorite" data-i="{{index}}" data-id="{{item.id}}" data-isCollect="{{!!item.isCollect}}">
              <image class="favorite" src="../../imgs/favorite{{item.isCollect?'-checked':''}}.png"></image>
              <text>{{item.collectNumber||0}}</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- item -->
  </view>
</view>

<!-- mine -->

<view class="mine col full" wx:if="{{curNav==3}}">
  <view>
    <image class="fullx" src="../../imgs/mine-bg.png" mode="widthFix" style="display:block"></image>
  </view>
  <view class="wrp row fg" style="height: 200rpx" bindtap="clickMyinfo">
    <view class="circle shadow posrel bg" style="top: -158rpx; height: 236rpx; width: 236rpx;">
      <image class="" src="{{user.upload_head || user.avatar}}" class="full"></image>
      <!-- <image class="" src="{{user.avatarUrl}}" style="padding: 8rpx; height: 220rpx; width: 220rpx;"></image> -->
    </view>
    <view class="gapleft">
      <view class="txtbold txtlg imgsmr row bot gapbot">
        <text>{{user.realname || user.nickname || ''}}</text>
        <image src="../../imgs/{{user.sex==1?'male':'female'}}.png" style="margin-bottom: 6rpx" class="gapleft"></image>
      </view>
      <text class="txtsub subtxt">{{user.introduction||'这个家伙很懒，什么都没留下...'}}</text>
    </view>
  </view>
  <view class="inbot bory row center mineNav">
    <view class="{{mine.curNav == 0?'selected':''}}" bindtap="clickMinenav" data-cur="0">
      我的发布
    </view>
    <view class="{{mine.curNav == 1?'selected':''}}" bindtap="clickMinenav" data-cur="1">
      我的收藏
    </view>
    <view class="{{mine.curNav == 2?'selected':''}}" bindtap="clickMinenav" data-cur="2">
      我的评论
    </view>
    <view class="{{mine.curNav == 3?'selected':''}}" bindtap="clickMinenav" data-cur="3">
      我的活动
    </view>
  </view>
  <view class="fg flexible myPub myCollection" wx:if="{{mine.curNav==1 || mine.curNav==0}}">
    <view class="bfc">
      <!-- item -->
      <view wx:for="{{mine.list}}" wx:key>
        <view class="imgtxt" bindtap="clickCommunityArticle" data-item="{{item}}">
          <view class="img">
            <image mode="aspectFill" src="{{imgUrl + item.coverImage}}"></image>
            <image mode="scaleToFill" src="../../imgs/video-play.png" class="videoPlay" wx:if="{{item.file_type=='2'}}"></image>
            <view class="tag {{item.is_prize=='0'?'ready':item.is_prize=='1'?'finished':''}}" wx:if="{{item.is_prize!=2}}">{{item.is_prize==0?'审核中':item.is_prize==1?'未通过':''}}</view>
            <view class="removeTag circle row center" catchtap="clickRemoveArticle" data-id="{{item.id}}" data-i="{{index}}" data-mineNav="{{mine.curNav}}">
              <text class="cuIcon-deletefill txtanti"></text>
            </view>
          </view>
          <view class="text">
            <view class="textcontent">
              <text>{{item.articleTitle||''}}</text>
            </view>
            <view class="row between more subtxt">
              <view class="row crosscenter avatar flexible noscroll">
                <view class="circle">
                  <image src="{{item.avatar}}" class="full"></image>
                </view>
                <view class="flexible noscroll nowrap-ell">
                  <text>{{item.nickname||''}}</text>
                </view>
              </view>
              <view class="row crosscenter favor" catchtap="clickFavorite" wx:if="{{false}}" data-i="{{index}}" data-id="{{item.id}}">
                <image class="favorite" src="../../imgs/favorite{{item.isCollect?'-checked':''}}.png"></image>
                <text>{{item.collectNumber||0}}</text>
              </view>
            </view>
          </view>
        </view>
      </view>
      <!-- item -->
    </view>
  </view>
  <view class="myComment flexible" wx:if="{{mine.curNav==2}}">

    <view class="inright row fg comment" wx:for="{{mine.list}}" wx:key>
      <image src="{{user.avatarUrl}}" class="gapright"></image>
      <view class="col flexible">
        <text class="txtsub nickname gapbot">{{user.articleTitle}}</text>
        <view class="row gapbot wrpright">
          <text class="flexible">{{item.comments}}</text>
          <text class="subtxt">{{item.createTime}}</text>
        </view>
        <view class="bortop wrpright row txtsub" style="padding-top: 8rpx">
          <text class="subtxt flexible">{{item.space_title}}</text>
          <text class="{{item.is_prize_show==1?'txtdanger':'subtxt'}}">{{['','待审核', '已通过', '未通过'][item.status]}}</text>
        </view>
      </view>
    </view>

  </view>
  <view class="myActivities flexible" wx:if="{{mine.curNav==3}}">
    <view class="fg wrplg myAct" wx:for="{{mine.list}}" wx:key>
      <view class="txtbold">{{item.activityTitle}}</view>
      <view class="txtsub gaptop">
        <text class="subtxt">活动时间：</text>
        <text>{{item.activityTime}}</text>
      </view>
      <view class="txtsub">
        <text class="subtxt">活动地点：</text>
        <text>{{item.activityLocation}}</text>
      </view>
    </view>
  </view>

</view>

<!-- bottom navigation bar -->

<!-- <view class="navigation row around fg">
  <view class="nav col crosscenter {{curNav == 0 && 'act'}}" bindtap="clickNav" data-cur="0">
    <image src="../../imgs/home{{curNav==0? '-act':''}}.png"></image>
    <text>首页</text>
  </view>
  <view class="nav col crosscenter {{curNav==1&&'act'}}" bindtap="clickNav" data-cur="1">
    <image src="../../imgs/activity{{curNav==1? '-act':''}}.png"></image>
    <text>活动</text>
  </view>
  <view class="addTidings col crosscenter" bindtap="clickAddtidings" wx:if="{{curNav==2}}">
    <image src="../../imgs/add-tidings.png"></image>
  </view>
  <view class="nav col crosscenter {{curNav==2&&'act'}}" bindtap="clickNav" data-cur="2">
    <image src="../../imgs/community{{curNav==2?'-act':''}}.png"></image>
    <text>社区</text>
  </view>
  <view class="nav col crosscenter {{curNav==3&&'act'}}" bindtap="clickNav" data-cur="3">
    <image src="../../imgs/mine{{curNav==3?'-act':''}}.png"></image>
    <text>我的</text>
  </view>
</view> -->

<view class="nav-list">
  <image mode="widthFix" class="bg" src="../../imgs/nav/bg.png"></image>
  <view class="nav-select">
    <view class="home" bindtap="clickNav" data-cur="0">
      <image src="../../imgs/nav/home{{curNav==0? '-active':''}}.png"></image>
      <view>首页</view>
    </view>
    <view class="activity" bindtap="clickNav" data-cur="1">
      <image src="../../imgs/nav/activity{{curNav==1? '-active':''}}.png"></image>
      <view>活动</view>
    </view>
    <!-- <view class="release" bindtap="clickAddtidings" >
      <image mode="widthFix" src="../../imgs/nav/release.png"></image>
    </view> -->
    <view class="release" bindtap="toLinkR">
      <image mode="widthFix" src="../../imgs/nav/release.png"></image>
    </view>
    <view class="community" bindtap="clickNav" data-cur="2">
      <image src="../../imgs/nav/community{{curNav==2?'-active':''}}.png"></image>
      <view>社区</view>
    </view>
    <view class="me" bindtap="clickNav" data-cur="3">
      <image src="../../imgs/nav/me{{curNav==3?'-active':''}}.png"></image>
      <view>我的</view>
    </view>
  </view>
</view>

<!-- community img and video upload mask -->

<view class="cover col center"  wx:if="{{community.showAddtidings}}" catchtap="clickClosetidings">

  <view class="imglg txtanti txtsub">
    <view class="txtcenter col" bindtap="clickUploadpics">
      <image class="gapbot" src="../../imgs/picture.png"></image>
      <text>图片上传</text>
    </view>
    <view class="txtcenter col" style="margin-top: 120rpx" bindtap="clickUploadvideos">
      <image class="gapbot" src="../../imgs/video.png"></image>
      <text>视频上传</text>
    </view>
  </view>
  <!-- <view class="navigation row around">
    <view class="nav col crosscenter">
      <image></image>
      <text>0</text>
    </view>
    <view class="addTidings col crosscenter" bindtap="clickClosetidings">
      <image src="../../imgs/close-tidings.png" style="margin-top: calc(-32rpx - .4vh)"></image>
    </view>
    <view class="nav col crosscenter">
      <image></image>
      <text></text>
    </view>
  </view> -->
</view>


<view class="cu-modal {{showAuthPanel&&'show'}}">
  <view class="cu-dialog">
    <view class="cu-bar bg-white justify-end">
      <view class="content">微信授权</view>
      <view class="action" bindtap="clickHideAuthPanel">
        <text class="cuIcon-close text-red"></text>
      </view>
    </view>
    <view class="padding-xl">
      使用小程序需要获取您的公开信息（昵称，头像等）
    </view>
    <view class="cu-bar bg-white justify-end">
      <view class="action">
        <button class="cu-btn line-green text-green" bindtap="clickHideAuthPanel">取消</button>
        <button class="cu-btn bg-green margin-left" open-type="getUserInfo" bindtap="getUserInfo">授权</button>
      </view>
    </view>
  </view>
</view>