与牧同行-小程序用户端
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.

125 lines
4.4 KiB

  1. <view class="notice-page">
  2. <!-- 背景 -->
  3. <view class="bg-blur"></view>
  4. <!-- 主内容区 -->
  5. <view class="content">
  6. <!-- 头部标题 & 搜索栏一体化 -->
  7. <view class="header">
  8. <text class="title">📋 公告·通知</text>
  9. <view class="search-box">
  10. <text class="icon">🔍</text>
  11. <input
  12. type="text"
  13. placeholder="搜索标题或摘要..."
  14. placeholder-class="placeholder"
  15. bindinput="onSearchInput"
  16. value="{{searchKeyword}}"
  17. confirm-type="search"
  18. bindconfirm="handleSearch"
  19. />
  20. <text class="clear-icon" wx:if="{{searchKeyword}}" bindtap="clearSearch">✕</text>
  21. </view>
  22. </view>
  23. <!-- 分类导航-->
  24. <scroll-view class="category-scroll" scroll-x show-scrollbar="{{false}}" enhanced>
  25. <view class="category-list">
  26. <view
  27. class="category-item {{currentCategory === '全部' ? 'active' : ''}}"
  28. bindtap="switchCategory"
  29. data-category="全部"
  30. data-type=""
  31. >
  32. <text>全部</text>
  33. <text class="dot" wx:if="{{currentCategory === '全部'}}"></text>
  34. </view>
  35. <view
  36. wx:for="{{categories}}"
  37. wx:key="index"
  38. class="category-item {{currentCategory === item.dictLabel ? 'active' : ''}}"
  39. bindtap="switchCategory"
  40. data-category="{{item.dictLabel}}"
  41. data-type="{{item.dictValue}}"
  42. >
  43. <text>{{item.dictLabel}}</text>
  44. <text class="dot" wx:if="{{currentCategory === item.dictLabel}}"></text>
  45. </view>
  46. </view>
  47. </scroll-view>
  48. <!-- 列表内容区域 -->
  49. <view class="list-container">
  50. <!-- 骨架屏 / 加载提示 -->
  51. <block wx:if="{{loading && noticeList.length === 0}}">
  52. <view class="skeleton-list">
  53. <view wx:for="{{4}}" wx:key="*this" class="skeleton-item"></view>
  54. </view>
  55. </block>
  56. <!-- 列表渲染 -->
  57. <scroll-view
  58. class="notice-scroll"
  59. scroll-y
  60. enhanced
  61. show-scrollbar="{{false}}"
  62. bindscrolltolower="loadMore"
  63. lower-threshold="50"
  64. refresher-enabled
  65. refresher-triggered="{{refreshing}}"
  66. bindrefresherrefresh="onRefresh"
  67. >
  68. <view class="notice-list">
  69. <view
  70. wx:for="{{noticeList}}"
  71. wx:key="id"
  72. class="notice-card"
  73. bindtap="viewDetail"
  74. data-id="{{item.id}}"
  75. >
  76. <!-- 重要性标记装饰 -->
  77. <view class="card-left-bar" style="background: {{getImportanceColor(item.warningLevel)}};"></view>
  78. <view class="card-content">
  79. <view class="card-header">
  80. <text class="notice-title">{{item.title}}</text>
  81. <text class="notice-tag" style="background: {{getTagBg(item.warningLevel)}};">{{item.warningType}}</text>
  82. </view>
  83. <view class="notice-abstract">{{item.responseMeasures || '暂无摘要'}}</view>
  84. <view class="card-footer">
  85. <view class="date-time">
  86. <text class="date-icon">📅</text>
  87. <text>{{item.createdTime}}</text>
  88. </view>
  89. <view class="warning-level" style="color: {{getLevelColor(item.warningLevel)}}; background: {{getLevelBg(item.warningLevel)}};">
  90. {{item.warningLevel || '一般'}}
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <!-- 上拉加载更多状态 -->
  97. <view class="load-more" wx:if="{{noticeList.length > 0}}">
  98. <block wx:if="{{loading}}">
  99. <text class="loading-icon">⋯</text>
  100. <text>加载中...</text>
  101. </block>
  102. <block wx:elif="{{hasMore}}">
  103. <text class="loading-icon">↓</text>
  104. <text>上拉加载更多</text>
  105. </block>
  106. <block wx:else>
  107. <text>—— 已经到底了 ——</text>
  108. </block>
  109. </view>
  110. <!-- 空状态展示 -->
  111. <view class="empty-state" wx:if="{{!loading && noticeList.length === 0}}">
  112. <text>📭 暂无相关公告</text>
  113. <text style="font-size: 28rpx; color: #999; margin-top: 16rpx;">
  114. {{searchKeyword ? '试试其他关键词' : currentCategory !== '全部' ? '试试其他分类' : '暂无数据'}}
  115. </text>
  116. </view>
  117. </scroll-view>
  118. </view>
  119. </view>
  120. </view>