杂务:更新 YumiNail 工作区
This commit is contained in:
@@ -8,10 +8,17 @@
|
||||
<a-button type="primary" @click="openCreate">发布公告</a-button>
|
||||
</div>
|
||||
|
||||
<a-table :columns="columns" :data-source="announcements" :loading="loading" row-key="id">
|
||||
<a-table
|
||||
class="announcement-table"
|
||||
:columns="columns"
|
||||
:data-source="announcements"
|
||||
:loading="loading"
|
||||
row-key="id"
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'content'">
|
||||
<span class="ellipsis">{{ record.content }}</span>
|
||||
<span class="ellipsis">{{ extractRichText(record.content) }}</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<a-tag :color="record.status === 1 ? 'green' : 'default'">{{ record.status === 1 ? '已发布' : '已撤回' }}</a-tag>
|
||||
@@ -25,13 +32,13 @@
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<a-modal v-model:open="formOpen" title="发布公告" @ok="submit" :confirm-loading="saving">
|
||||
<a-modal v-model:open="formOpen" title="发布公告" :mask-closable="false" @ok="submit" :confirm-loading="saving">
|
||||
<a-form layout="vertical">
|
||||
<a-form-item label="标题">
|
||||
<a-input v-model:value="form.title" :maxlength="100" />
|
||||
</a-form-item>
|
||||
<a-form-item label="内容">
|
||||
<a-textarea v-model:value="form.content" :rows="4" :maxlength="1000" />
|
||||
<a-textarea v-model:value="form.content" :rows="4" :maxlength="1000" placeholder="支持 HTML / Markdown,也可以直接输入纯文本" />
|
||||
</a-form-item>
|
||||
<a-form-item label="接收范围">
|
||||
<a-select v-model:value="form.targetType" :options="targetOptions" />
|
||||
@@ -55,13 +62,14 @@
|
||||
* AnnouncementsView page script.
|
||||
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
|
||||
*/
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { computed, h, onMounted, reactive, ref } from 'vue'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
/**
|
||||
* Purpose: AnnouncementVO supports AnnouncementsView.vue by holding or executing the announcement vo page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
import { adminAnnouncementApi, type AnnouncementVO, type MessageTargetOptionsVO } from '@/api/admin'
|
||||
import { extractRichText, renderRichContent } from '@/utils/rich-content'
|
||||
|
||||
/** loading is a reactive state variable used by the template and event handlers. */
|
||||
const loading = ref(false)
|
||||
@@ -158,7 +166,14 @@ const submit = async () => {
|
||||
|
||||
/** preview is a local helper used by this page script. */
|
||||
const preview = (record: AnnouncementVO) => {
|
||||
Modal.info({ title: record.title, content: record.content })
|
||||
Modal.info({
|
||||
title: record.title,
|
||||
width: 560,
|
||||
content: h('div', {
|
||||
class: 'announcement-preview-content',
|
||||
innerHTML: renderRichContent(record.content)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** revoke is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
@@ -175,6 +190,27 @@ onMounted(load)
|
||||
.admin-page { display: grid; gap: 18px; }
|
||||
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
|
||||
.page-head h2 { margin: 0 0 4px; }
|
||||
.page-head p { margin: 0; color: #7a6f68; }
|
||||
.page-head p { margin: 0; color: var(--text-secondary); }
|
||||
.ellipsis { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
|
||||
.announcement-table :deep(.ant-table) { min-width: 880px; }
|
||||
.announcement-table :deep(.ant-table-cell) { white-space: nowrap; word-break: keep-all; overflow-wrap: normal; }
|
||||
.announcement-table :deep(.ant-table-content) { overflow-x: auto; }
|
||||
:global(.announcement-preview-content) { line-height: 1.8; overflow-wrap: break-word; }
|
||||
:global(.announcement-preview-content *) { max-width: 100%; }
|
||||
:global(.announcement-preview-content p),
|
||||
:global(.announcement-preview-content ul),
|
||||
:global(.announcement-preview-content ol),
|
||||
:global(.announcement-preview-content blockquote),
|
||||
:global(.announcement-preview-content pre),
|
||||
:global(.announcement-preview-content table) { margin: 0 0 12px; }
|
||||
:global(.announcement-preview-content p:last-child),
|
||||
:global(.announcement-preview-content ul:last-child),
|
||||
:global(.announcement-preview-content ol:last-child),
|
||||
:global(.announcement-preview-content blockquote:last-child),
|
||||
:global(.announcement-preview-content pre:last-child),
|
||||
:global(.announcement-preview-content table:last-child) { margin-bottom: 0; }
|
||||
:global(.announcement-preview-content ul),
|
||||
:global(.announcement-preview-content ol) { padding-left: 1.25em; }
|
||||
:global(.announcement-preview-content img) { display: block; max-width: 100%; border-radius: 8px; }
|
||||
:global(.announcement-preview-content pre) { overflow-x: auto; padding: 10px 12px; border-radius: 8px; background: var(--theme-primary-soft); }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user