<wxs src="../../utils/filter.wxs" module="filters" />
<view class="classBox">
    <!-- 搜索 -->
    <block>
        <view class="searchBox" wx:if="{{type=='search'}}">
            <input class="input" bindfocus='cleanPlaceholder' bindblur='setPlaceholder' placeholder="{{placeholderText}}"bindconfirm='search' confirm-type='send' bindinput="setSearch"
                value="{{text}}" maxlength='20' />
            <view class="searchBtn" catchtap="search">
                <image src="/static/search-2.png" class="img" />
            </view>
        </view>
        <view class="historyList" wx:if="{{text==''&&list.length==0}}">
            <view class="notes" wx:for="{{historySearch}}" wx:key="index" data-text="{{item}}" bindtap="historySearch">
                <view class="left">
                    <image src="/static/clock.png" class="clock" />
                    {{item}}
                </view>
                <view class="delete" data-text="{{item}}" catchtap="deleteHistory">
                    ×
                </view>
            </view>
            <view class="clearHistory" bindtap="clearHistory" wx:if="{{historySearch.length>0}}">
                清除搜索记录
            </view>
        </view>
    </block>
    <!-- 内容区域 -->
    <scroll-view class="classify" scroll-x="true" scroll-into-view="{{currentId}}" enhanced show-scrollbar="{{false}}"
        wx:if="{{type=='class'&&!childType}}">
        <view id="{{'class'+index}}" class="name {{currentIndex==index?'currentClass':''}}" wx:for="{{categoryList}}"
            wx:key="id" data-index="{{index}}" data-title='{{item.title}}' bindtap="setClass">
            {{item.title}}
        </view>
    </scroll-view>
    <scroll-view wx:if="{{list.length>0}}" class="worksList" style="{{childType?'padding-top:10rpx':''}}"
        scroll-y="true" enhanced show-scrollbar="{{false}}" scroll-top="{{scrollTop}}" bindscrolltolower='loadMore'
        bindtouchstart="touchStart" bindtouchend="touchEnd">
        <view class="worksBox" wx:for="{{list}}" wx:key="id" data-id="{{item.id}}" bindtap="goRead">
            <view class="left">
                <image src="{{item.coverImg}}" class="cover" wx:if="{{item.resourcesType==0}}" />
                <view class="audioCover" style="background-image: url({{item.backgroundVirtualImg}});" wx:else>
                    <image src="/static/audioBg.png" class="audioPlayBg" />
                    <image src="/static/zhen.png" class="audioPlayZhen" />
                    <image src="{{item.coverImg}}" class="cover" />
                </view>
                <view class="work">
                    <view class="title textOver">{{item.title}}</view>
                    <view class="statistics">
                        <view class="statistic">
                            <image src="/static/zp.png" class="playImg" mode="" />
                            <view class="num">{{filters.numFilter(item.readAmount)|| 0}}</view>
                        </view>
                        <view class="statistic">
                            <image src="/static/play2.png" class="playImg" mode="" />
                            <view class="num">{{filters.numFilter(item.playAmount)|| 0}}</view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="goRead">去朗读</view>
        </view>
    </scroll-view>
    <emptyBg wx:if="{{text!=''&&nullList}}" message="没有找到想要的内容~"></emptyBg>
</view>