gaoshp
2024-06-13 fd7586c8d91473d2850af1e48b12f1a289e6b8d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!--
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-04-16 15:22:46
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-06-06 16:17:02
 * @FilePath: /src/views/home/widgets/components/welcome.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <el-card shadow="hover" header="公告">
        <div class="announcement">
            <div v-if="noticeList.length != 0" v-for="item in noticeList" class="mesg">
                <div>
                    <span>{{item.categoryName}}</span>
                    <span @click="showDialog(item)">{{item.title}}</span>
                </div>
                <span>{{item.updateTime}}</span>
            </div>
            <div v-if="noticeList.length == 0">暂无内容</div>
        </div>
    </el-card>
    <el-dialog title="查看" v-model="visible" :width="600" destroy-on-close>
        <el-form :model="viewNoticeForm" :disabled="mode=='show'" ref="dialogForm" label-width="80px" label-position="center">
            <el-row>
                <el-col :span="24">
                    <el-form-item label="通知标题">
                        <span>{{viewNoticeForm.title}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="通知类型">
                        <span>{{viewNoticeForm.categoryName}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="通知时间">
                        <span>{{viewNoticeForm.updateTime}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="通知内容">
                        <div v-html="viewNoticeForm.content"></div>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
    </el-dialog>
</template>
 
<script>
    export default {
        title: "公告",
        icon: "el-icon-setting",
        description: "系统内通知、公告通知快速查看",
        data() {
            return {
                viewNoticeForm: {
                    title: "",
                    categoryName: "",
                    updateTime: "",
                    content: ""
                },
                mode: "show",
                visible: false,
                noticeList: []
            }
        },
        mounted() {
            this.showDetail();
        },
        methods: {
            showDialog(item) {
                this.$HTTP.get(`/api/blade-notify/notice/detail?id=${item.id}`).then(res=> {
                    if(res.code == 200) {
                        this.visible = true;
                        this.viewNoticeForm = res.data;
                    }
                })
            },
            showDetail(){
                this.$HTTP.get("/api/blade-notify/notice/page?current=1&size=-1").then(res=> {
                    if(res.code == 200) {
                        this.noticeList = res.data.records;
                    }
                })
            }
        }
    }
</script>
 
<style scoped>
    .announcement {
        text-align: center;
    }
    .announcement img {
        text-align: center;
        width:150px;
        height:150px;
    }
    .mesg {
        display: flex;
        justify-content: space-between;
        margin-bottom: 12px;
    }
    .mesg > div {
        padding-left: 12px;
    }
    .mesg > div span:nth-child(1) {
        margin-right: 12px;
        padding: 0 10px;
        border: 1px solid #94c4f6;
        background-color: #e5ecf4;
    }
    .mesg > div span:nth-child(2) {
        font-weight: bold;
        cursor: pointer;
        font-size: 14px;
    }
    .mesg > span {
        padding-right: 12px;
    }
</style>