<wxs src="../tools.wxs" module="globalTools" />
<wxs src="./index.wxs" module="Tools" />

<view class='app-header'>
  <view class='map' bindtap='toCity'>
    <view class='location'>
      <image src='/images/happyjob/index_position.png'></image>
    </view>
    <text class='cityname'>{{cityName}}</text>
    <!-- <i-icon class="arrow-down" type="play_fill" /> -->
  </view>
  <view class='search' bindtap='toSearch'>
    <view class="search-content">
      <view class='i_search'>
        <image src='{{imgServerUrl}}/images/happyjob/search.png'></image>
      </view>
      <text class='search-input'>搜索你想要的好岗位</text>
    </view>
    <view class="btn-search">搜索</view>
  </view>
</view>
<!-- 轮播 -->
<view class="swiper" wx:if='{{list.length}}'>
  <swiper indicator-dots="true" autoplay="true" interval="5000" duration="500" circular="true" indicator-active-color="#FE7235" class="banner">
    <block wx:for="{{imgList}}" wx:key="picUrl">
      <swiper-item class='banner-item'>
        <image src="{{item.picUrl}}" catchtap='toDetail_slide' data-id="{{item.positionDetail}}" data-url="{{item.picDetail}}" class="slide-image" mode='widthFix' bindload='imageLoad' />
      </swiper-item>
    </block>
  </swiper>
</view>
<!-- 滚动 -->
<view class='marquee' wx:if='{{list.length}}'>
  <view class='broadcast'>
    <image src='/images/happyjob/index_hot.png'></image>
    <text>开心头条：</text>
  </view>
  <!-- 跑马灯 暂未调好速度问题 -->
  <!-- <view class='swip'>
    <marquee text="{{broadcastText}}"></marquee>
  </view> -->
  <swiper class='swip' autoplay="true" interval="4000" duration="600" circular="true" vertical="true">
    <block wx:for="{{broadcastList}}" wx:key="bo">
      <swiper-item>
        <view>{{item}}</view>
      </swiper-item>
    </block>
  </swiper>
</view>

<!-- 岗位 -->
<view class="activity-box" wx:if='{{list.length}}'>
  <view class="activity">
    <block wx:for="{{activity}}" wx:key="text">
      <view class="activity-item" bindtap='changeList' data-index="{{index}}" hover-class="none">
        <image src="{{item.src}}" mode="scaleToFill"></image>
        <text>{{item.text}}</text>
      </view>
    </block>
  </view>
</view>
<!-- 岗位2 -->
<view class="activity-box2" wx:if='{{list.length}}'>
  <view class="activity2">
    <block wx:for="{{activity_two}}" wx:key="text">
      <view class="activity-item2" bindtap='changeList2' data-index="{{index}}" hover-class="none">
        <image src="{{item.src}}" mode="scaleToFill"></image>
      </view>
    </block>
  </view>
</view>

<!-- 热门岗位 -->
<view class='box-body' wx:if='{{list.length}}'>
  <view class='box_title'>为您推荐：</view>
  <view class='box-item' wx:for="{{list}}" wx:key="hpPositionId" bindtap='toDetail' data-id="{{item.id}}" data-cate="{{item.positionCategory}}" hover-class="none">
    <!-- 兼职岗位 -->
    <block wx:if="{{item.positionCategory == 1}}">
      <view class='box-item-info'>
        <view class='one'>
          <view class='left'>
            {{item.positionName}}
          </view>
          <view class='salary'>
            {{item.salary}}
          </view>
        </view>
        <view class='two' id="two_{{index}}">
          <view class='limit'>
            <!-- <view>
              <image src='{{imgServerUrl}}/images/happyjob/time.png'></image>
            </view> -->
            <view>
              <block wx:if="{{item.workDay}}">
                <block wx:for="{{globalTools.splitStr1(item.workDay,',')}}" wx:key="*this" wx:for-item="tag">
                  <block wx:if="{{index == 0}}">
                    {{globalTools.formatDate(tag)}} 至
                  </block>
                  <block wx:if="{{index == (globalTools.splitStr1(item.workDay,',').length-1)}}">
                    {{globalTools.formatDate(tag)}}
                  </block>
                </block>
                <text> (共计{{globalTools.splitStr1(item.workDay,',').length}}天)</text>
              </block>
            </view>
          </view>
          <view class='time'>
            <text>{{Tools.formatTime(item.updateDate)}}</text>
          </view>
        </view>
        <view class="address">
          <text>{{(item.isPublishNationwide || item.publishNationwide)?'全国':item.hpPositionAddressList[0].adname}}</text>
        </view>
        <view class='two {{item.up?"down":""}}'>
          <view class='limit_1'>
            <block wx:if="{{item.settlementMethod}}">
              <i-tag i-class="tag-class">
                {{item.settlementMethod}}
              </i-tag>
            </block>
            <block wx:if="{{item.specialWelfare}}">
              <i-tag wx:for="{{globalTools.splitStr1(item.specialWelfare,',')}}" wx:key="*this" wx:for-item="tag" i-class="tag-class">
                {{tag}}
              </i-tag>
            </block>
            <block wx:if="{{item.accommodation}}">
              <i-tag i-class="tag-class">
                {{item.accommodation}}
              </i-tag>
            </block>
            <block wx:if="{{item.socialSecurity}}">
              <i-tag i-class="tag-class">
                {{item.socialSecurity}}
              </i-tag>
            </block>
            <block wx:if="{{item.workDinner}}">
              <i-tag i-class="tag-class">
                {{item.workDinner}}
              </i-tag>
            </block>
            <block wx:if="{{item.regularBus}}">
              <i-tag i-class="tag-class">
                {{item.regularBus}}
              </i-tag>
            </block>
          </view>
          <!-- <view class="arrow" catchtap="doArrow" data-index='{{index}}' wx:if="{{item.specialWelfare || item.accommodation || item.socialSecurity || item.workDinner || item.regularBus}}">
            <image src="/images/happyjob/index_up.png" wx:if='{{!item.up}}'></image>
            <image src="/images/happyjob/index_down.png" wx:if='{{item.up}}'></image>
          </view> -->
        </view>
        <!-- <view class='three'>
          <view class='area' wx:if="{{item.hpPositionAddressList}}">
            <image src='{{imgServerUrl}}/images/happyjob/address.png'></image>
            <text class='area-name'>{{item.hpPositionAddressList[0].adname}}</text>
          </view>
          <view wx:else>
          </view>
          <view class='time'>
            <image src='{{imgServerUrl}}/images/happyjob/time.png'></image>
            <text>{{Tools.formatTime(item.updateDate)}}</text>
          </view>
        </view> -->
      </view>
    </block>
    <!-- 福利岗位 -->
    <block wx:elif="{{item.positionCategory == 5}}">
      <view class='box-item-info'>
        <view class='one'>
          <view class='left'>
            {{item.positionName}}
          </view>
          <view class='salary'>
            {{item.salary}}
          </view>
        </view>
        <view class='two'>
          <view class='limit'>
            <!-- <view>
              <image src='{{imgServerUrl}}/images/happyjob/time.png'></image>
            </view> -->
            <text> {{globalTools.formatDate(item.publishTime)}} 至 {{globalTools.formatDate(item.endTime)}}</text>
          </view>
          <view class='time'>{{Tools.formatTime(item.updateDate)}}</view>
        </view>
        <view class="address">
          <text>{{(item.isPublishNationwide || item.publishNationwide)?'全国':item.hpPositionAddressList[0].adname}}</text>
        </view>
        <view class='two {{item.up?"down":""}}' id="two_{{index}}">
          <view class='limit_1'>
            <block wx:if="{{item.settlementMethod}}">
              <i-tag i-class="tag-class">
                {{item.settlementMethod}}
              </i-tag>
            </block>
            <block wx:if="{{item.specialWelfare}}">
              <i-tag wx:for="{{globalTools.splitStr1(item.specialWelfare,',')}}" wx:key="*this" wx:for-item="tag" i-class="tag-class">
                {{tag}}
              </i-tag>
            </block>
            <block wx:if="{{item.accommodation}}">
              <i-tag i-class="tag-class">
                {{item.accommodation}}
              </i-tag>
            </block>
            <block wx:if="{{item.socialSecurity}}">
              <i-tag i-class="tag-class">
                {{item.socialSecurity}}
              </i-tag>
            </block>
            <block wx:if="{{item.workDinner}}">
              <i-tag i-class="tag-class">
                {{item.workDinner}}
              </i-tag>
            </block>
            <block wx:if="{{item.regularBus}}">
              <i-tag i-class="tag-class">
                {{item.regularBus}}
              </i-tag>
            </block>
          </view>
          <view class="arrow {{item.up?'down':''}}" data-index='{{index}}' catchtap="doArrow" wx:if="{{item.specialWelfare || item.accommodation || item.socialSecurity || item.workDinner || item.regularBus}}">
            <image src="/images/happyjob/index_up.png" wx:if='{{!item.up}}'></image>
            <image src="/images/happyjob/index_down.png" wx:if='{{item.up}}'></image>
          </view>
        </view>
        <view class='three'>
          <!-- <view class='area'>
            <image src='{{imgServerUrl}}/images/happyjob/address.png'></image>
            <block wx:if="{{item.activityWide}}">
              <i-tag wx:for="{{globalTools.splitStr1(item.activityWide,',')}}" wx:key="*this" wx:for-item="tag" i-class="tag-class1" style="margin-left:10rpx;">
                {{tag}}
              </i-tag>
            </block>
          </view> -->
          <!-- <view class='time'>
            <image src='{{imgServerUrl}}/images/happyjob/time.png'></image>
            <text>{{globalTools.subStr(item.updateDate)}}</text>
          </view> -->
        </view>
      </view>
    </block>
    <!-- 全职，入职奖励，高薪急聘 -->
    <block wx:else>
      <view class='box-item-info'>
        <view class='one'>
          <view class='left'>
            <view wx:if='{{item.positionCategory == 3}}' class="gaoxin">高薪</view>
            <view wx:if='{{item.positionCategory == 4}}' class="pintuan">拼团</view>
            {{item.positionName}}
          </view>
          <view class='salary'>
            {{item.totalSalary?item.totalSalary:item.basicSalary}}
          </view>
        </view>
        <view class='four'>
          <view class='commpany'>{{item.hpCompany.companyName}}</view>
          <view class='area'>
            <!-- <image src='{{imgServerUrl}}/images/happyjob/address.png'></image> -->
            <!-- {{item.hpPositionAddressList[0].adname}} -->
            <text class='area-name'><text>{{Tools.formatTime(item.updateDate)}}</text></text>
          </view>
        </view>
        <view class="address">
          <text>{{item.hpPositionAddressList.length?item.hpPositionAddressList[0].adname:'全国'}}</text>
        </view>
        <view class='three'>
          <block wx:if="{{item.positionCategory == 3}}">
            <view class='fan' wx:if="{{item.reward}}">
              <!-- <image src='{{imgServerUrl}}/images/happyjob/reward.png'></image> -->
              <text>入职最高奖励 {{item.reward}}元，额外奖励{{item.platformAllowance}}元</text>
            </view>
            <view class='fan' wx:elif="{{item.platformAllowance}}">
              <!-- <image src='{{imgServerUrl}}/images/happyjob/reward.png'></image> -->
              <text>入职最高奖励 {{item.platformAllowance}}元</text>
            </view>
            <view wx:else>
            </view>
          </block>
          <block wx:else>
            <view class='fan' wx:if="{{item.reward}}">
              <!-- <image src='{{imgServerUrl}}/images/happyjob/reward.png'></image> -->
              <text>入职最高奖励 {{item.reward}}元</text>
            </view>
            <view wx:else>
            </view>
          </block>
          <!-- <view class='time'>
            <image src='{{imgServerUrl}}/images/happyjob/time.png'></image>
            <text>{{globalTools.subStr(item.updateDate)}}</text>
          </view> -->
        </view>
        <view class='two {{item.up?"down":""}}' id="two_{{index}}">
          <view class='limit_1'>
            <block wx:if="{{item.settlementMethod}}">
              <i-tag i-class="tag-class">
                {{item.settlementMethod}}
              </i-tag>
            </block>
            <block wx:if="{{item.specialWelfare}}">
              <i-tag wx:for="{{globalTools.splitStr1(item.specialWelfare,',')}}" wx:key="*this" wx:for-item="tag" i-class="tag-class">
                {{tag}}
              </i-tag>
            </block>
            <block wx:if="{{item.accommodation}}">
              <i-tag i-class="tag-class">
                {{item.accommodation}}
              </i-tag>
            </block>
            <block wx:if="{{item.socialSecurity}}">
              <i-tag i-class="tag-class">
                {{item.socialSecurity}}
              </i-tag>
            </block>
            <block wx:if="{{item.workDinner}}">
              <i-tag i-class="tag-class">
                {{item.workDinner}}
              </i-tag>
            </block>
            <block wx:if="{{item.regularBus}}">
              <i-tag i-class="tag-class">
                {{item.regularBus}}
              </i-tag>
            </block>
          </view>
          <view class="arrow {{item.up?'down':''}}" catchtap="doArrow" data-index='{{index}}' wx:if="{{item.specialWelfare || item.accommodation || item.socialSecurity || item.workDinner || item.regularBus}}">
            <image src="/images/happyjob/index_up.png" wx:if='{{!item.up}}'></image>
            <image src="/images/happyjob/index_down.png" wx:if='{{item.up}}'></image>
          </view>
        </view>

      </view>
    </block>
  </view>
</view>
<view class="loading_no" hidden='{{isScroll}}'>{{showNoMore}}</view>
<!-- 客服 -->
<button id="kefu" open-type="contact" bindcontact="handleContact" hover-class='kefu-hover'></button>
<!-- 公众号组件 -->
<view class='office'>
  <official-account></official-account>
</view>
<view class="no_data" wx:if='{{!list.length&&offline}}'>
  <image src="/images/happyjob/index_offline.png"></image>
  <view class="no_text">
    <text>无网络连接</text>
    <text class="text">请在地球有信号的地方使用</text>
  </view>
  <view class="reload" bindtap="reload">刷新试试</view>
</view>