Files
im-uniapp/pages/workbench/notice/notice.vue
砂糖 884b1bb311 feat: 添加通知公告功能和相关页面
refactor: 重构财务类型选项为独立变量

docs: 更新版本记录规则和文档

feat(workbench): 新增通知公告列表和详情页面

feat(h5office): 添加h5office文档预览组件和相关配置

style: 优化文章页面样式和布局

fix(update): 添加版本检查日志输出
2025-11-07 10:30:50 +08:00

98 lines
2.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- 通知公告列表展示noticeTitle createBy, createTime -->
<div class="notice-list-container">
<!-- 判空提示 -->
<div class="empty-tip" v-if="notices.length === 0">
暂无通知公告
</div>
<!-- 公告列表 -->
<div class="notice-list" v-else>
<div class="notice-item" v-for="(notice, index) in notices" :key="index" @click="toDetail(notice.noticeId)">
<div class="notice-title">{{ notice.noticeTitle }}</div>
<div class="notice-meta">
<span class="create-by">{{ notice.createBy || '未知发布人' }}</span>
<span class="create-time">{{ notice.createTime || '未知时间' }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import { listNotice } from '@/api/oa/notice.js'
export default {
data() {
return {
notices: []
}
},
mounted() {
listNotice({ pageSize: 999, pageNum: 1 }).then(res => {
// 确保res.rows存在避免空数据报错
this.notices = res?.rows || [];
}).catch(err => {
console.error('获取通知公告失败', err);
this.notices = [];
});
},
methods: {
toDetail(id) {
uni.navigateTo({
url: '/pages/workbench/article/article?type=notice&id=' + id
})
}
}
}
</script>
<style scoped lang="scss">
.notice-list-container {
background-color: #f5f5f5; // 米色背景
padding: 15px;
min-height: 100vh; // 避免容器过矮
.empty-tip {
text-align: center;
padding: 30px 0;
color: #999;
font-size: 14px;
}
.notice-list {
.notice-item {
background-color: #fff; // 白色公告背景
padding: 12px 15px;
margin-bottom: 10px;
border-radius: 6px;
box-shadow: 0 1px 2px rgba(0,0,0,0.05); // 轻微阴影增强层次感
.notice-title {
font-size: 16px;
font-weight: 500;
color: #333;
margin-bottom: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; // 标题过长省略
}
.notice-meta {
display: flex;
justify-content: space-between; // 发布人和时间两端对齐
font-size: 13px;
color: #666;
.create-by {
&:after {
content: '|'; // 分隔符
margin: 0 8px;
color: #ccc;
}
}
}
}
}
}
</style>