 <template>
 	<view class="stu-punishment">
 		<view class="search">
 			<view class="input">
 				<image src="../../static/search.png" mode="widthFix"></image>
				<input type="text" placeholder="输入学生姓名/学号进行搜索"/>
 			</view>
 			<view class="icon" @tap="addPunishment">
 				<image src="/static/add_punishment.png" mode="aspectFit"></image>
 			</view>
 		</view>
 		<view class="body">
 			<view class="list">
 				<view class="item" v-for="(item,index) in punishmentList" :key="index">
 					<view class="title">
 						<text class="name">{{item.stuName}}</text>
 						<view class="lifting">
							<text v-if="item.penaltyType==0">处分已解除</text>
							<text v-if="item.penaltyType==1">处分申请中</text>
							<text v-if="item.penaltyType==2||item.penaltyType==4">处分申请中</text>
							<text v-if="item.penaltyType==3">处分已解除</text>
 						</view>
 					</view>
 					<view class="number">
 						<text>学号:</text>
 						<text>{{item.stuNo}}</text>
 					</view>
 					<view class="number-1">
 						<text>班级:</text>
 						<text>{{item.className}}</text>
 					</view>
 					<view class="grade">
 						<view class="left">
 							<text>处分等级:</text>
 							<text v-if="item.penaltyType==0">警告</text>
 							<text v-if="item.penaltyType==1">严重警告</text>
 							<text v-if="item.penaltyType==2">记过</text>
 							<text v-if="item.penaltyType==3">留校察看</text>
 						</view>

 						<view class="right">
 							<image src="/static/detail-icon.png" mode=""></image>
 							<text>详情</text>
 						</view>
 					</view>
					<view class="time">
						<text>提交时间:</text>
						<text>{{item.createTime}}</text>
					</view>
 				</view>
 			</view>
 		</view>
 	</view>
 </template>

 <script>
 	import {
 		list
 	} from "@/api/applyrelieve/applyrelieve.js";
 	export default {
 		data() {
 			return {
 				punishmentList: [],
				pageNum: 1,
				pageSize: 10
 			}
 		},
		onShow() {
			this.getPunishmentList();
		},
 		methods: {
 			getPunishmentList() {
				list({pageNum:this.pageNum,pageSize:this.pageSize}).then(res => {
					console.log(res);
					this.punishmentList = res.rows;
				})
 			},
			addPunishment(){
				uni.navigateTo({
					url:"/pages/applyrelieve/add-punishment"
				})
			}
 		}
 	}
 </script>

 <style scoped lang="scss">
 	.stu-punishment {
 		.search {
 			background-color: #258FE4;
 			height: 170rpx;
 			display: flex;
 			align-items: center;
 			justify-content: space-around;
 			padding: 0 10px;

 			.input {
 				display: flex;
 				align-items: center;
 				background-color: #ffffff;
 				height: 76rpx;
 				flex: 1;
 				margin: 0 30px 0 15px;
 				border-radius: 50px;

 				image {
 					width: 30rpx;
 					height: 36rpx;
 					margin: 0 20px;
 				}

 				input {
 					font-size: 28rpx;
 					line-height: 40px;
 					color: #dedede;
					width: 100%;
 				}
 			}

 			.icon {
 				background-color: #ffffff;
 				width: 75rpx;
 				height: 75rpx;
 				border-radius: 8px;
 				display: flex;
 				justify-content: center;
 				align-items: center;

 				image {
 					width: 34rpx;
 					height: 38rpx;
 				}
 			}
 		}

 		.body {
 			background-color: #F5F5F7;
 			padding: 10px;

 			.list {


 				.item {
 					background-color: #ffffff;
 					border-radius: 10px;
 					margin: 20px;
 					padding: 15px;

 					.title {
 						display: flex;
 						justify-content: space-between;
 						padding-bottom: 10px;

 						.name {
 							font-size: 36rpx;
 							font-weight: bold;
 						}

 						.lifting {
 							display: flex;
 							justify-content: center;
 							align-items: center;
 							background-color: #e3f9ed;
 							// width: 100rpx;
							padding: 0 5px;
 							height: 48rpx;
 							border-radius: 5px;
 							border: 1px solid #71E2A3;

 							text {
 								color: #71E2A3;
 								font-size: 24rpx;
 							}
 						}
 					}

 					.number {
 						font-size: 28rpx;
 						padding-bottom: 10px;

 						text:nth-child(1) {
 							color: #9C9C9C;
 						}

 						text:nth-child(2) {
 							margin-left: 10px;
 							color: #202020;
 						}
 					}

 					.number-1 {
 						font-size: 28rpx;
 						padding-bottom: 10px;

 						text:nth-child(1) {
 							color: #9C9C9C;
 						}

 						text:nth-child(2) {
 							margin-left: 10px;
 							color: #202020;
 						}
 					}

 					.grade {
 						display: flex;
 						font-size: 28rpx;
 						justify-content: space-between;

 						.left {
 							text:nth-child(1) {
 								color: #9C9C9C;
 							}

 							text:nth-child(2) {
 								color: #E80000;
 								margin-left: 10px;
 							}
 						}

 						.right {
 							display: flex;
 							align-items: center;

 							image {
 								width: 28rpx;
 								height: 28rpx;
 								margin-right: 3px;
 							}

 							text {
 								color: #258FE4;
 							}
 						}
 					}
					.time{
						margin-top:10px;
						color: gray;
					}
 				}
 			}

 		}
 	}
 </style>