category.wxml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!--pages/category/category.wxml-->
  2. <view class="container">
  3. <!-- 顶部性别切换和搜索 -->
  4. <view class="header">
  5. <gender-tabs gender="{{gender}}" bind:switch="switchGender"/>
  6. <view class="search-box" bindtap="goToSearch">
  7. <icon type="search" size="22" color="#999"/>
  8. <input
  9. type="text"
  10. placeholder="请输入书名/口令搜索"
  11. placeholder-class="placeholder"
  12. disabled="true"
  13. />
  14. </view>
  15. </view>
  16. <view class="content">
  17. <!-- 左侧分类列表 -->
  18. <scroll-view scroll-y class="category-list">
  19. <view
  20. wx:for="{{categories}}"
  21. wx:key="code"
  22. class="category-item {{currentCategory === item.code ? 'active' : ''}}"
  23. data-category="{{item.code}}"
  24. bindtap="switchCategory"
  25. >
  26. <text>{{item.name}}</text>
  27. </view>
  28. </scroll-view>
  29. <!-- 右侧书籍列表 -->
  30. <scroll-view
  31. scroll-y
  32. class="book-list"
  33. bindscrolltolower="onScrollToLower"
  34. lower-threshold="50"
  35. >
  36. <view class="book-item"
  37. wx:for="{{bookList}}"
  38. wx:key="id"
  39. bindtap="handleBookTap"
  40. data-id="{{item.id}}"
  41. data-wxbookid="{{item.wxBookId}}"
  42. >
  43. <image class="book-cover" src="{{item.cover}}" mode="aspectFill"/>
  44. <view class="book-info">
  45. <text class="book-title">{{item.title}}</text>
  46. <text class="book-desc">{{item.brief}}</text>
  47. </view>
  48. </view>
  49. <!-- 加载状态 -->
  50. <view class="loading" wx:if="{{loading}}">
  51. <text>加载中...</text>
  52. </view>
  53. <!-- 没有更多数据 -->
  54. <view class="no-more" wx:if="{{!hasMore && bookList.length > 0}}">
  55. <text>没有更多了</text>
  56. </view>
  57. <!-- 暂无数据 -->
  58. <view class="empty" wx:if="{{!loading && bookList.length === 0}}">
  59. <text>暂无数据</text>
  60. </view>
  61. </scroll-view>
  62. </view>
  63. </view>