principals_mailbox.vue
1.7 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
<template>
<view class="principals_mailbox">
<view class="tel_index_bg"></view>
<scroll-view :scroll-y="true" class="list-h" @scrolltolower="getData">
<view class="principals_mailbox-list">
<ListItem v-for="item in dataList" @successRead="successRead" :info="item" :key="item.id"/>
</view>
</scroll-view>
</view>
</template>
<script>
import ListItem from "./components/ListItem/index.vue"
import { READINGSTATUS } from "./emit.js"
export default {
components: {
ListItem
},
data() {
return {
page: 1,
total: 0,
dataList: []
}
},
onLoad() {
this.getData()
},
methods: {
successRead(e) {
console.log('e=======>', e)
this.dataList = this.dataList.map(item => {
let result = item
if(e === item.id) {
result.is_read = READINGSTATUS.READ
}
return result
})
},
getData() {
var datas = {
page: this.page,
limit: 10
}
var jkurl = '/admin/message'
this.$service.P_post(jkurl, datas).then(res => {
this.total = res.data.total
if(this.dataList.length < this.total) {
if(this.page === 1) {
this.dataList = res.data.data
} else {
this.dataList.push(...res.data.data)
}
this.page++
}
console.log('dataList====>', this.dataList)
})
}
}
}
</script>
<style lang="scss" scoped>
.principals_mailbox{
.tel_index_bg{
position: absolute;
top: 0;
z-index: 1;
width: 100%;
min-height: 220rpx;
background: linear-gradient(0deg, #f8f8f8 0%, #ffffff 25%, #5D9DFD 60%, #428EFE 70%, #2D81FF 100%);
}
.list-h{
height: calc(100vh - 102rpx);
margin-top: 40rpx;
}
.principals_mailbox-list{
position: relative;
z-index: 1;
padding: 0rpx 25rpx;
}
}
</style>