与牧同行-小程序用户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.7 KiB

1 month ago
  1. <view class="container_zsl">
  2. <!-- 搜索区域 -->
  3. <view class="search-area">
  4. <view class="search-box">
  5. <view class="search-input-wrapper">
  6. <image src="/pagesB/images/sou.png" class="search-icon" />
  7. <input
  8. class="search-input"
  9. placeholder="请输入关键词搜索,如:猪瘟、饲养、疫苗..."
  10. placeholder-class="placeholder"
  11. value="{{searchValue}}"
  12. bindinput="onInputSearch"
  13. bindconfirm="onSearch"
  14. />
  15. <icon
  16. class="clear-icon"
  17. type="clear"
  18. size="16"
  19. wx:if="{{searchValue}}"
  20. bindtap="onClearSearch"
  21. />
  22. </view>
  23. </view>
  24. <!-- 分类筛选 -->
  25. <view class="category-filter">
  26. <view
  27. class="category-item {{activeCategory === item ? 'active' : ''}}"
  28. wx:for="{{categories}}"
  29. wx:key="index"
  30. data-category="{{item}}"
  31. bindtap="onFilterCategory"
  32. >
  33. {{item}}
  34. <view class="category-dot" wx:if="{{activeCategory === item}}"></view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 加载状态 -->
  39. <view wx:if="{{isLoading}}" class="loading">
  40. <view class="spinner">
  41. <view class="spinner-item"></view>
  42. <view class="spinner-item"></view>
  43. <view class="spinner-item"></view>
  44. </view>
  45. <text class="loading-text">正在搜索...</text>
  46. </view>
  47. <!-- 搜索结果 -->
  48. <scroll-view wx:else class="result-list" scroll-y enable-back-to-top>
  49. <!-- 搜索结果列表 -->
  50. <view wx:if="{{searchResults.length > 0}}">
  51. <view class="result-count">
  52. <text>找到 {{searchResults.length}} 条相关结果</text>
  53. </view>
  54. <view class="knowledge-list">
  55. <view
  56. class="knowledge-item"
  57. wx:for="{{searchResults}}"
  58. wx:key="id"
  59. data-id="{{item.id}}"
  60. bindtap="onViewDetail"
  61. >
  62. <view class="item-header">
  63. <view class="title-wrapper">
  64. <view class="item-title">{{item.title}}</view>
  65. <view class="item-category">{{item.category}}</view>
  66. </view>
  67. </view>
  68. <view class="item-content">{{item.content}}</view>
  69. <view class="item-footer">
  70. <view class="tags">
  71. <view class="tag" wx:for="{{item.tags}}" wx:key="*this">
  72. {{item}}
  73. </view>
  74. </view>
  75. <view class="actions">
  76. <view class="date-info">
  77. <text class="date">{{item.date}}</text>
  78. </view>
  79. <view
  80. class="copy-btn"
  81. data-content="{{item.content}}"
  82. bindtap="onCopyContent"
  83. >
  84. <text>复制</text>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 无结果 -->
  92. <view class="empty-state" wx:if="{{searchValue && searchResults.length==0}}">
  93. <text class="empty-text">未找到"{{searchValue}}"的相关信息</text>
  94. <view class="suggestions">
  95. <view class="suggestion-item">
  96. <view class="suggestion-dot"></view>
  97. <text>检查关键词拼写</text>
  98. </view>
  99. <view class="suggestion-item">
  100. <view class="suggestion-dot"></view>
  101. <text>尝试其他相关词汇</text>
  102. </view>
  103. <view class="suggestion-item">
  104. <view class="suggestion-dot"></view>
  105. <text>咨询专业兽医</text>
  106. </view>
  107. </view>
  108. </view>
  109. </scroll-view>
  110. </view>
  111. <!-- 使用提示弹框 -->
  112. <view wx:if="{{showTipsModal}}" class="modal-mask" bindtap="hideTips">
  113. <view class="modal-content" catchtap="stopPropagation">
  114. <view class="modal-header">
  115. <image src="/pagesB/images/syts.png" class="modal-icon" />
  116. <text class="modal-title">使用提示</text>
  117. </view>
  118. <view class="modal-body">
  119. <view class="tip-item">
  120. <view class="tip-number">1</view>
  121. <text class="tip-text">可以搜索疾病名称(如:猪瘟)</text>
  122. </view>
  123. <view class="tip-item">
  124. <view class="tip-number">2</view>
  125. <text class="tip-text">可以搜索动物种类(如:鸡、牛)</text>
  126. </view>
  127. <view class="tip-item">
  128. <view class="tip-number">3</view>
  129. <text class="tip-text">可以搜索症状(如:腹泻)</text>
  130. </view>
  131. <view class="tip-item">
  132. <view class="tip-number">4</view>
  133. <text class="tip-text">可以搜索管理方法(如:饲料、消毒)</text>
  134. </view>
  135. </view>
  136. <view class="modal-footer">
  137. <button class="modal-confirm" bindtap="hideTips">我知道了</button>
  138. </view>
  139. </view>
  140. </view>