praise_andLike.vue
2.9 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
<template>
<view class="praise_andLike">
<public-switching :option="option" :current="current" @change="changeSwitching"></public-switching>
<view class="praise_andLike-main">
<scroll-view :scroll-y="true" class="praise_andLike-list">
<view v-if="dataList.length">
<praise-item :type="LIKETYPE.STUDENTEND" v-for="item in dataList" :info="item" :key="item.id"></praise-item>
</view>
<u-empty v-else mode="data" icon="/static/imagesV2/icon24.png" ></u-empty>
</scroll-view>
</view>
<view class="operation" @click="$service.jump" data-url="/page_admin/add_praise/add_praise">
添加表扬
</view>
</view>
</template>
<script>
import public_switching from "@/components/public_switching/public_switching.vue"
import praise_item from "@/components/praise_item/praise_item.vue"
import { PRAISEANDLIKE } from "./emit.js"
import { LIKETYPE } from "@/emit/index.js"
export default {
components: {
PublicSwitching: public_switching,
PraiseItem: praise_item
},
data() {
return {
LIKETYPE,
option: [
{
lable: '全部表扬',
value: PRAISEANDLIKE.WHOLE
},
{
lable: '我的表扬',
value: PRAISEANDLIKE.MY
}
],
current: PRAISEANDLIKE.WHOLE,
page: 1,
dataList: [],
total: 0
};
},
onShow() {
this.page = 1
this.total = 0
this.dataList = []
this.getData()
},
methods: {
getData() {
var datas = {
is_my: this.current,
page: this.page,
limit: 10
}
var jkurl = '/praise'
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++
}
if(this.current === PRAISEANDLIKE.MY) {
this.dataList = this.dataList.map(item => {
return {
...item,
is_my: true
}
})
}
console.log('dataList====>', this.dataList)
})
},
changeSwitching(e) {
this.current = e
this.page = 1
this.total = 0
this.dataList = []
this.getData()
}
}
}
</script>
<style lang="scss">
.praise_andLike{
.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%);
}
.praise_andLike-main{
position: relative;
z-index: 1;
padding: 0rpx 25rpx;
.praise_andLike-list{
margin-top: 30rpx;
height: calc(100vh - 152rpx);
}
}
.operation{
position: absolute;
bottom: 150rpx;
left: 50%;
width: 700rpx;
transform: translateX(-50%);
z-index: 1;
height: 88rpx;
line-height: 88rpx;
background-color: #2D81FF;
border-radius: 200rpx;
text-align: center;
font-size: 34rpx;
color: #fff;
margin-top: 53rpx;
}
}
</style>