feat: 添加公告功能

This commit is contained in:
ibuler
2021-09-28 10:20:39 +08:00
parent 8db10e806a
commit 972b7276cf
6 changed files with 69 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
<template>
<el-alert
v-if="!isViewed()"
type="success"
:center="false"
:title="this.$t('common.Announcement') + ': ' + announcement.subject"
@close="onClose"
>
<span> {{ announcement.content }}</span>
<span v-if="announcement.link">
<el-link :href="announcement.link" class="link-more"> 查看更多</el-link> <i class="fa fa-share-square-o" />
</span>
</el-alert>
</template>
<script>
export default {
name: 'Announcement',
data() {
return {
viewedKey: 'AnnouncementViewed',
announcement: {
id: 'abcd',
subject: '伟大的中国共产党万岁, 伟大中华民族万岁,伟大的中国人民万岁',
content: '人民民日报刊发“宣言”文章我们为什么能够成功1840年鸦片战争以后国家蒙辱、人民蒙难、文明蒙尘\n' +
' 中华民族遭受了前所未有的劫难。从此,实现中华民族伟大复兴就成为中国人民和中华民族最伟大的梦想,成为近代以来中国全部历史的主题。\n' +
' 为了实现民族复兴的梦想,中国人民奋起抗争,各种力量前仆后继,各种方案轮番试验.',
link: 'https://www.qq.com'
}
}
},
methods: {
onClose() {
localStorage.setItem(this.viewedKey, this.announcement.id)
},
isViewed() {
const viewedId = localStorage.getItem(this.viewedKey)
return viewedId === this.announcement.id
}
}
}
</script>
<style scoped>
</style>

View File

@@ -26,3 +26,4 @@ export { default as AccountListTable } from './AccountListTable/index'
export { default as AppAccountListTable } from './AppAccountListTable'
export { default as AssetRelationCard } from './AssetRelationCard'
export { default as MFAVerifyDialog } from './MFAVerifyDialog'
export { default as Announcement } from './Announcement'

View File

@@ -233,6 +233,7 @@
"ReLogin": "重新登录"
},
"common": {
"Announcement": "公告",
"Logging": "日志记录",
"Database": "数据库记录",
"Params": "参数",

View File

@@ -231,6 +231,7 @@
"ReLogin": "Re-Login"
},
"common": {
"Announcement": "Announcement",
"Logging": "Logging",
"Database": "Database",
"Params": "Params",

View File

@@ -1,13 +1,18 @@
<template>
<GenericTreeListPage :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting" />
<div>
<Announcement />
<GenericTreeListPage :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting" />
</div>
</template>
<script>
import GenericTreeListPage from '@/layout/components/GenericTreeListPage/index'
import { Announcement } from '@/components'
import { SystemUserFormatter, DialogDetailFormatter } from '@/components/TableFormatters'
export default {
components: {
GenericTreeListPage
GenericTreeListPage,
Announcement
},
data() {
return {
@@ -192,4 +197,10 @@ export default {
cursor: not-allowed;
background-color:rgba(192,196,204,0.28) !important;
}
.link-more {
margin-left: 10px;
border-bottom: solid 1px;
font-size: 12px
}
</style>

View File

@@ -1,5 +1,6 @@
<template>
<Page>
<Announcement />
<ResourceSummary />
<DatesLoginSummary />
<TopAndLatestSummary />
@@ -7,6 +8,7 @@
</template>
<script>
import { Announcement } from '@/components'
import { Page } from '@/layout/components'
import ResourceSummary from './ResourceSummary'
import DatesLoginSummary from './DatesLoginSummary'
@@ -15,7 +17,11 @@ import TopAndLatestSummary from './TopAndLatestSummary'
export default {
name: 'Dashboard',
components: {
Page, DatesLoginSummary, ResourceSummary, TopAndLatestSummary
Page,
DatesLoginSummary,
ResourceSummary,
TopAndLatestSummary,
Announcement
},
data() {
return {