<template>
	<view class="student-management">
		<view class="form-item">
			<label>01 每周按时开展班会（10分）</label>
			<view class="bottom">
				<input @blur="onLimitInput($event,'classScoring',10)" v-model="classScoring" type="number"
					placeholder="请输入分值" placeholder-class="input-placeholder" />
				<text @tap="uploadClassMeetingMaterial">
					{{commitStatus==1?"查看材料":"上传材料"}}
				</text>
			</view>
		</view>
		<view class="form-item">
			<label>02 每周深入学生宿舍至少2次（10分）</label>
			<view class="bottom">
				<input @blur="onLimitInput($event,'visitDormitoryScoring',10)" v-model="visitDormitoryScoring" type="number" placeholder="请输入分值"
					placeholder-class="input-placeholder" />
				<text @tap="uploadSleepCheckMaterial">
					{{commitStatus==1?"查看材料":"上传材料"}}
				</text>
			</view>
		</view>
		<view class="form-item">
			<label>03 每月与带班学生谈心谈话，覆盖率不低于8%（10分）</label>
			<view class="bottom">
				<input @blur="onLimitInput($event,'stuTalkScoring',10)" v-model="stuTalkScoring" type="number" placeholder="请输入分值"
					placeholder-class="input-placeholder" />
				<text @tap="uploadInterviewMaterial">
					{{commitStatus==1?"查看材料":"上传材料"}}
				</text>
			</view>
		</view>
		<view class="form-item">
			<label>04 每月开展班团干部会议至少2次（5分）</label>
			<view class="bottom">
				<input @blur="onLimitInput($event,'cadreScoring',5)" v-model="cadreScoring" type="number" placeholder="请输入分值" placeholder-class="input-placeholder" />
				<text @tap="uploadLeagueMeetingMaterial">
					{{commitStatus==1?"查看材料":"上传材料"}}
				</text>
			</view>
		</view>
		<view class="form-item">
			<label>05 每月深入学生社区面向学生开展活动1次 （5分）</label>
			<view class="bottom">
				<input @blur="onLimitInput($event,'stuActivityScoring',5)" v-model="stuActivityScoring" type="number" placeholder="请输入分值"
					placeholder-class="input-placeholder" />
				<text @tap="uploadStuActivityMaterials">
					{{commitStatus==1?"查看材料":"上传材料"}}
				</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		teacherKpiFillingMgtDetail
	} from "@/api/instructor/superintendent.js"
	import {
		limitInput
	} from "@/utils/limitInput.js"
	export default {
		props: ["queryDetailParams","commitStatus"],
		data() {
			return {
				classScoring: "", //班会材料分数
				visitDormitoryScoring: "", //每周深入学生宿舍材料分数
				stuTalkScoring: "", //	学生谈话分数
				cadreScoring: "", //班团干部会议材料分数
				stuActivityScoring: "", //学生开展活动材料分数
				id: "", //学生开展活动材料分数
				queryParams:null
			}
		},
		created() {
			teacherKpiFillingMgtDetail(this.queryDetailParams).then(res => {
				console.log(res);
				if (res.data) {
					this.classScoring = res.data.classScoring;
					this.visitDormitoryScoring = res.data.visitDormitoryScoring;
					this.stuTalkScoring = res.data.stuTalkScoring;
					this.cadreScoring = res.data.cadreScoring;
					this.stuActivityScoring = res.data.stuActivityScoring;
					this.id = res.data.id;
				}
			})
			this.queryParams = new URLSearchParams({
				year: this.queryDetailParams.fillingYear,
				month: this.queryDetailParams.fillingMonth,
				commitStatus:this.commitStatus
			});
		},
		methods: {
			onLimitInput(event,name,max) {
				let result = limitInput(event.detail.value,max);
				this[name] = result;
			},
			uploadClassMeetingMaterial() {
				
				uni.navigateTo({
					url: `/pages/instructor/performance-appraisal/performance-evaluation/class-meeting-evidence/list?${this.queryParams.toString()}`
				})
			},
			uploadSleepCheckMaterial() {
				uni.navigateTo({
					url: `/pages/instructor/performance-appraisal/performance-evaluation/sleep-check-evidence/list?${this.queryParams.toString()}`
				})
			},
			uploadInterviewMaterial() {
				uni.navigateTo({
					url: `/pages/instructor/performance-appraisal/performance-evaluation/interview/list?${this.queryParams.toString()}`
				})
			},
			uploadLeagueMeetingMaterial() {
				uni.navigateTo({
					url: `/pages/instructor/performance-appraisal/performance-evaluation/league-meeting/list?${this.queryParams.toString()}`
				})
			},
			uploadStuActivityMaterials() {
				uni.navigateTo({
					url: `/pages/instructor/performance-appraisal/performance-evaluation/student-activity/list?${this.queryParams.toString()}`
				})
			},
			getFormData() {
				return {
					classScoring: this.classScoring,
					visitDormitoryScoring: this.visitDormitoryScoring,
					stuTalkScoring: this.stuTalkScoring,
					cadreScoring: this.cadreScoring,
					stuActivityScoring: this.stuActivityScoring,
					id: this.id
				};
			}
		}
	}
</script>

<style scoped lang="scss">
	.student-management {
		.form-item {
			padding: 22rpx 40rpx 40rpx 40rpx;
			background-color: white;
			margin-bottom: 40rpx;
			border-radius: 16rpx;

			label {
				margin-bottom: 20rpx;
				display: inline-block;
				font-size: 26rpx;
			}

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

				input {
					flex: 1;
					border: 1px solid #E1E1E1;
					border-radius: 10rpx;
					height: 60rpx;
					padding-left: 30rpx;

					.input-placeholder {
						color: #b6b6b6;
					}
				}

				text {
					color: #1890FF;
					border-bottom: 2px solid #1890FF;
					margin-left: 40rpx;
					font-weight: bold;
					font-size: 26rpx;
				}
			}
		}
	}
</style>