teacher_praise.vue 1.9 KB
<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>