teacher_praise.vue
1.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
<template>
<view class="teacher_praise">
<view class="card" v-for="item in dataList" :key="item.id">
<view class="user">
<u--image
shape="circle"
height="60rpx"
width="60rpx"
:src="item.uimg"
>
</u--image>
<view class="info">
<view class="name">
{{ item.uname }}
</view>
<view class="time">
{{ item.create_time }}
</view>
</view>
</view>
<view class="content">
{{ item.content }}
</view>
</view>
<u-empty v-if="!dataList.length" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" ></u-empty>
</view>
</template>
<script>
import { LIKETYPE } from "@/emit/index.js"
export default {
data() {
return {
LIKETYPE,
page: 1,
dataList: [],
total: 0
};
},
mounted() {
this.getData()
},
methods: {
getData() {
var datas = {
page: this.page,
limit: 10
}
var jkurl = '/teacher/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++
}
console.log('dataList====>', this.dataList)
})
}
}
}
</script>
<style lang="scss">
.teacher_praise{
padding: 25rpx;
.card {
padding: 30rpx;
background-color: #fff;
border-radius: 20rpx;
& + .card {
margin-top: 20rpx;
}
.user {
display: flex;
.info {
flex: 1;
margin-left: 30rpx;
.name {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: #323232;
}
.time {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 400;
color: #979797;
margin-top: 10rpx;
}
}
}
.content {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 400;
color: #323232;
line-height: 42px;
margin-top: 20rpx;
}
}
}
</style>