noticeList.vue
1.94 KB
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
<template>
<div class = "noticeList">
<ul>
<li class = "item" v-for="notice in noticeList" :key="notice.date">
<a v-bind:href="notice.link" target="_blank"><div class = "title">{{notice.title}}</div></a>
<div class = "noticeInfo">
<span class = "site khu" v-if="notice.site == '경희대학교 공지사항'">경희대</span>
<span class = "site sw" v-else-if="notice.site == '소프트웨어 융합대학 공지사항'">SW융합</span>
<span class = "site janghak" v-else-if="notice.site == '경희대학교 장학센터'">장학센터</span>
<span class = "date">{{notice.date}}</span>
</div>
</li>
</ul>
</div>
</template>
<script>
import axios from 'axios'
export default {
el: '.noticeList',
data () {
return {
noticeList: []
}
},
components: {
},
created () {
this.fetchNoticeList()
},
methods: {
fetchNoticeList () {
axios
.post('/api/fetchNoticeList', {})
.then((noticeList) => {
console.log(noticeList.data)
this.noticeList = noticeList.data
})
}
}
}
</script>
<style>
.imfoList{
width: 800px;
background: grey;
}
ul{
display: flex;
flex-direction: column;
margin: 0 auto 10px auto;
}
li{
margin-bottom:2px;
}
.item{
background: white;
height: 32px;
display: flex;
position: relative;
padding: 6px 15px 18px;
width: 700px;
border-radius:5px;
}
.title{
font-size:15px;
}
a{
color: #34495e;
}
a:visited{
color: grey;
}
.noticeInfo{
position: absolute;
bottom:12px;
font-size:12px;
}
.date{
color: grey;
}
.site{
color: white;
font-size:10px;
padding: 2px 10px;
}
.khu{
background-color: #C0392B;
}
.sw{
background-color: #3498DB;
}
.janghak{
background-color: #632300;
}
</style>