diff --git a/pages/notice/detail/index.vue b/pages/notice/detail/index.vue index fe81679..5370584 100644 --- a/pages/notice/detail/index.vue +++ b/pages/notice/detail/index.vue @@ -120,19 +120,35 @@ 加载中... + + + + 修改 + 删除 + diff --git a/pages/notice/list/index.vue b/pages/notice/list/index.vue index 7f567f9..3e48008 100644 --- a/pages/notice/list/index.vue +++ b/pages/notice/list/index.vue @@ -1,101 +1,5 @@ @@ -228,6 +117,7 @@ import { getNoticeList, deleteNotice } from '@/api'; import { usePagination } from '@/composables'; import { truncateText } from '@/utils/textSolve/truncateText'; import { useUserStore } from '@/store/user'; +import FabPlus from '@/components/FabPlus.vue'; // 搜索表单 const searchForm = ref({ @@ -297,50 +187,6 @@ const { // 公告列表 const notices = computed(() => list.value); -// 表格选择 -const selectedNoticeIds = ref([]); -const isAllSelected = computed(() => { - const data = notices.value; - if (!data.length) return false; - return data.every((notice) => selectedNoticeIds.value.includes(notice.id)); -}); - -const isNoticeSelected = (noticeId) => selectedNoticeIds.value.includes(noticeId); - -const toggleNoticeSelection = (noticeId) => { - if (!noticeId) return; - if (isNoticeSelected(noticeId)) { - selectedNoticeIds.value = selectedNoticeIds.value.filter((id) => id !== noticeId); - } else { - selectedNoticeIds.value = [...selectedNoticeIds.value, noticeId]; - } -}; - -const handleSelectAll = () => { - if (isAllSelected.value) { - selectedNoticeIds.value = []; - } else { - selectedNoticeIds.value = notices.value.map((notice) => notice.id); - } -}; - -const clearTableSelection = () => { - selectedNoticeIds.value = []; -}; - -watch( - notices, - (newList) => { - if (!newList?.length) { - selectedNoticeIds.value = []; - return; - } - const ids = newList.map((item) => item.id); - selectedNoticeIds.value = selectedNoticeIds.value.filter((id) => ids.includes(id)); - }, - { immediate: true } -); - // 用户角色判断 const userStore = useUserStore(); const { userInfo } = storeToRefs(userStore); @@ -356,7 +202,6 @@ const selectLevel = (value) => { // 搜索 const handleSearch = () => { - clearTableSelection(); reset(); getList(); }; @@ -369,7 +214,6 @@ const handleReset = () => { level: '', top: '' }; - clearTableSelection(); reset(); getList(); }; @@ -407,76 +251,6 @@ const handleCreate = () => { url: '/pages/notice/create/index' }); }; -const handleEdit = () => { - if (!selectedNoticeIds.value.length) { - uni.showToast({ - title: '请先选择要修改的公告', - icon: 'none' - }); - return; - } - - if (selectedNoticeIds.value.length > 1) { - uni.showToast({ - title: '一次只能修改一条公告', - icon: 'none' - }); - return; - } - - const id = selectedNoticeIds.value[0]; - if (!id) { - uni.showToast({ - title: '请选择有效的公告', - icon: 'none' - }); - return; - } - - uni.navigateTo({ - url: `/pages/notice/edit/index?id=${id}` - }); -}; -const handleDelete = async () => { - if (!selectedNoticeIds.value.length) { - uni.showToast({ - title: '请先选择要删除的公告', - icon: 'none' - }); - return; - } - - const ids = selectedNoticeIds.value; - - uni.showModal({ - title: '删除确认', - content: - ids.length === 1 - ? '删除后将无法恢复,确认删除该公告吗?' - : `已选择 ${ids.length} 条公告,删除后将无法恢复,确认删除吗?`, - confirmText: '删除', - confirmColor: '#f56c6c', - success: async (res) => { - if (!res.confirm) return; - try { - await deleteNotice(ids); - uni.showToast({ - title: '删除成功', - icon: 'success' - }); - clearTableSelection(); - reset(); - getList(); - } catch (error) { - console.error('删除公告失败:', error); - uni.showToast({ - title: error?.message || '删除失败', - icon: 'none' - }); - } - } - }); -}; // 管理员视图接收对象描述 const formatReceiveInfo = (notice) => { @@ -494,7 +268,6 @@ const formatReceiveInfo = (notice) => { }; const handleNoticeUpdated = () => { - clearTableSelection(); reset(); getList(); }; @@ -519,8 +292,10 @@ onBeforeUnmount(() => { } .search-filter-section { + position: fixed; + bottom: 0px; background: #fff; - padding: 16px; + padding: 6px; margin-bottom: 8px; } @@ -618,11 +393,6 @@ onBeforeUnmount(() => { font-weight: 500; } -.action-buttons { - display: flex; - gap: 12px; - margin-top: 12px; -} .notice-scroll { flex: 1; @@ -636,39 +406,6 @@ onBeforeUnmount(() => { gap: 12px; } -.admin-action-row { - display: flex; - gap: 12px; - -} - -.checkbox-indicator { - width: 18px; - height: 18px; - border-radius: 4px; - border: 2px solid #c0c4cc; - background: #fff; - transition: all 0.2s; -} - -.checkbox-indicator.checked { - border-color: #2885ff; - background: #2885ff; - position: relative; -} - -.checkbox-indicator.checked::after { - content: ''; - position: absolute; - top: 2px; - left: 4px; - width: 5px; - height: 9px; - border: 2px solid #fff; - border-top: 0; - border-left: 0; - transform: rotate(45deg); -} .notice-card { background: #fff; @@ -686,33 +423,6 @@ onBeforeUnmount(() => { opacity: 0.9; } -.notice-card.admin-selectable { - position: relative; - padding-top: 32px; -} - -.notice-card.selected { - box-shadow: 0 4px 18px rgba(40, 133, 255, 0.18); -} - -.card-select-btn { - - top: 12px; - left: 12px; - width: 30px; - height: 30px; - border-radius: 10px; - background: rgba(255, 255, 255, 0.98); - display: flex; - align-items: center; - justify-content: center; - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); - z-index: 1; -} - -.card-select-btn:active { - transform: scale(0.92); -} .notice-header { display: flex;