<!--packageE/top_navigation/top_navigation.wxml-->
<wxs module="util">
  var inOf = function(val, str) { if (val) {return val.indexOf(str) }};
  module.exports.inOf = inOf;
</wxs>
<view class="component-wrapper">

  <view style="height: {{datas.show_search.value? datas.search_height.value + ( datas.title_list.value && datas.title_list.value.length > 0 ? datas.title_height.value : 0): datas.title_height.value }}px;"></view>

  <view class="advertising-preview" style="width: {{clientWidth}}px;">

    <block wx:if="{{datas.show_search.value}}">
      <view class="weixin-title {{btnFlag && datas.scroll_hide_search.value?'hidestyle':''}}" style="height: {{datas.search_height.value}}px; background-color: {{datas.preview_color.value}};" wx:if="{{datas.logo_style.value == 1}}">
        <view class="weixin-logo-one" wx:if="{{datas.show_logo.value}}" style="border-radius: {{datas.border_radius.value}}px;">
          <image catchtap="gotoUrl" class="img" style="border-radius: {{datas.border_radius.value}}px;" src="{{datas.logo.value || emptyImage}}" mode="aspectFill" />
        </view>
        <view class="weixin-sousuo {{datas.choose_search_style.value==3 ? 'w':''}} {{datas.choose_search_style.value==2?'center':''}} {{datas.choose_search_style.value==3?'padding':''}}" style="background-color: {{datas.search_color.value}}; color: {{datas.font_color.value}};border-radius: {{datas.search_border_radius.value}}px; border: solid  {{datas.border_style.value}}px {{datas.border_color.value}};" catchtap="tosearch">
          <icon class="i iconfont icon-all_search_2"
             wx:if="{{datas.choose_search_style.value==1||datas.choose_search_style.value==2}}"></icon>
          <view>{{datas.search_title.value}}</view>
        </view>
        <view wx:if="{{datas.choose_search_style.value==3}}"  class="span block {{ datas.choose_search_style.value==3 ? 'borderOne': '' }}" catchtap="tosearch">搜索</view>
      </view>
      <view class="weixin-title {{btnFlag && datas.scroll_hide_search.value ? 'hidestyle':''}}" style="height: {{datas.search_height.value}}px; background-color: {{datas.preview_color.value}};" wx:else>
        <view wx:if="{{datas.choose_search_style.value==3}}" class="span block {{datas.choose_search_style.value==3 ? 'borderTwo' : ''}}" catchtap="tosearch">搜索</view>
        <view class="weixin-sousuo {{datas.choose_search_style.value==3 ? 'w':''}} {{datas.choose_search_style.value==2?'center':''}} {{datas.choose_search_style.value==3?'padding':''}}" style="background-color: {{datas.search_color.value}}; color: {{datas.font_color.value}};border-radius: {{datas.search_border_radius.value}}px; border: solid  {{datas.border_style.value}}px {{datas.border_color.value}};" catchtap="tosearch">
          <icon class="i iconfont icon-all_search_2"
             wx:if="{{datas.choose_search_style.value==1||datas.choose_search_style.value==2}}"></icon>
          <view>{{datas.search_title.value}}</view>
        </view>
        <view class="weixin-logo-two" wx:if="{{datas.show_logo.value}}" style="border-radius: {{datas.border_radius.value}}px;">
          <image catchtap="gotoUrl" class="img" style="border-radius: {{datas.border_radius.value}}px;" src="{{datas.logo.value || emptyImage}}" mode="aspectFill" />
        </view>
      </view>
    </block>

    <view class="weixin-bd" wx:if="{{datas.title_list.value.length > 0}}">
      <view class="ul weixin-menu scroll" style="font-weight: {{util.inOf(datas.title_style.value,'1') > -1 ?'bold':''}}; font-style: {{util.inOf(datas.title_style.value,'2') > -1 ?'italic':''}}; height: {{datas.title_height.value}}px; font-size: {{datas.title_size.value}}px; color: {{datas.title_color.value}}; background-color: {{datas.navigate_color.value }};" id="weixin-menu">
        <view class="li menu-item" style="height: {{datas.title_height.value}}px; line-height: {{datas.title_height.value}}px;"
              wx:for='{{datas.title_list.value}}' wx:key="index" wx:for-item="btn" wx:for-index="index" catchtap="selectedMenu" data-item="{{btn}}" data-index="{{index}}">
          <view class="menu-item-title {{selectedMenuIndex==index ? 'current':''}}" style="color: {{ selectedMenuIndex==index ? datas.choose_title_color.value:'' }}; background-color: {{selectedMenuIndex==index?datas.title_bg_color.value:''}};">
            <image wx:if="{{datas.choose_style.value == '2'}}" class="img" src="{{btn.image || emptyImage}}" mode="aspectFill" />
            <view class="span">{{ btn.text}}</view>
          </view>
        </view>
      </view>
    </view>

  </view>

</view>
