<template>
	<view>
		<view class="score-main">
			<view class="score-lable">
				<text>评分</text>
			</view>
			<view class="score-value-text">
				<uni-rate allow-half readonly v-model="concreteNum" :size="20" color="#C4CCD8" activeColor="#ED7043" />
				<text style="margin-left: 20rpx;" v-if="concreteNum>0">123分</text>
				<text style="margin-left: 20rpx;" v-else>暂无评分</text>
			</view>
		</view>
		<scroll-view :scroll-y='true' class="pingjia-list" @scrolltolower="reachBottom()">
			<view class="list-title"> 123 </view>
			<view class="list-item" >
				<view class="item-title">
					<view class="item-user">21312</view>
					<view class="item-pf">
						<text style="
		            color: #34373b;
		            font-size: 28rpx;
		            font-weight: 400;
		            margin-right: 10rpx;
		          ">打分</text>
						<uni-rate allow-half :value="2" :size="15" color="#C4CCD8" activeColor="#ED7043"
							readonly />
					</view>
				</view>
				<view class="item-article">
					123
				</view>
				<view class="item-time">
					发布于121
				</view>
			</view>
			<u-loadmore :status="status" :load-text="loadText" color="#C4CCD8" font-size="24" />
		</scroll-view>
		<fixedButton @click="submit" :title="'我要评价'"></fixedButton>
	</view>
</template>

<script>

	
	export default {
		name: "modelScore",
		
		data() {
			return {
				loadText: {
					nomore: "已经到底了~",
					loading: "努力加载中",
				},
				status: "nomore",
				statusFlag: false,
				query: {
					demonstration_id: 0, //示范id
					type: 0,
					pageSize: 10,
					pageNum: 1,
				},
				//获取到的评分
				concreteNum: 0,
				list: [],
				//总数
				total: 0,
				//计时器
				timer: null,
			};
		},
		mounted() {
			this.getList()
			this.gradeNum()
		},

		methods: {
			//获取评价分数
			gradeNum() {
				
					this.concreteNum =  0
			},
			//下拉加载效果
			reachStart() {
				this.statusFlag = true
				this.status = 'loading'
			},
			//下拉结束效果
			reachEnd() {
				this.statusFlag = false
				this.status = 'nomore'
			},
			//获取评价列表
			getList() {
				this.reachStart()
					this.list = [];
					this.total = 0;
					this.reachEnd()
			},
			//触底加载
			reachBottom() {
				if (this.total > this.list.length) {
					if (this.statusFlag) {
						return
					}
					this.query.pageNum++;
					this.getList(this.query);
				}
			},
			//重置
			resetList() {
				this.query.pageSize = 10
				this.query.pageNum = 1
				this.list = []
				this.gradeNum()
				this.getList()
			},
			submit() {
				uni.navigateTo({
					url: `/sub-public/allPingJia/allPingJia`,
				});
			},
		},
	}
</script>

<style lang="scss" scoped>
	.score-main {
		margin: 20rpx 0;
		box-sizing: border-box;
		padding: 30rpx;
		min-height: 100rpx;
		background-color: #fff;
		border-radius: 16rpx;
		display: flex;
		align-items: center;

		.score-lable {
			width: 190rpx;
		}

		.score-value-text {
			display: flex;
			font-size: 30rpx;
			align-items: center;
			color: rgb(237, 112, 67);
			;
		}
	}

	.pingjia-list {
		margin-top: 20rpx;
		height: 800rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
		box-sizing: border-box;
		padding: 30rpx;

		.list-title {
			font-size: 36rpx;
			font-weight: 520;
			color: #34373b;
			margin-bottom: 20rpx;
		}

		.list-item {
			box-sizing: border-box;
			padding: 30rpx 0;
			border-bottom: 1rpx solid #dce3ec;

			.item-title {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.item-user {
					font-size: 30rpx;
					color: #3976f1;
					font-weight: 400;
				}

				.item-pf {
					display: flex;
					align-items: center;
				}
			}

			.item-article {
				margin: 20rpx 0;
				font-size: 28rpx;
				font-weight: 400;
				color: #34373b;
			}

			.item-time {
				font-size: 26rpx;
				font-weight: 400;
				color: #9da2ab;
			}
		}

		.lastItem {
			border: 0;
			padding-bottom: 0;
		}
	}

	// .score-content {
	// 	box-sizing: border-box;
	// 	padding: 30rpx;
	// 	min-height: 300rpx;
	// 	background-color: #fff;
	// 	border-radius: 16rpx;

	// 	.score-value {
	// 		margin-top: 6rpx;
	// 	}
	// }
</style>