notice.vue
3.6 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
<div>
<nav-bar class="noticebar">
<div slot="left" class="back" @click="goBack">
<img src="../../assets/img/back.png" alt="">
</div>
<div slot="center" class="userinfotitle">
消息通知
</div>
<div slot="right" class="result"></div>
</nav-bar>
<div class="notices" :style="{height:+height+'px'}">
<Scroll
style="height: 100%;"
ref="scroll"
:probeType="3"
:scrollX="scrollX"
:pullup="true"
@scrollEnd="scrollEnd"
>
<div style="padding-bottom: 0.52rem; box-sizing: border-box;">
<router-link :to="{path:'/noticeDetail',query:{id:item.id}}" v-for="(item,index) in notices" :key="index" class="notice_item display-flex-between">
<img src="../../assets/img/notice.png" alt="">
<div style="flex: 1;">
<div class="notice_title display-flex-between">
<div>平台通知</div>
<div style="color:rgba(150,151,153,1); ">{{item.create_time}}</div>
</div>
<div class="notice_detail p-2">
{{item.content}}
</div>
</div>
</router-link>
</div>
</Scroll>
</div>
</div>
</template>
<script>
import Scroll from '@/components/scroll.vue'
export default {
components: {
Scroll
},
data () {
return {
scrollX: false,
notices: [],
page: 1,
ifmore: false,
height: ''
}
},
mounted () {
this.height = document.documentElement.clientHeight - 20
console.log(document.documentElement.clientHeight)
this.getlist()
},
methods: {
scrollEnd () {
if (this.ifmore) {
++this.page
this.getlist()
} else {
this.$toast({ message: '没有更多了', duration: 1000 })
}
},
goBack () {
this.$router.go(-1)
},
async getlist () {
const params = {
page: this.page,
page_num: 20
}
const res = await this.api.getnotice(params)
if (res.code === 1) {
const list = res.data.list.data
if (list.length === 0) {
this.ifmore = false
this.notices = this.reports.concat(list)
} else {
this.ifmore = true
this.notices = this.page === 1 ? list : this.notices.concat(list)
}
}
}
}
}
</script>
<style lang="scss">
body{
background: #fff;
}
.noticebar{
position: fixed;
top: 0;
background: #fff;
z-index: 2;
}
.notices{
width: 100%;
/* height: 15rem; */
padding: 0 0.32rem;
box-sizing: border-box;
background-color: #ffffff;
margin-top: 0.88rem;
}
.notice_item{
width: 100%;
height: auto;
padding: 0.32rem 0;
box-sizing: border-box;
align-items: flex-start;
border-bottom: 0.01rem solid #eee;
}
.notice_item img{
width: 0.88rem;
height: 0.88rem;
border-radius: 50%;
margin-right: 0.32rem;
}
.notice_title{
color: rgba(50,50,51,1);
font-size: 0.28rem;
}
.notice_detail{
color: rgba(50,50,51,1);
font-size: 0.24rem;
font-weight: 400;
font-family: "PingFang SC";
text-align: left;
line-height: 0.44rem;
margin-top: 0.16rem;
word-break: break-all;
}
</style>