| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- <template>
- <view class="page_mine">
- <notice-header title="我的通知" :showSearch="true" :showFilter="true" :showTabs="true" :tabs="tabs"
- :activeTab="activeTab" tabMode="index" @tabChange="handleTabChange" @typeChange="handleTypeChange" @timeChange="handleTimeChange" @searchChange="handleSearchChange"></notice-header>
- <view class="notice_content">
- <view class="notice_list">
- <scroll-view scroll-y v-for="item in noticeList" :key="item.id" class="notice_item">
- <view class="item_content">
- <view class="notice_title_row">
- <image class="notice_icon" :src="item.icon" mode="aspectFit"></image>
- <text class="notice_title">{{ item.title }}</text>
- </view>
- <view class="notice_meta">
- <view class="status_tag" :class="item.statusClass">
- <text>{{ item.status }}</text>
- </view>
- <text class="meta_text">{{ item.category }}</text>
- <text class="meta_text">{{ item.department }}</text>
- <text class="meta_text">{{ item.time }}</text>
- </view>
- </view>
- <view class="item_bottom">
- <view class="notice_stats">
- <text class="stats_text">已读: {{ item.readCount }}人</text>
- <text class="stats_text">未读: {{ item.unreadCount }}人</text>
- </view>
- <view class="notice_actions">
- <view class="action_btn" :class="getDeleteClass(item)" @click="handleDelete(item.id)">
- <text>删除</text>
- </view>
- <view class="action_btn edit" @click="handleEdit(item.id)">
- <text>编辑</text>
- </view>
- <view class="action_btn detail" @click="handleDetail(item.id)">
- <text>详情</text>
- </view>
- </view>
- </view>
- </scroll-view>
- <no-data v-if="noticeList.length === 0" text="暂无通知" />
- </view>
- </view>
- <common-tabbar></common-tabbar>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue';
- import NoticeHeader from '@/components/notice-header.vue';
- import NoData from '@/components/no-data.vue';
- const tabs = ['未读', '已读', '全部'];
- const activeTab = ref(0);
- const noticeList = ref([
- {
- id: '1',
- title: '25-26学年第一学期初一期中考试安排通知',
- status: '已发布',
- statusClass: 'status-published',
- category: '教学教务',
- department: '教务处',
- time: '2024-06-03 18:00:00',
- readCount: 1500,
- unreadCount: 50,
- icon: '/static/image/todo/xiaoxi.png'
- },
- {
- id: '2',
- title: '关于开展教师培训的通知',
- status: '已发布',
- statusClass: 'status-published',
- category: '教师培训',
- department: '人事处',
- time: '2024-06-02 10:00:00',
- readCount: 280,
- unreadCount: 15,
- icon: '/static/image/todo/xiaoxi.png'
- },
- {
- id: '3',
- title: '暑期放假安排通知',
- status: '待发布',
- statusClass: 'status-pending',
- category: '学校通知',
- department: '校长办公室',
- time: '2024-06-01 09:00:00',
- readCount: 0,
- unreadCount: 0,
- icon: '/static/image/todo/xiaoxi.png'
- }
- ]);
- const getDeleteClass = (item) => {
- if (item.noticeStatus !== 2) {
- return 'delete disabled';
- }
- return 'delete';
- };
- const goBack = () => {
- uni.navigateBack();
- };
- const handleTabChange = (idx) => {
- activeTab.value = idx;
- };
- const handleTypeChange = () => {};
- const handleTimeChange = () => {};
- const handleSearchChange = () => {};
- const handleDelete = (id) => {
- uni.showModal({
- title: '确认删除',
- content: '确定要删除这条通知吗?',
- success: (res) => {
- if (res.confirm) {
- noticeList.value = noticeList.value.filter(item => item.id !== id);
- uni.showToast({ title: '删除成功', icon: 'success' });
- }
- }
- });
- };
- const handleEdit = (id) => {
- uni.navigateTo({ url: `/pages/notice/publish/index?id=${id}` });
- };
- const handleDetail = (id) => {
- const item = noticeList.value.find(item => item.id === id);
- if (item && item.status === '待发布') {
- uni.showToast({ title: '待发布通知暂无法查看详情', icon: 'none' });
- return;
- }
- uni.showToast({ title: `查看详情: ${id}`, icon: 'none' });
- };
- </script>
- <style lang="scss">
- .page_mine {
- }
- .notice_content {
- padding-top: 325rpx;
- padding-bottom: 104px;
- }
- .notice_list {
- padding: 0rpx 24rpx;
- box-sizing: border-box;
- }
- .notice_item {
- background-color: #F9FAFF;
- border-radius: 20rpx;
- margin-bottom: 24rpx;
- border: 2rpx solid #E4E7ED;
- .item_content {
- padding: 24rpx;
- .notice_title_row {
- display: flex;
- align-items: center;
- margin-bottom: 16rpx;
- .notice_icon {
- width: 32rpx;
- height: 32rpx;
- margin-right: 16rpx;
- }
- .notice_title {
- flex: 1;
- font-weight: 500;
- font-size: 28rpx;
- color: #333333;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .notice_meta {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 16rpx;
- .status_tag {
- font-size: 24rpx;
- height: 48rpx;
- width: 96rpx;
- text-align: center;
- line-height: 48rpx;
- border-radius: 8rpx;
- font-weight: 400;
- &.status-pending {
- background: rgba(46, 100, 250, 0.1);
- color: #2E64FA;
- }
- &.status-published {
- background: rgba(82, 196, 26, 0.1);
- color: #2BC644;
- }
- &.status-closed {
- background: rgba(245, 108, 108, 0.1);
- color: #F56C6C;
- }
- }
- .meta_text {
- font-size: 24rpx;
- color: #999999;
- line-height: 48rpx;
- }
- }
- }
- .item_bottom {
- border-top: 2rpx solid #E4E7ED;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- padding: 24rpx 16rpx;
- .notice_stats {
- display: flex;
- .stats_text {
- font-size: 24rpx;
- color: #999999;
- &:first-child {
- margin-right: 32rpx;
- }
- }
- }
- .notice_actions {
- display: flex;
- justify-content: flex-end;
- gap: 16rpx;
- .action_btn {
- font-size: 24rpx;
- padding: 12rpx 24rpx;
- border-radius: 8rpx;
- border: 2rpx solid transparent;
- &.delete {
- border-color: #F56C6C;
- color: #F56C6C;
- background-color: #FFFFFF;
- &.disabled {
- border-color: #C0C4CC;
- color: #C0C4CC;
- background-color: #FFFFFF;
- }
- }
- &.edit {
- border-color: #2E64FA;
- color: #2E64FA;
- background-color: #FFFFFF;
- &.disabled {
- border-color: #C0C4CC;
- color: #C0C4CC;
- background-color: #FFFFFF;
- }
- }
- &.detail {
- background-color: #2E64FA;
- color: #FFFFFF;
- &.disabled {
- border-color: #C0C4CC;
- color: #C0C4CC;
- background-color: #FFFFFF;
- }
- }
- }
- }
- }
- &:last-child {
- margin-bottom: 0;
- }
- }
- </style>
|