<template>
	<view class="content">
		 
		<mescroll-body top="0rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
		<view class="tongue-list">
			<view v-for="(item,index) in dataList" :key="index" class="item" @click="navTo('/pages_user/tongue/report?type=back&id='+item.id)">
					<view class="ask-text"  >舌苔特征：{{item.taiseName}}</view>
					<view class="ask-text"  >舌苔描述：{{item.taiseDesc}}</view>
					<view class="ask-text">所属体质：{{item.typeName}}</view>
					<view class="patient-text">患者：{{item.name}} {{item.age}}岁 {{item.sex==1?'男':'女'}} </view>
					<view class="ask-time" v-if="item.createTime!=null">检测时间：{{item.createTime}}</view>
				</view>
		</view>
		</mescroll-body>
	</view>
</template>

<script>
	import {getHealthTongueList} from '@/api/healthTongue.js'
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], 
		data() {
			return {
				mescroll:null,
				downOption: {
					//下拉刷新
					use: true,
					auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
				},
				// 上拉加载的配置
				upOption: {
					onScroll:false,
					use: true, // 是否启用上拉加载; 默认true
					page: {
						pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
						size: 10 // 每页数据的数量,默认10
					},
					noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
					textNoMore:"已经到底了",
					empty: {
						icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
						tip: '暂无数据'
					}
				},
				// 列表数据
				dataList: []
			}
		},
		onLoad() {
			
		},
		methods: {
			navTo(url){
				uni.navigateTo({
					url: url
				})
			},
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},
			/*下拉刷新的回调 */
			downCallback(mescroll) {
				mescroll.resetUpScroll()
			},
			upCallback(page) {
				//联网加载数据
				var that = this;
				var data = {
					pageNum: page.num,
					pageSize: page.size
				};
				getHealthTongueList(data).then(res => {
					if(res.code==200){
						//设置列表数据
						if (page.num == 1) {
							that.dataList = res.data.list; 
						} else {
							that.dataList = that.dataList.concat(res.data.list);
						}
						that.mescroll.endBySize(res.data.list.length, res.data.total);
						
					}else{
						uni.showToast({
							icon:'none',
							title: "请求失败",
						});
						that.dataList = null;
						that.mescroll.endErr();
					}
				});
			}
			 
		}
	}
</script>

<style lang="scss">
	.content{
		 
		.tongue-list{
			padding: 20upx;
			.item{
				background: #FFFFFF;
				border-radius: 16upx;
				padding: 30upx;
				position: relative;
				margin-bottom: 20upx;
				 
				
				.ask-text{
					margin: 24rpx 0rpx;
					font-size: 30upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #111111;
					line-height: 42upx;
				}
				.patient-text{
					font-size: 24upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
					margin-bottom: 15upx;
				}
				.ask-time{
					font-size: 24upx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
				}
				 
			}
		}
	}
	 
</style>
