refactor(enterpriseZone): 优化公告查看功能

- 移除 ElMessageBox 弹框显示方式- 添加详情页面和列表页面切换逻辑
- 优化公告内容展示样式
- 增加返回列表按钮
This commit is contained in:
syruan 2025-06-02 16:12:58 +08:00
parent 14f9a8182e
commit f394d50cbf
1 changed files with 106 additions and 22 deletions

View File

@ -1,9 +1,9 @@
<script setup lang="ts">
import NavMenu from 'components/Navmenu/index.vue'
import { ElMessageBox } from 'element-plus'
import {
getListApi, //
} from 'http/api/info'
const leaseList = ref([
{
noticeContent: '',
@ -11,6 +11,14 @@ const leaseList = ref([
},
])
//
const showDetail = ref(false)
const currentNotice = ref({
noticeContent: '',
noticeTitle: '',
createTime: ''
})
const getList = async () => {
leaseList.value = []
const { data: res }: any = await getListApi()
@ -20,13 +28,18 @@ const getList = async () => {
const handleRowClick = (row: any) => {
console.log('🚀 ~ handleRowClick ~ row', row)
//
ElMessageBox.alert(row.noticeContent, '消息内容', {
showConfirmButton: false,
showCancelButton: true,
cancelButtonText: '关闭',
dangerouslyUseHTMLString: true,
})
//
currentNotice.value = {
noticeContent: decodeURIComponent(row.noticeContent),
noticeTitle: row.noticeTitle,
createTime: row.createTime
}
showDetail.value = true
}
//
const handleBack = () => {
showDetail.value = false
}
onMounted(() => {
@ -39,6 +52,8 @@ onMounted(() => {
<NavMenu />
<div class="container">
<!-- 列表页面 -->
<div v-if="!showDetail">
<el-table
:data="leaseList"
style="width: 100%"
@ -54,10 +69,79 @@ onMounted(() => {
</el-table-column>
</el-table>
</div>
<!-- 详情页面 -->
<div v-else class="detail-container">
<div class="detail-header">
<el-button @click="handleBack" style="margin-bottom: 20px;color: #00a288;">
<el-icon><ArrowLeft /></el-icon>
返回列表
</el-button>
<h2 class="detail-title" v-html="currentNotice.noticeTitle"></h2>
<p class="detail-time">发布时间{{ currentNotice.createTime }}</p>
</div>
<div class="detail-content">
<div v-html="currentNotice.noticeContent"></div>
</div>
</div>
</div>
</template>
<style scoped>
.container {
height: 600px;
padding: 20px;
}
.detail-container {
height: 100%;
overflow-y: auto;
}
.detail-header {
border-bottom: 1px solid #e4e7ed;
padding-bottom: 20px;
margin-bottom: 20px;
}
.detail-title {
font-size: 24px;
font-weight: bold;
color: #303133;
margin: 10px 0;
line-height: 1.4;
}
.detail-time {
color: #909399;
font-size: 14px;
margin: 0;
}
.detail-content {
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
line-height: 1.6;
}
.detail-content :deep(img) {
max-width: 100%;
height: auto;
}
.detail-content :deep(p) {
margin-bottom: 15px;
}
.detail-content :deep(h1),
.detail-content :deep(h2),
.detail-content :deep(h3),
.detail-content :deep(h4),
.detail-content :deep(h5),
.detail-content :deep(h6) {
margin: 20px 0 15px 0;
font-weight: bold;
}
</style>