admin_praise.vue
2.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
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
<template>
<view class="admin_praise">
<view class="tel_index_bg"></view>
<view class="admin_praise-main">
<public-switching :option="option" :current="current" @change="changeSwitching"></public-switching>
<scroll-view :scroll-y="true" class="praise_andLike-list" @scrolltolower="getData">
<view v-if="dataList.length">
<praise-item :type="LIKETYPE.ADMINEND" :info="item" v-for="item in dataList" :key="item.id" @success="success"></praise-item>
</view>
<u-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" ></u-empty>
</scroll-view>
</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.PENDINGREVIEW
}
],
current: PRAISEANDLIKE.WHOLE,
total: 0,
dataList: [],
page: 1
}
},
onLoad() {
this.getData()
},
methods: {
success(e) {
this.dataList = this.dataList.filter(item => item.id !== e)
},
changeSwitching(e) {
this.current = e
this.page = 1
this.total = 0
this.dataList = []
this.getData()
},
getData() {
var datas = {
is_uncheck: this.current,
page: this.page,
limit: 10
}
var jkurl = '/admin/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
console.log('res====>', res)
} else {
this.dataList.push(...result)
}
this.page++
}
if(this.current === PRAISEANDLIKE.PENDINGREVIEW) {
this.dataList = this.dataList.map(item => {
return {
...item,
showOperation: true
}
})
}
console.log('dataList====>', this.dataList)
})
}
}
}
</script>
<style lang="scss" scoped>
.admin_praise{
.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%);
}
.admin_praise-main{
position: relative;
z-index: 1;
padding: 0rpx 25rpx;
.praise_andLike-list{
margin-top: 30rpx;
height: calc(100vh - 152rpx);
}
}
}
</style>