<wxs module="tools">

</wxs>
<view class="container">
  <!-- 返回按钮 --> 
  <view class="custom-nav">
    <view bindtap="goBack">
      <image src="/static_file/backcion.png" mode="aspectFit" class="back-icon"></image>
    </view>
    <!-- <view class="nav-title">消息通知</view> -->
  </view>

  <!-- 添加Tab页切换 -->
  <view class="tab-container">
    <view class="tab-item {{activeTab === 0 ? 'active' : ''}}" bindtap="switchTab" data-index="0">
      <text class="tab-text">通知</text>
    </view>
    <view class="tab-divider"></view>
    <view class="tab-item {{activeTab === 1 ? 'active' : ''}}" bindtap="switchTab" data-index="1">
      <text class="tab-text">消息</text>
      <view class="tab-right">
        <view class="unread-badge" wx:if="{{unreadCount > 0}}">{{unreadCount > 99 ? '99+' : unreadCount}}</view>
        <image class="clean-icon" src="/static_file/yjyd.png" catchtap="markAllAsRead"></image>
      </view>
    </view>
  </view>

  <!-- 公告列表 -->
  <view class="notice-list" wx:if="{{activeTab === 0}}">
    <block wx:for="{{noticeList}}" wx:key="id">
      <view class="notice-item" bindtap="goToDetail" data-id="{{item.id}}">
        <view class="notice-left">
          <image class="notice-icon" src="{{item.type === 'payment' ? '/static_file/speaker.png' : '/static_file/speaker.png'}}" mode="aspectFit"></image>
        </view>
        <view class="notice-content">
          <view class="notice-title">{{item.noticetitle}}</view>
          <view class="notice-desc">
            <rich-text nodes="{{item.noticecontent}}"></rich-text>
          </view>
        </view>
        <view class="notice-date">{{item.publishtime}}</view>
      </view>
    </block>
    <view wx:if="{{noticeList.length === 0}}" class="empty-tip">暂无公告</view>
  </view>

  <!-- 消息列表 -->
  <view class="notice-list" wx:if="{{activeTab === 1}}">
    <view class="notice-item" wx:for="{{userNoticesList}}" wx:key="id" bindtap="goToDetail" data-id="{{item.id}}">
      <view class="notice-left">
        <image class="notice-icon" src="{{item.iconUrl || '/static_file/water_drop_icon.png'}}" mode="aspectFit"></image>
        <view class="unread-dot" wx:if="{{item.readstate === '2'}}"></view>
      </view>
      <view class="notice-content">
        <view class="notice-title">{{item.title}}</view>
        <view class="notice-desc">{{item.roption}}</view>
      </view>
      <view class="notice-date">{{item.createdate}}</view>
    </view>
    <view wx:if="{{userNoticesList.length === 0}}" class="empty-tip">暂无消息</view>
  </view>
</view>