wujingjing
2024-06-27 bb360db5687a483f60fba3d457d3dcfb9994d683
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
<template>
    <div class="top_text">
        <div class="notice">
            <el-badge :value="3">
                <el-button link size="small" icon="ele-Message" class="set-notice" @click="handleAnnouncementClick">系统公告</el-button>
            </el-badge>
            <div class="notice_box notice_box_show" v-show="state.isShowAnnouncement">
                <div class="notice_box_header">
                    <span>最新公告</span>
                </div>
                <div class="notice_box_body">
                    <div class="notice_item" v-for="item in state.announcementList" :key="item.ID">
                        <p>{{ item.Content }}</p>
                        <p class="text-right">
                            <span>{{ item.Time }}</span>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script setup lang="ts">
import { reactive } from 'vue';
let state = reactive({
    isShowAnnouncement: false,
    announcementList: [
        {
            ID: 1,
            Content: '尊敬的用户,如果遇到上传文件失败的错误(pdf、图片、聊天记录等),请刷新一下网页再操作。',
            Time: '2021-08-10',
        },
        {
            ID: 2,
            Content: '水利工程施工现场安全工作要点',
            Time: '2021-08-10',
        },
        {
            ID: 3,
            Content: '水利工程施工现场安全工作要点',
            Time: '2021-08-10',
        },
    ],
});
const handleAnnouncementClick = () => {
    state.isShowAnnouncement = !state.isShowAnnouncement;
};
</script>
<style scoped lang="scss">
.top_text {
    width: 100%;
    height: 42px;
    background-color: #fff;
    position: absolute;
    top: 0;
    z-index: 10;
}
.notice {
    position: fixed;
    top: 18px;
    right: 30px;
    z-index: 12;
    .set-notice {
        font-size: 12px;
        font-weight: 400;
        letter-spacing: 0;
        line-height: 17.38px;
        color: #9598b3;
    }
    .notice_box_show {
        width: 300px !important;
        height: 400px !important;
        padding: 0 20px 10px;
    }
    .notice_box {
        position: absolute;
        z-index: 12;
        top: calc(100% + 20px);
        right: -10px;
        width: 0;
        height: 0;
        border-radius: 5px;
        -webkit-box-shadow: 0 0 5px #ddd;
        box-shadow: 0 0 5px #ddd;
        background: #fff;
        display: block;
        -webkit-transition: all 0.3s;
        -o-transition: all 0.3s;
        transition: all 0.3s;
        overflow: hidden;
        &_header {
            line-height: 40px;
            font-size: 14px;
            height: 40px;
            color: #0084ff;
        }
        &_body {
            height: calc(100% - 40px);
            // overflow: auto;
            .notice_item {
                cursor: pointer;
                padding: 10px;
                width: 280px;
                border-top: 1px solid #efefef;
                color: #767a97;
                position: relative;
                line-height: 19px;
                font-size: 12px;
            }
        }
    }
}
</style>